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

This commit is contained in:
youxilong 2024-07-04 09:27:05 +08:00
commit 6c507928fc
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()));
} else if (DATA_SCOPE_DEPT.equals(dataScope)) { // 部门数据权限
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 = "签约患者管理路径表主键列表")
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
@DataScope(agencyAlias = "p")
@DataScope(agencyAlias = "p",userAlias = "p.certificate_issuing_doctor_id")
public List<PatientPreHospitalization> selectList(PatientInfoDto patientInfo) {
return preHospitalizationMapper.selectList(patientInfo);
}

View File

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

View File

@ -755,7 +755,6 @@ public class SignPatientManageRouteNodeServiceImpl implements ISignPatientManage
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);
@ -813,11 +812,6 @@ public class SignPatientManageRouteNodeServiceImpl implements ISignPatientManage
// 话术库json内容替换
manageRouteNode.setPhoneNodeContent(getFlowScheme(scriptInfo.getFlowScheme(), labelFieldContentList));
}
// 电话短信内容
if (node.getPhoneMessageTemplateId() != null) {
// 查询短信库
manageRouteNode.setPhoneMessageTemplateContent(replaceMessageInfo(node.getPhoneMessageTemplateId(), labelFieldContentList));
}
break;
}
}
@ -839,9 +833,11 @@ public class SignPatientManageRouteNodeServiceImpl implements ISignPatientManage
manageNodeList.add(manageRouteNode);
}
nodeSaveList.addAll(manageNodeList);
// 保存
signPatientManageRouteNodeMapper.insertBatch(nodeSaveList);
});
// 保存
if(CollectionUtils.isNotEmpty(nodeSaveList)) {
signPatientManageRouteNodeMapper.insertBatch(nodeSaveList);
}
}
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) {
// 查询短信模板
TextMessage textMessage = textMessageMapper.selectTextMessageById(messageTemplateId);
String textMessageContent = textMessage.getTextMessageContent();
// 替换{{}}中的内容
Pattern pattern = Pattern.compile("#\\{([^\\}]*)\\}");
Matcher matcher = pattern.matcher(textMessage.getTextMessageContent());
while (matcher.find()) {
// 过滤出符合条件的对象不匹配返回null
LabelFieldInfoContentVo labelFieldContent = labelFieldContentList.stream().filter(s -> Objects.equals(s.getFieldCode(), matcher.group(1))).findFirst().orElse(null);
if (ObjectUtils.isNotEmpty(labelFieldContent)) {
textMessageContent = textMessageContent.replaceAll("#\\{"+matcher.group(1) +"\\}", ObjectUtils.isEmpty(labelFieldContent) ? "" : labelFieldContent.getFieldValue());
if (ObjectUtils.isNotEmpty(textMessage)) {
String textMessageContent = textMessage.getTextMessageContent();
// 替换{{}}中的内容
Pattern pattern = Pattern.compile("#\\{([^\\}]*)\\}");
Matcher matcher = pattern.matcher(textMessage.getTextMessageContent());
while (matcher.find()) {
// 过滤出符合条件的对象不匹配返回null
LabelFieldInfoContentVo labelFieldContent = labelFieldContentList.stream().filter(s -> Objects.equals(s.getFieldCode(), matcher.group(1))).findFirst().orElse(null);
if (ObjectUtils.isNotEmpty(labelFieldContent)) {
textMessageContent = textMessageContent.replaceAll("#\\{"+matcher.group(1) +"\\}", ObjectUtils.isEmpty(labelFieldContent) ? "" : labelFieldContent.getFieldValue());
}
}
return textMessageContent;
}
return textMessageContent;
return null;
}
/**
* 替换短信公众号小程序内容
* @param manageRouteNode 签约路径节点
* @param node
* @param labelFieldContentList
* @param node 专病路径节点
* @param 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));
}
if (node.getPhoneMessageTemplateId() != null) {
// 替换短信模板
manageRouteNode.setPhoneMessageTemplateContent(replaceMessageInfo(node.getPhoneMessageTemplateId(), labelFieldContentList));
}
// 替换公众号模板
if (node.getOfficialPushSign() != null && node.getOfficialPushSign() == 1) {
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) {
List<String> labelValueList = new ArrayList<>();
String triggerConditionCode = triggerCondition.getTriggerConditionCode().replaceAll("_", "");
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));
Field[] declaredFields = PatientAllInfoViewUppercase.class.getDeclaredFields();
List<Field> fieldList = Arrays.stream(declaredFields).collect(Collectors.toList());
fieldList.forEach(field -> {
if (StringUtils.equals(field.getName(), triggerConditionCode)) {
Class<?> clazz = patientAllInfo.getClass();
field.setAccessible(true);
// 获取字段的值
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)) {
labelValueList.addAll(labelFieldContentList.stream()
.filter(content -> StringUtils.equals(content.getFieldCode(), triggerCondition.getTriggerConditionCode()))
.filter(content -> StringUtils.equals(content.getFieldCode(), triggerConditionCode))
.map(LabelFieldInfoContentVo::getFieldValue)
.collect(Collectors.toList()));
}

View File

@ -465,7 +465,7 @@
<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,
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,
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,
@ -473,7 +473,8 @@
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},
#{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.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},

View File

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