Merge branch '0418_小程序开发' of http://182.92.166.109:3000/zhuangyuanke/PostDischargePatientManage into 0418_小程序开发

This commit is contained in:
zhuangyuanke 2024-06-28 17:13:58 +08:00
commit 9d04991580
19 changed files with 401 additions and 95 deletions

View File

@ -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= "";
}

View File

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

View File

@ -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 = "所属医院名称")

View File

@ -331,4 +331,15 @@ public class SignPatientManageRouteNode extends BaseEntity {
@ApiModelProperty(value = "AI自动 或 COMMON手动")
@Excel(name = "AI自动 或 COMMON手动")
private String phoneDialMethod;
/** 人工随访问卷模板表id */
@ApiModelProperty(value = "人工随访模板表id")
@Excel(name = "人工随访模板表id")
private Long followTemplateId;
/** 人工随访问卷模板名称 */
@ApiModelProperty(value = "人工随访模板名称")
@Excel(name = "人工随访模板名称")
private String followTemplateName;
}

View File

@ -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 */

View File

@ -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;
/**

View File

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

View File

@ -3,6 +3,7 @@ package com.xinelu.manage.service.scriptInfo.impl;
import com.xinelu.common.annotation.DataScope;
import com.xinelu.common.config.SystemBusinessConfig;
import com.xinelu.common.core.domain.AjaxResult;
import com.xinelu.common.enums.ScriptStatusEnum;
import com.xinelu.common.exception.ServiceException;
import com.xinelu.common.utils.SecurityUtils;
import com.xinelu.common.utils.file.FileUploadUtils;
@ -89,6 +90,7 @@ public class ScriptInfoServiceImpl implements IScriptInfoService {
// 设置创建人与创建时间
scriptInfo.setCreateBy(SecurityUtils.getUsername());
scriptInfo.setCreateTime(LocalDateTime.now());
scriptInfo.setScriptStatus(ScriptStatusEnum.OFF_SHELF.getInfo());
scriptInfo.setScriptId(IdUtils.fastUUID());
return scriptInfoMapper.insertScriptInfo(scriptInfo);
}
@ -102,6 +104,13 @@ public class ScriptInfoServiceImpl implements IScriptInfoService {
@Override
@Transactional(rollbackFor = Exception.class)
public int updateScriptInfo(ScriptInfo scriptInfo) {
ScriptInfo scriptInfo1 = scriptInfoMapper.selectScriptInfoById(scriptInfo.getId());
if (Objects.isNull(scriptInfo1)) {
throw new ServiceException("该话术名称已删除!");
}
if (ScriptStatusEnum.NORMAL.getInfo().equals(scriptInfo.getScriptStatus()) && Objects.isNull(scriptInfo1.getScriptFilePath())) {
throw new ServiceException("请生成话术图片后上架该话术!");
}
// 检查除当前记录之外是否存在同名的话术名称
if (scriptInfoMapper.countByScriptNameExcludingId(scriptInfo.getScriptName(), scriptInfo.getDepartmentId(), scriptInfo.getId(), scriptInfo.getCommonScriptName()) > 0) {
// 存在同名的通用话术名称不能进行更新

View File

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

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

@ -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;
/**
* 查询签约患者管理任务路径节点
@ -234,8 +246,8 @@ public class SignPatientManageRouteNodeServiceImpl implements ISignPatientManage
}
break;
case (TaskContentConstants.ARTIFICIAL_FOLLOW_UP): // 人工随访-返回问卷信息
if (node.getPhoneTemplateId() != null) {
QuestionVO questionVO = questionInfoService.selectQuestionInfoById(Long.valueOf(node.getPhoneTemplateId()));
if (node.getFollowTemplateId() != null) {
QuestionVO questionVO = questionInfoService.selectQuestionInfoById(node.getFollowTemplateId());
detailInfo = JSONObject.parseObject(JSONObject.toJSONString(questionVO));
}
break;
@ -595,8 +607,9 @@ public class SignPatientManageRouteNodeServiceImpl implements ISignPatientManage
return executeDateTime;
}
@Override public void generateMainRouteTask(Long signRecordId) {
List<SignPatientManageRouteNode> nodeSaveList = new ArrayList<>();
@Override
@Transactional(rollbackFor = Exception.class)
public void generateMainRouteTask(Long signRecordId) {
// 查询专病路径节点和手动创建的任务节点
SignPatientRecord signPatientRecord = signPatientRecordMapper.selectByPrimaryKey(signRecordId);
if (ObjectUtils.isEmpty(signPatientRecord)) {
@ -610,12 +623,149 @@ public class SignPatientManageRouteNodeServiceImpl implements ISignPatientManage
throw new ServiceException("未找到签约管理路径");
}
SignPatientManageRoute signPatientManageRoute = manageRouteList.get(0);
generateByManageRoute(signPatientManageRoute, signPatientRecord.getPatientId());
}
@Override
@Transactional(rollbackFor = Exception.class)
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 专病管理路径子路径主键
*/
@Override
@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成立继续判断条件23
if (triggerConditionList.size() > 1) {
boolean condition2 = judgeTriggerCondition(triggerConditionList.get(1), patientAllInfo, labelFieldContentList);
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个条件且成立生成任务
generateTask = true;
}
}
}
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);
signPatientManageRoute.setSignPatientRecordId(signPatientRecordId);
signPatientManageRoute.setPatientId(patientId);
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);
// 保存任务
generateByManageRoute(signPatientManageRoute, patientId);
}
}
/**
* 根据管理路径生成任务
* @param signPatientManageRoute 签约管理路径
* @param patientId 患者主键
*/
private void generateByManageRoute(SignPatientManageRoute signPatientManageRoute, Long patientId) {
List<SignPatientManageRouteNode> nodeSaveList = new ArrayList<>();
// 查询路径节点
SpecialDiseaseNode specialDiseaseNodeQuery = new SpecialDiseaseNode();
specialDiseaseNodeQuery.setRouteId(signPatientManageRoute.getRouteId());
List<SpecialDiseaseNode> nodeList = specialDiseaseNodeMapper.selectSpecialDiseaseNodeList(specialDiseaseNodeQuery);
// 查询患者画像信息
List<LabelFieldInfoContentVo> labelFieldContentList = labelFieldContentMapper.selectByPatientId(signPatientRecord.getPatientId());
List<LabelFieldInfoContentVo> labelFieldContentList = labelFieldContentMapper.selectByPatientId(patientId);
if (CollectionUtils.isEmpty(labelFieldContentList)) {
throw new ServiceException("请先维护画像信息");
}
@ -675,66 +825,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) {
Map<String, String> map = paramsList.stream().collect(Collectors.toMap(PatientNodeParamsCurrent::getParamKey,PatientNodeParamsCurrent::getParamValue,(key1,key2)->key2));
Document document = Jsoup.parse(nodeContent);
@ -874,4 +964,65 @@ public class SignPatientManageRouteNodeServiceImpl implements ISignPatientManage
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;
}
}

