子路径任务生成修改。

This commit is contained in:
haown 2024-06-28 14:31:32 +08:00
parent 7c58b736e0
commit ebc631c253
2 changed files with 39 additions and 44 deletions

View File

@ -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);
}

View File

@ -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成立继续判断条件23
if (triggerConditionList.size() > 1) {
boolean condition2 = judgeTriggerCondition(triggerConditionList.get(1), patientAllInfo, labelFieldContentList);
if (condition2) {
// 条件2成立判断23的逻辑连接符or则不判断3and需要判断3
if (triggerConditionList.size() > 2) {
boolean judgetCondition3 = true;
if (triggerConditionList.size() > 2) { // 有3个条件
boolean condition3 = judgeTriggerCondition(triggerConditionList.get(2), patientAllInfo, labelFieldContentList);
switch (triggerConditionList.get(2).getTriggerLogic()) {
case TriggerLogicConstants.AND:
judgetCondition3 = true;
generateTask = condition2 && condition3;
break;
case TriggerLogicConstants.OR:
judgetCondition3 = false;
generateTask = condition2 || condition3;
break;
default:
generateTask = condition2 && condition3;
break;
}
if (judgetCondition3) {
boolean condition3 = judgeTriggerCondition(triggerConditionList.get(2), patientAllInfo, labelFieldContentList);
if (condition3) {
// 3成立则生成任务
generateTask = true;
}
}
}
} else {
// 条件2不成立判断23的逻辑连接符or判断3and不判断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;
}
}
}
} 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<SignPatientManageRoute> 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);