修改生成任务。

This commit is contained in:
haown 2024-07-04 09:06:32 +08:00
parent 86a96c3769
commit 82d4353fa7
7 changed files with 74 additions and 49 deletions

View File

@ -97,6 +97,8 @@ public class DataScopeAspect {
sqlString.append(StringUtils.format(" OR {}.hospital_agency_id = {} ", agencyAlias, user.getHospitalAgencyId())); sqlString.append(StringUtils.format(" OR {}.hospital_agency_id = {} ", agencyAlias, user.getHospitalAgencyId()));
} else if (DATA_SCOPE_DEPT.equals(dataScope)) { // 部门数据权限 } else if (DATA_SCOPE_DEPT.equals(dataScope)) { // 部门数据权限
sqlString.append(StringUtils.format(" OR {}.department_id = {} ", deptAlias, user.getDepartmentId())); sqlString.append(StringUtils.format(" OR {}.department_id = {} ", deptAlias, user.getDepartmentId()));
} else if (DATA_SCOPE_SELF.equals(dataScope)) { // 部门数据权限
sqlString.append(StringUtils.format(" OR {} = {} ", userAlias, user.getUserId()));
} }
} }

View File

@ -54,4 +54,10 @@ public class SignPatientManageRouteNodeDto {
@ApiModelProperty(value = "签约患者管理路径表主键列表") @ApiModelProperty(value = "签约患者管理路径表主键列表")
private List<Long> manageRouteIdList; private List<Long> manageRouteIdList;
/**
* AI自动 COMMON手动
*/
@ApiModelProperty(value = "AI自动 或 COMMON手动")
private String phoneDialMethod;
} }

View File

@ -111,7 +111,7 @@ public class PatientPreHospitalizationServiceImpl implements IPatientPreHospital
} }
@Override @Override
@DataScope(agencyAlias = "p") @DataScope(agencyAlias = "p",userAlias = "p.certificate_issuing_doctor_id")
public List<PatientPreHospitalization> selectList(PatientInfoDto patientInfo) { public List<PatientPreHospitalization> selectList(PatientInfoDto patientInfo) {
return preHospitalizationMapper.selectList(patientInfo); return preHospitalizationMapper.selectList(patientInfo);
} }

View File