View File

@ -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<SpecialDiseaseRoute> specialDiseaseRouteList = specialDiseaseRouteMapper.selectRouteAndChildren(signPatientManageRoute.getRouteId());
specialDiseaseRouteList.forEach(specialDiseaseRoute -> {

View File

@ -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("&gt;", ">").replace("&lt;", "<"));
});
// 保存子路径
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("&gt;", ">").replace("&lt;", "<"));
});
// 修改子路径路径名称
SpecialDiseaseRoute specialDiseaseRoute = new SpecialDiseaseRoute();

View File

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

View File

@ -123,5 +123,9 @@ public class ManualFollowUpVO {
@ApiModelProperty(value = "任务处理信息")
private String routeHandleRemark;
@ApiModelProperty(value = "人工随访问卷模板表id")
private Long followTemplateId;
@ApiModelProperty(value = "电话话术表id")
private Long phoneId;
}

View File

@ -17,6 +17,7 @@
<result property="patientVisitRecordId" column="patient_visit_record_id"/>
<result property="visitMethod" column="visit_method"/>
<result property="visitDate" column="visit_date"/>
<result property="hospitalAgencyId" column="hospital_agency_id"/>
<result property="hospitalAgencyName" column="hospital_agency_name"/>
<result property="campusAgencyName" column="campus_agency_name"/>
<result property="departmentName" column="department_name"/>
@ -50,7 +51,7 @@
</resultMap>
<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>
<select id="selectPatientAllInfoViewList" parameterType="PatientAllInfoView" resultMap="PatientAllInfoViewResult">
@ -65,6 +66,9 @@
<if test="signPatientRecordId != null ">
and sign_patient_record_id = #{signPatientRecordId}
</if>
<if test="hospitalAgencyId != null ">
and hospital_agency_id = #{hospitalAgencyId}
</if>
</where>
</select>

View File

