From 7c58b736e0c9eb32dfe15e7ec47af5892b25c858 Mon Sep 17 00:00:00 2001 From: haown <454902499@qq.com> Date: Fri, 28 Jun 2024 14:12:08 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A0=B9=E6=8D=AE=E8=A7=A6=E5=8F=91=E6=9D=A1?= =?UTF-8?q?=E4=BB=B6=E7=94=9F=E6=88=90=E5=AD=90=E8=B7=AF=E5=BE=84=E4=BB=BB?= =?UTF-8?q?=E5=8A=A1=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../TriggerConditionOperatorConstants.java | 59 ++++ .../constant/TriggerLogicConstants.java | 19 ++ .../patientinfo/PatientAllInfoView.java | 6 + .../SignRouteTriggerCondition.java | 4 +- .../SpecialDiseaseTriggerCondition.java | 6 +- .../impl/LabelFieldContentServiceImpl.java | 2 + .../SignPatientManageRouteServiceImpl.java | 2 - ...SignPatientManageRouteNodeServiceImpl.java | 288 ++++++++++++++---- .../impl/SignPatientRecordServiceImpl.java | 3 +- ...ialDiseaseTriggerConditionServiceImpl.java | 2 + .../labelfieldcontent/PatientPortaitVo.java | 13 - .../patientinfo/PatientAllInfoViewMapper.xml | 6 +- 12 files changed, 325 insertions(+), 85 deletions(-) create mode 100644 postdischarge-common/src/main/java/com/xinelu/common/constant/TriggerConditionOperatorConstants.java create mode 100644 postdischarge-common/src/main/java/com/xinelu/common/constant/TriggerLogicConstants.java delete mode 100644 postdischarge-manage/src/main/java/com/xinelu/manage/vo/labelfieldcontent/PatientPortaitVo.java diff --git a/postdischarge-common/src/main/java/com/xinelu/common/constant/TriggerConditionOperatorConstants.java b/postdischarge-common/src/main/java/com/xinelu/common/constant/TriggerConditionOperatorConstants.java new file mode 100644 index 00000000..1acbcc44 --- /dev/null +++ b/postdischarge-common/src/main/java/com/xinelu/common/constant/TriggerConditionOperatorConstants.java @@ -0,0 +1,59 @@ +package com.xinelu.common.constant; + +/** + * @description: 触发条件运算符常量 + * @author: haown + * @create: 2024-06-28 09:46 + **/ +public class TriggerConditionOperatorConstants { + /** + * 包含 + */ + public static final String CONTAIN = "CONTAIN"; + + /** + * 不包含 + */ + public static final String NOT_CONTAIN = "NOT_CONTAIN"; + + /** + * 等于 + */ + public static final String EQUAL_TO = "EQUAL_TO"; + + /** + * 不等于 + */ + public static final String NOT_EQUAL_TO = "NOT_EQUAL_TO"; + + /** + * = + */ + public static final String EQUAL= "="; + + /** + * ≠ + */ + public static final String NOT_EQUAL= "≠"; + + /** + * ≥ + */ + public static final String GREATER_THAN_OR_EQUAL= "≥"; + + /** + * > + */ + public static final String GREATER_THAN= ">"; + + /** + * < + */ + public static final String LESS_THAN= "<"; + + /** + * ≤ + */ + public static final String LESS_THAN_OR_EQUAL= "≤"; + +} diff --git a/postdischarge-common/src/main/java/com/xinelu/common/constant/TriggerLogicConstants.java b/postdischarge-common/src/main/java/com/xinelu/common/constant/TriggerLogicConstants.java new file mode 100644 index 00000000..59366ccf --- /dev/null +++ b/postdischarge-common/src/main/java/com/xinelu/common/constant/TriggerLogicConstants.java @@ -0,0 +1,19 @@ +package com.xinelu.common.constant; + +/** + * @description: 条件连接符常量 + * @author: haown + * @create: 2024-06-28 10:50 + **/ +public class TriggerLogicConstants { + /** + * AND + */ + public static final String AND= "AND"; + + /** + * OR + */ + public static final String OR= "OR"; + +} diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/domain/patientinfo/PatientAllInfoView.java b/postdischarge-manage/src/main/java/com/xinelu/manage/domain/patientinfo/PatientAllInfoView.java index 9fdf360e..9a7d7dab 100644 --- a/postdischarge-manage/src/main/java/com/xinelu/manage/domain/patientinfo/PatientAllInfoView.java +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/domain/patientinfo/PatientAllInfoView.java @@ -87,6 +87,12 @@ public class PatientAllInfoView { @Excel(name = "就诊时间,格式:yyyy-MM-dd HH:mm:ss", width = 30, dateFormat = "yyyy-MM-dd") private LocalDateTime visitDate; + /** + * 所属医院id + */ + @ApiModelProperty(value = "所属医院id") + private Long hospitalAgencyId; + /** 所属医院名称 */ @ApiModelProperty(value = "所属医院名称") @Excel(name = "所属医院名称") diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/domain/signroutetriggercondition/SignRouteTriggerCondition.java b/postdischarge-manage/src/main/java/com/xinelu/manage/domain/signroutetriggercondition/SignRouteTriggerCondition.java index fa449bde..7b1f60a1 100644 --- a/postdischarge-manage/src/main/java/com/xinelu/manage/domain/signroutetriggercondition/SignRouteTriggerCondition.java +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/domain/signroutetriggercondition/SignRouteTriggerCondition.java @@ -43,8 +43,8 @@ public class SignRouteTriggerCondition extends BaseEntity { private String triggerConditionCode; /** 触发条件名称,诊断:DIAGNOSIS,换药日期:DRESSING_CHANGE_DATE,治疗方式:TREATMENT_METHOD,手术名称:SURGICAL_NAME,药品名称:DRUG_NAME */ - @ApiModelProperty(value = "触发条件名称,诊断:DIAGNOSIS,换药日期:DRESSING_CHANGE_DATE,治疗方式:TREATMENT_METHOD,手术名称:SURGICAL_NAME,药品名称:DRUG_NAME") - @Excel(name = "触发条件名称,诊断:DIAGNOSIS,换药日期:DRESSING_CHANGE_DATE,治疗方式:TREATMENT_METHOD,手术名称:SURGICAL_NAME,药品名称:DRUG_NAME") + @ApiModelProperty(value = "触发条件名称,诊断:MAIN_DIAGNOSIS,换药日期:DRESSING_CHANGE_DATE,治疗方式:TREATMENT_METHOD,手术名称:SURGICAL_NAME,药品名称:DRUG_NAME") + @Excel(name = "触发条件名称,诊断:MAIN_DIAGNOSIS,换药日期:DRESSING_CHANGE_DATE,治疗方式:TREATMENT_METHOD,手术名称:SURGICAL_NAME,药品名称:DRUG_NAME") private String triggerConditionName; /** 触发条件运算符,包含:CONTAIN,不包含:NOT_CONTAIN,等于:EQUAL_TO,不等于:NOT_EQUAL_TO */ diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/domain/specialdiseasetriggercondition/SpecialDiseaseTriggerCondition.java b/postdischarge-manage/src/main/java/com/xinelu/manage/domain/specialdiseasetriggercondition/SpecialDiseaseTriggerCondition.java index 26ecf6f8..c6d78997 100644 --- a/postdischarge-manage/src/main/java/com/xinelu/manage/domain/specialdiseasetriggercondition/SpecialDiseaseTriggerCondition.java +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/domain/specialdiseasetriggercondition/SpecialDiseaseTriggerCondition.java @@ -52,10 +52,10 @@ public class SpecialDiseaseTriggerCondition extends BaseEntity { private String triggerConditionCode; /** - * 触发条件名称,诊断:DIAGNOSIS,换药日期:DRESSING_CHANGE_DATE,治疗方式:TREATMENT_METHOD,手术名称:SURGICAL_NAME,药品名称:DRUG_NAME + * 触发条件名称,诊断:MAIN_DIAGNOSIS,换药日期:DRESSING_CHANGE_DATE,治疗方式:TREATMENT_METHOD,手术名称:SURGICAL_NAME,药品名称:DRUG_NAME */ - @ApiModelProperty(value = "触发条件名称,诊断:DIAGNOSIS,换药日期:DRESSING_CHANGE_DATE,治疗方式:TREATMENT_METHOD,手术名称:SURGICAL_NAME,药品名称:DRUG_NAME") - @Excel(name = "触发条件名称,诊断:DIAGNOSIS,换药日期:DRESSING_CHANGE_DATE,治疗方式:TREATMENT_METHOD,手术名称:SURGICAL_NAME,药品名称:DRUG_NAME") + @ApiModelProperty(value = "触发条件名称,诊断:MAIN_DIAGNOSIS,换药日期:DRESSING_CHANGE_DATE,治疗方式:TREATMENT_METHOD,手术名称:SURGICAL_NAME,药品名称:DRUG_NAME") + @Excel(name = "触发条件名称,诊断:MAIN_DIAGNOSIS,换药日期:DRESSING_CHANGE_DATE,治疗方式:TREATMENT_METHOD,手术名称:SURGICAL_NAME,药品名称:DRUG_NAME") private String triggerConditionName; /** 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 4da08ece..48c6beef 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 @@ -269,11 +269,13 @@ public class LabelFieldContentServiceImpl implements ILabelFieldContentService { if (Objects.isNull(groupingValue.getLabelFieldContentId())) { groupingValue.setCreateBy(SecurityUtils.getUsername()); groupingValue.setCreateTime(LocalDateTime.now()); + groupingValue.setPortraitStatus(PortraitStatusEnum.INUSE.getInfo()); insertGroupingValues.add(groupingValue); } if (Objects.nonNull(groupingValue.getLabelFieldContentId())) { groupingValue.setCreateTime(LocalDateTime.now()); groupingValue.setCreateBy(SecurityUtils.getUsername()); + groupingValue.setPortraitStatus(PortraitStatusEnum.INUSE.getInfo()); updateGroupingValues.add(groupingValue); } } 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 d5d9e594..e54fb64b 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 @@ -821,8 +821,6 @@ public class SignPatientManageRouteServiceImpl implements ISignPatientManageRout manageNode.setNodeContent(document.body().html()); manageNodeList.add(manageNode); } - } else { - throw new ServiceException("请维护该患者【"+node.getTaskPartitionDictName()+ "】的画像信息"); } return manageNodeList; 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 55001df9..04c4f8df 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 @@ -7,6 +7,8 @@ import com.xinelu.common.constant.RouteNodeNameConstants; import com.xinelu.common.constant.TaskContentConstants; import com.xinelu.common.constant.TaskCreateTypeConstant; import com.xinelu.common.constant.TemplateTypeConstants; +import com.xinelu.common.constant.TriggerConditionOperatorConstants; +import com.xinelu.common.constant.TriggerLogicConstants; import com.xinelu.common.constant.VisitMethodConstants; import com.xinelu.common.enums.NodeExecuteStatusEnum; import com.xinelu.common.enums.RouteCheckStatusEnum; @@ -14,6 +16,7 @@ import com.xinelu.common.exception.ServiceException; import com.xinelu.common.utils.SecurityUtils; import com.xinelu.common.utils.StringUtils; import com.xinelu.common.utils.bean.BeanUtils; +import com.xinelu.manage.domain.patientinfo.PatientAllInfoViewUppercase; import com.xinelu.manage.domain.patientinfo.PatientInfo; import com.xinelu.manage.domain.patientnodeparamscurrent.PatientNodeParamsCurrent; import com.xinelu.manage.domain.patientvisitrecord.PatientVisitRecord; @@ -22,6 +25,7 @@ import com.xinelu.manage.domain.signpatientmanageroute.SignPatientManageRoute; import com.xinelu.manage.domain.signpatientmanageroutenode.SignPatientManageRouteNode; import com.xinelu.manage.domain.signpatientrecord.SignPatientRecord; import com.xinelu.manage.domain.specialdiseasenode.SpecialDiseaseNode; +import com.xinelu.manage.domain.specialdiseaseroute.SpecialDiseaseRoute; import com.xinelu.manage.domain.specialdiseasetriggercondition.SpecialDiseaseTriggerCondition; import com.xinelu.manage.domain.textmessage.TextMessage; import com.xinelu.manage.domain.wechattemplate.WechatTemplate; @@ -31,6 +35,7 @@ import com.xinelu.manage.dto.signpatientmanageroutenode.PatientTaskDto; import com.xinelu.manage.dto.signpatientmanageroutenode.RouteNodeCheckDto; import com.xinelu.manage.dto.signpatientmanageroutenode.SignPatientManageRouteNodeDto; import com.xinelu.manage.mapper.labelfieldcontent.LabelFieldContentMapper; +import com.xinelu.manage.mapper.patientinfo.PatientAllInfoViewMapper; import com.xinelu.manage.mapper.patientinfo.PatientInfoMapper; import com.xinelu.manage.mapper.patientvisitrecord.PatientVisitRecordMapper; import com.xinelu.manage.mapper.scriptInfo.ScriptInfoMapper; @@ -38,6 +43,7 @@ import com.xinelu.manage.mapper.signpatientmanageroute.SignPatientManageRouteMap import com.xinelu.manage.mapper.signpatientmanageroutenode.SignPatientManageRouteNodeMapper; import com.xinelu.manage.mapper.signpatientrecord.SignPatientRecordMapper; import com.xinelu.manage.mapper.specialdiseasenode.SpecialDiseaseNodeMapper; +import com.xinelu.manage.mapper.specialdiseaseroute.SpecialDiseaseRouteMapper; import com.xinelu.manage.mapper.specialdiseasetriggercondition.SpecialDiseaseTriggerConditionMapper; import com.xinelu.manage.mapper.textmessage.TextMessageMapper; import com.xinelu.manage.mapper.wechattemplate.WechatTemplateMapper; @@ -56,6 +62,8 @@ import com.xinelu.manage.vo.signpatientmanageroutenode.SignPatientManageRouteNod import com.xinelu.manage.vo.signpatientmanageroutenode.SignPatientManageRouteNodeVo; import com.xinelu.manage.vo.specialdiseasenode.PatientSpecialDiseaseNodeVo; import com.xinelu.manage.vo.specialdiseaseroute.SpecialDiseaseRouteVO; +import java.lang.reflect.Field; +import java.math.BigDecimal; import java.time.LocalDateTime; import java.time.LocalTime; import java.util.ArrayList; @@ -113,6 +121,10 @@ public class SignPatientManageRouteNodeServiceImpl implements ISignPatientManage private LabelFieldContentMapper labelFieldContentMapper; @Resource private WechatTemplateMapper wechatTemplateMapper; + @Resource + private PatientAllInfoViewMapper patientAllInfoViewMapper; + @Resource + private SpecialDiseaseRouteMapper specialDiseaseRouteMapper; /** * 查询签约患者管理任务路径节点 @@ -596,7 +608,7 @@ public class SignPatientManageRouteNodeServiceImpl implements ISignPatientManage } @Override public void generateMainRouteTask(Long signRecordId) { - List nodeSaveList = new ArrayList<>(); + // 查询专病路径节点和手动创建的任务节点 SignPatientRecord signPatientRecord = signPatientRecordMapper.selectByPrimaryKey(signRecordId); if (ObjectUtils.isEmpty(signPatientRecord)) { @@ -610,12 +622,163 @@ public class SignPatientManageRouteNodeServiceImpl implements ISignPatientManage throw new ServiceException("未找到签约管理路径"); } SignPatientManageRoute signPatientManageRoute = manageRouteList.get(0); + generateByManageRoute(signPatientManageRoute, signPatientRecord.getPatientId()); + } + + @Override + public void manualCreateTaskLabelReplace(Long signRecordId) { + SignPatientManageRoute manageRouteQuery = new SignPatientManageRoute(); + manageRouteQuery.setSignPatientRecordId(signRecordId); + manageRouteQuery.setTaskCreateType(TaskCreateTypeConstant.MANUAL_CREATE); + List manageRouteList = signRouteMapper.selectSignPatientManageRouteList(manageRouteQuery); + if (CollectionUtils.isNotEmpty(manageRouteList)) { + // 查询患者画像信息 + List labelFieldContentList = labelFieldContentMapper.selectByPatientId(manageRouteList.get(0).getPatientId()); + if (CollectionUtils.isEmpty(labelFieldContentList)) { + throw new ServiceException("请先维护画像信息"); + } + List manageRouteIds = manageRouteList.stream().map(SignPatientManageRoute::getId).collect(Collectors.toList()); + List manageNodeList = signPatientManageRouteNodeMapper.selectNodesByManageIds(manageRouteIds); + // 根据node去替换模板信息 + manageNodeList.forEach(manageNode -> { + switch(manageNode.getTaskType()) { + // 电话外呼--话术 + case TaskContentConstants.PHONE_OUTBOUND: + ScriptInfo scriptInfo = scriptInfoMapper.selectScriptInfoById(manageNode.getPhoneId()); + if (ObjectUtils.isNotEmpty(scriptInfo)) { + // 话术库json内容替换 + manageNode.setPhoneNodeContent(getFlowScheme(scriptInfo.getFlowScheme(), labelFieldContentList)); + + // 电话短信内容 + if (manageNode.getPhoneMessageTemplateId() != null) { + // 查询短信库 + manageNode.setPhoneMessageTemplateContent(replaceMessageInfo(manageNode.getPhoneMessageTemplateId(), labelFieldContentList)); + } + } + break; + // 问卷 + case TaskContentConstants.QUESTIONNAIRE_SCALE: + // 宣教 + case TaskContentConstants.PROPAGANDA_ARTICLE: + // 文字提醒 + case TaskContentConstants.TEXT_REMIND: + // 人工随访 + case TaskContentConstants.ARTIFICIAL_FOLLOW_UP: + break; + } + signPatientManageRouteNodeMapper.updateSignPatientManageRouteNode(manageNode); + }); + } + } + + /** + * 生成子路径任务 + * @param patientId 患者主键 + * @param signPatientRecordId 签约记录主键 + * @param specialDiseaseRouteId 专病管理路径路径id + */ + @Transactional(rollbackFor = Exception.class) + public void generateChildRouteTask(Long patientId, Long signPatientRecordId, Long specialDiseaseRouteId) { + boolean generateTask = false; + // 查询患者信息 + PatientAllInfoViewUppercase patientAllInfo = null; + List patientAllInfoViewList = patientAllInfoViewMapper.selectPatientAllInfoListViewByPatientId(patientId); + if (CollectionUtils.isNotEmpty(patientAllInfoViewList)) { + patientAllInfo = patientAllInfoViewList.get(0); + } + + // 查询画像信息 + List labelFieldContentList = labelFieldContentMapper.selectByPatientId(patientId); + + // 查询子路径触发条件 + SpecialDiseaseTriggerCondition triggerConditionQuery = new SpecialDiseaseTriggerCondition(); + triggerConditionQuery.setRouteId(specialDiseaseRouteId); + List triggerConditionList = triggerConditionMapper.selectSpecialDiseaseTriggerConditionList(triggerConditionQuery); + // 判断触发条件是否成立 + if (CollectionUtils.isNotEmpty(triggerConditionList)) { + boolean condition1 = judgeTriggerCondition(triggerConditionList.get(0), patientAllInfo, labelFieldContentList); + if (condition1) { + // 条件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; + } + } + } + } + } else { + // 只有1个条件且成立,生成任务 + generateTask = true; + } + } + } + if (generateTask) { + // 保存sign_patient_manage_route表 + SpecialDiseaseRoute specialDiseaseRoute = specialDiseaseRouteMapper.selectSpecialDiseaseRouteById(specialDiseaseRouteId); + SignPatientManageRoute signPatientManageRoute = new SignPatientManageRoute(); + BeanUtils.copyBeanProp(signPatientManageRoute, specialDiseaseRoute); + signPatientManageRoute.setSignPatientRecordId(signPatientRecordId); + signPatientManageRoute.setPatientId(patientId); + signPatientManageRoute.setId(null); + signPatientManageRoute.setRouteId(specialDiseaseRoute.getId()); + signPatientManageRoute.setTaskCreateType(TaskCreateTypeConstant.MANUAL_MATCHE); + signPatientManageRoute.setCreateTime(LocalDateTime.now()); + signPatientManageRoute.setCreateBy(SecurityUtils.getLoginUser().getUser().getNickName()); + signRouteMapper.insertSignPatientManageRoute(signPatientManageRoute); + // 保存任务 + generateByManageRoute(signPatientManageRoute, patientId); + } + } + + /** + * 根据管理路径生成任务 + * @param signPatientManageRoute 签约管理路径 + * @param patientId 患者主键 + */ + private void generateByManageRoute(SignPatientManageRoute signPatientManageRoute, Long patientId) { + List nodeSaveList = new ArrayList<>(); // 查询路径节点 SpecialDiseaseNode specialDiseaseNodeQuery = new SpecialDiseaseNode(); specialDiseaseNodeQuery.setRouteId(signPatientManageRoute.getRouteId()); List nodeList = specialDiseaseNodeMapper.selectSpecialDiseaseNodeList(specialDiseaseNodeQuery); // 查询患者画像信息 - List labelFieldContentList = labelFieldContentMapper.selectByPatientId(signPatientRecord.getPatientId()); + List labelFieldContentList = labelFieldContentMapper.selectByPatientId(patientId); if (CollectionUtils.isEmpty(labelFieldContentList)) { throw new ServiceException("请先维护画像信息"); } @@ -675,66 +838,6 @@ public class SignPatientManageRouteNodeServiceImpl implements ISignPatientManage }); } - @Override - public void manualCreateTaskLabelReplace(Long signRecordId) { - SignPatientManageRoute manageRouteQuery = new SignPatientManageRoute(); - manageRouteQuery.setSignPatientRecordId(signRecordId); - manageRouteQuery.setTaskCreateType(TaskCreateTypeConstant.MANUAL_CREATE); - List manageRouteList = signRouteMapper.selectSignPatientManageRouteList(manageRouteQuery); - if (CollectionUtils.isNotEmpty(manageRouteList)) { - // 查询患者画像信息 - List labelFieldContentList = labelFieldContentMapper.selectByPatientId(manageRouteList.get(0).getPatientId()); - if (CollectionUtils.isEmpty(labelFieldContentList)) { - throw new ServiceException("请先维护画像信息"); - } - List manageRouteIds = manageRouteList.stream().map(SignPatientManageRoute::getId).collect(Collectors.toList()); - List manageNodeList = signPatientManageRouteNodeMapper.selectNodesByManageIds(manageRouteIds); - // 根据node去替换模板信息 - manageNodeList.forEach(manageNode -> { - switch(manageNode.getTaskType()) { - // 电话外呼--话术 - case TaskContentConstants.PHONE_OUTBOUND: - ScriptInfo scriptInfo = scriptInfoMapper.selectScriptInfoById(manageNode.getPhoneId()); - if (ObjectUtils.isNotEmpty(scriptInfo)) { - // 话术库json内容替换 - manageNode.setPhoneNodeContent(getFlowScheme(scriptInfo.getFlowScheme(), labelFieldContentList)); - - // 电话短信内容 - if (manageNode.getPhoneMessageTemplateId() != null) { - // 查询短信库 - manageNode.setPhoneMessageTemplateContent(replaceMessageInfo(manageNode.getPhoneMessageTemplateId(), labelFieldContentList)); - } - } - break; - // 问卷 - case TaskContentConstants.QUESTIONNAIRE_SCALE: - // 宣教 - case TaskContentConstants.PROPAGANDA_ARTICLE: - // 文字提醒 - case TaskContentConstants.TEXT_REMIND: - // 人工随访 - case TaskContentConstants.ARTIFICIAL_FOLLOW_UP: - break; - } - signPatientManageRouteNodeMapper.updateSignPatientManageRouteNode(manageNode); - }); - } - } - - /** - * 生成子路径任务 - * @param patientId 患者主键 - * @param routeId 子路径id - * @param routeNodeId 节点id - */ - private void generateChildRouteTask(Long patientId, Long routeId, Long routeNodeId) { - - // 查询子路径触发条件 - SpecialDiseaseTriggerCondition triggerConditionQuery = new SpecialDiseaseTriggerCondition(); - triggerConditionQuery.setRouteId(routeId); - List triggerConditionList = triggerConditionMapper.selectSpecialDiseaseTriggerConditionList(triggerConditionQuery); - - } private String replaceNodeContent(String nodeContent, List paramsList) { Map map = paramsList.stream().collect(Collectors.toMap(PatientNodeParamsCurrent::getParamKey,PatientNodeParamsCurrent::getParamValue,(key1,key2)->key2)); Document document = Jsoup.parse(nodeContent); @@ -874,4 +977,65 @@ public class SignPatientManageRouteNodeServiceImpl implements ISignPatientManage return manageNodeList; } + + private boolean judgeTriggerCondition(SpecialDiseaseTriggerCondition triggerCondition, PatientAllInfoViewUppercase patientAllInfo, List labelFieldContentList) { + List labelValueList = new ArrayList<>(); + if (ObjectUtils.isNotEmpty(patientAllInfo)) { + try { + Class clazz = patientAllInfo.getClass(); + Field field = clazz.getDeclaredField(triggerCondition.getTriggerConditionCode()); + field.setAccessible(true); + // 获取字段的值 + Object value = field.get(patientAllInfo); + if (ObjectUtils.isNotEmpty(value)) { + labelValueList.add(String.valueOf(value)); + } + } catch (NoSuchFieldException | IllegalAccessException e) { + throw new RuntimeException(e); + } + } + + // 查询画像中的信息 + if (CollectionUtils.isNotEmpty(labelFieldContentList)) { + labelValueList.addAll(labelFieldContentList.stream() + .filter(content -> StringUtils.equals(content.getFieldCode(), triggerCondition.getTriggerConditionCode())) + .map(LabelFieldInfoContentVo::getFieldValue) + .collect(Collectors.toList())); + } + + boolean retBoolean = false; + if (CollectionUtils.isNotEmpty(labelValueList)) { + switch (triggerCondition.getTriggerConditionOperator()) { + case (TriggerConditionOperatorConstants.CONTAIN): + // 判断labelValue中的内容是否包含triggerConditionValue + retBoolean = labelValueList.stream().anyMatch(labelValue -> StringUtils.containsIgnoreCase(labelValue, triggerCondition.getTriggerConditionValue())); + break; + case (TriggerConditionOperatorConstants.NOT_CONTAIN): + retBoolean = labelValueList.stream().anyMatch(labelValue -> !StringUtils.containsIgnoreCase(labelValue, triggerCondition.getTriggerConditionValue())); + break; + case (TriggerConditionOperatorConstants.EQUAL_TO): + case (TriggerConditionOperatorConstants.EQUAL): + retBoolean = labelValueList.stream().anyMatch(labelValue -> StringUtils.equalsIgnoreCase(labelValue, triggerCondition.getTriggerConditionValue())); + break; + case (TriggerConditionOperatorConstants.NOT_EQUAL_TO): + case (TriggerConditionOperatorConstants.NOT_EQUAL): + retBoolean = labelValueList.stream().anyMatch(labelValue -> !StringUtils.equalsIgnoreCase(labelValue, triggerCondition.getTriggerConditionValue())); + break; + + case (TriggerConditionOperatorConstants.GREATER_THAN_OR_EQUAL): + retBoolean = labelValueList.stream().anyMatch(labelValue -> new BigDecimal(labelValue).compareTo(new BigDecimal(triggerCondition.getTriggerConditionValue())) >= 0); + break; + case (TriggerConditionOperatorConstants.GREATER_THAN): + retBoolean = labelValueList.stream().anyMatch(labelValue -> new BigDecimal(labelValue).compareTo(new BigDecimal(triggerCondition.getTriggerConditionValue())) > 0); + break; + case (TriggerConditionOperatorConstants.LESS_THAN): + retBoolean = labelValueList.stream().anyMatch(labelValue -> new BigDecimal(labelValue).compareTo(new BigDecimal(triggerCondition.getTriggerConditionValue())) < 0); + break; + case (TriggerConditionOperatorConstants.LESS_THAN_OR_EQUAL): + retBoolean = labelValueList.stream().anyMatch(labelValue -> new BigDecimal(labelValue).compareTo(new BigDecimal(triggerCondition.getTriggerConditionValue())) <= 0); + break; + } + } + return retBoolean; + } } diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/service/signpatientrecord/impl/SignPatientRecordServiceImpl.java b/postdischarge-manage/src/main/java/com/xinelu/manage/service/signpatientrecord/impl/SignPatientRecordServiceImpl.java index 9809caa7..fb085572 100644 --- a/postdischarge-manage/src/main/java/com/xinelu/manage/service/signpatientrecord/impl/SignPatientRecordServiceImpl.java +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/service/signpatientrecord/impl/SignPatientRecordServiceImpl.java @@ -188,8 +188,7 @@ public class SignPatientRecordServiceImpl implements ISignPatientRecordService { if (ObjectUtils.isEmpty(body.getRoute()) || body.getRoute().getRouteId() == null) { throw new ServiceException("请选择管理路径"); } - // 保存管理路径 - // 查询主路径及子路径列表 + // 保存管理路径主路径 SignPatientManageRoute signPatientManageRoute = body.getRoute(); List specialDiseaseRouteList = specialDiseaseRouteMapper.selectRouteAndChildren(signPatientManageRoute.getRouteId()); specialDiseaseRouteList.forEach(specialDiseaseRoute -> { diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/service/specialdiseasetriggercondition/impl/SpecialDiseaseTriggerConditionServiceImpl.java b/postdischarge-manage/src/main/java/com/xinelu/manage/service/specialdiseasetriggercondition/impl/SpecialDiseaseTriggerConditionServiceImpl.java index 2936b2d9..50bca686 100644 --- a/postdischarge-manage/src/main/java/com/xinelu/manage/service/specialdiseasetriggercondition/impl/SpecialDiseaseTriggerConditionServiceImpl.java +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/service/specialdiseasetriggercondition/impl/SpecialDiseaseTriggerConditionServiceImpl.java @@ -94,6 +94,7 @@ public class SpecialDiseaseTriggerConditionServiceImpl implements ISpecialDiseas if (StringUtils.isBlank(item.getTriggerConditionName()) || StringUtils.isBlank(item.getTriggerConditionOperator()) || StringUtils.isBlank(item.getTriggerConditionValue())) { throw new ServiceException("请选择完整的触发条件"); } + item.setTriggerConditionOperator(item.getTriggerConditionOperator().replace(">", ">").replace("<", "<")); }); // 保存子路径 specialDiseaseRoute.setCreateTime(LocalDateTime.now()); @@ -157,6 +158,7 @@ public class SpecialDiseaseTriggerConditionServiceImpl implements ISpecialDiseas if (StringUtils.isBlank(item.getTriggerConditionName()) || StringUtils.isBlank(item.getTriggerConditionOperator()) || StringUtils.isBlank(item.getTriggerConditionValue())) { throw new ServiceException("请选择完整的触发条件"); } + item.setTriggerConditionOperator(item.getTriggerConditionOperator().replace(">", ">").replace("<", "<")); }); // 修改子路径路径名称 SpecialDiseaseRoute specialDiseaseRoute = new SpecialDiseaseRoute(); diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/vo/labelfieldcontent/PatientPortaitVo.java b/postdischarge-manage/src/main/java/com/xinelu/manage/vo/labelfieldcontent/PatientPortaitVo.java deleted file mode 100644 index eb464372..00000000 --- a/postdischarge-manage/src/main/java/com/xinelu/manage/vo/labelfieldcontent/PatientPortaitVo.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.xinelu.manage.vo.labelfieldcontent; - -import java.util.List; -import java.util.Map; - -/** - * @description: 画像审核返回视图类 - * @author: haown - * @create: 2024-06-27 15:01 - **/ -public class PatientPortaitVo { - Map>> portaitInfo; -} diff --git a/postdischarge-manage/src/main/resources/mapper/manage/patientinfo/PatientAllInfoViewMapper.xml b/postdischarge-manage/src/main/resources/mapper/manage/patientinfo/PatientAllInfoViewMapper.xml index f95ac747..a4c08850 100644 --- a/postdischarge-manage/src/main/resources/mapper/manage/patientinfo/PatientAllInfoViewMapper.xml +++ b/postdischarge-manage/src/main/resources/mapper/manage/patientinfo/PatientAllInfoViewMapper.xml @@ -17,6 +17,7 @@ + @@ -50,7 +51,7 @@ - select patient_id, patient_name, patient_phone, family_member_phone, birth_date, card_no, sex, address, patient_type, patient_visit_record_id, visit_method, visit_date, hospital_agency_name, campus_agency_name, department_name, ward_name, attending_physician_name, main_diagnosis, admission_time, discharge_time, hospitalization_days, in_hospital_info, out_hospital_info, visit_serial_number, in_hospital_number, responsible_nurse, surgical_name, surgical_record, sign_patient_record_id, payment_status, health_manage_name, service_status, sign_status, billing_doctor_name, sign_time, package_name, package_payment_status, package_price, service_start_time, service_end_time, package_term, package_term_unit from patient_all_info_view + select patient_id, patient_name, patient_phone, family_member_phone, birth_date, card_no, sex, address, patient_type, patient_visit_record_id, visit_method, visit_date, hospital_agency_id, hospital_agency_name, campus_agency_name, department_name, ward_name, attending_physician_name, main_diagnosis, admission_time, discharge_time, hospitalization_days, in_hospital_info, out_hospital_info, visit_serial_number, in_hospital_number, responsible_nurse, surgical_name, surgical_record, sign_patient_record_id, payment_status, health_manage_name, service_status, sign_status, billing_doctor_name, sign_time, package_name, package_payment_status, package_price, service_start_time, service_end_time, package_term, package_term_unit from patient_all_info_view