根据触发条件生成子路径任务。
This commit is contained in:
parent
64b23966ef
commit
7c58b736e0
@ -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= "≤";
|
||||||
|
|
||||||
|
}
|
||||||
@ -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";
|
||||||
|
|
||||||
|
}
|
||||||
@ -87,6 +87,12 @@ public class PatientAllInfoView {
|
|||||||
@Excel(name = "就诊时间,格式:yyyy-MM-dd HH:mm:ss", width = 30, dateFormat = "yyyy-MM-dd")
|
@Excel(name = "就诊时间,格式:yyyy-MM-dd HH:mm:ss", width = 30, dateFormat = "yyyy-MM-dd")
|
||||||
private LocalDateTime visitDate;
|
private LocalDateTime visitDate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 所属医院id
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "所属医院id")
|
||||||
|
private Long hospitalAgencyId;
|
||||||
|
|
||||||
/** 所属医院名称 */
|
/** 所属医院名称 */
|
||||||
@ApiModelProperty(value = "所属医院名称")
|
@ApiModelProperty(value = "所属医院名称")
|
||||||
@Excel(name = "所属医院名称")
|
@Excel(name = "所属医院名称")
|
||||||
|
|||||||
@ -43,8 +43,8 @@ public class SignRouteTriggerCondition extends BaseEntity {
|
|||||||
private String triggerConditionCode;
|
private String triggerConditionCode;
|
||||||
|
|
||||||
/** 触发条件名称,诊断:DIAGNOSIS,换药日期:DRESSING_CHANGE_DATE,治疗方式:TREATMENT_METHOD,手术名称:SURGICAL_NAME,药品名称:DRUG_NAME */
|
/** 触发条件名称,诊断:DIAGNOSIS,换药日期:DRESSING_CHANGE_DATE,治疗方式:TREATMENT_METHOD,手术名称:SURGICAL_NAME,药品名称:DRUG_NAME */
|
||||||
@ApiModelProperty(value = "触发条件名称,诊断: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 = "触发条件名称,诊断: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;
|
private String triggerConditionName;
|
||||||
|
|
||||||
/** 触发条件运算符,包含:CONTAIN,不包含:NOT_CONTAIN,等于:EQUAL_TO,不等于:NOT_EQUAL_TO */
|
/** 触发条件运算符,包含:CONTAIN,不包含:NOT_CONTAIN,等于:EQUAL_TO,不等于:NOT_EQUAL_TO */
|
||||||
|
|||||||
@ -52,10 +52,10 @@ public class SpecialDiseaseTriggerCondition extends BaseEntity {
|
|||||||
private String triggerConditionCode;
|
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")
|
@ApiModelProperty(value = "触发条件名称,诊断:MAIN_DIAGNOSIS,换药日期:DRESSING_CHANGE_DATE,治疗方式:TREATMENT_METHOD,手术名称:SURGICAL_NAME,药品名称:DRUG_NAME")
|
||||||
@Excel(name = "触发条件名称,诊断: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;
|
private String triggerConditionName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -269,11 +269,13 @@ public class LabelFieldContentServiceImpl implements ILabelFieldContentService {
|
|||||||
if (Objects.isNull(groupingValue.getLabelFieldContentId())) {
|
if (Objects.isNull(groupingValue.getLabelFieldContentId())) {
|
||||||
groupingValue.setCreateBy(SecurityUtils.getUsername());
|
groupingValue.setCreateBy(SecurityUtils.getUsername());
|
||||||
groupingValue.setCreateTime(LocalDateTime.now());
|
groupingValue.setCreateTime(LocalDateTime.now());
|
||||||
|
groupingValue.setPortraitStatus(PortraitStatusEnum.INUSE.getInfo());
|
||||||
insertGroupingValues.add(groupingValue);
|
insertGroupingValues.add(groupingValue);
|
||||||
}
|
}
|
||||||
if (Objects.nonNull(groupingValue.getLabelFieldContentId())) {
|
if (Objects.nonNull(groupingValue.getLabelFieldContentId())) {
|
||||||
groupingValue.setCreateTime(LocalDateTime.now());
|
groupingValue.setCreateTime(LocalDateTime.now());
|
||||||
groupingValue.setCreateBy(SecurityUtils.getUsername());
|
groupingValue.setCreateBy(SecurityUtils.getUsername());
|
||||||
|
groupingValue.setPortraitStatus(PortraitStatusEnum.INUSE.getInfo());
|
||||||
updateGroupingValues.add(groupingValue);
|
updateGroupingValues.add(groupingValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -821,8 +821,6 @@ public class SignPatientManageRouteServiceImpl implements ISignPatientManageRout
|
|||||||
manageNode.setNodeContent(document.body().html());
|
manageNode.setNodeContent(document.body().html());
|
||||||
manageNodeList.add(manageNode);
|
manageNodeList.add(manageNode);
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
throw new ServiceException("请维护该患者【"+node.getTaskPartitionDictName()+ "】的画像信息");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return manageNodeList;
|
return manageNodeList;
|
||||||
|
|||||||
@ -7,6 +7,8 @@ import com.xinelu.common.constant.RouteNodeNameConstants;
|
|||||||
import com.xinelu.common.constant.TaskContentConstants;
|
import com.xinelu.common.constant.TaskContentConstants;
|
||||||
import com.xinelu.common.constant.TaskCreateTypeConstant;
|
import com.xinelu.common.constant.TaskCreateTypeConstant;
|
||||||
import com.xinelu.common.constant.TemplateTypeConstants;
|
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.constant.VisitMethodConstants;
|
||||||
import com.xinelu.common.enums.NodeExecuteStatusEnum;
|
import com.xinelu.common.enums.NodeExecuteStatusEnum;
|
||||||
import com.xinelu.common.enums.RouteCheckStatusEnum;
|
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.SecurityUtils;
|
||||||
import com.xinelu.common.utils.StringUtils;
|
import com.xinelu.common.utils.StringUtils;
|
||||||
import com.xinelu.common.utils.bean.BeanUtils;
|
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.patientinfo.PatientInfo;
|
||||||
import com.xinelu.manage.domain.patientnodeparamscurrent.PatientNodeParamsCurrent;
|
import com.xinelu.manage.domain.patientnodeparamscurrent.PatientNodeParamsCurrent;
|
||||||
import com.xinelu.manage.domain.patientvisitrecord.PatientVisitRecord;
|
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.signpatientmanageroutenode.SignPatientManageRouteNode;
|
||||||
import com.xinelu.manage.domain.signpatientrecord.SignPatientRecord;
|
import com.xinelu.manage.domain.signpatientrecord.SignPatientRecord;
|
||||||
import com.xinelu.manage.domain.specialdiseasenode.SpecialDiseaseNode;
|
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.specialdiseasetriggercondition.SpecialDiseaseTriggerCondition;
|
||||||
import com.xinelu.manage.domain.textmessage.TextMessage;
|
import com.xinelu.manage.domain.textmessage.TextMessage;
|
||||||
import com.xinelu.manage.domain.wechattemplate.WechatTemplate;
|
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.RouteNodeCheckDto;
|
||||||
import com.xinelu.manage.dto.signpatientmanageroutenode.SignPatientManageRouteNodeDto;
|
import com.xinelu.manage.dto.signpatientmanageroutenode.SignPatientManageRouteNodeDto;
|
||||||
import com.xinelu.manage.mapper.labelfieldcontent.LabelFieldContentMapper;
|
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.patientinfo.PatientInfoMapper;
|
||||||
import com.xinelu.manage.mapper.patientvisitrecord.PatientVisitRecordMapper;
|
import com.xinelu.manage.mapper.patientvisitrecord.PatientVisitRecordMapper;
|
||||||
import com.xinelu.manage.mapper.scriptInfo.ScriptInfoMapper;
|
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.signpatientmanageroutenode.SignPatientManageRouteNodeMapper;
|
||||||
import com.xinelu.manage.mapper.signpatientrecord.SignPatientRecordMapper;
|
import com.xinelu.manage.mapper.signpatientrecord.SignPatientRecordMapper;
|
||||||
import com.xinelu.manage.mapper.specialdiseasenode.SpecialDiseaseNodeMapper;
|
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.specialdiseasetriggercondition.SpecialDiseaseTriggerConditionMapper;
|
||||||
import com.xinelu.manage.mapper.textmessage.TextMessageMapper;
|
import com.xinelu.manage.mapper.textmessage.TextMessageMapper;
|
||||||
import com.xinelu.manage.mapper.wechattemplate.WechatTemplateMapper;
|
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.signpatientmanageroutenode.SignPatientManageRouteNodeVo;
|
||||||
import com.xinelu.manage.vo.specialdiseasenode.PatientSpecialDiseaseNodeVo;
|
import com.xinelu.manage.vo.specialdiseasenode.PatientSpecialDiseaseNodeVo;
|
||||||
import com.xinelu.manage.vo.specialdiseaseroute.SpecialDiseaseRouteVO;
|
import com.xinelu.manage.vo.specialdiseaseroute.SpecialDiseaseRouteVO;
|
||||||
|
import java.lang.reflect.Field;
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.time.LocalTime;
|
import java.time.LocalTime;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -113,6 +121,10 @@ public class SignPatientManageRouteNodeServiceImpl implements ISignPatientManage
|
|||||||
private LabelFieldContentMapper labelFieldContentMapper;
|
private LabelFieldContentMapper labelFieldContentMapper;
|
||||||
@Resource
|
@Resource
|
||||||
private WechatTemplateMapper wechatTemplateMapper;
|
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) {
|
@Override public void generateMainRouteTask(Long signRecordId) {
|
||||||
List<SignPatientManageRouteNode> nodeSaveList = new ArrayList<>();
|
|
||||||
// 查询专病路径节点和手动创建的任务节点
|
// 查询专病路径节点和手动创建的任务节点
|
||||||
SignPatientRecord signPatientRecord = signPatientRecordMapper.selectByPrimaryKey(signRecordId);
|
SignPatientRecord signPatientRecord = signPatientRecordMapper.selectByPrimaryKey(signRecordId);
|
||||||
if (ObjectUtils.isEmpty(signPatientRecord)) {
|
if (ObjectUtils.isEmpty(signPatientRecord)) {
|
||||||
@ -610,12 +622,163 @@ public class SignPatientManageRouteNodeServiceImpl implements ISignPatientManage
|
|||||||
throw new ServiceException("未找到签约管理路径");
|
throw new ServiceException("未找到签约管理路径");
|
||||||
}
|
}
|
||||||
SignPatientManageRoute signPatientManageRoute = manageRouteList.get(0);
|
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<SignPatientManageRoute> manageRouteList = signRouteMapper.selectSignPatientManageRouteList(manageRouteQuery);
|
||||||
|
if (CollectionUtils.isNotEmpty(manageRouteList)) {
|
||||||
|
// 查询患者画像信息
|
||||||
|
List<LabelFieldInfoContentVo> labelFieldContentList = labelFieldContentMapper.selectByPatientId(manageRouteList.get(0).getPatientId());
|
||||||
|
if (CollectionUtils.isEmpty(labelFieldContentList)) {
|
||||||
|
throw new ServiceException("请先维护画像信息");
|
||||||
|
}
|
||||||
|
List<Long> manageRouteIds = manageRouteList.stream().map(SignPatientManageRoute::getId).collect(Collectors.toList());
|
||||||
|
List<SignPatientManageRouteNode> 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<PatientAllInfoViewUppercase> patientAllInfoViewList = patientAllInfoViewMapper.selectPatientAllInfoListViewByPatientId(patientId);
|
||||||
|
if (CollectionUtils.isNotEmpty(patientAllInfoViewList)) {
|
||||||
|
patientAllInfo = patientAllInfoViewList.get(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询画像信息
|
||||||
|
List<LabelFieldInfoContentVo> labelFieldContentList = labelFieldContentMapper.selectByPatientId(patientId);
|
||||||
|
|
||||||
|
// 查询子路径触发条件
|
||||||
|
SpecialDiseaseTriggerCondition triggerConditionQuery = new SpecialDiseaseTriggerCondition();
|
||||||
|
triggerConditionQuery.setRouteId(specialDiseaseRouteId);
|
||||||
|
List<SpecialDiseaseTriggerCondition> 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<SignPatientManageRouteNode> nodeSaveList = new ArrayList<>();
|
||||||
// 查询路径节点
|
// 查询路径节点
|
||||||
SpecialDiseaseNode specialDiseaseNodeQuery = new SpecialDiseaseNode();
|
SpecialDiseaseNode specialDiseaseNodeQuery = new SpecialDiseaseNode();
|
||||||
specialDiseaseNodeQuery.setRouteId(signPatientManageRoute.getRouteId());
|
specialDiseaseNodeQuery.setRouteId(signPatientManageRoute.getRouteId());
|
||||||
List<SpecialDiseaseNode> nodeList = specialDiseaseNodeMapper.selectSpecialDiseaseNodeList(specialDiseaseNodeQuery);
|
List<SpecialDiseaseNode> nodeList = specialDiseaseNodeMapper.selectSpecialDiseaseNodeList(specialDiseaseNodeQuery);
|
||||||
// 查询患者画像信息
|
// 查询患者画像信息
|
||||||
List<LabelFieldInfoContentVo> labelFieldContentList = labelFieldContentMapper.selectByPatientId(signPatientRecord.getPatientId());
|
List<LabelFieldInfoContentVo> labelFieldContentList = labelFieldContentMapper.selectByPatientId(patientId);
|
||||||
if (CollectionUtils.isEmpty(labelFieldContentList)) {
|
if (CollectionUtils.isEmpty(labelFieldContentList)) {
|
||||||
throw new ServiceException("请先维护画像信息");
|
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<SignPatientManageRoute> manageRouteList = signRouteMapper.selectSignPatientManageRouteList(manageRouteQuery);
|
|
||||||
if (CollectionUtils.isNotEmpty(manageRouteList)) {
|
|
||||||
// 查询患者画像信息
|
|
||||||
List<LabelFieldInfoContentVo> labelFieldContentList = labelFieldContentMapper.selectByPatientId(manageRouteList.get(0).getPatientId());
|
|
||||||
if (CollectionUtils.isEmpty(labelFieldContentList)) {
|
|
||||||
throw new ServiceException("请先维护画像信息");
|
|
||||||
}
|
|
||||||
List<Long> manageRouteIds = manageRouteList.stream().map(SignPatientManageRoute::getId).collect(Collectors.toList());
|
|
||||||
List<SignPatientManageRouteNode> 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<SpecialDiseaseTriggerCondition> triggerConditionList = triggerConditionMapper.selectSpecialDiseaseTriggerConditionList(triggerConditionQuery);
|
|
||||||
|
|
||||||
}
|
|
||||||
private String replaceNodeContent(String nodeContent, List<PatientNodeParamsCurrent> paramsList) {
|
private String replaceNodeContent(String nodeContent, List<PatientNodeParamsCurrent> paramsList) {
|
||||||
Map<String, String> map = paramsList.stream().collect(Collectors.toMap(PatientNodeParamsCurrent::getParamKey,PatientNodeParamsCurrent::getParamValue,(key1,key2)->key2));
|
Map<String, String> map = paramsList.stream().collect(Collectors.toMap(PatientNodeParamsCurrent::getParamKey,PatientNodeParamsCurrent::getParamValue,(key1,key2)->key2));
|
||||||
Document document = Jsoup.parse(nodeContent);
|
Document document = Jsoup.parse(nodeContent);
|
||||||
@ -874,4 +977,65 @@ public class SignPatientManageRouteNodeServiceImpl implements ISignPatientManage
|
|||||||
|
|
||||||
return manageNodeList;
|
return manageNodeList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean judgeTriggerCondition(SpecialDiseaseTriggerCondition triggerCondition, PatientAllInfoViewUppercase patientAllInfo, List<LabelFieldInfoContentVo> labelFieldContentList) {
|
||||||
|
List<String> 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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -188,8 +188,7 @@ public class SignPatientRecordServiceImpl implements ISignPatientRecordService {
|
|||||||
if (ObjectUtils.isEmpty(body.getRoute()) || body.getRoute().getRouteId() == null) {
|
if (ObjectUtils.isEmpty(body.getRoute()) || body.getRoute().getRouteId() == null) {
|
||||||
throw new ServiceException("请选择管理路径");
|
throw new ServiceException("请选择管理路径");
|
||||||
}
|
}
|
||||||
// 保存管理路径
|
// 保存管理路径主路径
|
||||||
// 查询主路径及子路径列表
|
|
||||||
SignPatientManageRoute signPatientManageRoute = body.getRoute();
|
SignPatientManageRoute signPatientManageRoute = body.getRoute();
|
||||||
List<SpecialDiseaseRoute> specialDiseaseRouteList = specialDiseaseRouteMapper.selectRouteAndChildren(signPatientManageRoute.getRouteId());
|
List<SpecialDiseaseRoute> specialDiseaseRouteList = specialDiseaseRouteMapper.selectRouteAndChildren(signPatientManageRoute.getRouteId());
|
||||||
specialDiseaseRouteList.forEach(specialDiseaseRoute -> {
|
specialDiseaseRouteList.forEach(specialDiseaseRoute -> {
|
||||||
|
|||||||
@ -94,6 +94,7 @@ public class SpecialDiseaseTriggerConditionServiceImpl implements ISpecialDiseas
|
|||||||
if (StringUtils.isBlank(item.getTriggerConditionName()) || StringUtils.isBlank(item.getTriggerConditionOperator()) || StringUtils.isBlank(item.getTriggerConditionValue())) {
|
if (StringUtils.isBlank(item.getTriggerConditionName()) || StringUtils.isBlank(item.getTriggerConditionOperator()) || StringUtils.isBlank(item.getTriggerConditionValue())) {
|
||||||
throw new ServiceException("请选择完整的触发条件");
|
throw new ServiceException("请选择完整的触发条件");
|
||||||
}
|
}
|
||||||
|
item.setTriggerConditionOperator(item.getTriggerConditionOperator().replace(">", ">").replace("<", "<"));
|
||||||
});
|
});
|
||||||
// 保存子路径
|
// 保存子路径
|
||||||
specialDiseaseRoute.setCreateTime(LocalDateTime.now());
|
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())) {
|
if (StringUtils.isBlank(item.getTriggerConditionName()) || StringUtils.isBlank(item.getTriggerConditionOperator()) || StringUtils.isBlank(item.getTriggerConditionValue())) {
|
||||||
throw new ServiceException("请选择完整的触发条件");
|
throw new ServiceException("请选择完整的触发条件");
|
||||||
}
|
}
|
||||||
|
item.setTriggerConditionOperator(item.getTriggerConditionOperator().replace(">", ">").replace("<", "<"));
|
||||||
});
|
});
|
||||||
// 修改子路径路径名称
|
// 修改子路径路径名称
|
||||||
SpecialDiseaseRoute specialDiseaseRoute = new SpecialDiseaseRoute();
|
SpecialDiseaseRoute specialDiseaseRoute = new SpecialDiseaseRoute();
|
||||||
|
|||||||
@ -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<String, List<List<GroupingValue>>> portaitInfo;
|
|
||||||
}
|
|
||||||
@ -17,6 +17,7 @@
|
|||||||
<result property="patientVisitRecordId" column="patient_visit_record_id"/>
|
<result property="patientVisitRecordId" column="patient_visit_record_id"/>
|
||||||
<result property="visitMethod" column="visit_method"/>
|
<result property="visitMethod" column="visit_method"/>
|
||||||
<result property="visitDate" column="visit_date"/>
|
<result property="visitDate" column="visit_date"/>
|
||||||
|
<result property="hospitalAgencyId" column="hospital_agency_id"/>
|
||||||
<result property="hospitalAgencyName" column="hospital_agency_name"/>
|
<result property="hospitalAgencyName" column="hospital_agency_name"/>
|
||||||
<result property="campusAgencyName" column="campus_agency_name"/>
|
<result property="campusAgencyName" column="campus_agency_name"/>
|
||||||
<result property="departmentName" column="department_name"/>
|
<result property="departmentName" column="department_name"/>
|
||||||
@ -50,7 +51,7 @@
|
|||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="selectPatientAllInfoViewVo">
|
<sql id="selectPatientAllInfoViewVo">
|
||||||
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
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="selectPatientAllInfoViewList" parameterType="PatientAllInfoView" resultMap="PatientAllInfoViewResult">
|
<select id="selectPatientAllInfoViewList" parameterType="PatientAllInfoView" resultMap="PatientAllInfoViewResult">
|
||||||
@ -65,6 +66,9 @@
|
|||||||
<if test="signPatientRecordId != null ">
|
<if test="signPatientRecordId != null ">
|
||||||
and sign_patient_record_id = #{signPatientRecordId}
|
and sign_patient_record_id = #{signPatientRecordId}
|
||||||
</if>
|
</if>
|
||||||
|
<if test="hospitalAgencyId != null ">
|
||||||
|
and hospital_agency_id = #{hospitalAgencyId}
|
||||||
|
</if>
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user