@ -737,30 +737,37 @@ public class SignPatientManageRouteServiceImpl implements ISignPatientManageRout
* * 短信模板内容 * * 短信模板内容
* @param messageTemplateId 短信模板主键 * @param messageTemplateId 短信模板主键
* @param labelFieldContentList 患者画像信息 * @param labelFieldContentList 患者画像信息
* @return * @return 替换标签后的内容
*/ */
private String replaceMessageInfo(Long messageTemplateId, List<LabelFieldInfoContentVo> labelFieldContentList) { private String replaceMessageInfo(Long messageTemplateId, List<LabelFieldInfoContentVo> labelFieldContentList) {
// 查询短信模板 // 查询短信模板
TextMessage textMessage = textMessageMapper.selectTextMessageById(messageTemplateId); TextMessage textMessage = textMessageMapper.selectTextMessageById(messageTemplateId);
String textMessageContent = textMessage.getTextMessageContent(); if (ObjectUtils.isNotEmpty(textMessage)) {
// 替换{{}}中的内容 String textMessageContent = textMessage.getTextMessageContent();
Pattern pattern = Pattern.compile("#\\{([^\\}]*)\\}"); // 替换{{}}中的内容
Matcher matcher = pattern.matcher(textMessage.getTextMessageContent()); Pattern pattern = Pattern.compile("#\\{([^\\}]*)\\}");
while (matcher.find()) { Matcher matcher = pattern.matcher(textMessage.getTextMessageContent());
// 过滤出符合条件的对象不匹配返回null while (matcher.find()) {
LabelFieldInfoContentVo labelFieldContent = labelFieldContentList.stream().filter(s -> Objects.equals(s.getFieldCode(), matcher.group(1))).findFirst().orElse(null); // 过滤出符合条件的对象不匹配返回null
if (ObjectUtils.isNotEmpty(labelFieldContent)) { LabelFieldInfoContentVo labelFieldContent = labelFieldContentList.stream().filter(s -> Objects.equals(s.getFieldCode(), matcher.group(1))).findFirst().orElse(null);
textMessageContent = textMessageContent.replaceAll("#\\{"+matcher.group(1) +"\\}", ObjectUtils.isEmpty(labelFieldContent) ? "" : labelFieldContent.getFieldValue()); if (ObjectUtils.isNotEmpty(labelFieldContent)) {
textMessageContent = textMessageContent.replaceAll("#\\{"+matcher.group(1) +"\\}", ObjectUtils.isEmpty(labelFieldContent) ? "" : labelFieldContent.getFieldValue());
}
} }
return textMessageContent;
} }
return textMessageContent; return null;
} }
private void replaceTemplateInfo(SignPatientManageNodeAuditVo manageRouteNode, RouteTaskAuditVo node, List<LabelFieldInfoContentVo> labelFieldContentList) { private void replaceTemplateInfo(SignPatientManageNodeAuditVo manageRouteNode, RouteTaskAuditVo node, List<LabelFieldInfoContentVo> labelFieldContentList) {
if (node.getMessagePushSign() != null && node.getMessagePushSign() == 1) { if (node.getMessageTemplateId() != null) {
// 替换短信模板 // 替换短信模板
manageRouteNode.setMessageNodeContent(replaceMessageInfo(node.getMessageTemplateId(), labelFieldContentList)); manageRouteNode.setMessageNodeContent(replaceMessageInfo(node.getMessageTemplateId(), labelFieldContentList));
} }
if (node.getPhoneMessageTemplateId() != null) {
// 替换短信模板
manageRouteNode.setPhoneMessageTemplateContent(replaceMessageInfo(node.getPhoneMessageTemplateId(), labelFieldContentList));
}
// 替换公众号模板 // 替换公众号模板
if (node.getOfficialPushSign() != null && node.getOfficialPushSign() == 1) { if (node.getOfficialPushSign() != null && node.getOfficialPushSign() == 1) {
manageRouteNode.setOfficialNodeContent(replaceWeChatTemplate(node.getOfficialTemplateId(), labelFieldContentList)); manageRouteNode.setOfficialNodeContent(replaceWeChatTemplate(node.getOfficialTemplateId(), labelFieldContentList));

View File

@ -755,7 +755,6 @@ public class SignPatientManageRouteNodeServiceImpl implements ISignPatientManage
signPatientManageRoute.setTaskCreateType(TaskCreateTypeConstant.MANUAL_MATCHE); signPatientManageRoute.setTaskCreateType(TaskCreateTypeConstant.MANUAL_MATCHE);
signPatientManageRoute.setParentRouteId(mainManageRoute.getId()); signPatientManageRoute.setParentRouteId(mainManageRoute.getId());
signPatientManageRoute.setCreateTime(LocalDateTime.now()); signPatientManageRoute.setCreateTime(LocalDateTime.now());
signPatientManageRoute.setCreateBy(SecurityUtils.getLoginUser().getUser().getNickName());
signRouteMapper.insertSignPatientManageRoute(signPatientManageRoute); signRouteMapper.insertSignPatientManageRoute(signPatientManageRoute);
// 保存任务 // 保存任务
generateByManageRoute(signPatientManageRoute, patientId); generateByManageRoute(signPatientManageRoute, patientId);
@ -813,11 +812,6 @@ public class SignPatientManageRouteNodeServiceImpl implements ISignPatientManage
// 话术库json内容替换 // 话术库json内容替换
manageRouteNode.setPhoneNodeContent(getFlowScheme(scriptInfo.getFlowScheme(), labelFieldContentList)); manageRouteNode.setPhoneNodeContent(getFlowScheme(scriptInfo.getFlowScheme(), labelFieldContentList));
} }
// 电话短信内容
if (node.getPhoneMessageTemplateId() != null) {
// 查询短信库
manageRouteNode.setPhoneMessageTemplateContent(replaceMessageInfo(node.getPhoneMessageTemplateId(), labelFieldContentList));
}
break; break;
} }
} }
@ -839,9 +833,11 @@ public class SignPatientManageRouteNodeServiceImpl implements ISignPatientManage
manageNodeList.add(manageRouteNode); manageNodeList.add(manageRouteNode);
} }
nodeSaveList.addAll(manageNodeList); nodeSaveList.addAll(manageNodeList);
// 保存
signPatientManageRouteNodeMapper.insertBatch(nodeSaveList);
}); });
// 保存
if(CollectionUtils.isNotEmpty(nodeSaveList)) {
signPatientManageRouteNodeMapper.insertBatch(nodeSaveList);
}
} }
private String replaceNodeContent(String nodeContent, List<PatientNodeParamsCurrent> paramsList) { private String replaceNodeContent(String nodeContent, List<PatientNodeParamsCurrent> paramsList) {
@ -889,31 +885,38 @@ public class SignPatientManageRouteNodeServiceImpl implements ISignPatientManage
private String replaceMessageInfo(Long messageTemplateId, List<LabelFieldInfoContentVo> labelFieldContentList) { private String replaceMessageInfo(Long messageTemplateId, List<LabelFieldInfoContentVo> labelFieldContentList) {
// 查询短信模板 // 查询短信模板
TextMessage textMessage = textMessageMapper.selectTextMessageById(messageTemplateId); TextMessage textMessage = textMessageMapper.selectTextMessageById(messageTemplateId);
String textMessageContent = textMessage.getTextMessageContent(); if (ObjectUtils.isNotEmpty(textMessage)) {
// 替换{{}}中的内容 String textMessageContent = textMessage.getTextMessageContent();
Pattern pattern = Pattern.compile("#\\{([^\\}]*)\\}"); // 替换{{}}中的内容
Matcher matcher = pattern.matcher(textMessage.getTextMessageContent()); Pattern pattern = Pattern.compile("#\\{([^\\}]*)\\}");
while (matcher.find()) { Matcher matcher = pattern.matcher(textMessage.getTextMessageContent());
// 过滤出符合条件的对象不匹配返回null while (matcher.find()) {
LabelFieldInfoContentVo labelFieldContent = labelFieldContentList.stream().filter(s -> Objects.equals(s.getFieldCode(), matcher.group(1))).findFirst().orElse(null); // 过滤出符合条件的对象不匹配返回null
if (ObjectUtils.isNotEmpty(labelFieldContent)) { LabelFieldInfoContentVo labelFieldContent = labelFieldContentList.stream().filter(s -> Objects.equals(s.getFieldCode(), matcher.group(1))).findFirst().orElse(null);
textMessageContent = textMessageContent.replaceAll("#\\{"+matcher.group(1) +"\\}", ObjectUtils.isEmpty(labelFieldContent) ? "" : labelFieldContent.getFieldValue()); if (ObjectUtils.isNotEmpty(labelFieldContent)) {
textMessageContent = textMessageContent.replaceAll("#\\{"+matcher.group(1) +"\\}", ObjectUtils.isEmpty(labelFieldContent) ? "" : labelFieldContent.getFieldValue());
}
} }
return textMessageContent;
} }
return textMessageContent; return null;
} }
/** /**
* 替换短信公众号小程序内容 * 替换短信公众号小程序内容
* @param manageRouteNode 签约路径节点 * @param manageRouteNode 签约路径节点
* @param node * @param node 专病路径节点
* @param labelFieldContentList * @param labelFieldContentList 患者画像信息
*/ */
private void replaceTemplateInfo(SignPatientManageRouteNode manageRouteNode, SpecialDiseaseNode node, List<LabelFieldInfoContentVo> labelFieldContentList) { private void replaceTemplateInfo(SignPatientManageRouteNode manageRouteNode, SpecialDiseaseNode node, List<LabelFieldInfoContentVo> labelFieldContentList) {
if (node.getMessagePushSign() != null && node.getMessagePushSign() == 1) { if (node.getMessageTemplateId() != null) {
// 替换短信模板 // 替换短信模板
manageRouteNode.setMessageNodeContent(replaceMessageInfo(node.getMessageTemplateId(), labelFieldContentList)); manageRouteNode.setMessageNodeContent(replaceMessageInfo(node.getMessageTemplateId(), labelFieldContentList));
} }
if (node.getPhoneMessageTemplateId() != null) {
// 替换短信模板
manageRouteNode.setPhoneMessageTemplateContent(replaceMessageInfo(node.getPhoneMessageTemplateId(), labelFieldContentList));
}
// 替换公众号模板 // 替换公众号模板
if (node.getOfficialPushSign() != null && node.getOfficialPushSign() == 1) { if (node.getOfficialPushSign() != null && node.getOfficialPushSign() == 1) {
manageRouteNode.setOfficialNodeContent(replaceWeChatTemplate(node.getOfficialTemplateId(), labelFieldContentList)); manageRouteNode.setOfficialNodeContent(replaceWeChatTemplate(node.getOfficialTemplateId(), labelFieldContentList));
@ -1010,25 +1013,31 @@ public class SignPatientManageRouteNodeServiceImpl implements ISignPatientManage
private boolean judgeTriggerCondition(SpecialDiseaseTriggerCondition triggerCondition, PatientAllInfoViewUppercase patientAllInfo, List<LabelFieldInfoContentVo> labelFieldContentList) { private boolean judgeTriggerCondition(SpecialDiseaseTriggerCondition triggerCondition, PatientAllInfoViewUppercase patientAllInfo, List<LabelFieldInfoContentVo> labelFieldContentList) {
List<String> labelValueList = new ArrayList<>(); List<String> labelValueList = new ArrayList<>();
String triggerConditionCode = triggerCondition.getTriggerConditionCode().replaceAll("_", "");
if (ObjectUtils.isNotEmpty(patientAllInfo)) { if (ObjectUtils.isNotEmpty(patientAllInfo)) {
try { Field[] declaredFields = PatientAllInfoViewUppercase.class.getDeclaredFields();
Class<?> clazz = patientAllInfo.getClass(); List<Field> fieldList = Arrays.stream(declaredFields).collect(Collectors.toList());
Field field = clazz.getDeclaredField(triggerCondition.getTriggerConditionCode()); fieldList.forEach(field -> {
field.setAccessible(true); if (StringUtils.equals(field.getName(), triggerConditionCode)) {
// 获取字段的值 Class<?> clazz = patientAllInfo.getClass();
Object value = field.get(patientAllInfo); field.setAccessible(true);
if (ObjectUtils.isNotEmpty(value)) { // 获取字段的值
labelValueList.add(String.valueOf(value)); try {
Object value = field.get(patientAllInfo);
if (ObjectUtils.isNotEmpty(value)) {
labelValueList.add(String.valueOf(value));
}
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
}
} }
} catch (NoSuchFieldException | IllegalAccessException e) { });
throw new RuntimeException(e);
}
} }
// 查询画像中的信息 // 查询画像中的信息
if (CollectionUtils.isNotEmpty(labelFieldContentList)) { if (CollectionUtils.isNotEmpty(labelFieldContentList)) {
labelValueList.addAll(labelFieldContentList.stream() labelValueList.addAll(labelFieldContentList.stream()
.filter(content -> StringUtils.equals(content.getFieldCode(), triggerCondition.getTriggerConditionCode())) .filter(content -> StringUtils.equals(content.getFieldCode(), triggerConditionCode))
.map(LabelFieldInfoContentVo::getFieldValue) .map(LabelFieldInfoContentVo::getFieldValue)
.collect(Collectors.toList())); .collect(Collectors.toList()));
} }

View File

@ -465,7 +465,7 @@
<insert id="insertBatch"> <insert id="insertBatch">
insert into sign_patient_manage_route_node(manage_route_id, manage_route_name, route_node_id, route_node_name, route_node_day, task_type, task_status, task_subdivision, second_classify_describe, insert into sign_patient_manage_route_node(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, 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, question_info_id, questionnaire_name, questionnaire_content, question_expiration_date, propaganda_info_id, propaganda_title, propaganda_content, message_push_sign, 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, 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, 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_check_status, route_check_person, route_check_date, route_check_remark, route_node_remark, node_execute_status, route_handle_remark,phone_connect_status,
@ -473,7 +473,8 @@
values values
<foreach collection="nodeList" item="item" separator=","> <foreach collection="nodeList" item="item" separator=",">
(#{item.manageRouteId},#{item.manageRouteName},#{item.routeNodeId},#{item.routeNodeName},#{item.routeNodeDay},#{item.taskType},#{item.taskStatus},#{item.taskSubdivision},#{item.secondClassifyDescribe}, (#{item.manageRouteId},#{item.manageRouteName},#{item.routeNodeId},#{item.routeNodeName},#{item.routeNodeDay},#{item.taskType},#{item.taskStatus},#{item.taskSubdivision},#{item.secondClassifyDescribe},
#{item.executeTime},#{item.phonePushSign},#{item.phoneId},#{item.phoneTemplateId},#{item.phoneTemplateName},#{item.phoneNodeContent},#{item.phoneRedialTimes},#{item.phoneTimeInterval},#{item.phoneMessageRemind},#{item.phoneMessageTemplateId},#{item.phoneMessageTemplateName}, #{item.executeTime},#{item.phonePushSign},#{item.phoneId},#{item.phoneTemplateId},#{item.phoneTemplateName},#{item.phoneNodeContent},#{item.phoneRedialTimes},#{item.phoneTimeInterval},#{item.phoneMessageRemind},#{item.phoneMessageTemplateId},
#{item.phoneMessageTemplateName},#{item.phoneMessageTemplateContent},
#{item.questionInfoId},#{item.questionnaireName},#{item.questionnaireContent},#{item.questionExpirationDate},#{item.propagandaInfoId},#{item.propagandaTitle},#{item.propagandaContent},#{item.messagePushSign},#{item.messageTemplateId}, #{item.questionInfoId},#{item.questionnaireName},#{item.questionnaireContent},#{item.questionExpirationDate},#{item.propagandaInfoId},#{item.propagandaTitle},#{item.propagandaContent},#{item.messagePushSign},#{item.messageTemplateId},
#{item.messageTemplateName},#{item.messagePreview},#{item.messageNodeContent},#{item.officialPushSign},#{item.officialTemplateId},#{item.officialTemplateName},#{item.officialRemindContent},#{item.officialNodeContent}, #{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.appletPushSign},#{item.appletTemplateId},#{item.appletTemplateName},#{item.appletRemindContent},#{item.appletPromptDescription},#{item.appletNodeContent},

View File

@ -40,7 +40,7 @@ public class GenerateChildRouteTask {
// 查询画像和路径都审核通过的在签患者 // 查询画像和路径都审核通过的在签患者
SignPatientListDto signPatientRecord = new SignPatientListDto(); SignPatientListDto signPatientRecord = new SignPatientListDto();
signPatientRecord.setRouteCheckStatus(RouteCheckStatusEnum.AGREE.getInfo()); signPatientRecord.setRouteCheckStatus(RouteCheckStatusEnum.AGREE.getInfo());
signPatientRecord.setServiceStatus(SignRecordServiceStatusConstants.IN_SIGN); signPatientRecord.setServiceStatus(SignRecordServiceStatusConstants.SERVICE_CENTER);
List<SignPatientListVo> signPatientList = signPatientRecordMapper.selectList(signPatientRecord); List<SignPatientListVo> signPatientList = signPatientRecordMapper.selectList(signPatientRecord);
// 查询患者签约专病路径包含的子路径id // 查询患者签约专病路径包含的子路径id
signPatientList.forEach(signPatient -> { signPatientList.forEach(signPatient -> {