From 0405f918d1ef03bc5c3dc92db9b313f10bdea274 Mon Sep 17 00:00:00 2001 From: "WIN-N0D4SD9MOKI\\Administrator" <1419361763@qq.com> Date: Tue, 13 Sep 2022 17:19:31 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AF=8A=E6=96=AD=E8=AE=B0=E5=BD=95-=E5=8E=86?= =?UTF-8?q?=E5=8F=B2=E5=A4=87=E4=BB=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../web/controller/api/AppController.java | 7 + .../web/controller/api/MpController.java | 15 + .../ruoyi/system/domain/TImageHistory.java | 81 +++++ .../ruoyi/system/domain/TRecordHistory.java | 276 ++++++++++++++++++ .../system/mapper/TImageHistoryMapper.java | 61 ++++ .../system/mapper/TRecordHistoryMapper.java | 63 ++++ .../system/service/ITImageHistoryService.java | 61 ++++ .../service/ITRecordHistoryService.java | 63 ++++ .../impl/TImageHistoryServiceImpl.java | 95 ++++++ .../impl/TRecordHistoryServiceImpl.java | 136 +++++++++ .../mapper/system/TImageHistoryMapper.xml | 70 +++++ .../mapper/system/TRecordHistoryMapper.xml | 135 +++++++++ 12 files changed, 1063 insertions(+) create mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/domain/TImageHistory.java create mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/domain/TRecordHistory.java create mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/mapper/TImageHistoryMapper.java create mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/mapper/TRecordHistoryMapper.java create mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/service/ITImageHistoryService.java create mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/service/ITRecordHistoryService.java create mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TImageHistoryServiceImpl.java create mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TRecordHistoryServiceImpl.java create mode 100644 ruoyi-system/src/main/resources/mapper/system/TImageHistoryMapper.xml create mode 100644 ruoyi-system/src/main/resources/mapper/system/TRecordHistoryMapper.xml diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/AppController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/AppController.java index 0629298..6da0625 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/AppController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/AppController.java @@ -66,6 +66,9 @@ public class AppController extends BaseController @Resource private ISysConfigService configService; + @Resource + private ITRecordHistoryService recordHistoryService; + @Resource private ITImageService imageService; @@ -202,6 +205,10 @@ public class AppController extends BaseController @PostMapping("/record/diagnostic/upload") public AjaxResult diagnosticRecordsUploaded(@RequestBody AppRecordReq appRecordReq) { + //覆盖recode记录前,先备份数据 + //备份历史记录 + recordHistoryService.saveHistory(appRecordReq.getId()); + TRecord tRecord = new TRecord(); BeanUtils.copyProperties(appRecordReq, tRecord); if (null == tRecord.getAiResultModifyTime()) { diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/MpController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/MpController.java index 2c2e920..ecb7f64 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/MpController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/MpController.java @@ -9,6 +9,8 @@ import com.ruoyi.system.domain.TPatientHospitalDoctor; import com.ruoyi.system.domain.TRecord; import com.ruoyi.system.domain.resp.PatientHistoryRecordResp; import com.ruoyi.system.domain.resp.TRecordResp; +import com.ruoyi.system.service.ITImageHistoryService; +import com.ruoyi.system.service.ITRecordHistoryService; import com.ruoyi.system.service.ITRecordService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -28,6 +30,11 @@ import java.util.stream.Collectors; public class MpController extends BaseController { @Autowired private ITRecordService tRecordService; + @Autowired + private ITRecordHistoryService recordHistoryService; + @Autowired + private ITImageHistoryService imageHistoryService; + @ApiOperation("患者诊断记录") @GetMapping("/patient/history/record") @@ -51,14 +58,22 @@ public class MpController extends BaseController { public AjaxResult reschedule(@PathVariable("recordId") Long recordId){ // 逻辑删除本条记录 TRecord tRecord = tRecordService.selectTRecordById(recordId); + + //备份历史记录 + recordHistoryService.saveHistory(recordId); + + TRecord delRecord = new TRecord(); delRecord.setId(recordId); delRecord.setDelFlag("2"); tRecordService.updateTRecord(delRecord); + // 重新生成一条记录 tRecord.setId(null); tRecord.setDelFlag("0"); tRecord.setStatus("0"); + tRecord.setUpdateResult(null); + tRecord.setUpdateResult2(null); tRecordService.insertTRecord(tRecord); AjaxResult success = AjaxResult.success(); success.put("recordId", tRecord.getId()); diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/TImageHistory.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/TImageHistory.java new file mode 100644 index 0000000..3ea25af --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/TImageHistory.java @@ -0,0 +1,81 @@ +package com.ruoyi.system.domain; + +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.core.domain.BaseEntity; + +/** + * 图片记录历史对象 t_image_history + * + * @author ruoyi + * @date 2022-09-13 + */ +public class TImageHistory extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** ID */ + private Long id; + + /** thirdID */ + @Excel(name = "thirdID") + private Long thirdId; + + /** 路径 */ + @Excel(name = "路径") + private String path; + + /** 名称 */ + @Excel(name = "名称") + private String name; + + + public void setId(Long id) + { + this.id = id; + } + + public Long getId() + { + return id; + } + public void setThirdId(Long thirdId) + { + this.thirdId = thirdId; + } + + public Long getThirdId() + { + return thirdId; + } + public void setPath(String path) + { + this.path = path; + } + + public String getPath() + { + return path; + } + public void setName(String name) + { + this.name = name; + } + + public String getName() + { + return name; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("id", getId()) + .append("thirdId", getThirdId()) + .append("path", getPath()) + .append("name", getName()) + .append("createTime", getCreateTime()) + .toString(); + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/TRecordHistory.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/TRecordHistory.java new file mode 100644 index 0000000..dfdfcb6 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/TRecordHistory.java @@ -0,0 +1,276 @@ +package com.ruoyi.system.domain; + +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.core.domain.BaseEntity; + +/** + * 诊断记录信息历史对象 t_record_history + * + * @author ruoyi + * @date 2022-09-13 + */ +public class TRecordHistory extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** ID */ + private Long id; + + /** 患者 */ + @Excel(name = "患者") + private Long patientId; + + /** 医生 */ + @Excel(name = "医生") + private Long doctorId; + + /** 医院 */ + @Excel(name = "医院") + private Long hospitalId; + + /** 状态(0预约 1就诊) */ + @Excel(name = "状态", readConverterExp = "0=预约,1=就诊") + private String status; + + /** ai诊断结果 */ + @Excel(name = "ai诊断结果") + private String aiResult; + + /** ai诊断结果,无图片 */ + @Excel(name = "ai诊断结果,无图片") + private String aiResult2; + + /** 医生诊断结果 */ + @Excel(name = "医生诊断结果") + private String updateResult; + + /** 医生诊断结果,无图片 */ + @Excel(name = "医生诊断结果,无图片") + private String updateResult2; + + /** 上传时间 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "上传时间", width = 30, dateFormat = "yyyy-MM-dd") + private Date uploadTime; + + /** 舌下 */ + @Excel(name = "舌下") + private String imgSx; + + /** 舌上 */ + @Excel(name = "舌上") + private String imgSm; + + /** 响应时长 */ + @Excel(name = "响应时长") + private Long responseTime; + + /** ai结果返回时间 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "ai结果返回时间", width = 30, dateFormat = "yyyy-MM-dd") + private Date aiResultReturnTime; + + /** ai结果修改时间 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "ai结果修改时间", width = 30, dateFormat = "yyyy-MM-dd") + private Date aiResultModifyTime; + + /** + * 预约时间 + */ + private String appointmentTime; + + /** + * 删除标志(0:代表存在 1:代表删除) + */ + private String delFlag; + + private Long recodeId; + + public Long getRecodeId() { + return recodeId; + } + + public void setRecodeId(Long recodeId) { + this.recodeId = recodeId; + } + + public String getAppointmentTime() { + return appointmentTime; + } + + public void setAppointmentTime(String appointmentTime) { + this.appointmentTime = appointmentTime; + } + + public String getDelFlag() { + return delFlag; + } + + public void setDelFlag(String delFlag) { + this.delFlag = delFlag; + } + + public void setId(Long id) + { + this.id = id; + } + + public Long getId() + { + return id; + } + public void setPatientId(Long patientId) + { + this.patientId = patientId; + } + + public Long getPatientId() + { + return patientId; + } + public void setDoctorId(Long doctorId) + { + this.doctorId = doctorId; + } + + public Long getDoctorId() + { + return doctorId; + } + public void setHospitalId(Long hospitalId) + { + this.hospitalId = hospitalId; + } + + public Long getHospitalId() + { + return hospitalId; + } + public void setStatus(String status) + { + this.status = status; + } + + public String getStatus() + { + return status; + } + public void setAiResult(String aiResult) + { + this.aiResult = aiResult; + } + + public String getAiResult() + { + return aiResult; + } + public void setAiResult2(String aiResult2) + { + this.aiResult2 = aiResult2; + } + + public String getAiResult2() + { + return aiResult2; + } + public void setUpdateResult(String updateResult) + { + this.updateResult = updateResult; + } + + public String getUpdateResult() + { + return updateResult; + } + public void setUpdateResult2(String updateResult2) + { + this.updateResult2 = updateResult2; + } + + public String getUpdateResult2() + { + return updateResult2; + } + public void setUploadTime(Date uploadTime) + { + this.uploadTime = uploadTime; + } + + public Date getUploadTime() + { + return uploadTime; + } + public void setImgSx(String imgSx) + { + this.imgSx = imgSx; + } + + public String getImgSx() + { + return imgSx; + } + public void setImgSm(String imgSm) + { + this.imgSm = imgSm; + } + + public String getImgSm() + { + return imgSm; + } + public void setResponseTime(Long responseTime) + { + this.responseTime = responseTime; + } + + public Long getResponseTime() + { + return responseTime; + } + public void setAiResultReturnTime(Date aiResultReturnTime) + { + this.aiResultReturnTime = aiResultReturnTime; + } + + public Date getAiResultReturnTime() + { + return aiResultReturnTime; + } + public void setAiResultModifyTime(Date aiResultModifyTime) + { + this.aiResultModifyTime = aiResultModifyTime; + } + + public Date getAiResultModifyTime() + { + return aiResultModifyTime; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("id", getId()) + .append("patientId", getPatientId()) + .append("doctorId", getDoctorId()) + .append("hospitalId", getHospitalId()) + .append("status", getStatus()) + .append("aiResult", getAiResult()) + .append("aiResult2", getAiResult2()) + .append("updateResult", getUpdateResult()) + .append("updateResult2", getUpdateResult2()) + .append("createTime", getCreateTime()) + .append("updateTime", getUpdateTime()) + .append("uploadTime", getUploadTime()) + .append("imgSx", getImgSx()) + .append("imgSm", getImgSm()) + .append("responseTime", getResponseTime()) + .append("aiResultReturnTime", getAiResultReturnTime()) + .append("aiResultModifyTime", getAiResultModifyTime()) + .toString(); + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/TImageHistoryMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/TImageHistoryMapper.java new file mode 100644 index 0000000..0b1eda8 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/TImageHistoryMapper.java @@ -0,0 +1,61 @@ +package com.ruoyi.system.mapper; + +import java.util.List; +import com.ruoyi.system.domain.TImageHistory; + +/** + * 图片记录历史Mapper接口 + * + * @author ruoyi + * @date 2022-09-13 + */ +public interface TImageHistoryMapper +{ + /** + * 查询图片记录历史 + * + * @param id 图片记录历史主键 + * @return 图片记录历史 + */ + public TImageHistory selectTImageHistoryById(Long id); + + /** + * 查询图片记录历史列表 + * + * @param tImageHistory 图片记录历史 + * @return 图片记录历史集合 + */ + public List selectTImageHistoryList(TImageHistory tImageHistory); + + /** + * 新增图片记录历史 + * + * @param tImageHistory 图片记录历史 + * @return 结果 + */ + public int insertTImageHistory(TImageHistory tImageHistory); + + /** + * 修改图片记录历史 + * + * @param tImageHistory 图片记录历史 + * @return 结果 + */ + public int updateTImageHistory(TImageHistory tImageHistory); + + /** + * 删除图片记录历史 + * + * @param id 图片记录历史主键 + * @return 结果 + */ + public int deleteTImageHistoryById(Long id); + + /** + * 批量删除图片记录历史 + * + * @param ids 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteTImageHistoryByIds(Long[] ids); +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/TRecordHistoryMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/TRecordHistoryMapper.java new file mode 100644 index 0000000..2f7a37f --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/TRecordHistoryMapper.java @@ -0,0 +1,63 @@ +package com.ruoyi.system.mapper; + +import java.util.List; +import com.ruoyi.system.domain.TRecordHistory; +import org.springframework.stereotype.Repository; + +/** + * 诊断记录信息历史Mapper接口 + * + * @author ruoyi + * @date 2022-09-13 + */ +@Repository +public interface TRecordHistoryMapper +{ + /** + * 查询诊断记录信息历史 + * + * @param id 诊断记录信息历史主键 + * @return 诊断记录信息历史 + */ + public TRecordHistory selectTRecordHistoryById(Long id); + + /** + * 查询诊断记录信息历史列表 + * + * @param tRecordHistory 诊断记录信息历史 + * @return 诊断记录信息历史集合 + */ + public List selectTRecordHistoryList(TRecordHistory tRecordHistory); + + /** + * 新增诊断记录信息历史 + * + * @param tRecordHistory 诊断记录信息历史 + * @return 结果 + */ + public int insertTRecordHistory(TRecordHistory tRecordHistory); + + /** + * 修改诊断记录信息历史 + * + * @param tRecordHistory 诊断记录信息历史 + * @return 结果 + */ + public int updateTRecordHistory(TRecordHistory tRecordHistory); + + /** + * 删除诊断记录信息历史 + * + * @param id 诊断记录信息历史主键 + * @return 结果 + */ + public int deleteTRecordHistoryById(Long id); + + /** + * 批量删除诊断记录信息历史 + * + * @param ids 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteTRecordHistoryByIds(Long[] ids); +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/ITImageHistoryService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/ITImageHistoryService.java new file mode 100644 index 0000000..e0470b2 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/ITImageHistoryService.java @@ -0,0 +1,61 @@ +package com.ruoyi.system.service; + +import java.util.List; +import com.ruoyi.system.domain.TImageHistory; + +/** + * 图片记录历史Service接口 + * + * @author ruoyi + * @date 2022-09-13 + */ +public interface ITImageHistoryService +{ + /** + * 查询图片记录历史 + * + * @param id 图片记录历史主键 + * @return 图片记录历史 + */ + public TImageHistory selectTImageHistoryById(Long id); + + /** + * 查询图片记录历史列表 + * + * @param tImageHistory 图片记录历史 + * @return 图片记录历史集合 + */ + public List selectTImageHistoryList(TImageHistory tImageHistory); + + /** + * 新增图片记录历史 + * + * @param tImageHistory 图片记录历史 + * @return 结果 + */ + public int insertTImageHistory(TImageHistory tImageHistory); + + /** + * 修改图片记录历史 + * + * @param tImageHistory 图片记录历史 + * @return 结果 + */ + public int updateTImageHistory(TImageHistory tImageHistory); + + /** + * 批量删除图片记录历史 + * + * @param ids 需要删除的图片记录历史主键集合 + * @return 结果 + */ + public int deleteTImageHistoryByIds(Long[] ids); + + /** + * 删除图片记录历史信息 + * + * @param id 图片记录历史主键 + * @return 结果 + */ + public int deleteTImageHistoryById(Long id); +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/ITRecordHistoryService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/ITRecordHistoryService.java new file mode 100644 index 0000000..8998fbb --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/ITRecordHistoryService.java @@ -0,0 +1,63 @@ +package com.ruoyi.system.service; + +import java.util.List; +import com.ruoyi.system.domain.TRecordHistory; + +/** + * 诊断记录信息历史Service接口 + * + * @author ruoyi + * @date 2022-09-13 + */ +public interface ITRecordHistoryService +{ + /** + * 查询诊断记录信息历史 + * + * @param id 诊断记录信息历史主键 + * @return 诊断记录信息历史 + */ + public TRecordHistory selectTRecordHistoryById(Long id); + + /** + * 查询诊断记录信息历史列表 + * + * @param tRecordHistory 诊断记录信息历史 + * @return 诊断记录信息历史集合 + */ + public List selectTRecordHistoryList(TRecordHistory tRecordHistory); + + /** + * 新增诊断记录信息历史 + * + * @param tRecordHistory 诊断记录信息历史 + * @return 结果 + */ + public int insertTRecordHistory(TRecordHistory tRecordHistory); + + /** + * 修改诊断记录信息历史 + * + * @param tRecordHistory 诊断记录信息历史 + * @return 结果 + */ + public int updateTRecordHistory(TRecordHistory tRecordHistory); + + /** + * 批量删除诊断记录信息历史 + * + * @param ids 需要删除的诊断记录信息历史主键集合 + * @return 结果 + */ + public int deleteTRecordHistoryByIds(Long[] ids); + + /** + * 删除诊断记录信息历史信息 + * + * @param id 诊断记录信息历史主键 + * @return 结果 + */ + public int deleteTRecordHistoryById(Long id); + + void saveHistory(Long recordId); +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TImageHistoryServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TImageHistoryServiceImpl.java new file mode 100644 index 0000000..264f816 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TImageHistoryServiceImpl.java @@ -0,0 +1,95 @@ +package com.ruoyi.system.service.impl; + +import java.util.List; +import com.ruoyi.common.utils.DateUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ruoyi.system.mapper.TImageHistoryMapper; +import com.ruoyi.system.domain.TImageHistory; +import com.ruoyi.system.service.ITImageHistoryService; + +/** + * 图片记录历史Service业务层处理 + * + * @author ruoyi + * @date 2022-09-13 + */ +@Service +public class TImageHistoryServiceImpl implements ITImageHistoryService +{ + @Autowired + private TImageHistoryMapper tImageHistoryMapper; + + /** + * 查询图片记录历史 + * + * @param id 图片记录历史主键 + * @return 图片记录历史 + */ + @Override + public TImageHistory selectTImageHistoryById(Long id) + { + return tImageHistoryMapper.selectTImageHistoryById(id); + } + + /** + * 查询图片记录历史列表 + * + * @param tImageHistory 图片记录历史 + * @return 图片记录历史 + */ + @Override + public List selectTImageHistoryList(TImageHistory tImageHistory) + { + return tImageHistoryMapper.selectTImageHistoryList(tImageHistory); + } + + /** + * 新增图片记录历史 + * + * @param tImageHistory 图片记录历史 + * @return 结果 + */ + @Override + public int insertTImageHistory(TImageHistory tImageHistory) + { + tImageHistory.setCreateTime(DateUtils.getNowDate()); + return tImageHistoryMapper.insertTImageHistory(tImageHistory); + } + + /** + * 修改图片记录历史 + * + * @param tImageHistory 图片记录历史 + * @return 结果 + */ + @Override + public int updateTImageHistory(TImageHistory tImageHistory) + { + return tImageHistoryMapper.updateTImageHistory(tImageHistory); + } + + /** + * 批量删除图片记录历史 + * + * @param ids 需要删除的图片记录历史主键 + * @return 结果 + */ + @Override + public int deleteTImageHistoryByIds(Long[] ids) + { + return tImageHistoryMapper.deleteTImageHistoryByIds(ids); + } + + /** + * 删除图片记录历史信息 + * + * @param id 图片记录历史主键 + * @return 结果 + */ + @Override + public int deleteTImageHistoryById(Long id) + { + return tImageHistoryMapper.deleteTImageHistoryById(id); + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TRecordHistoryServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TRecordHistoryServiceImpl.java new file mode 100644 index 0000000..4602635 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TRecordHistoryServiceImpl.java @@ -0,0 +1,136 @@ +package com.ruoyi.system.service.impl; + +import java.util.List; +import com.ruoyi.common.utils.DateUtils; +import com.ruoyi.system.domain.TImage; +import com.ruoyi.system.domain.TImageHistory; +import com.ruoyi.system.domain.TRecord; +import com.ruoyi.system.service.ITImageHistoryService; +import com.ruoyi.system.service.ITImageService; +import com.ruoyi.system.service.ITRecordService; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ruoyi.system.mapper.TRecordHistoryMapper; +import com.ruoyi.system.domain.TRecordHistory; +import com.ruoyi.system.service.ITRecordHistoryService; + +/** + * 诊断记录信息历史Service业务层处理 + * + * @author ruoyi + * @date 2022-09-13 + */ +@Service +public class TRecordHistoryServiceImpl implements ITRecordHistoryService +{ + @Autowired + private TRecordHistoryMapper tRecordHistoryMapper; + @Autowired + private ITRecordService tRecordService; + @Autowired + private ITImageHistoryService imageHistoryService; + @Autowired + private ITImageService imageService; + + + /** + * 查询诊断记录信息历史 + * + * @param id 诊断记录信息历史主键 + * @return 诊断记录信息历史 + */ + @Override + public TRecordHistory selectTRecordHistoryById(Long id) + { + return tRecordHistoryMapper.selectTRecordHistoryById(id); + } + + /** + * 查询诊断记录信息历史列表 + * + * @param tRecordHistory 诊断记录信息历史 + * @return 诊断记录信息历史 + */ + @Override + public List selectTRecordHistoryList(TRecordHistory tRecordHistory) + { + return tRecordHistoryMapper.selectTRecordHistoryList(tRecordHistory); + } + + /** + * 新增诊断记录信息历史 + * + * @param tRecordHistory 诊断记录信息历史 + * @return 结果 + */ + @Override + public int insertTRecordHistory(TRecordHistory tRecordHistory) + { + tRecordHistory.setCreateTime(DateUtils.getNowDate()); + return tRecordHistoryMapper.insertTRecordHistory(tRecordHistory); + } + + /** + * 修改诊断记录信息历史 + * + * @param tRecordHistory 诊断记录信息历史 + * @return 结果 + */ + @Override + public int updateTRecordHistory(TRecordHistory tRecordHistory) + { + tRecordHistory.setUpdateTime(DateUtils.getNowDate()); + return tRecordHistoryMapper.updateTRecordHistory(tRecordHistory); + } + + /** + * 批量删除诊断记录信息历史 + * + * @param ids 需要删除的诊断记录信息历史主键 + * @return 结果 + */ + @Override + public int deleteTRecordHistoryByIds(Long[] ids) + { + return tRecordHistoryMapper.deleteTRecordHistoryByIds(ids); + } + + /** + * 删除诊断记录信息历史信息 + * + * @param id 诊断记录信息历史主键 + * @return 结果 + */ + @Override + public int deleteTRecordHistoryById(Long id) + { + return tRecordHistoryMapper.deleteTRecordHistoryById(id); + } + + @Override + public void saveHistory(Long recordId) { + TRecord tRecord = tRecordService.selectTRecordById(recordId); + TRecordHistory tRecordHistory = new TRecordHistory(); + BeanUtils.copyProperties(tRecord,tRecordHistory); + + tRecordHistory.setRecodeId(recordId); + tRecordHistory.setId(null); + //备份记录表 + tRecordHistoryMapper.insertTRecordHistory(tRecordHistory); + + //备份图片表 + TImage tImage = new TImage(); + tImage.setThirdId(recordId); + List images = imageService.selectTImageList(tImage); + + images.parallelStream().forEach(x->{ + TImageHistory tImageHistory=new TImageHistory(); + BeanUtils.copyProperties(x,tImageHistory); + + tImageHistory.setId(null); + tImageHistory.setThirdId(tRecordHistory.getId()); + imageHistoryService.insertTImageHistory(tImageHistory); + }); + } +} diff --git a/ruoyi-system/src/main/resources/mapper/system/TImageHistoryMapper.xml b/ruoyi-system/src/main/resources/mapper/system/TImageHistoryMapper.xml new file mode 100644 index 0000000..7656c48 --- /dev/null +++ b/ruoyi-system/src/main/resources/mapper/system/TImageHistoryMapper.xml @@ -0,0 +1,70 @@ + + + + + + + + + + + + + + select id, third_id, path, name, create_time from t_image_history + + + + + + + + insert into t_image_history + + third_id, + path, + name, + create_time, + + + #{thirdId}, + #{path}, + #{name}, + #{createTime}, + + + + + update t_image_history + + third_id = #{thirdId}, + path = #{path}, + name = #{name}, + create_time = #{createTime}, + + where id = #{id} + + + + delete from t_image_history where id = #{id} + + + + delete from t_image_history where id in + + #{id} + + + \ No newline at end of file diff --git a/ruoyi-system/src/main/resources/mapper/system/TRecordHistoryMapper.xml b/ruoyi-system/src/main/resources/mapper/system/TRecordHistoryMapper.xml new file mode 100644 index 0000000..dadf646 --- /dev/null +++ b/ruoyi-system/src/main/resources/mapper/system/TRecordHistoryMapper.xml @@ -0,0 +1,135 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select id, patient_id, doctor_id, hospital_id, status, ai_result, ai_result2, update_result, update_result2, create_time, update_time, upload_time, img_sx, img_sm, response_time, ai_result_return_time, ai_result_modify_time from t_record_history + + + + + + + + insert into t_record_history + + patient_id, + doctor_id, + hospital_id, + status, + ai_result, + ai_result2, + update_result, + update_result2, + create_time, + update_time, + upload_time, + img_sx, + img_sm, + response_time, + ai_result_return_time, + ai_result_modify_time, + del_flag, + recode_id, + + + #{patientId}, + #{doctorId}, + #{hospitalId}, + #{status}, + #{aiResult}, + #{aiResult2}, + #{updateResult}, + #{updateResult2}, + #{createTime}, + #{updateTime}, + #{uploadTime}, + #{imgSx}, + #{imgSm}, + #{responseTime}, + #{aiResultReturnTime}, + #{delFlag}, + #{recodeId}, + + + + + update t_record_history + + patient_id = #{patientId}, + doctor_id = #{doctorId}, + hospital_id = #{hospitalId}, + status = #{status}, + ai_result = #{aiResult}, + ai_result2 = #{aiResult2}, + update_result = #{updateResult}, + update_result2 = #{updateResult2}, + create_time = #{createTime}, + update_time = #{updateTime}, + upload_time = #{uploadTime}, + img_sx = #{imgSx}, + img_sm = #{imgSm}, + response_time = #{responseTime}, + ai_result_return_time = #{aiResultReturnTime}, + ai_result_modify_time = #{aiResultModifyTime}, + + where id = #{id} + + + + delete from t_record_history where id = #{id} + + + + delete from t_record_history where id in + + #{id} + + + \ No newline at end of file