@ -331,15 +331,17 @@
spmrn.route_node_name AS 'routeNodeName',
spmrn.task_type,
CASE
WHEN spmrn.task_type = 'PHONE_OUTBOUND' THEN spmrn.phone_template_name
WHEN spmrn.task_type = 'PHONE_OUTBOUND' THEN COALESCE(spmrn.phone_template_name, spmrn.follow_template_name)
WHEN spmrn.task_type = 'QUESTIONNAIRE_SCALE' THEN spmrn.questionnaire_name
WHEN spmrn.task_type = 'ARTIFICIAL_FOLLOW_UP' THEN spmrn.follow_template_name
END AS 'templateName',
CASE
WHEN spmrn.task_type = 'PHONE_OUTBOUND' THEN spmrn.phone_id
WHEN spmrn.task_type = 'PHONE_OUTBOUND' THEN COALESCE(spmrn.phone_id, spmrn.follow_template_id)
WHEN spmrn.task_type = 'QUESTIONNAIRE_SCALE' THEN spmrn.question_info_id
WHEN spmrn.task_type = 'ARTIFICIAL_FOLLOW_UP' THEN spmrn.follow_template_id
END AS 'templateId',
spmrn.phone_id,
spmrn.follow_template_id,
spmrn.node_execute_status,
spmrn.route_handle_remark
FROM

View File

