diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/process/ProcessController.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/process/ProcessController.java index 2bced1fbc..a1f1d2ceb 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/process/ProcessController.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/process/ProcessController.java @@ -31,6 +31,7 @@ public class ProcessController { private ProcessService processService; @Resource private ProcessMapper processMapper; + @GetMapping("/get") @Operation(summary = "获得危急值记录") @Parameter(name = "id", description = "编号", required = true, example = "1024") @@ -41,13 +42,14 @@ public class ProcessController { @GetMapping("/page") @Operation(summary = "获得危急值记录分页") - public CommonResult> getProcessPage(@Valid ProcessPageReqVO pageReqVO) { - PageResult pageResult = processService.getProcessPage(pageReqVO); + public CommonResult>> getProcessPage(@Valid ProcessPageReqVO pageReqVO) { + PageResult> pageResult = processService.getProcessPage(pageReqVO); return success(pageResult); } + @PostMapping("/save") @Operation(summary = "返修申请插入") - @LogRecord(type = "返修申请", subType = "申请", bizNo ="1001" , success = "ID:{{#processSaveReqVO.getUserId}}-{{#processSaveReqVO.getApplyDoctor}}对检查编号:{{#processSaveReqVO.getExamId}}-{{#processSaveReqVO.getPname}}患者进行返修申请操作") + @LogRecord(type = "返修申请", subType = "申请", bizNo = "1001", success = "ID:{{#processSaveReqVO.getUserId}}-{{#processSaveReqVO.getApplyDoctor}}对检查编号:{{#processSaveReqVO.getExamId}}-{{#processSaveReqVO.getPname}}患者进行返修申请操作") public CommonResult save(@RequestBody ProcessSaveReqVO processSaveReqVO) { ProcessDO process = new ProcessDO(); process.setId(UUID.randomUUID().toString()); @@ -63,4 +65,14 @@ public class ProcessController { processMapper.insert(process); return success(true); } + + @GetMapping("/examineProcess") + @Operation(summary = "返修审核") + @LogRecord(type = "返修审核", subType = "审核状态(0申请、1审核、2拒绝):{{#examineType}}", bizNo = "1003", success = "{{#success_msg}}") + public CommonResult examineProcess(@RequestParam("id") String id, + @RequestParam("examineType") String examineType, + @RequestParam("refuseremark") String refuseremark) { + String strResult = processService.examineProcess(id, examineType, refuseremark); + return success(strResult); + } } \ No newline at end of file diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/process/ProcessMapper.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/process/ProcessMapper.java index 35158da64..f3e7800ae 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/process/ProcessMapper.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/process/ProcessMapper.java @@ -30,4 +30,9 @@ public interface ProcessMapper extends BaseMapperX { .likeIfPresent(ProcessDO::getPname, reqVO.getPname()) .orderByDesc(ProcessDO::getApplyDateTime)); } + + @Update(" UPDATE tb_patientexamlist t1 SET \n" + + " t1.reviewStatus='0',t1.reviewDoctorId=NULL,t1.reviewDoctor=NULL,t1.reviewDate=NULL,t1.reportstatus='已分析' \n" + + " WHERE t1.regId=#{regId} AND t1.examId=#{examId} ") + int updateReviewStatusOfPatientexamlist(@Param("regId") String regId, @Param("examId") String examId); } \ No newline at end of file diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/process/ProcessService.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/process/ProcessService.java index 59506abab..b645ec725 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/process/ProcessService.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/process/ProcessService.java @@ -28,6 +28,13 @@ public interface ProcessService { * @param pageReqVO 分页查询 * @return 危急值记录分页 */ - PageResult getProcessPage(ProcessPageReqVO pageReqVO); + PageResult> getProcessPage(ProcessPageReqVO pageReqVO); + /** + * 审核数据 + * + * @param id 编号, examineType 审核类型, refuseremark 拒绝原因 + * @return + */ + String examineProcess(String id, String examineType, String refuseremark); } \ No newline at end of file diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/process/ProcessServiceImpl.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/process/ProcessServiceImpl.java index bb07aee0f..f0ca74a40 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/process/ProcessServiceImpl.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/process/ProcessServiceImpl.java @@ -1,12 +1,24 @@ package cn.iocoder.yudao.module.system.service.process; +import cn.hutool.core.bean.BeanUtil; import cn.iocoder.yudao.framework.common.exception.ErrorCode; +import cn.iocoder.yudao.module.system.api.notify.NotifyMessageSendApi; +import cn.iocoder.yudao.module.system.api.notify.dto.NotifySendSingleToUserReqDTO; +import cn.iocoder.yudao.module.system.dal.dataobject.doctor.DoctorDO; +import cn.iocoder.yudao.module.system.dal.dataobject.org.OrgUnitDO; +import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO; +import cn.iocoder.yudao.module.system.dal.mysql.doctor.DoctorMapper; +import cn.iocoder.yudao.module.system.dal.mysql.org.OrgUnitMapper; import cn.iocoder.yudao.module.system.service.user.AdminUserService; +import com.mzt.logapi.context.LogRecordContext; import org.springframework.stereotype.Service; import org.springframework.validation.annotation.Validated; import org.springframework.transaction.annotation.Transactional; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; import java.util.*; +import java.util.stream.Collectors; import cn.iocoder.yudao.module.system.controller.admin.process.vo.*; import cn.iocoder.yudao.module.system.dal.dataobject.process.ProcessDO; @@ -18,6 +30,7 @@ import cn.iocoder.yudao.module.system.dal.mysql.process.ProcessMapper; import javax.annotation.*; import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; +import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId; /** * 危急值记录 Service 实现类 @@ -31,9 +44,18 @@ public class ProcessServiceImpl implements ProcessService { @Resource private ProcessMapper processMapper; + @Resource + private OrgUnitMapper orgUnitMapper; + @Resource private AdminUserService userService; + @Resource + private DoctorMapper doctorMapper; + + @Resource + private NotifyMessageSendApi notifySendApi; + private void validateProcessExists(String id) { if (processMapper.selectById(id) == null) { throw exception(new ErrorCode(1, "ID为空")); @@ -46,14 +68,118 @@ public class ProcessServiceImpl implements ProcessService { } @Override - public PageResult getProcessPage(ProcessPageReqVO pageReqVO) { + public PageResult> getProcessPage(ProcessPageReqVO pageReqVO) { + PageResult> res = null; + + //res_temp if (pageReqVO != null) { if (pageReqVO.getProcessDate_le() != null) pageReqVO.setProcessDate_le(pageReqVO.getProcessDate_le().plusDays(1)); if (pageReqVO.getApplyDateTime_le() != null) pageReqVO.setApplyDateTime_le(pageReqVO.getApplyDateTime_le().plusDays(1)); } - return processMapper.selectPage(pageReqVO); + PageResult res_temp = processMapper.selectPage(pageReqVO); + + //res + if (res_temp != null) { + res = new PageResult<>(); + res.setTotal(res_temp.getTotal()); + if (res_temp.getList() == null || res_temp.getList().isEmpty()) { + res.setList(Collections.emptyList()); + } else { + List orgs = orgUnitMapper.getOrgUnitdictList(); + res.setList(res_temp.getList().stream().map(item -> { + Map item_map = BeanUtil.beanToMap(item); + String orgName = null; + if (orgs != null && !orgs.isEmpty() && item.getOrgId() != null && !item.getOrgId().trim().equals("")) { + Optional optOrg = orgs.stream().filter(it -> it != null && it.getOrgID() != null && it.getOrgID().trim().equals(item.getOrgId().trim())).findFirst(); + if (optOrg.isPresent()) orgName = optOrg.get().getOrgName(); + } + item_map.put("orgId_name", orgName); + return item_map; + }).collect(Collectors.toList())); + + } + } + + return res; } + @Override + public String examineProcess(String id, String examineType, String refuseremark) { + String out = "-200";//失败 + try { + LogRecordContext.putVariable("success_msg", "无"); + ProcessDO process = null; + if (id != null && !id.trim().equals("")) + process = processMapper.selectById(id); + + if (process == null) { + } else if (process.getProcessstats() == null || process.getProcessstats() != 0) { + } else if (examineType == null || examineType.trim().equals("")) { + } else { + examineType = examineType.trim(); + AdminUserDO user = userService.getUser(getLoginUserId()); + DoctorDO doctor = doctorMapper.selectOne(user.getDoctorID()); + OrgUnitDO org = orgUnitMapper.selectByKey(user.getOrgId()); + LocalDateTime dateTime = LocalDateTime.parse( + LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")), + DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss") + ); + if (Arrays.asList(new String[]{"1", "2"}).contains(examineType)) { + LogRecordContext.putVariable("success_msg", "医生" + (doctor != null ? doctor.getDoctorName() : "") + "(id:" + (doctor != null ? doctor.getDoctorID() : "") + ")[" + (examineType.equals("1") ? "审核" : "拒绝") + + "]了患者" + process.getPname() + "(regId:" + process.getRegId() + ",examId:" + process.getExamId() + "),[返修审核]id:" + id); + } + if (examineType.equals("1")) { + process.setProcessstats(1); + if (doctor != null) + process.setProcessDoctor(doctor.getDoctorName()); + process.setProcessDate(dateTime); + process.setProcessOrgId(user.getOrgId()); + if (org != null) + process.setProcessorgName(org.getOrgName()); + processMapper.updateById(process); + processMapper.updateReviewStatusOfPatientexamlist(process.getRegId(), process.getExamId()); + //站内信 + if (process.getUserId() != null) { + String templateCode = "A002"; + Long userId = Long.valueOf(process.getUserId()); + Map templateParams = new HashMap<>(); + templateParams.put("pname", process.getPname()); + templateParams.put("regId", process.getRegId()); + notifySendApi.sendSingleMessageToAdmin(new NotifySendSingleToUserReqDTO() + .setUserId(userId).setTemplateCode(templateCode).setTemplateParams(templateParams)); + } + out = "200";//成功 + } else if (examineType.equals("2")) { + process.setProcessstats(2); + if (doctor != null) + process.setProcessDoctor(doctor.getDoctorName()); + process.setProcessDate(dateTime); + process.setProcessOrgId(user.getOrgId()); + if (org != null) + process.setProcessorgName(org.getOrgName()); + if (refuseremark != null) + process.setRefuseremark(refuseremark.trim()); + processMapper.updateById(process); + //站内信 + if (process.getUserId() != null) { + String templateCode = "A003"; + Long userId = Long.valueOf(process.getUserId()); + Map templateParams = new HashMap<>(); + templateParams.put("pname", process.getPname()); + templateParams.put("regId", process.getRegId()); + notifySendApi.sendSingleMessageToAdmin(new NotifySendSingleToUserReqDTO() + .setUserId(userId).setTemplateCode(templateCode).setTemplateParams(templateParams)); + } + out = "200";//成功 + } + } + } catch (Exception ex) { + out = "-200";//失败 + } + return out; + } + + } \ No newline at end of file diff --git a/yudao-module-tblist/yudao-module-tblist-biz/src/main/java/cn/iocoder/yudao/module/tblist/controller/admin/patientexamlist/PatientexamlistController.java b/yudao-module-tblist/yudao-module-tblist-biz/src/main/java/cn/iocoder/yudao/module/tblist/controller/admin/patientexamlist/PatientexamlistController.java index 45cc2afaf..4ab9f8534 100644 --- a/yudao-module-tblist/yudao-module-tblist-biz/src/main/java/cn/iocoder/yudao/module/tblist/controller/admin/patientexamlist/PatientexamlistController.java +++ b/yudao-module-tblist/yudao-module-tblist-biz/src/main/java/cn/iocoder/yudao/module/tblist/controller/admin/patientexamlist/PatientexamlistController.java @@ -326,7 +326,7 @@ public class PatientexamlistController { @PutMapping("/examineupdate") @Operation(summary = "超声保存更新数据") @PreAuthorize("@ss.hasPermission('tblist:patientexamlist:update')") - @LogRecord(type = "超声保存", subType = "保存", bizNo = "{{#updateReqVO.getId}}", success = "保存ID为{{#updateReqVO.getId}}的患者") + @LogRecord(type = "超声保存", subType = "保存", bizNo = "1002", success = "保存ID为{{#updateReqVO.getId}}的患者") public CommonResult updateexaminelist(@Valid @RequestBody PatientexamlistSaveReqVO updateReqVO) { LocalDateTime dateTime = LocalDateTime.parse(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")), @@ -339,7 +339,7 @@ public class PatientexamlistController { @GetMapping("/examine") @Operation(summary = "超声审核更新数据") @PreAuthorize("@ss.hasPermission('tblist:patientexamlist:update')") - @LogRecord(type = "超声审核", subType = "审核", bizNo = "{{#updateReqVO.getId}}", success = "审核ID为{{#id}}的患者") + @LogRecord(type = "超声审核", subType = "审核", bizNo = "1002", success = "审核ID为{{#id}}的患者") public CommonResult examine(@RequestParam("id") String id) { LocalDateTime dateTime = LocalDateTime.parse(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")),