diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/service/signpatientmanageroutenode/ISignPatientManageRouteNodeService.java b/postdischarge-manage/src/main/java/com/xinelu/manage/service/signpatientmanageroutenode/ISignPatientManageRouteNodeService.java index 468178c5..3e20a3e7 100644 --- a/postdischarge-manage/src/main/java/com/xinelu/manage/service/signpatientmanageroutenode/ISignPatientManageRouteNodeService.java +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/service/signpatientmanageroutenode/ISignPatientManageRouteNodeService.java @@ -152,4 +152,12 @@ public interface ISignPatientManageRouteNodeService { * @param signRecordId 签约记录主键 */ void manualCreateTaskLabelReplace(Long signRecordId); + + /** + * 根据触发条件生成子路径任务 + * @param patientId 患者主键 + * @param signPatientRecordId 签约记录表主键 + * @param specialDiseaseRouteId 专病管理路径子路径主键 + */ + void generateChildRouteTask(Long patientId, Long signPatientRecordId, Long specialDiseaseRouteId); } diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/service/signpatientmanageroutenode/impl/SignPatientManageRouteNodeServiceImpl.java b/postdischarge-manage/src/main/java/com/xinelu/manage/service/signpatientmanageroutenode/impl/SignPatientManageRouteNodeServiceImpl.java index 04c4f8df..e6b2018a 100644 --- a/postdischarge-manage/src/main/java/com/xinelu/manage/service/signpatientmanageroutenode/impl/SignPatientManageRouteNodeServiceImpl.java +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/service/signpatientmanageroutenode/impl/SignPatientManageRouteNodeServiceImpl.java @@ -607,8 +607,9 @@ public class SignPatientManageRouteNodeServiceImpl implements ISignPatientManage return executeDateTime; } - @Override public void generateMainRouteTask(Long signRecordId) { - + @Override + @Transactional(rollbackFor = Exception.class) + public void generateMainRouteTask(Long signRecordId) { // 查询专病路径节点和手动创建的任务节点 SignPatientRecord signPatientRecord = signPatientRecordMapper.selectByPrimaryKey(signRecordId); if (ObjectUtils.isEmpty(signPatientRecord)) { @@ -626,6 +627,7 @@ public class SignPatientManageRouteNodeServiceImpl implements ISignPatientManage } @Override + @Transactional(rollbackFor = Exception.class) public void manualCreateTaskLabelReplace(Long signRecordId) { SignPatientManageRoute manageRouteQuery = new SignPatientManageRoute(); manageRouteQuery.setSignPatientRecordId(signRecordId); @@ -672,11 +674,12 @@ public class SignPatientManageRouteNodeServiceImpl implements ISignPatientManage } /** - * 生成子路径任务 + * 根据触发条件生成子路径任务 * @param patientId 患者主键 - * @param signPatientRecordId 签约记录主键 - * @param specialDiseaseRouteId 专病管理路径路径id + * @param signPatientRecordId 签约记录表主键 + * @param specialDiseaseRouteId 专病管理路径子路径主键 */ + @Override @Transactional(rollbackFor = Exception.class) public void generateChildRouteTask(Long patientId, Long signPatientRecordId, Long specialDiseaseRouteId) { boolean generateTask = false; @@ -701,46 +704,21 @@ public class SignPatientManageRouteNodeServiceImpl implements ISignPatientManage // 条件1成立,继续判断条件2,3 if (triggerConditionList.size() > 1) { boolean condition2 = judgeTriggerCondition(triggerConditionList.get(1), patientAllInfo, labelFieldContentList); - if (condition2) { - // 条件2成立,判断2、3的逻辑连接符,or:则不判断3,and:需要判断3 - if (triggerConditionList.size() > 2) { - boolean judgetCondition3 = true; - switch (triggerConditionList.get(2).getTriggerLogic()) { - case TriggerLogicConstants.AND: - judgetCondition3 = true; - break; - case TriggerLogicConstants.OR: - judgetCondition3 = false; - break; - } - if (judgetCondition3) { - boolean condition3 = judgeTriggerCondition(triggerConditionList.get(2), patientAllInfo, labelFieldContentList); - if (condition3) { - // 3成立,则生成任务 - generateTask = true; - } - } - } - } else { - // 条件2不成立,判断2、3的逻辑连接符,or:判断3,and:不判断3 - if (triggerConditionList.size() > 2) { - boolean judgetCondition3 = false; - switch (triggerConditionList.get(2).getTriggerLogic()) { - case TriggerLogicConstants.AND: - judgetCondition3 = false; - break; - case TriggerLogicConstants.OR: - judgetCondition3 = true; - break; - } - if (judgetCondition3) { - boolean condition3 = judgeTriggerCondition(triggerConditionList.get(2), patientAllInfo, labelFieldContentList); - if (condition3) { - // 3成立,则生成任务 - generateTask = true; - } - } + if (triggerConditionList.size() > 2) { // 有3个条件 + boolean condition3 = judgeTriggerCondition(triggerConditionList.get(2), patientAllInfo, labelFieldContentList); + switch (triggerConditionList.get(2).getTriggerLogic()) { + case TriggerLogicConstants.AND: + generateTask = condition2 && condition3; + break; + case TriggerLogicConstants.OR: + generateTask = condition2 || condition3; + break; + default: + generateTask = condition2 && condition3; + break; } + } else { // 有两个条件 + generateTask = condition2; } } else { // 只有1个条件且成立,生成任务 @@ -750,6 +728,14 @@ public class SignPatientManageRouteNodeServiceImpl implements ISignPatientManage } if (generateTask) { // 保存sign_patient_manage_route表 + SignPatientManageRoute manageRouteQuery = new SignPatientManageRoute(); + manageRouteQuery.setSignPatientRecordId(signPatientRecordId); + manageRouteQuery.setTaskCreateType(TaskCreateTypeConstant.MANUAL_MATCHE); + List mainRouteList = signRouteMapper.selectSignPatientManageRouteList(manageRouteQuery); + if (CollectionUtils.isEmpty(mainRouteList)) { + throw new ServiceException("未找到签约管理路径"); + } + SignPatientManageRoute mainManageRoute = mainRouteList.get(0); SpecialDiseaseRoute specialDiseaseRoute = specialDiseaseRouteMapper.selectSpecialDiseaseRouteById(specialDiseaseRouteId); SignPatientManageRoute signPatientManageRoute = new SignPatientManageRoute(); BeanUtils.copyBeanProp(signPatientManageRoute, specialDiseaseRoute); @@ -758,6 +744,7 @@ public class SignPatientManageRouteNodeServiceImpl implements ISignPatientManage signPatientManageRoute.setId(null); signPatientManageRoute.setRouteId(specialDiseaseRoute.getId()); signPatientManageRoute.setTaskCreateType(TaskCreateTypeConstant.MANUAL_MATCHE); + signPatientManageRoute.setParentRouteId(mainManageRoute.getId()); signPatientManageRoute.setCreateTime(LocalDateTime.now()); signPatientManageRoute.setCreateBy(SecurityUtils.getLoginUser().getUser().getNickName()); signRouteMapper.insertSignPatientManageRoute(signPatientManageRoute);