@ -50,6 +50,8 @@
<result property="appletRemindContent" column="applet_remind_content"/>
<result property="appletPromptDescription" column="applet_prompt_description"/>
<result property="appletNodeContent" column="applet_node_content"/>
<result property="followTemplateId" column="follow_template_id"/>
<result property="followTemplateName" column="follow_template_name"/>
<result property="routeCheckStatus" column="route_check_status"/>
<result property="routeCheckPerson" column="route_check_person"/>
<result property="routeCheckDate" column="route_check_date"/>
@ -72,7 +74,7 @@
</resultMap>
<sql id="selectSignPatientManageRouteNodeVo">
select id, manage_route_id, manage_route_name, route_node_id, route_node_name, route_node_day, task_type, task_status, task_subdivision, second_classify_describe, execute_time, phone_push_sign, phone_id, phone_template_id, phone_template_name, phone_node_content, phone_redial_times, phone_time_interval, phone_message_remind, phone_message_template_id, phone_message_template_name,phone_message_template_content,question_info_id, questionnaire_name, questionnaire_content, question_expiration_date, propaganda_info_id, propaganda_title, propaganda_content, message_push_sign, message_template_id, message_template_name, message_preview, message_node_content, official_push_sign, official_template_id, official_template_name, official_remind_content, official_node_content, applet_push_sign, applet_template_id, applet_template_name, applet_remind_content, applet_prompt_description, applet_node_content, route_check_status, route_check_person, route_check_date, route_check_remark, route_node_remark, node_execute_status, route_handle_remark, route_handle_id, route_handle_person, route_link,text_remind_content, node_content,message_status, del_flag, create_by, create_time, update_by, update_time, phone_dial_method from sign_patient_manage_route_node
select id, manage_route_id, manage_route_name, route_node_id, route_node_name, route_node_day, task_type, task_status, task_subdivision, second_classify_describe, execute_time, phone_push_sign, phone_id, phone_template_id, phone_template_name, phone_node_content, phone_redial_times, phone_time_interval, phone_message_remind, phone_message_template_id, phone_message_template_name,phone_message_template_content,question_info_id, questionnaire_name, questionnaire_content, question_expiration_date, propaganda_info_id, propaganda_title, propaganda_content, message_push_sign, message_template_id, message_template_name, message_preview, message_node_content, official_push_sign, official_template_id, official_template_name, official_remind_content, official_node_content, follow_template_id, follow_template_name, applet_push_sign, applet_template_id, applet_template_name, applet_remind_content, applet_prompt_description, applet_node_content, route_check_status, route_check_person, route_check_date, route_check_remark, route_node_remark, node_execute_status, route_handle_remark, route_handle_id, route_handle_person, route_link,text_remind_content, node_content,message_status, del_flag, create_by, create_time, update_by, update_time, phone_dial_method from sign_patient_manage_route_node
</sql>
<select id="selectSignPatientManageRouteNodeList" parameterType="com.xinelu.manage.dto.signpatientmanageroutenode.SignPatientManageRouteNodeDto" resultMap="SignPatientManageRouteNodeResult">
@ -149,7 +151,7 @@
node.phone_template_id, node.phone_template_name, node.phone_node_content, node.phone_redial_times, node.phone_time_interval,
node.phone_message_remind, node.phone_message_template_id, node.phone_message_template_name,node.phone_message_template_content,
node.question_info_id, node.questionnaire_name, node.questionnaire_content, node.question_expiration_date,
node.propaganda_info_id, node.propaganda_title, node.propaganda_content,
node.propaganda_info_id, node.propaganda_title, node.propaganda_content,node.follow_template_id, node.follow_template_name,
node.message_push_sign, node.message_template_id, node.message_template_name,node.message_preview, node.message_node_content,
node.official_push_sign, node.official_template_id, node.official_template_name, node.official_remind_content, node.official_node_content,
node.applet_push_sign, node.applet_template_id, node.applet_template_name, node.applet_remind_content, node.applet_prompt_description, node.applet_node_content,
@ -322,6 +324,10 @@
</if>
<if test="phoneDialMethod != null">phone_dial_method,
</if>
<if test="followTemplateId != null">follow_template_id,
</if>
<if test="followTemplateName != null">follow_template_name,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="manageRouteId != null">#{manageRouteId},
@ -448,7 +454,11 @@
</if>
<if test="updateTime != null">#{updateTime},
</if>
<if test="phoneDialMethod != null ">#{phoneDialMethod}
<if test="phoneDialMethod != null ">#{phoneDialMethod},
</if>
<if test="followTemplateId != null">#{followTemplateId},
</if>
<if test="followTemplateName != null">#{followTemplateName},
</if>
</trim>
</insert>
@ -459,7 +469,7 @@
message_template_id, message_template_name, message_preview, message_node_content, official_push_sign, official_template_id, official_template_name, official_remind_content,
official_node_content, applet_push_sign, applet_template_id, applet_template_name, applet_remind_content, applet_prompt_description, applet_node_content,
route_check_status, route_check_person, route_check_date, route_check_remark, route_node_remark, node_execute_status, route_handle_remark,phone_connect_status,
route_handle_id, route_handle_person, route_link, text_remind_content,node_content, del_flag, create_by, create_time, update_by, update_time,phone_dial_method)
route_handle_id, route_handle_person, route_link, text_remind_content,node_content, del_flag, create_by, create_time, update_by, update_time,phone_dial_method,follow_template_id, follow_template_name)
values
<foreach collection="nodeList" item="item" separator=",">
(#{item.manageRouteId},#{item.manageRouteName},#{item.routeNodeId},#{item.routeNodeName},#{item.routeNodeDay},#{item.taskType},#{item.taskStatus},#{item.taskSubdivision},#{item.secondClassifyDescribe},
@ -468,7 +478,7 @@
#{item.messageTemplateName},#{item.messagePreview},#{item.messageNodeContent},#{item.officialPushSign},#{item.officialTemplateId},#{item.officialTemplateName},#{item.officialRemindContent},#{item.officialNodeContent},
#{item.appletPushSign},#{item.appletTemplateId},#{item.appletTemplateName},#{item.appletRemindContent},#{item.appletPromptDescription},#{item.appletNodeContent},
#{item.routeCheckStatus},#{item.routeCheckPerson},#{item.routeCheckDate},#{item.routeCheckRemark},#{item.routeNodeRemark},#{item.nodeExecuteStatus},#{item.routeHandleRemark},#{item.phoneConnectStatus},
#{item.routeHandleId},#{item.routeHandlePerson},#{item.routeLink},#{item.textRemindContent},#{item.nodeContent},0,#{item.createBy},#{item.createTime},#{item.updateBy},#{item.updateTime},#{item.phoneDialMethod})
#{item.routeHandleId},#{item.routeHandlePerson},#{item.routeLink},#{item.textRemindContent},#{item.nodeContent},0,#{item.createBy},#{item.createTime},#{item.updateBy},#{item.updateTime},#{item.phoneDialMethod},#{item.followTemplateId},#{item.followTemplateName})
</foreach>
</insert>
<update id="updateSignPatientManageRouteNode" parameterType="SignPatientManageRouteNode">
@ -663,6 +673,12 @@
<if test="phoneDialMethod != null ">phone_dial_method =
#{phoneDialMethod},
</if>
<if test="followTemplateId != null">follow_template_id =
#{followTemplateId},
</if>
<if test="followTemplateName != null">follow_template_name =
#{followTemplateName},
</if>
</trim>
where id = #{id}
</update>

View File

@ -0,0 +1,29 @@
package com.xinelu.quartz.task;
import com.xinelu.manage.mapper.signpatientrecord.SignPatientRecordMapper;
import com.xinelu.manage.service.signpatientrecord.ISignPatientRecordService;
import javax.annotation.Resource;
import org.springframework.stereotype.Component;
/**
* @description: 根据触发条件生成子路径任务
* @author: haown
* @create: 2024-06-28 14:27
**/
@Component("GenerateChildRouteTask")
public class GenerateChildRouteTask {
@Resource
private ISignPatientRecordService signPatientRecordService;
@Resource
private SignPatientRecordMapper signPatientRecordMapper;
public void GenerateChildRouteTask() {
// 查询在签患者
// 查询患者签约专病路径包含的子路径id
// 查询签约路径表已生成的子路径id
// 取差集
// 生成子路径任务
}
}