From 929370c09d636598158fc288b1c61c27047e16d3 Mon Sep 17 00:00:00 2001 From: zhuangyuanke Date: Wed, 11 Dec 2024 09:07:06 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81=E4=BC=98=E5=8C=96=E6=82=A3=E8=80=85?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=AF=BC=E5=85=A5=E9=80=BB=E8=BE=91=EF=BC=9B?= =?UTF-8?q?=202=E3=80=81=E6=82=A3=E8=80=85=E5=AF=BC=E5=85=A5=E6=97=B6?= =?UTF-8?q?=EF=BC=8C=E5=90=8C=E6=AD=A5=E5=86=99=E5=85=A5=E9=97=AE=E8=AF=8A?= =?UTF-8?q?ID=EF=BC=9B=203=E3=80=81=E4=BF=AE=E6=94=B9=E9=83=A8=E5=88=86bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/LabelFieldContentServiceImpl.java | 7 +- .../impl/PatientInfoServiceImpl.java | 13 +++ .../SignPatientManageRouteServiceImpl.java | 108 ++++++++++++++---- .../SignPatientManageRouteVO.java | 4 + .../PatientVisitRecordMapper.xml | 3 +- .../SignPatientManageRouteMapper.xml | 12 +- 6 files changed, 119 insertions(+), 28 deletions(-) diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/service/labelfieldcontent/impl/LabelFieldContentServiceImpl.java b/postdischarge-manage/src/main/java/com/xinelu/manage/service/labelfieldcontent/impl/LabelFieldContentServiceImpl.java index cab36302..d3f184c8 100644 --- a/postdischarge-manage/src/main/java/com/xinelu/manage/service/labelfieldcontent/impl/LabelFieldContentServiceImpl.java +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/service/labelfieldcontent/impl/LabelFieldContentServiceImpl.java @@ -393,8 +393,11 @@ public class LabelFieldContentServiceImpl implements ILabelFieldContentService { } PatientAllInfoViewUppercase patientAllInfoView = patientAllInfoViews.get(0); retObj = JSONObject.parseObject(JSONObject.toJSONString(patientAllInfoView)); - // 性别转换成中文、计算年龄 - retObj.fluentPut("SEX", PatientSexEnum.getInfoByCode(patientAllInfoView.getSEX()).getInfo()).fluentPut("AGE", BaseUtil.getAge(patientAllInfoView.getBIRTHDATE())); + try { + // 性别转换成中文、计算年龄 + retObj.fluentPut("SEX", PatientSexEnum.getInfoByCode(patientAllInfoView.getSEX()).getInfo()).fluentPut("AGE", BaseUtil.getAge(patientAllInfoView.getBIRTHDATE())); + } + catch(Exception ex) {} return retObj; } } diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/service/patientinfo/impl/PatientInfoServiceImpl.java b/postdischarge-manage/src/main/java/com/xinelu/manage/service/patientinfo/impl/PatientInfoServiceImpl.java index 041e34d8..4907c311 100644 --- a/postdischarge-manage/src/main/java/com/xinelu/manage/service/patientinfo/impl/PatientInfoServiceImpl.java +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/service/patientinfo/impl/PatientInfoServiceImpl.java @@ -534,6 +534,19 @@ public class PatientInfoServiceImpl implements IPatientInfoService { log.info("就诊记录表新增失败!"); return AjaxResult.error("就诊记录新增失败"); } + // 更新 患者信息表中 的 最近一次问诊记录id + for (PatientInfoImport patientInfoImport : patientInfoImportList) { + //获取患者的最近一次就诊ID + PatientVisitRecordDto patientVisitRecordDto = new PatientVisitRecordDto(); + patientVisitRecordDto.setPatientId(patientInfoImport.getPatientInfoId()); + PatientVisitRecord patientVisitRecord = patientVisitRecordMapper.getLastRecord(patientVisitRecordDto); + PatientInfo patientInfo = new PatientInfo(); + patientInfo.setId(patientInfoImport.getPatientInfoId()); + // 修改患者最近一次就诊记录id + patientInfo.setPatientVisitRecordId(patientVisitRecord.getId()); + patientInfoMapper.updatePatientInfoSelective(patientInfo); + } + //endregion } String msg = "已完成数据导入!导入成功" + patientInfoImportList.size() + "条记录,失败0条记录"; diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/service/signpatientmanageroute/impl/SignPatientManageRouteServiceImpl.java b/postdischarge-manage/src/main/java/com/xinelu/manage/service/signpatientmanageroute/impl/SignPatientManageRouteServiceImpl.java index 31507486..ad89a6fa 100644 --- a/postdischarge-manage/src/main/java/com/xinelu/manage/service/signpatientmanageroute/impl/SignPatientManageRouteServiceImpl.java +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/service/signpatientmanageroute/impl/SignPatientManageRouteServiceImpl.java @@ -32,10 +32,12 @@ import com.xinelu.manage.domain.signpatientrecord.SignPatientRecord; import com.xinelu.manage.domain.signroutetriggercondition.SignRouteTriggerCondition; import com.xinelu.manage.dto.aiob.ActualTimeTaskDto; import com.xinelu.manage.dto.manualfollowup.ManualFollowUpDTO; +import com.xinelu.manage.dto.patientinfo.PatientInfoDto; import com.xinelu.manage.dto.patientquestionoptionresult.PatientQuestionOptionResultDTO; import com.xinelu.manage.dto.patientquestionsubjectresult.PatientQuestionSubjectResultDTO; import com.xinelu.manage.dto.patientquestionsubmitresult.PatientQuestionSubmitResultDTO; import com.xinelu.manage.dto.signpatientmanageroutenode.CreateAiobActualTimeTaskDto; +import com.xinelu.manage.dto.signpatientmanageroutenode.PatientTaskDto; import com.xinelu.manage.dto.smssend.SmsInfoDTO; import com.xinelu.manage.mapper.labelfieldcontent.LabelFieldContentMapper; import com.xinelu.manage.mapper.patientinfo.PatientInfoMapper; @@ -62,6 +64,7 @@ import com.xinelu.manage.service.specialdiseaseroute.ISpecialDiseaseRouteService import com.xinelu.manage.vo.labelfieldcontent.LabelFieldInfoContentVo; import com.xinelu.manage.vo.manualfollowup.ManualFollowPatientVO; import com.xinelu.manage.vo.manualfollowup.ManualFollowUpVO; +import com.xinelu.manage.vo.patientinfo.PatientInfoVo; import com.xinelu.manage.vo.propagandainfo.PropagandaMaterialsVo; import com.xinelu.manage.vo.questionInfo.QuestionVO; import com.xinelu.manage.vo.signpatientmanageroute.PhonePush; @@ -182,6 +185,36 @@ public class SignPatientManageRouteServiceImpl implements ISignPatientManageRout @Transactional(rollbackFor = Exception.class) @Override public AjaxResult insertSignPatientManageRoute(SignPatientManageRouteVO signPatientManageRoute) { + //如果是批量 创建 + if(StringUtils.isNotBlank(signPatientManageRoute.getSn())) + { + //获取患者信息 + List listPatient = new ArrayList<>(); + PatientInfoDto patientInfo = new PatientInfoDto(); + patientInfo.setSn(signPatientManageRoute.getSn()); + listPatient = patientInfoMapper.getPatientList(patientInfo); + for(PatientInfoVo patientInfoVo : listPatient) + { + signPatientManageRoute.setPatientId(patientInfoVo.getId()); + signPatientManageRoute.setPatientName(patientInfoVo.getPatientName()); + signPatientManageRoute.setDepartmentId(patientInfoVo.getDepartmentId()); + signPatientManageRoute.setDepartmentName(patientInfoVo.getDepartmentName()); + AjaxResult ar = insertSignPatientManageRouteForPatient(signPatientManageRoute); + //如果有错误码,直接返回; + if(ar.containsValue(901)) + return ar; + } + return AjaxResult.success(); + } + else + { + return insertSignPatientManageRouteForPatient(signPatientManageRoute); + + } + + } + public AjaxResult insertSignPatientManageRouteForPatient(SignPatientManageRouteVO signPatientManageRoute) + { // 新增主表 signPatientManageRoute.setTaskCreateType(TaskCreateTypeEnum.MANUAL_CREATE.getInfo()); signPatientManageRoute.setCreateBy(SecurityUtils.getUsername()); @@ -190,37 +223,54 @@ public class SignPatientManageRouteServiceImpl implements ISignPatientManageRout if(StringUtils.isNotBlank(signPatientManageRoute.getImportMainId())) { signPatientManageRoute.setTaskExcuteType(TaskExcuteTypeEnum.BATCH_TASK.getInfo());} + //任务路由主表 新增 int insertRoute = signPatientManageRouteMapper.insertSignPatientManageRoute(signPatientManageRoute); if (insertRoute < 0) { - return AjaxResult.error("新增签约患者管理任务路径失败!请联系管理员!"); + return AjaxResult.error(901,"新增签约患者管理任务路径失败!请联系管理员!"); } // 新增节点表 List signPatientManageRouteNodes = new ArrayList<>(); for (SignPatientManageRouteNode routeNode : signPatientManageRoute.getRouteNodeList()) { - if (Objects.isNull(routeNode) || StringUtils.isBlank(routeNode.getTaskNodeType()) || (" ").equals(routeNode.getTaskNodeType()) || StringUtils.isBlank(routeNode.getRouteNodeName()) || Objects.isNull(routeNode.getRouteNodeDay())) { + if (Objects.isNull(routeNode) || StringUtils.isBlank(routeNode.getTaskNodeType()) || (" ").equals(routeNode.getTaskNodeType()) + || (Objects.isNull(routeNode.getNodePlanTime()) && (StringUtils.isBlank(routeNode.getRouteNodeName()) || !Objects.isNull(routeNode.getRouteNodeDay()))) || + (Objects.isNull(routeNode.getRouteNodeDay()) && Objects.isNull(routeNode.getNodePlanTime()))) { continue; } //任务执行类型,批量执行 if(StringUtils.isNotBlank(signPatientManageRoute.getImportMainId())) { routeNode.setTaskExcuteType(TaskExcuteTypeEnum.BATCH_TASK.getInfo());} + if(Objects.isNull(signPatientManageRoute.getSignPatientRecordId())) { + //更新 审核状态为 已审核,适用场景:手动创建任务 zyk 20241204 + routeNode.setRouteCheckStatus(RouteCheckStatusEnum.AGREE.getInfo()); + } extracted(signPatientManageRoute, signPatientManageRouteNodes, routeNode); } if (CollectionUtils.isEmpty(signPatientManageRouteNodes)) { - return AjaxResult.error("创建任务中至少有一个管理任务节点!"); + return AjaxResult.error(901,"创建任务中至少有一个管理任务节点!"); } //批量插入任务 int insertBatchCount = signPatientManageRouteNodeMapper.insertBatch(signPatientManageRouteNodes); if (insertBatchCount < 0) { - return AjaxResult.error("新增签约患者管理任务路径失败!请联系管理员!"); + return AjaxResult.error(901,"新增签约患者管理任务路径失败!请联系管理员!"); } - //更新 签约记录的 审核状态为 未审核,适用场景:手动创建任务 zyk 20241204 + + SignPatientRecord signPatientRecord = new SignPatientRecord(); - signPatientRecord.setRouteCheckStatus(RouteCheckStatusEnum.UNAUDITED.getInfo()); + + if(Objects.isNull(signPatientManageRoute.getSignPatientRecordId())) { + //更新 签约记录的 审核状态为 已审核,适用场景:手动创建任务 zyk 20241204 + signPatientRecord.setRouteCheckStatus(RouteCheckStatusEnum.AGREE.getInfo()); + } + else + { + //×××××更新 签约记录的 审核状态为 未审核,适用场景:手动创建任务 zyk 20241204 + signPatientRecord.setRouteCheckStatus(RouteCheckStatusEnum.UNAUDITED.getInfo()); + } signPatientRecord.setId(signPatientManageRoute.getSignPatientRecordId()); int updateRecord = signPatientRecordMapper.updateByPrimaryKeySelective(signPatientRecord); if (updateRecord < 0) { - return AjaxResult.error("修改签约患者管理任务路径失败!请联系管理员!"); + return AjaxResult.error(901,"修改签约患者管理任务路径失败!请联系管理员!"); } return AjaxResult.success(); @@ -301,7 +351,7 @@ public class SignPatientManageRouteServiceImpl implements ISignPatientManageRout } /** - * 查询人工随访代办列表 + * 查询人工随访待办列表 * * @param manualFollowUpDTO 人工随访查询DTO * @return ManualFollowUpVO 人工随访代办VO @@ -312,35 +362,50 @@ public class SignPatientManageRouteServiceImpl implements ISignPatientManageRout if (manualFollowUpDTO.getNodeExecuteStatus().equals(NodeExecuteStatusEnum.UNEXECUTED.getInfo())) { manualFollowUpDTO.setPhoneNodeExecuteResultStatus(null); } + //1、查询 List manualFollowUpVOS = signPatientManageRouteMapper.selectManualFollowUpList(manualFollowUpDTO); + //2、1如果是查询已执行的任务,直接返回查询结果 if (manualFollowUpDTO.getNodeExecuteStatus().equals(NodeExecuteStatusEnum.EXECUTED.getInfo())) { return manualFollowUpVOS; } + //2.2如果是查询“所有”、"未执行“任务,则这届返回查询结果 + if (StringUtils.isNotBlank(manualFollowUpDTO.getTimeSign()) && manualFollowUpDTO.getTimeSign().equals("WHOLE")) { + return manualFollowUpVOS; + } + //2.3如果是查询未执行(截止到当前时间)的任务, ArrayList manualFollowUps = new ArrayList<>(); for (ManualFollowUpVO manualFollowUpVO : manualFollowUpVOS) { - //判断路径节点,组装数据 + //3.1判断路径节点,组装数据 + //任务执行时间, LocalDate localDate = null; - if (Objects.nonNull(manualFollowUpVO.getDischargeTime())) { - localDate = manualFollowUpVO.getDischargeTime().plusDays(manualFollowUpVO.getRouteNodeDay()).toLocalDate(); + if(Objects.nonNull( manualFollowUpVO.getNodePlanTime()) && StringUtils.isNotBlank( manualFollowUpVO.getNodePlanTime().toString())) { + localDate = manualFollowUpVO.getNodePlanTime().toLocalDate(); } - if (Objects.isNull(manualFollowUpVO.getDischargeTime()) && Objects.nonNull(manualFollowUpVO.getVisitTime())) { - localDate = manualFollowUpVO.getVisitTime().plusDays(manualFollowUpVO.getRouteNodeDay()).toLocalDate(); - } - if (Objects.isNull(localDate)) { - continue; + else { + //3.2根据出院时间 和 第几天 计算 + if (Objects.nonNull(manualFollowUpVO.getDischargeTime())) { + localDate = manualFollowUpVO.getDischargeTime().plusDays(manualFollowUpVO.getRouteNodeDay()).toLocalDate(); + } + //3.3根据就诊时间 和 第几天 计算 + if (Objects.isNull(manualFollowUpVO.getDischargeTime()) && Objects.nonNull(manualFollowUpVO.getVisitTime())) { + localDate = manualFollowUpVO.getVisitTime().plusDays(manualFollowUpVO.getRouteNodeDay()).toLocalDate(); + } + //3.4如果为空,不予处理 + if (Objects.isNull(localDate)) { + continue; + } } + //3.5如果截止到当前时间,已到期,则放入返回集合 boolean before = localDate.isBefore(LocalDate.now()) || localDate.isEqual(LocalDate.now()); if (before) { //转换成中文…… manualFollowUpVO.setRouteNodeName(RouteNodeNameEnum.getNameByInfo(manualFollowUpVO.getRouteNodeName()).getName()); manualFollowUpVO.setPlanTime(localDate); + // 3.6 放入集合 manualFollowUps.add(manualFollowUpVO); } } - //返回所有未执行任务 - if (StringUtils.isNotBlank(manualFollowUpDTO.getTimeSign()) && manualFollowUpDTO.getTimeSign().equals("WHOLE")) { - return manualFollowUpVOS; - } + //返回今天之前任务 return manualFollowUps; } @@ -1009,6 +1074,8 @@ public class SignPatientManageRouteServiceImpl implements ISignPatientManageRout signPatientManageRouteNode.setTaskExcuteType(TaskExcuteTypeEnum.BATCH_TASK.getInfo()); else signPatientManageRouteNode.setTaskExcuteType(TaskExcuteTypeEnum.ACTUAL_TIME_TASK.getInfo()); + signPatientManageRouteNode.setNodePlanTime(routeNode.getNodePlanTime()); + //电话外呼 if (Objects.nonNull(routeNode) && TaskNodeTypeEnum.PHONE_OUTBOUND.getInfo().equals(routeNode.getTaskNodeType())) { signPatientManageRouteNode.setPhonePushSign(Objects.isNull(routeNode.getPhonePushSign()) ? null : routeNode.getPhonePushSign()); @@ -1065,6 +1132,7 @@ public class SignPatientManageRouteServiceImpl implements ISignPatientManageRout signPatientManageRouteNode.setRouteNodeDay(routeNode.getRouteNodeDay()); signPatientManageRouteNode.setCreateTime(LocalDateTime.now()); signPatientManageRouteNode.setCreateBy(SecurityUtils.getUsername()); + signPatientManageRouteNode.setRouteCheckStatus(routeNode.getRouteCheckStatus()); signPatientManageRouteNodes.add(signPatientManageRouteNode); } diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/vo/signpatientmanageroute/SignPatientManageRouteVO.java b/postdischarge-manage/src/main/java/com/xinelu/manage/vo/signpatientmanageroute/SignPatientManageRouteVO.java index d34463c7..5bb36e6c 100644 --- a/postdischarge-manage/src/main/java/com/xinelu/manage/vo/signpatientmanageroute/SignPatientManageRouteVO.java +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/vo/signpatientmanageroute/SignPatientManageRouteVO.java @@ -24,6 +24,10 @@ public class SignPatientManageRouteVO extends SignPatientManageRoute { @ApiModelProperty(value = "批量导入表ID") private String importMainId; + /** 批量导入表(patient_info_import_main表)流水号 */ + @ApiModelProperty(value = "批量导入表流水号") + private String sn; + /** * 患者管理任务路径id */ diff --git a/postdischarge-manage/src/main/resources/mapper/manage/patientvisitrecord/PatientVisitRecordMapper.xml b/postdischarge-manage/src/main/resources/mapper/manage/patientvisitrecord/PatientVisitRecordMapper.xml index be415c4d..50238ae1 100644 --- a/postdischarge-manage/src/main/resources/mapper/manage/patientvisitrecord/PatientVisitRecordMapper.xml +++ b/postdischarge-manage/src/main/resources/mapper/manage/patientvisitrecord/PatientVisitRecordMapper.xml @@ -500,6 +500,7 @@ and card_no != #{cardNo,jdbcType=VARCHAR} + order by id desc limit 1