添加档案基本操作
parent
3dd4b9112e
commit
04212d76f2
12
pom.xml
12
pom.xml
|
@ -111,12 +111,14 @@
|
|||
<version>1.26.5</version>
|
||||
</dependency>
|
||||
|
||||
<!-- RuoYi Common core -->
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>health-common-core</artifactId>
|
||||
<version>3.6.3</version>
|
||||
<version>3.6.8</version>
|
||||
</dependency>
|
||||
|
||||
<!-- RuoYi Common security -->
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>health-common-security</artifactId>
|
||||
|
@ -173,6 +175,14 @@
|
|||
<!-- <version>5.5.13.2</version>-->
|
||||
<!-- </dependency>-->
|
||||
|
||||
|
||||
<!-- RuoYi Common redis -->
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>health-common-redis</artifactId>
|
||||
<version>3.6.3</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
|
|
@ -0,0 +1,67 @@
|
|||
package com.ruoyi.mybasic.common.domain;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 档案表
|
||||
* @author Lou-Zs
|
||||
*/
|
||||
@Data
|
||||
public class Archives {
|
||||
|
||||
|
||||
/**
|
||||
* 档案id(用户编号)
|
||||
*/
|
||||
private Integer userId;
|
||||
/**
|
||||
* 主要病状
|
||||
*/
|
||||
private String diseaseMain;
|
||||
/**
|
||||
* 现在病史
|
||||
*/
|
||||
private String diseaseNow;
|
||||
/**
|
||||
* 既往病史
|
||||
*/
|
||||
private String diseaseBefore;
|
||||
/**
|
||||
* 最近治疗医院
|
||||
*/
|
||||
private String hospitalName;
|
||||
/**
|
||||
* 治疗过程
|
||||
*/
|
||||
private String treatmentProcess;
|
||||
/**
|
||||
* 开始时间
|
||||
*/
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
|
||||
private Date startTime;
|
||||
/**
|
||||
* 结束时间
|
||||
*/
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
|
||||
private Date endTime;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 照片路径
|
||||
*/
|
||||
private String pictureUrl;
|
||||
/**
|
||||
* pictureList[]
|
||||
*/
|
||||
private List<String> pictureList;
|
||||
|
||||
}
|
|
@ -0,0 +1,106 @@
|
|||
package com.ruoyi.mybasic.controller;
|
||||
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.mybasic.common.domain.Archives;
|
||||
import com.ruoyi.mybasic.service.ArchivesService;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
/**
|
||||
* @ClassName: ArchivesController
|
||||
* @BelongsProject: parent
|
||||
* @BelongsPackage: com.ruoyi.archives.controller
|
||||
* @Author: zhiS_Lou
|
||||
* @CreateTime: 2023/10/17 11:02
|
||||
*/
|
||||
|
||||
/**
|
||||
* 档案控制层
|
||||
* @author Lou_Zs
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/Archives")
|
||||
@Log4j2
|
||||
public class ArchivesController {
|
||||
|
||||
@Autowired
|
||||
private HttpServletRequest request;
|
||||
@Autowired
|
||||
private ArchivesService archivesService;
|
||||
|
||||
|
||||
/**
|
||||
* 查询我的档案
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/findArchivesList")
|
||||
public R<Archives> findArchivesList(){
|
||||
log.info("功能介绍:获取我的档案详情,请求方式:{},请求路径:{},请求参数:{}",
|
||||
request.getMethod(),request.getRequestURI(),"无参数");
|
||||
|
||||
R<Archives> result = archivesService.findArchivesList();
|
||||
|
||||
log.info("功能介绍:获取我的档案详情,请求方式:{},请求路径:{},响应结果:{}",
|
||||
request.getMethod(),request.getRequestURI(), JSONObject.toJSONString(result));
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加我的档案
|
||||
* @param archives
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/insertArchivesAndPicture")
|
||||
public R insertArchivesAndPicture(@RequestBody Archives archives){
|
||||
log.info("功能介绍:添加我的档案,请求方式:{},请求路径:{},请求参数:{}",
|
||||
request.getMethod(),request.getRequestURI(),JSONObject.toJSONString(archives));
|
||||
|
||||
R result = archivesService.insertArchivesAndPicture(archives);
|
||||
|
||||
log.info("功能介绍:添加我的档案,请求方式:{},请求路径:{},响应结果:{}",
|
||||
request.getMethod(),request.getRequestURI(),JSONObject.toJSONString(result));
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 编辑我的档案
|
||||
* @param archives
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/updateArchivesAndPicture")
|
||||
public R updateArchivesAndPicture(@RequestBody Archives archives){
|
||||
log.info("功能介绍:编辑我的档案,请求方式:{},请求路径:{},请求参数:{}",
|
||||
request.getMethod(),request.getRequestURI(),JSONObject.toJSONString(archives));
|
||||
R result = archivesService.updateArchivesAndPicture(archives);
|
||||
|
||||
log.info("功能介绍:编辑我的档案,请求方式:{},请求路径:{},响应结果:{}",
|
||||
request.getMethod(),request.getMethod(),JSONObject.toJSONString(result));
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据档案编号删除档案
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/deleteArchivesById/{id}")
|
||||
public R deleteArchivesById(@PathVariable String id){
|
||||
log.info("功能介绍:根据档案编号删除档案,请求方式:{},请求路径:{},请求参数:{}",
|
||||
request.getMethod(),request.getRequestURI(),JSONObject.toJSONString(id));
|
||||
R result = archivesService.deleteArchivesById(id);
|
||||
log.info("功能介绍:根据档案编号删除档案,请求方式:{},请求路径:{},响应结果:{}",
|
||||
request.getMethod(),request.getRequestURI(), JSONObject.toJSONString(result));
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
package com.ruoyi.mybasic.mapper;
|
||||
|
||||
|
||||
import com.ruoyi.mybasic.common.domain.Archives;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 档案Mapper接口
|
||||
* @author Lou_Zs
|
||||
*/
|
||||
@Mapper
|
||||
public interface ArchivesMapper {
|
||||
|
||||
|
||||
/**
|
||||
* 查询患者档案
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
Archives findArchivesList(@Param("userId") Long userId);
|
||||
|
||||
/**
|
||||
* 添加我的档案
|
||||
* @param archives
|
||||
*/
|
||||
void insertArchives(Archives archives);
|
||||
|
||||
|
||||
/**
|
||||
* 编辑我的档案
|
||||
* @param archives
|
||||
*/
|
||||
void updateArchives(Archives archives);
|
||||
|
||||
/**
|
||||
* 删除我的档案
|
||||
* @param id
|
||||
*/
|
||||
void deleteArchivesById(@Param("id") String id);
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
package com.ruoyi.mybasic.service;
|
||||
|
||||
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.mybasic.common.domain.Archives;
|
||||
|
||||
/**
|
||||
* 档案持久层
|
||||
* @author Lou_Zs
|
||||
*/
|
||||
public interface ArchivesService {
|
||||
|
||||
/**
|
||||
* 查询我的档案列表
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
R<Archives> findArchivesList();
|
||||
|
||||
/**
|
||||
* 添加我的档案
|
||||
* @return
|
||||
*/
|
||||
R insertArchivesAndPicture(Archives archives);
|
||||
|
||||
|
||||
/**
|
||||
* 编辑我的档案
|
||||
* @param archives
|
||||
* @return
|
||||
*/
|
||||
R updateArchivesAndPicture(Archives archives);
|
||||
|
||||
/**
|
||||
* 根据档案编号删除档案
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
R deleteArchivesById(String id);
|
||||
}
|
|
@ -0,0 +1,109 @@
|
|||
package com.ruoyi.mybasic.service.Impl;
|
||||
|
||||
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.common.security.utils.SecurityUtils;
|
||||
import com.ruoyi.mybasic.common.domain.Archives;
|
||||
import com.ruoyi.mybasic.mapper.ArchivesMapper;
|
||||
import com.ruoyi.mybasic.service.ArchivesService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName: ArchivesServiceImpl
|
||||
* @BelongsProject: parent
|
||||
* @BelongsPackage: com.ruoyi.archives.service.impl
|
||||
* @Author: zhiS_Lou
|
||||
* @CreateTime: 2023/10/17 11:05
|
||||
*/
|
||||
|
||||
/**
|
||||
* 档案实现层
|
||||
* @author Lou_Zs
|
||||
*/
|
||||
@Service
|
||||
public class ArchivesServiceImpl implements ArchivesService {
|
||||
|
||||
@Autowired
|
||||
private ArchivesMapper archivesMapper;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 查询我的档案列表
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public R<Archives> findArchivesList() {
|
||||
//获取用户id
|
||||
Long userId = SecurityUtils.getUserId();
|
||||
Archives archivesList = archivesMapper.findArchivesList(userId);
|
||||
return R.ok(archivesList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加我的档案
|
||||
* @param archives
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public R insertArchivesAndPicture(Archives archives) {
|
||||
//获取用户id
|
||||
Long userId = SecurityUtils.getUserId();
|
||||
//添加当前用户
|
||||
archives.setUserId(Math.toIntExact(userId));
|
||||
/**
|
||||
* 若前台传输为[]
|
||||
*/
|
||||
//获取图片集合
|
||||
List<String> pictureList = archives.getPictureList();
|
||||
if (pictureList.size() > 0){
|
||||
//将集合拼接为字符串
|
||||
String join = String.join(",", pictureList);
|
||||
//将拼接好的字符串添加到字段
|
||||
archives.setPictureUrl(join);
|
||||
}
|
||||
//添加档案
|
||||
archivesMapper.insertArchives(archives);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑我的档案
|
||||
* @param archives
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public R updateArchivesAndPicture(Archives archives) {
|
||||
/**
|
||||
* 若前台传输为[]
|
||||
*/
|
||||
//获取图片集合
|
||||
List<String> pictureList = archives.getPictureList();
|
||||
if (pictureList.size() > 0){
|
||||
//将集合拼接为字符串
|
||||
String join = String.join(",", pictureList);
|
||||
//将拼接好的字符串添加到字段
|
||||
archives.setPictureUrl(join);
|
||||
}
|
||||
//编辑档案
|
||||
archivesMapper.updateArchives(archives);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据档案编号删除档案
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public R deleteArchivesById(String id) {
|
||||
//档案删除
|
||||
archivesMapper.deleteArchivesById(id);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,52 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
|
||||
<mapper namespace="com.ruoyi.mybasic.mapper.ArchivesMapper">
|
||||
|
||||
<!-- 查询患者档案-->
|
||||
<select id="findArchivesList" resultType="com.ruoyi.mybasic.common.domain.Archives">
|
||||
select * from t_archives where user_id = #{userId}
|
||||
</select>
|
||||
<!-- 添加患者档案-->
|
||||
<insert id="insertArchives" keyProperty="id" useGeneratedKeys="true">
|
||||
INSERT INTO t_archives
|
||||
(user_id,
|
||||
disease_main,
|
||||
disease_now,
|
||||
disease_before,
|
||||
hospital_name,
|
||||
treatment_process,
|
||||
start_time,
|
||||
end_time)
|
||||
VALUES
|
||||
(
|
||||
#{userId},
|
||||
#{diseaseMain},
|
||||
#{diseaseNow},
|
||||
#{diseaseBefore},
|
||||
#{hospitalName},
|
||||
#{treatmentProcess},
|
||||
#{startTime},
|
||||
#{endTime}
|
||||
)
|
||||
</insert>
|
||||
<!-- 编辑档案-->
|
||||
<update id="updateArchives">
|
||||
UPDATE t_archives
|
||||
SET
|
||||
disease_main = #{diseaseMain},
|
||||
disease_now = #{diseaseNow},
|
||||
disease_before = #{diseaseBefore},
|
||||
hospital_name = #{hospitalName},
|
||||
treatment_process = #{treatmentProcess},
|
||||
start_time = #{startTime},
|
||||
end_time = #{endTime},
|
||||
picture_url = #{pictureUrl}
|
||||
WHERE
|
||||
user_id = #{userId}
|
||||
</update>
|
||||
<!-- 删除该档案-->
|
||||
<delete id="deleteArchivesById">
|
||||
delete from t_archives where user_id = #{id}
|
||||
</delete>
|
||||
</mapper>
|
Loading…
Reference in New Issue