患者信息管理列表id倒序排序。
This commit is contained in:
parent
d2615383e7
commit
741870be67
@ -26,8 +26,6 @@ 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.signroutetriggercondition.SignRouteTriggerCondition;
|
||||
import com.xinelu.manage.domain.textmessage.TextMessage;
|
||||
import com.xinelu.manage.domain.wechattemplate.WechatTemplate;
|
||||
import com.xinelu.manage.dto.manualfollowup.ManualFollowUpDTO;
|
||||
import com.xinelu.manage.dto.patientquestionoptionresult.PatientQuestionOptionResultDTO;
|
||||
import com.xinelu.manage.dto.patientquestionsubjectresult.PatientQuestionSubjectResultDTO;
|
||||
@ -67,8 +65,6 @@ import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
import javax.annotation.Resource;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
@ -506,7 +502,7 @@ public class SignPatientManageRouteServiceImpl implements ISignPatientManageRout
|
||||
ScriptInfo scriptInfo = scriptInfoMapper.selectScriptInfoById(node.getPhoneTemplateId());
|
||||
if (ObjectUtils.isNotEmpty(scriptInfo)) {
|
||||
// 话术库json内容替换
|
||||
manageRouteNode.setPhoneNodeContent(getFlowScheme(scriptInfo.getFlowScheme(), labelFieldContentList));
|
||||
manageRouteNode.setPhoneNodeContent(signPatientManageRouteNodeService.getFlowScheme(scriptInfo.getFlowScheme(), labelFieldContentList));
|
||||
templateDetail = JSONObject.parseObject(JSONObject.toJSONString(scriptInfo));
|
||||
manageRouteNode.setTemplateType(TemplateTypeConstants.SCRIPT);
|
||||
manageRouteNode.setTemplateDetail(templateDetail);
|
||||
@ -514,7 +510,7 @@ public class SignPatientManageRouteServiceImpl implements ISignPatientManageRout
|
||||
// 电话短信内容
|
||||
if (node.getPhoneMessageTemplateId() != null) {
|
||||
// 查询短信库
|
||||
manageRouteNode.setPhoneMessageTemplateContent(replaceMessageInfo(node.getPhoneMessageTemplateId(), labelFieldContentList));
|
||||
manageRouteNode.setPhoneMessageTemplateContent(signPatientManageRouteNodeService.replaceMessageInfo(node.getPhoneMessageTemplateId(), labelFieldContentList));
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -548,7 +544,7 @@ public class SignPatientManageRouteServiceImpl implements ISignPatientManageRout
|
||||
ScriptInfo scriptInfo = scriptInfoMapper.selectScriptInfoById(manageNode.getPhoneId());
|
||||
if (ObjectUtils.isNotEmpty(scriptInfo)) {
|
||||
// 话术库json内容替换
|
||||
manageNode.setPhoneNodeContent(getFlowScheme(scriptInfo.getFlowScheme(), labelFieldContentList));
|
||||
manageNode.setPhoneNodeContent(signPatientManageRouteNodeService.getFlowScheme(scriptInfo.getFlowScheme(), labelFieldContentList));
|
||||
templateDetail = JSONObject.parseObject(JSONObject.toJSONString(scriptInfo));
|
||||
manageNode.setTemplateType(TemplateTypeConstants.SCRIPT);
|
||||
manageNode.setTemplateDetail(templateDetail);
|
||||
@ -565,7 +561,7 @@ public class SignPatientManageRouteServiceImpl implements ISignPatientManageRout
|
||||
// 电话短信内容
|
||||
if (manageNode.getPhoneMessageTemplateId() != null) {
|
||||
// 查询短信库
|
||||
manageNode.setPhoneMessageTemplateContent(replaceMessageInfo(manageNode.getPhoneMessageTemplateId(), labelFieldContentList));
|
||||
manageNode.setPhoneMessageTemplateContent(signPatientManageRouteNodeService.replaceMessageInfo(manageNode.getPhoneMessageTemplateId(), labelFieldContentList));
|
||||
}
|
||||
break;
|
||||
// 问卷
|
||||
@ -710,101 +706,24 @@ public class SignPatientManageRouteServiceImpl implements ISignPatientManageRout
|
||||
signPatientManageRouteNodes.add(signPatientManageRouteNode);
|
||||
}
|
||||
|
||||
/**
|
||||
* 话术json参数替换
|
||||
* @param flowScheme 话术json
|
||||
* @param labelFieldContentList 患者画像信息
|
||||
* @return
|
||||
*/
|
||||
private String getFlowScheme(String flowScheme, List<LabelFieldInfoContentVo> labelFieldContentList) {
|
||||
// 话术库json内容替换
|
||||
if (StringUtils.isNotBlank(flowScheme)) {
|
||||
// 替换{{}}中的内容
|
||||
Pattern pattern = Pattern.compile("#\\{([^\\}]*)\\}");
|
||||
Matcher matcher = pattern.matcher(flowScheme);
|
||||
while (matcher.find()) {
|
||||
//过滤出符合条件的对象,不匹配返回null。
|
||||
LabelFieldInfoContentVo labelFieldContent = labelFieldContentList.stream().filter(s -> Objects.equals(s.getFieldCode(), matcher.group(1))).findFirst().orElse(null);
|
||||
if (ObjectUtils.isNotEmpty(labelFieldContent)) {
|
||||
flowScheme = flowScheme.replaceAll("#\\{"+matcher.group(1) +"\\}", ObjectUtils.isEmpty(labelFieldContent) ? "" : labelFieldContent.getFieldValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
return flowScheme;
|
||||
}
|
||||
|
||||
/**
|
||||
* * 短信模板内容
|
||||
* @param messageTemplateId 短信模板主键
|
||||
* @param labelFieldContentList 患者画像信息
|
||||
* @return 替换标签后的内容
|
||||
*/
|
||||
private String replaceMessageInfo(Long messageTemplateId, List<LabelFieldInfoContentVo> labelFieldContentList) {
|
||||
// 查询短信模板
|
||||
TextMessage textMessage = textMessageMapper.selectTextMessageById(messageTemplateId);
|
||||
if (ObjectUtils.isNotEmpty(textMessage)) {
|
||||
String textMessageContent = textMessage.getTextMessageContent();
|
||||
if (StringUtils.isBlank(textMessageContent)) {
|
||||
return null;
|
||||
}
|
||||
// 替换{{}}中的内容
|
||||
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 null;
|
||||
}
|
||||
|
||||
private void replaceTemplateInfo(SignPatientManageNodeAuditVo manageRouteNode, RouteTaskAuditVo node, List<LabelFieldInfoContentVo> labelFieldContentList) {
|
||||
if (node.getMessageTemplateId() != null) {
|
||||
// 替换短信模板
|
||||
manageRouteNode.setMessageNodeContent(replaceMessageInfo(node.getMessageTemplateId(), labelFieldContentList));
|
||||
manageRouteNode.setMessageNodeContent(signPatientManageRouteNodeService.replaceMessageInfo(node.getMessageTemplateId(), labelFieldContentList));
|
||||
}
|
||||
if (node.getPhoneMessageTemplateId() != null) {
|
||||
// 替换短信模板
|
||||
manageRouteNode.setPhoneMessageTemplateContent(replaceMessageInfo(node.getPhoneMessageTemplateId(), labelFieldContentList));
|
||||
manageRouteNode.setPhoneMessageTemplateContent(signPatientManageRouteNodeService.replaceMessageInfo(node.getPhoneMessageTemplateId(), labelFieldContentList));
|
||||
}
|
||||
// 替换公众号模板
|
||||
if (node.getOfficialPushSign() != null && node.getOfficialPushSign() == 1) {
|
||||
manageRouteNode.setOfficialNodeContent(replaceWeChatTemplate(node.getOfficialTemplateId(), labelFieldContentList));
|
||||
manageRouteNode.setOfficialNodeContent(signPatientManageRouteNodeService.replaceWeChatTemplate(node.getOfficialTemplateId(), labelFieldContentList));
|
||||
}
|
||||
// 替换小程序模板
|
||||
if (node.getAppletPushSign() != null && node.getAppletPushSign() == 1) {
|
||||
manageRouteNode.setAppletNodeContent(replaceWeChatTemplate(node.getAppletTemplateId(), labelFieldContentList));
|
||||
manageRouteNode.setAppletNodeContent(signPatientManageRouteNodeService.replaceWeChatTemplate(node.getAppletTemplateId(), labelFieldContentList));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 替换公众号、小程序模板内容
|
||||
* @param templateId 微信库模板id
|
||||
* @param labelFieldContentList 患者画像信息
|
||||
*/
|
||||
private String replaceWeChatTemplate(Long templateId, List<LabelFieldInfoContentVo> labelFieldContentList) {
|
||||
WechatTemplate wechatTemplate = wechatTemplateMapper.selectWechatTemplateById(templateId);
|
||||
if (ObjectUtils.isEmpty(wechatTemplate)){
|
||||
return null;
|
||||
}
|
||||
String templateContent = wechatTemplate.getTemplateContent();
|
||||
if (StringUtils.isBlank(templateContent)) {
|
||||
return null;
|
||||
}
|
||||
Pattern pattern = Pattern.compile("#\\{([^\\}]*)\\}");
|
||||
Matcher matcher = pattern.matcher(templateContent);
|
||||
while (matcher.find()) {
|
||||
// 过滤出符合条件的对象,不匹配返回null。
|
||||
LabelFieldInfoContentVo labelFieldContent = labelFieldContentList.stream().filter(s -> Objects.equals(s.getFieldCode(), matcher.group(1))).findFirst().orElse(null);
|
||||
if (ObjectUtils.isNotEmpty(labelFieldContent)) {
|
||||
templateContent = templateContent.replaceAll("#\\{"+matcher.group(1) +"\\}", ObjectUtils.isEmpty(labelFieldContent) ? "" : labelFieldContent.getFieldValue());
|
||||
}
|
||||
}
|
||||
return templateContent;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -171,4 +171,27 @@ public interface ISignPatientManageRouteNodeService {
|
||||
* @return 签约路径节点列表
|
||||
*/
|
||||
List<SignPatientManageNodeAuditVo> replaceNodeContent(SignPatientManageNodeAuditVo manageRouteNode, Long taskPartitionDictId, List<LabelFieldInfoContentVo> labelFieldContentList);
|
||||
|
||||
/**
|
||||
* 话术json参数替换
|
||||
* @param flowScheme 话术json
|
||||
* @param labelFieldContentList 患者画像信息
|
||||
* @return 替换标签后的话术json
|
||||
*/
|
||||
String getFlowScheme(String flowScheme, List<LabelFieldInfoContentVo> labelFieldContentList);
|
||||
|
||||
/**
|
||||
* 替换公众号、小程序模板内容
|
||||
* @param templateId 微信库模板id
|
||||
* @param labelFieldContentList 患者画像信息
|
||||
*/
|
||||
String replaceWeChatTemplate(Long templateId, List<LabelFieldInfoContentVo> labelFieldContentList);
|
||||
|
||||
/**
|
||||
* * 短信模板内容
|
||||
* @param messageTemplateId 短信模板主键
|
||||
* @param labelFieldContentList 患者画像信息
|
||||
* @return 替换标签后的内容
|
||||
*/
|
||||
String replaceMessageInfo(Long messageTemplateId, List<LabelFieldInfoContentVo> labelFieldContentList);
|
||||
}
|
||||
|
||||
@ -761,6 +761,148 @@ public class SignPatientManageRouteNodeServiceImpl implements ISignPatientManage
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 话术json参数替换
|
||||
* @param flowScheme 话术json
|
||||
* @param labelFieldContentList 患者画像信息
|
||||
* @return 替换标签后的话术json
|
||||
*/
|
||||
@Override
|
||||
public String getFlowScheme(String flowScheme, List<LabelFieldInfoContentVo> labelFieldContentList) {
|
||||
// 话术库json内容替换
|
||||
if (StringUtils.isNotBlank(flowScheme)) {
|
||||
// 替换{{}}中的内容
|
||||
Pattern pattern = Pattern.compile("#\\{([^\\}]*)\\}");
|
||||
Matcher matcher = pattern.matcher(flowScheme);
|
||||
while (matcher.find()) {
|
||||
//过滤出符合条件的对象,不匹配返回null。
|
||||
LabelFieldInfoContentVo labelFieldContent = labelFieldContentList.stream().filter(s -> Objects.equals(s.getFieldCode(), matcher.group(1))).findFirst().orElse(null);
|
||||
if (ObjectUtils.isNotEmpty(labelFieldContent)) {
|
||||
flowScheme = flowScheme.replaceAll("#\\{"+matcher.group(1) +"\\}", ObjectUtils.isEmpty(labelFieldContent) ? "" : labelFieldContent.getFieldValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
return flowScheme;
|
||||
}
|
||||
|
||||
/**
|
||||
* * 短信模板内容
|
||||
* @param messageTemplateId 短信模板主键
|
||||
* @param labelFieldContentList 患者画像信息
|
||||
* @return 替换标签后的内容
|
||||
*/
|
||||
@Override
|
||||
public String replaceMessageInfo(Long messageTemplateId, List<LabelFieldInfoContentVo> labelFieldContentList) {
|
||||
// 查询短信模板
|
||||
TextMessage textMessage = textMessageMapper.selectTextMessageById(messageTemplateId);
|
||||
if (ObjectUtils.isNotEmpty(textMessage)) {
|
||||
String textMessageContent = textMessage.getTextMessageContent();
|
||||
if (StringUtils.isBlank(textMessageContent)) {
|
||||
return null;
|
||||
}
|
||||
// 替换{{}}中的内容
|
||||
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 null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 替换公众号、小程序模板内容
|
||||
* @param templateId 微信库模板id
|
||||
* @param labelFieldContentList 患者画像信息
|
||||
*/
|
||||
@Override
|
||||
public String replaceWeChatTemplate(Long templateId, List<LabelFieldInfoContentVo> labelFieldContentList) {
|
||||
WechatTemplate wechatTemplate = wechatTemplateMapper.selectWechatTemplateById(templateId);
|
||||
if (ObjectUtils.isEmpty(wechatTemplate)){
|
||||
return null;
|
||||
}
|
||||
String templateContent = wechatTemplate.getTemplateContent();
|
||||
if (StringUtils.isBlank(templateContent)) {
|
||||
return null;
|
||||
}
|
||||
Pattern pattern = Pattern.compile("#\\{([^\\}]*)\\}");
|
||||
Matcher matcher = pattern.matcher(templateContent);
|
||||
while (matcher.find()) {
|
||||
// 过滤出符合条件的对象,不匹配返回null。
|
||||
LabelFieldInfoContentVo labelFieldContent = labelFieldContentList.stream().filter(s -> Objects.equals(s.getFieldCode(), matcher.group(1))).findFirst().orElse(null);
|
||||
if (ObjectUtils.isNotEmpty(labelFieldContent)) {
|
||||
templateContent = templateContent.replaceAll("#\\{"+matcher.group(1) +"\\}", ObjectUtils.isEmpty(labelFieldContent) ? "" : labelFieldContent.getFieldValue());
|
||||
}
|
||||
}
|
||||
return templateContent;
|
||||
}
|
||||
|
||||
/**
|
||||
* 替换节点标签内容
|
||||
* @param manageRouteNode 签约管理路径节点
|
||||
* @param taskPartitionDictId 专病节点任务细分
|
||||
* @param labelFieldContentList 患者画像
|
||||
* @return 签约路径节点列表
|
||||
*/
|
||||
@Override
|
||||
public List<SignPatientManageNodeAuditVo> replaceNodeContent(SignPatientManageNodeAuditVo manageRouteNode, Long taskPartitionDictId, List<LabelFieldInfoContentVo> labelFieldContentList) {
|
||||
List<SignPatientManageNodeAuditVo> manageNodeList = new ArrayList<>();
|
||||
Map<String, List<LabelFieldInfoContentVo>> groupByRang = labelFieldContentList.stream().collect(Collectors.groupingBy(LabelFieldInfoContentVo::getApplyRange));
|
||||
// 筛选应用范围是否有私用的画像
|
||||
List<LabelFieldInfoContentVo> privateLabelFields = groupByRang.get("PRIVATE");
|
||||
List<LabelFieldInfoContentVo> publicLabelFields = groupByRang.get("PUBLIC");
|
||||
|
||||
// 按照sn进行分组,判断生成几条任务
|
||||
Map<Long, List<LabelFieldInfoContentVo>> groupByPartition = privateLabelFields.stream().collect(Collectors.groupingBy(LabelFieldInfoContentVo::getTaskPartitionDictId));
|
||||
List<LabelFieldInfoContentVo> nodeLabelFieldContent = groupByPartition.get(taskPartitionDictId);
|
||||
if (CollectionUtils.isEmpty(privateLabelFields) || CollectionUtils.isEmpty(nodeLabelFieldContent)) {
|
||||
// 都是公有属性,只生成一条任务
|
||||
SignPatientManageNodeAuditVo manageNode = new SignPatientManageNodeAuditVo();
|
||||
BeanUtils.copyBeanProp(manageNode, manageRouteNode);
|
||||
// 替换文本
|
||||
Map<String, String> map = publicLabelFields.stream().collect(Collectors.toMap(LabelFieldInfoContentVo::getFieldCode,LabelFieldInfoContentVo::getFieldValue,(key1,key2)->key2));
|
||||
Document document = Jsoup.parse(manageNode.getNodeContent());
|
||||
// 需要提取的span
|
||||
Elements spanlist = document.select("span[data-w-e-type]");
|
||||
for (Element span : spanlist) {
|
||||
String paramKey = span.attr("data-fieldMark");
|
||||
span.text(map.getOrDefault(paramKey, ""));
|
||||
span.unwrap();
|
||||
}
|
||||
manageNode.setNodeContent(document.body().html());
|
||||
manageNodeList.add(manageNode);
|
||||
} else {
|
||||
Map<String, List<LabelFieldInfoContentVo>> groupBySn = nodeLabelFieldContent.stream().collect(Collectors.groupingBy(LabelFieldInfoContentVo::getPortraitSn));
|
||||
|
||||
for (String portraitSn : groupBySn.keySet()) {
|
||||
SignPatientManageNodeAuditVo manageNode = new SignPatientManageNodeAuditVo();
|
||||
BeanUtils.copyBeanProp(manageNode, manageRouteNode);
|
||||
// 替换文本
|
||||
List<LabelFieldInfoContentVo> nodeParams = groupBySn.get(portraitSn);
|
||||
nodeParams.addAll(publicLabelFields);
|
||||
|
||||
Map<String, String> map = nodeParams.stream().collect(Collectors.toMap(LabelFieldInfoContentVo::getFieldCode,LabelFieldInfoContentVo::getFieldValue,(key1,key2)->key2));
|
||||
Document document = Jsoup.parse(manageNode.getNodeContent());
|
||||
// 需要提取的span
|
||||
Elements spanlist = document.select("span[data-w-e-type]");
|
||||
for (Element span : spanlist) {
|
||||
String paramKey = span.attr("data-fieldMark");
|
||||
span.text(map.getOrDefault(paramKey, ""));
|
||||
span.unwrap();
|
||||
}
|
||||
manageNode.setNodeContent(document.body().html());
|
||||
manageNodeList.add(manageNode);
|
||||
}
|
||||
}
|
||||
|
||||
return manageNodeList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据管理路径生成任务
|
||||
* @param signPatientManageRoute 签约管理路径
|
||||
@ -853,58 +995,6 @@ public class SignPatientManageRouteNodeServiceImpl implements ISignPatientManage
|
||||
return document.body().html();
|
||||
}
|
||||
|
||||
/**
|
||||
* 话术json参数替换
|
||||
* @param flowScheme 话术json
|
||||
* @param labelFieldContentList 患者画像信息
|
||||
* @return
|
||||
*/
|
||||
private String getFlowScheme(String flowScheme, List<LabelFieldInfoContentVo> labelFieldContentList) {
|
||||
// 话术库json内容替换
|
||||
if (StringUtils.isNotBlank(flowScheme) && org.apache.commons.lang3.StringUtils.contains(flowScheme, "{{") && org.apache.commons.lang3.StringUtils.contains(flowScheme, "}}")) {
|
||||
// 替换#{}中的内容
|
||||
Pattern pattern = Pattern.compile("#\\{([^\\}]*)\\}");
|
||||
Matcher matcher = pattern.matcher(flowScheme);
|
||||
while (matcher.find()) {
|
||||
//过滤出符合条件的对象,不匹配返回null。
|
||||
LabelFieldInfoContentVo labelFieldContent = labelFieldContentList.stream().filter(s -> Objects.equals(s.getFieldCode(), matcher.group(1))).findFirst().orElse(null);
|
||||
if (ObjectUtils.isNotEmpty(labelFieldContent)) {
|
||||
flowScheme = flowScheme.replaceAll("#\\{"+matcher.group(1) +"\\}", ObjectUtils.isEmpty(labelFieldContent) ? "" : labelFieldContent.getFieldValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
return flowScheme;
|
||||
}
|
||||
|
||||
/**
|
||||
* * 短信模板内容
|
||||
* @param messageTemplateId 短信模板主键
|
||||
* @param labelFieldContentList 患者画像信息
|
||||
* @return
|
||||
*/
|
||||
private String replaceMessageInfo(Long messageTemplateId, List<LabelFieldInfoContentVo> labelFieldContentList) {
|
||||
// 查询短信模板
|
||||
TextMessage textMessage = textMessageMapper.selectTextMessageById(messageTemplateId);
|
||||
if (ObjectUtils.isNotEmpty(textMessage)) {
|
||||
String textMessageContent = textMessage.getTextMessageContent();
|
||||
if (StringUtils.isBlank(textMessageContent)) {
|
||||
return null;
|
||||
}
|
||||
// 替换{{}}中的内容
|
||||
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 null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 替换短信、公众号、小程序内容
|
||||
* @param manageRouteNode 签约路径节点
|
||||
@ -930,93 +1020,6 @@ public class SignPatientManageRouteNodeServiceImpl implements ISignPatientManage
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 替换公众号、小程序模板内容
|
||||
* @param templateId 微信库模板id
|
||||
* @param labelFieldContentList 患者画像信息
|
||||
*/
|
||||
private String replaceWeChatTemplate(Long templateId, List<LabelFieldInfoContentVo> labelFieldContentList) {
|
||||
WechatTemplate wechatTemplate = wechatTemplateMapper.selectWechatTemplateById(templateId);
|
||||
if (ObjectUtils.isEmpty(wechatTemplate)){
|
||||
return null;
|
||||
}
|
||||
String templateContent = wechatTemplate.getTemplateContent();
|
||||
if (StringUtils.isBlank(templateContent)) {
|
||||
return null;
|
||||
}
|
||||
Pattern pattern = Pattern.compile("#\\{([^\\}]*)\\}");
|
||||
Matcher matcher = pattern.matcher(templateContent);
|
||||
while (matcher.find()) {
|
||||
// 过滤出符合条件的对象,不匹配返回null。
|
||||
LabelFieldInfoContentVo labelFieldContent = labelFieldContentList.stream().filter(s -> Objects.equals(s.getFieldCode(), matcher.group(1))).findFirst().orElse(null);
|
||||
if (ObjectUtils.isNotEmpty(labelFieldContent)) {
|
||||
templateContent = templateContent.replaceAll("#\\{"+matcher.group(1) +"\\}", ObjectUtils.isEmpty(labelFieldContent) ? "" : labelFieldContent.getFieldValue());
|
||||
}
|
||||
}
|
||||
return templateContent;
|
||||
}
|
||||
|
||||
/**
|
||||
* 替换节点标签内容
|
||||
* @param manageRouteNode 签约管理路径节点
|
||||
* @param taskPartitionDictId 专病节点任务细分
|
||||
* @param labelFieldContentList 患者画像
|
||||
* @return 签约路径节点列表
|
||||
*/
|
||||
@Override
|
||||
public List<SignPatientManageNodeAuditVo> replaceNodeContent(SignPatientManageNodeAuditVo manageRouteNode, Long taskPartitionDictId, List<LabelFieldInfoContentVo> labelFieldContentList) {
|
||||
List<SignPatientManageNodeAuditVo> manageNodeList = new ArrayList<>();
|
||||
Map<String, List<LabelFieldInfoContentVo>> groupByRang = labelFieldContentList.stream().collect(Collectors.groupingBy(LabelFieldInfoContentVo::getApplyRange));
|
||||
// 筛选应用范围是否有私用的画像
|
||||
List<LabelFieldInfoContentVo> privateLabelFields = groupByRang.get("PRIVATE");
|
||||
List<LabelFieldInfoContentVo> publicLabelFields = groupByRang.get("PUBLIC");
|
||||
|
||||
// 按照sn进行分组,判断生成几条任务
|
||||
Map<Long, List<LabelFieldInfoContentVo>> groupByPartition = privateLabelFields.stream().collect(Collectors.groupingBy(LabelFieldInfoContentVo::getTaskPartitionDictId));
|
||||
List<LabelFieldInfoContentVo> nodeLabelFieldContent = groupByPartition.get(taskPartitionDictId);
|
||||
if (CollectionUtils.isEmpty(privateLabelFields) || CollectionUtils.isEmpty(nodeLabelFieldContent)) {
|
||||
// 都是公有属性,只生成一条任务
|
||||
SignPatientManageNodeAuditVo manageNode = new SignPatientManageNodeAuditVo();
|
||||
BeanUtils.copyBeanProp(manageNode, manageRouteNode);
|
||||
// 替换文本
|
||||
Map<String, String> map = publicLabelFields.stream().collect(Collectors.toMap(LabelFieldInfoContentVo::getFieldCode,LabelFieldInfoContentVo::getFieldValue,(key1,key2)->key2));
|
||||
Document document = Jsoup.parse(manageNode.getNodeContent());
|
||||
// 需要提取的span
|
||||
Elements spanlist = document.select("span[data-w-e-type]");
|
||||
for (Element span : spanlist) {
|
||||
String paramKey = span.attr("data-fieldMark");
|
||||
span.text(map.getOrDefault(paramKey, ""));
|
||||
span.unwrap();
|
||||
}
|
||||
manageNode.setNodeContent(document.body().html());
|
||||
manageNodeList.add(manageNode);
|
||||
} else {
|
||||
Map<String, List<LabelFieldInfoContentVo>> groupBySn = nodeLabelFieldContent.stream().collect(Collectors.groupingBy(LabelFieldInfoContentVo::getPortraitSn));
|
||||
|
||||
for (String portraitSn : groupBySn.keySet()) {
|
||||
SignPatientManageNodeAuditVo manageNode = new SignPatientManageNodeAuditVo();
|
||||
BeanUtils.copyBeanProp(manageNode, manageRouteNode);
|
||||
// 替换文本
|
||||
List<LabelFieldInfoContentVo> nodeParams = groupBySn.get(portraitSn);
|
||||
nodeParams.addAll(publicLabelFields);
|
||||
|
||||
Map<String, String> map = nodeParams.stream().collect(Collectors.toMap(LabelFieldInfoContentVo::getFieldCode,LabelFieldInfoContentVo::getFieldValue,(key1,key2)->key2));
|
||||
Document document = Jsoup.parse(manageNode.getNodeContent());
|
||||
// 需要提取的span
|
||||
Elements spanlist = document.select("span[data-w-e-type]");
|
||||
for (Element span : spanlist) {
|
||||
String paramKey = span.attr("data-fieldMark");
|
||||
span.text(map.getOrDefault(paramKey, ""));
|
||||
span.unwrap();
|
||||
}
|
||||
manageNode.setNodeContent(document.body().html());
|
||||
manageNodeList.add(manageNode);
|
||||
}
|
||||
}
|
||||
|
||||
return manageNodeList;
|
||||
}
|
||||
|
||||
private boolean judgeTriggerCondition(SpecialDiseaseTriggerCondition triggerCondition, PatientAllInfoViewUppercase patientAllInfo, List<LabelFieldInfoContentVo> labelFieldContentList) {
|
||||
List<String> labelValueList = new ArrayList<>();
|
||||
String triggerConditionCode = triggerCondition.getTriggerConditionCode().replaceAll("_", "");
|
||||
|
||||
@ -65,6 +65,7 @@
|
||||
<!-- 数据范围过滤 -->
|
||||
${params.dataScope}
|
||||
</where>
|
||||
order by b.id desc
|
||||
</select>
|
||||
|
||||
<select id="selectPatientBlacklistById" parameterType="Long"
|
||||
|
||||
@ -166,6 +166,7 @@
|
||||
<!-- 数据范围过滤 -->
|
||||
${params.dataScope}
|
||||
</where>
|
||||
order by p.id desc
|
||||
</select>
|
||||
|
||||
<select id="selectPatientInfoById" parameterType="Long" resultMap="PatientInfoResult">
|
||||
|
||||
@ -341,7 +341,7 @@
|
||||
<!-- 数据范围过滤 -->
|
||||
${params.dataScope}
|
||||
</where>
|
||||
order by p.appointment_date
|
||||
order by p.id desc
|
||||
</select>
|
||||
|
||||
<select id="selectApplyList" parameterType="com.xinelu.manage.domain.patientprehospitalization.PatientPreHospitalization" resultMap="BaseResultMap">
|
||||
|
||||
@ -483,6 +483,7 @@
|
||||
<!-- 数据范围过滤 -->
|
||||
${params.dataScope}
|
||||
</where>
|
||||
order by sign.id desc
|
||||
</select>
|
||||
<select id="getByRecordId" parameterType="java.lang.Long" resultType="com.xinelu.manage.vo.signpatientrecord.SignPatientInfoVo">
|
||||
select
|
||||
|
||||
Loading…
Reference in New Issue
Block a user