暂存。

This commit is contained in:
haown 2024-07-03 14:29:23 +08:00
parent 5ba970da7f
commit 569e60a0eb

View File

@ -58,9 +58,11 @@ import com.xinelu.manage.vo.signpatientmanageroutenode.AppletRouteNodeListVo;
import com.xinelu.manage.vo.signpatientmanageroutenode.PatientManageNodeInfoVo; import com.xinelu.manage.vo.signpatientmanageroutenode.PatientManageNodeInfoVo;
import com.xinelu.manage.vo.signpatientmanageroutenode.PatientManageNodeListVo; import com.xinelu.manage.vo.signpatientmanageroutenode.PatientManageNodeListVo;
import com.xinelu.manage.vo.signpatientmanageroutenode.PatientTaskVo; import com.xinelu.manage.vo.signpatientmanageroutenode.PatientTaskVo;
import com.xinelu.manage.vo.signpatientmanageroutenode.SignPatientManageNodeAuditVo;
import com.xinelu.manage.vo.signpatientmanageroutenode.SignPatientManageRouteNodeInfoVo; import com.xinelu.manage.vo.signpatientmanageroutenode.SignPatientManageRouteNodeInfoVo;
import com.xinelu.manage.vo.signpatientmanageroutenode.SignPatientManageRouteNodeVo; import com.xinelu.manage.vo.signpatientmanageroutenode.SignPatientManageRouteNodeVo;
import com.xinelu.manage.vo.specialdiseasenode.PatientSpecialDiseaseNodeVo; import com.xinelu.manage.vo.specialdiseasenode.PatientSpecialDiseaseNodeVo;
import com.xinelu.manage.vo.specialdiseasenode.SpecialDiseaseNodeVO;
import com.xinelu.manage.vo.specialdiseaseroute.SpecialDiseaseRouteVO; import com.xinelu.manage.vo.specialdiseaseroute.SpecialDiseaseRouteVO;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.math.BigDecimal; import java.math.BigDecimal;
@ -770,7 +772,7 @@ public class SignPatientManageRouteNodeServiceImpl implements ISignPatientManage
// 查询路径节点 // 查询路径节点
SpecialDiseaseNode specialDiseaseNodeQuery = new SpecialDiseaseNode(); SpecialDiseaseNode specialDiseaseNodeQuery = new SpecialDiseaseNode();
specialDiseaseNodeQuery.setRouteId(signPatientManageRoute.getRouteId()); specialDiseaseNodeQuery.setRouteId(signPatientManageRoute.getRouteId());
List<SpecialDiseaseNode> nodeList = specialDiseaseNodeMapper.selectSpecialDiseaseNodeList(specialDiseaseNodeQuery); List<SpecialDiseaseNodeVO> nodeList = specialDiseaseNodeMapper.selectSpeciaDiseaseNodeVoList(specialDiseaseNodeQuery);
// 查询患者画像信息 // 查询患者画像信息
List<LabelFieldInfoContentVo> labelFieldContentList = labelFieldContentMapper.selectByPatientId(patientId); List<LabelFieldInfoContentVo> labelFieldContentList = labelFieldContentMapper.selectByPatientId(patientId);
if (CollectionUtils.isEmpty(labelFieldContentList)) { if (CollectionUtils.isEmpty(labelFieldContentList)) {
@ -824,7 +826,7 @@ public class SignPatientManageRouteNodeServiceImpl implements ISignPatientManage
// 替换nodeContent // 替换nodeContent
List<SignPatientManageRouteNode> manageNodeList = new ArrayList<>(); List<SignPatientManageRouteNode> manageNodeList = new ArrayList<>();
if (StringUtils.contains(node.getNodeContent(), "data-w-e-type")) { if (StringUtils.contains(node.getNodeContent(), "data-w-e-type")) {
manageNodeList = replaceNodeContent(manageRouteNode, node, labelFieldContentList); manageNodeList = replaceNodeContent(manageRouteNode, node.getTaskPartitionDictId(), labelFieldContentList);
} else { } else {
manageNodeList.add(manageRouteNode); manageNodeList.add(manageRouteNode);
} }
@ -863,7 +865,7 @@ public class SignPatientManageRouteNodeServiceImpl implements ISignPatientManage
//过滤出符合条件的对象不匹配返回null //过滤出符合条件的对象不匹配返回null
LabelFieldInfoContentVo labelFieldContent = labelFieldContentList.stream().filter(s -> Objects.equals(s.getFieldCode(), matcher.group(1))).findFirst().orElse(null); LabelFieldInfoContentVo labelFieldContent = labelFieldContentList.stream().filter(s -> Objects.equals(s.getFieldCode(), matcher.group(1))).findFirst().orElse(null);
if (ObjectUtils.isNotEmpty(labelFieldContent)) { if (ObjectUtils.isNotEmpty(labelFieldContent)) {
flowScheme = flowScheme.replaceAll("#\\{([^\\}]*)\\}", ObjectUtils.isEmpty(labelFieldContent) ? "" : labelFieldContent.getFieldValue()); flowScheme = flowScheme.replaceAll("#\\{"+matcher.group(1) +"\\}", ObjectUtils.isEmpty(labelFieldContent) ? "" : labelFieldContent.getFieldValue());
} }
} }
} }
@ -887,7 +889,7 @@ public class SignPatientManageRouteNodeServiceImpl implements ISignPatientManage
// 过滤出符合条件的对象不匹配返回null // 过滤出符合条件的对象不匹配返回null
LabelFieldInfoContentVo labelFieldContent = labelFieldContentList.stream().filter(s -> Objects.equals(s.getFieldCode(), matcher.group(1))).findFirst().orElse(null); LabelFieldInfoContentVo labelFieldContent = labelFieldContentList.stream().filter(s -> Objects.equals(s.getFieldCode(), matcher.group(1))).findFirst().orElse(null);
if (ObjectUtils.isNotEmpty(labelFieldContent)) { if (ObjectUtils.isNotEmpty(labelFieldContent)) {
textMessageContent = textMessageContent.replaceAll("#\\{([^\\}]*)\\}", ObjectUtils.isEmpty(labelFieldContent) ? "" : labelFieldContent.getFieldValue()); textMessageContent = textMessageContent.replaceAll("#\\{"+matcher.group(1) +"\\}", ObjectUtils.isEmpty(labelFieldContent) ? "" : labelFieldContent.getFieldValue());
} }
} }
return textMessageContent; return textMessageContent;
@ -910,7 +912,7 @@ public class SignPatientManageRouteNodeServiceImpl implements ISignPatientManage
} }
// 替换小程序模板 // 替换小程序模板
if (node.getAppletPushSign() != null && node.getAppletPushSign() == 1) { if (node.getAppletPushSign() != null && node.getAppletPushSign() == 1) {
manageRouteNode.setAppletNodeContent(replaceWeChatTemplate(node.getOfficialTemplateId(), labelFieldContentList)); manageRouteNode.setAppletNodeContent(replaceWeChatTemplate(node.getAppletTemplateId(), labelFieldContentList));
} }
} }
@ -931,7 +933,7 @@ public class SignPatientManageRouteNodeServiceImpl implements ISignPatientManage
// 过滤出符合条件的对象不匹配返回null // 过滤出符合条件的对象不匹配返回null
LabelFieldInfoContentVo labelFieldContent = labelFieldContentList.stream().filter(s -> Objects.equals(s.getFieldCode(), matcher.group(1))).findFirst().orElse(null); LabelFieldInfoContentVo labelFieldContent = labelFieldContentList.stream().filter(s -> Objects.equals(s.getFieldCode(), matcher.group(1))).findFirst().orElse(null);
if (ObjectUtils.isNotEmpty(labelFieldContent)) { if (ObjectUtils.isNotEmpty(labelFieldContent)) {
templateContent = templateContent.replaceAll("#\\{([^\\}]*)\\}", ObjectUtils.isEmpty(labelFieldContent) ? "" : labelFieldContent.getFieldValue()); templateContent = templateContent.replaceAll("#\\{"+matcher.group(1) +"\\}", ObjectUtils.isEmpty(labelFieldContent) ? "" : labelFieldContent.getFieldValue());
} }
} }
return templateContent; return templateContent;
@ -939,24 +941,46 @@ public class SignPatientManageRouteNodeServiceImpl implements ISignPatientManage
/** /**
* 替换节点内容 * 替换节点内容
* @param node 节点 * @param taskPartitionDictId 节点任务细分id
* @param labelFieldContentList 画像信息 * @param labelFieldContentList 画像信息
* @return 替换标签后的节点列表 * @return 替换标签后的节点列表
*/ */
private List<SignPatientManageRouteNode> replaceNodeContent(SignPatientManageRouteNode manageRouteNode, SpecialDiseaseNode node, List<LabelFieldInfoContentVo> labelFieldContentList) { private List<SignPatientManageRouteNode> replaceNodeContent(SignPatientManageRouteNode manageRouteNode, Long taskPartitionDictId, List<LabelFieldInfoContentVo> labelFieldContentList) {
List<SignPatientManageRouteNode> manageNodeList = new ArrayList<>(); List<SignPatientManageRouteNode> manageNodeList = new ArrayList<>();
// 按照任务细分分组 Map<String, List<LabelFieldInfoContentVo>> groupByRang = labelFieldContentList.stream().collect(Collectors.groupingBy(LabelFieldInfoContentVo::getApplyRange));
Map<Long, List<LabelFieldInfoContentVo>> groupbyPartition = labelFieldContentList.stream().collect(Collectors.groupingBy(LabelFieldInfoContentVo::getTaskPartitionDictId)); // 筛选应用范围是否有私用的画像
List<LabelFieldInfoContentVo> nodeParamList = groupbyPartition.get(node.getTaskSubdivision()); List<LabelFieldInfoContentVo> privateLabelFields = groupByRang.get("PRIVATE");
// 参数按照序列号分组 List<LabelFieldInfoContentVo> publicLabelFields = groupByRang.get("PUBLIC");
if (CollectionUtils.isNotEmpty(nodeParamList)) {
Map<String, List<LabelFieldInfoContentVo>> groupBySn = nodeParamList.stream().collect(Collectors.groupingBy(LabelFieldInfoContentVo::getPortraitSn)); // 按照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()) { for (String portraitSn : groupBySn.keySet()) {
SignPatientManageRouteNode manageNode = new SignPatientManageRouteNode(); SignPatientManageNodeAuditVo manageNode = new SignPatientManageNodeAuditVo();
BeanUtils.copyBeanProp(manageNode, manageRouteNode); BeanUtils.copyBeanProp(manageNode, manageRouteNode);
// 替换文本 // 替换文本
List<LabelFieldInfoContentVo> nodeParams = groupBySn.get(portraitSn); 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)); Map<String, String> map = nodeParams.stream().collect(Collectors.toMap(LabelFieldInfoContentVo::getFieldCode,LabelFieldInfoContentVo::getFieldValue,(key1,key2)->key2));
Document document = Jsoup.parse(manageNode.getNodeContent()); Document document = Jsoup.parse(manageNode.getNodeContent());
// 需要提取的span // 需要提取的span