瀏覽代碼

辅检规则

zhoutg 3 年之前
父節點
當前提交
1b7bf3240e

+ 16 - 0
src/main/java/com/diagbot/dto/PacsOtherDTO.java

@@ -0,0 +1,16 @@
+package com.diagbot.dto;
+
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * @Description: 其他值提醒辅检提示语
+ * @Author:zhoutg
+ * @time: 2020/8/12 15:53
+ */
+@Data
+public class PacsOtherDTO {
+    // 主提示语
+    private List<String> mainMsg;
+}

+ 10 - 1
src/main/java/com/diagbot/facade/CacheFacade.java

@@ -11,6 +11,7 @@ import com.diagbot.enums.RedisEnum;
 import com.diagbot.enums.StandConvertEnum;
 import com.diagbot.util.EntityUtil;
 import com.diagbot.util.ListUtil;
+import com.diagbot.util.MsgNewUtil;
 import com.diagbot.util.RedisUtil;
 import com.diagbot.util.StringUtil;
 import com.google.common.collect.Lists;
@@ -237,7 +238,7 @@ public class CacheFacade {
     public void loadMsg() {
         // 开单提示语
         redisUtil.delete(RedisEnum.msg.getName());
-        List<DictionaryInfoDTO> msgList = klDictionaryInfoFacade.getListByGroupType(Lists.newArrayList(41, 42, 43));
+        List<DictionaryInfoDTO> msgList = klDictionaryInfoFacade.getListByGroupType(Lists.newArrayList(41, 42, 43, 44));
         Map<Long, List<DictionaryInfoDTO>> groupTypeMap = EntityUtil.makeEntityListMap(msgList, "groupType");
         List<DictionaryInfoDTO> dictionaryInfoDTOList = groupTypeMap.get(41L);
         if (ListUtil.isNotEmpty(dictionaryInfoDTOList)) {
@@ -272,5 +273,13 @@ public class CacheFacade {
             }
             redisUtil.putHashMap(RedisEnum.criticalMsg.getName(), msgMap);
         }
+
+        // 以后待用
+        List<DictionaryInfoDTO> ma = groupTypeMap.get(44L);
+        Map<String, String> placeholderMap = MsgNewUtil.placeholderMap;
+        placeholderMap.clear();
+        for (DictionaryInfoDTO dictionaryInfoDTO : ma) {
+            placeholderMap.put(dictionaryInfoDTO.getName(), dictionaryInfoDTO.getVal());
+        }
     }
 }

+ 94 - 72
src/main/java/com/diagbot/process/OtherTipProcess.java

@@ -14,7 +14,6 @@ import com.diagbot.enums.RedisEnum;
 import com.diagbot.enums.RuleTypeEnum;
 import com.diagbot.enums.TypeEnum;
 import com.diagbot.facade.CommonFacade;
-import com.diagbot.model.entity.PD;
 import com.diagbot.model.entity.PacsNum;
 import com.diagbot.model.label.PacsLabel;
 import com.diagbot.rule.AgeRule;
@@ -30,6 +29,7 @@ import com.diagbot.util.RedisUtil;
 import com.diagbot.util.ReflectUtil;
 import com.diagbot.util.StringUtil;
 import com.diagbot.vo.RuleVO;
+import com.google.common.collect.Lists;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
@@ -94,10 +94,9 @@ public class OtherTipProcess {
      */
     public void processPacs(WordCrfDTO wordCrfDTO, IndicationDTO res) {
         PacsLabel pacsLabel = wordCrfDTO.getPacsLabel();
-        List<Item> itemList = pacsLabel.getRes();
+        List<RuleVO> ruleList = getRuleVO(pacsLabel);
         List<BillMsg> otherList = res.getOtherList();
-        for (Item item : itemList) {
-            RuleVO ruleVO = getRuleVO(item);
+        for (RuleVO ruleVO : ruleList) {
             // 1、获取相关数据
             if (ruleVO != null) {
                 RuleExtDTO ruleExtDTO = commonFacade.getRuleData(ruleVO);
@@ -108,66 +107,66 @@ public class OtherTipProcess {
                 for (RuleConditionDTO ruleConditionDTO : ruleConditionDTOList) {
                     List<RuleBaseDTO> ruleBaseDTOList = ruleConditionDTO.getRuleBaseDTOList();
                     // 2、规则匹配
-                    pacsRule.otherPacs(ruleBaseDTOList, ruleConditionDTO.getMsg(), otherList, wordCrfDTO);
+                    pacsRule.otherPacs(ruleBaseDTOList, ruleConditionDTO.getMsg(), otherList, wordCrfDTO, ruleExtDTO);
                 }
             }
         }
 
-        // TODO 后期删除 辅检数值型匹配
-        List<PacsNum> pacsNumList = pacsLabel.getPacsNumList();
-        for (PacsNum pacsNum : pacsNumList) {
-            if ("心率".equals(pacsNum.getStandName())) {
-                PD pd = pacsNum.getPd();
-                if (pd != null && StringUtil.isNotBlank(pd.getValue())) {
-                    double v = Double.parseDouble(pd.getValue());
-                    String content = pacsNum.getStandName() + pd.getValue() + pd.getUnit();
-                    Double ageNum = wordCrfDTO.getAgeNum();
-                    Double min = null, max = null;
-                    String suggest = "";
-                    if (ageNum < 0.019) {
-                        min = 110D;
-                        max = 170D;
-                        suggest = "年龄0-6天心率正常值为110-170bpm";
-                    } else if (ageNum < 0.164) {
-                        min = 90D;
-                        max = 160D;
-                        suggest = "年龄7-59天心率正常值为90-160bpm";
-                    } else if (ageNum < 2) {
-                        min = 90D;
-                        max = 150D;
-                        suggest = "年龄2-23月心率正常值为90-150bpm";
-                    } else if (ageNum < 3) {
-                        min = 80D;
-                        max = 140D;
-                        suggest = "年龄2-3岁心率正常值为80-140bpm";
-                    } else if (ageNum < 6) {
-                        min = 80D;
-                        max = 130D;
-                        suggest = "年龄3-5岁心率正常值为80-130bpm";
-                    } else if (ageNum < 11) {
-                        min = 70D;
-                        max = 120D;
-                        suggest = "年龄6-10岁心率正常值为70-120bpm";
-                    } else if (ageNum < 18) {
-                        min = 60D;
-                        max = 120D;
-                        suggest = "年龄11-17岁心率正常值为60-120bpm";
-                    } else if (ageNum <= 150) {
-                        min = 60D;
-                        max = 110D;
-                        suggest = "年龄18-150岁心率正常值为60-110bpm";
-                    }
-                    int flag = compareValue(min, max, v);
-                    if (flag == 0) {
-                        String msg = String.format("该患者%s,%s", content, suggest);
-                        BillMsg billMsg = new BillMsg();
-                        billMsg.setMsg(msg);
-                        billMsg.setContent(content);
-                        otherList.add(billMsg);
-                    }
-                }
-            }
-        }
+        // // TODO 后期删除 辅检数值型匹配
+        // List<PacsNum> pacsNumList = pacsLabel.getPacsNumList();
+        // for (PacsNum pacsNum : pacsNumList) {
+        //     if ("心率".equals(pacsNum.getStandName())) {
+        //         PD pd = pacsNum.getPd();
+        //         if (pd != null && StringUtil.isNotBlank(pd.getValue())) {
+        //             double v = Double.parseDouble(pd.getValue());
+        //             String content = pacsNum.getStandName() + pd.getValue() + pd.getUnit();
+        //             Double ageNum = wordCrfDTO.getAgeNum();
+        //             Double min = null, max = null;
+        //             String suggest = "";
+        //             if (ageNum < 0.019) {
+        //                 min = 110D;
+        //                 max = 170D;
+        //                 suggest = "年龄0-6天心率正常值为110-170bpm";
+        //             } else if (ageNum < 0.164) {
+        //                 min = 90D;
+        //                 max = 160D;
+        //                 suggest = "年龄7-59天心率正常值为90-160bpm";
+        //             } else if (ageNum < 2) {
+        //                 min = 90D;
+        //                 max = 150D;
+        //                 suggest = "年龄2-23月心率正常值为90-150bpm";
+        //             } else if (ageNum < 3) {
+        //                 min = 80D;
+        //                 max = 140D;
+        //                 suggest = "年龄2-3岁心率正常值为80-140bpm";
+        //             } else if (ageNum < 6) {
+        //                 min = 80D;
+        //                 max = 130D;
+        //                 suggest = "年龄3-5岁心率正常值为80-130bpm";
+        //             } else if (ageNum < 11) {
+        //                 min = 70D;
+        //                 max = 120D;
+        //                 suggest = "年龄6-10岁心率正常值为70-120bpm";
+        //             } else if (ageNum < 18) {
+        //                 min = 60D;
+        //                 max = 120D;
+        //                 suggest = "年龄11-17岁心率正常值为60-120bpm";
+        //             } else if (ageNum <= 150) {
+        //                 min = 60D;
+        //                 max = 110D;
+        //                 suggest = "年龄18-150岁心率正常值为60-110bpm";
+        //             }
+        //             int flag = compareValue(min, max, v);
+        //             if (flag == 0) {
+        //                 String msg = String.format("该患者%s,%s", content, suggest);
+        //                 BillMsg billMsg = new BillMsg();
+        //                 billMsg.setMsg(msg);
+        //                 billMsg.setContent(content);
+        //                 otherList.add(billMsg);
+        //             }
+        //         }
+        //     }
+        // }
     }
 
     public int compareValue(Double min, Double max, Double v) {
@@ -294,24 +293,47 @@ public class OtherTipProcess {
         return hasAdviceFlag;
     }
 
+
     /**
      * 获取其他值提醒入参——辅检
      *
-     * @param bean
+     * @param pacsLabel
      * @return
      */
-    public RuleVO getRuleVO(Item bean) {
-        if (StringUtil.isNotBlank(bean.getUniqueName())) {
-            RuleVO ruleVO = new RuleVO();
-            ruleVO.setInputName(bean.getName());
-            ruleVO.setLibName(bean.getUniqueName());
-            ruleVO.setLibType(LexiconEnum.PacsResult.getKey());
-            ruleVO.setLibTypeName(TypeEnum.pacs.getName());
-            ruleVO.setDateValue(bean.getDateValue());
-            ruleVO.setSuffix(String.valueOf(RuleTypeEnum.other.getKey()));
-            return ruleVO;
+    public List<RuleVO> getRuleVO(PacsLabel pacsLabel) {
+        List<RuleVO> ruleVOList = Lists.newArrayList();
+
+        // 辅检结果
+        List<Item> itemList = pacsLabel.getRes();
+        if (ListUtil.isNotEmpty(itemList)) {
+            for (Item bean : itemList) {
+                if (StringUtil.isNotBlank(bean.getUniqueName())) {
+                    RuleVO ruleVO = new RuleVO();
+                    ruleVO.setInputName(bean.getName());
+                    ruleVO.setLibName(bean.getUniqueName());
+                    ruleVO.setLibType(LexiconEnum.PacsResult.getKey());
+                    ruleVO.setLibTypeName(TypeEnum.pacs.getName());
+                    ruleVO.setDateValue(bean.getDateValue());
+                    ruleVO.setSuffix(String.valueOf(RuleTypeEnum.other.getKey()));
+                    ruleVOList.add(ruleVO);
+                }
+            }
         }
-        return null;
+
+        // 辅检描述
+        List<PacsNum> pacsNumList = pacsLabel.getPacsNumList();
+        if (ListUtil.isNotEmpty(pacsNumList)) {
+            for (PacsNum pacsNum : pacsNumList) {
+                RuleVO ruleVO = new RuleVO();
+                ruleVO.setInputName(pacsNum.getName());
+                ruleVO.setLibName(pacsNum.getStandName());
+                ruleVO.setLibType(LexiconEnum.PacsDescribe.getKey());
+                ruleVO.setLibTypeName(TypeEnum.pacs.getName());
+                ruleVO.setSuffix(String.valueOf(RuleTypeEnum.other.getKey()));
+                ruleVOList.add(ruleVO);
+            }
+        }
+        return ruleVOList;
     }
 
     /**

+ 51 - 5
src/main/java/com/diagbot/rule/PacsRule.java

@@ -2,7 +2,9 @@ package com.diagbot.rule;
 
 import com.diagbot.dto.BillMsg;
 import com.diagbot.dto.MatchDTO;
+import com.diagbot.dto.PacsOtherDTO;
 import com.diagbot.dto.RuleBaseDTO;
+import com.diagbot.dto.RuleExtDTO;
 import com.diagbot.dto.RuleSimpleDTO;
 import com.diagbot.dto.WordCrfDTO;
 import com.diagbot.enums.BaseTypeEnum;
@@ -18,6 +20,7 @@ import org.springframework.stereotype.Component;
 
 import java.util.List;
 import java.util.Map;
+import java.util.stream.Collectors;
 
 /**
  * @description: 辅检规则
@@ -81,15 +84,19 @@ public class PacsRule {
      * 比较辅检结果——其他提醒
      *
      * @param ruleBaseDTOList
-     * @param msg
+     * @param suggestMsg
      * @param otherList
      * @param wordCrfDTO
+     * @param ruleExtDTO
      */
-    public void otherPacs(List<RuleBaseDTO> ruleBaseDTOList, String msg, List<BillMsg> otherList, WordCrfDTO wordCrfDTO) {
+    public void otherPacs(List<RuleBaseDTO> ruleBaseDTOList, String suggestMsg, List<BillMsg> otherList,
+                          WordCrfDTO wordCrfDTO, RuleExtDTO ruleExtDTO) {
         if (ListUtil.isEmpty(ruleBaseDTOList)) {
-            return ;
+            return;
         }
+        PacsOtherDTO pacsOtherDTO = new PacsOtherDTO();
         int i = 0;
+        out:
         for (RuleBaseDTO ruleBaseDTO : ruleBaseDTOList) {
             if (LexiconEnum.getEnum(ruleBaseDTO.getBaseLibType()) != null) { // 避免空指针
                 boolean flag = false;
@@ -98,18 +105,24 @@ public class PacsRule {
                         flag = ageRule.getFlag(wordCrfDTO, ruleBaseDTO);
                         if (flag) {
                             i++;
+                        } else {
+                            break out;// 直接跳出for循环
                         }
                         break;
                     case Gender: // 性别
                         flag = sexRule.getFlag(wordCrfDTO, ruleBaseDTO);
                         if (flag) {
                             i++;
+                        } else {
+                            break out;// 直接跳出for循环
                         }
                         break;
                     case Group: // 人群
                         Map map = groupRule.rule(wordCrfDTO, ruleBaseDTO);
                         if (CoreUtil.getMapFlag(map)) {
                             i++;
+                        } else {
+                            break out;// 直接跳出for循环
                         }
                         break;
                     case PacsResult: // 辅检结果
@@ -117,10 +130,14 @@ public class PacsRule {
                         if (ruleBaseDTO.getBaseType().equals(BaseTypeEnum.B3.getKey())) {
                             if (!CoreUtil.getMapFlag(map)) {
                                 i++;
+                            } else {
+                                break out;// 直接跳出for循环
                             }
                         } else {
                             if (CoreUtil.getMapFlag(map)) {
                                 i++;
+                            } else {
+                                break out;// 直接跳出for循环
                             }
                         }
                         break;
@@ -128,12 +145,16 @@ public class PacsRule {
                         map = commonRule.compareItem(wordCrfDTO.getDiag(), ruleBaseDTO);
                         if (CoreUtil.getMapFlag(map)) {
                             i++;
+                        } else {
+                            break out;// 直接跳出for循环
                         }
                         break;
                     case LisSubName: // 检验结果
                         List<MatchDTO> matchDTOList = CoreUtil.compareLis(ruleBaseDTO, wordCrfDTO.getLis());
                         if (ListUtil.isNotEmpty(matchDTOList)) {
                             i++;
+                        } else {
+                            break out;// 直接跳出for循环
                         }
                         break;
                     case VitalResult: //体格检查结果
@@ -141,6 +162,24 @@ public class PacsRule {
                         map = CoreUtil.compareVital(ruleBaseDTO, wordCrfDTO.getVitalLabel());
                         if (CoreUtil.getMapFlag(map)) {
                             i++;
+                        } else {
+                            break out;// 直接跳出for循环
+                        }
+                        break;
+                    case PacsDescribe: // 辅助检查描述
+                        matchDTOList = CoreUtil.comparePacsDesc(ruleBaseDTO, wordCrfDTO.getPacsLabel().getPacsNumList());
+                        if (ListUtil.isNotEmpty(matchDTOList)) {
+                            i++;
+                            /**
+                             * redis中的基础数据顺序会变动,第一条基础数据不一定是后台首行固定数据,找首行固定数据的依据
+                             * 是:基础规则术语类型、名称与主规则一致
+                             */
+                            if (ruleExtDTO.getLibName().equals(ruleBaseDTO.getBaseLibName())
+                                    && ruleExtDTO.getLibType().equals(ruleBaseDTO.getBaseLibType())) {
+                                pacsOtherDTO.setMainMsg(matchDTOList.stream().map(r -> r.getContent()).collect(Collectors.toList()));
+                            }
+                        } else {
+                            break out;// 直接跳出for循环
                         }
                         break;
                     default:
@@ -150,8 +189,15 @@ public class PacsRule {
         }
         // 条件全部符合
         if (i == ruleBaseDTOList.size()) {
-            BillMsg otherMsg = MsgUtil.getCommonOtherMsg(TypeEnum.pacs.getName(), msg, msg, null, null);
-            otherList.add(otherMsg);
+            if (ListUtil.isNotEmpty(pacsOtherDTO.getMainMsg())) { // 辅检描述走模板
+                for (String s : pacsOtherDTO.getMainMsg()) {
+                    BillMsg otherMsg = msgNewUtil.getOtherPacsMsg(s, LexiconEnum.PacsDescribe.getName(), suggestMsg);
+                    CoreUtil.addBeanToList(otherList, otherMsg);
+                }
+            } else { // 其他直接用提示语
+                BillMsg otherMsg = MsgUtil.getCommonOtherMsg(TypeEnum.pacs.getName(), suggestMsg, suggestMsg, null, null);
+                CoreUtil.addBeanToList(otherList, otherMsg);
+            }
         }
     }
 }

+ 30 - 0
src/main/java/com/diagbot/util/CoreUtil.java

@@ -10,6 +10,7 @@ import com.diagbot.model.entity.BodyPart;
 import com.diagbot.model.entity.Clinical;
 import com.diagbot.model.entity.Negative;
 import com.diagbot.model.entity.PD;
+import com.diagbot.model.entity.PacsNum;
 import com.diagbot.model.entity.Usual;
 import com.diagbot.model.entity.Vital;
 import com.diagbot.model.label.VitalLabel;
@@ -540,6 +541,35 @@ public class CoreUtil {
         return map;
     }
 
+    /**
+     * 比较辅检检查描述是否匹配
+     *
+     * @param ruleBaseDTO
+     * @param pacsNumList
+     * @return
+     */
+    public static List<MatchDTO> comparePacsDesc(RuleBaseDTO ruleBaseDTO, List<PacsNum> pacsNumList) {
+        if (ruleBaseDTO == null || ListUtil.isEmpty(pacsNumList)) {
+            return null;
+        }
+        List<MatchDTO> matchDTOList = new ArrayList<>();
+        // 辅助检查描述
+        for (PacsNum pacsNum : pacsNumList) {
+            if (ruleBaseDTO.getBaseLibName().equals(pacsNum.getStandName()) && pacsNum.getPd() != null
+                    && StringUtil.isNotBlank(pacsNum.getPd().getValue())) {
+                boolean flag = compareNum(ruleBaseDTO, Double.parseDouble(pacsNum.getPd().getValue()));
+                if (flag) {
+                    MatchDTO matchDTO = new MatchDTO();
+                    matchDTO.setContent(pacsNum.getName()
+                            + subZeroAndDot(String.valueOf(pacsNum.getPd().getValue()))
+                            + getJointUnits(pacsNum.getPd()));
+                    matchDTOList.add(matchDTO);
+                }
+            }
+        }
+        return matchDTOList;
+    }
+
     /**
      * 比较数值大小(double)
      *

+ 99 - 21
src/main/java/com/diagbot/util/MsgNewUtil.java

@@ -3,12 +3,16 @@ package com.diagbot.util;
 import com.diagbot.biz.push.entity.Lis;
 import com.diagbot.dto.BillMsg;
 import com.diagbot.dto.RuleSimpleDTO;
+import com.diagbot.enums.CommonEnum;
 import com.diagbot.enums.ConEnum;
 import com.diagbot.enums.RedisEnum;
 import com.diagbot.enums.TypeEnum;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
 /**
  * @description: 提示语工具类
  * @author: zhoutg
@@ -17,6 +21,11 @@ import org.springframework.stereotype.Component;
 @Component
 public class MsgNewUtil {
 
+    /**
+     * 占位符静态变量,格式:“前缀#后缀”
+     */
+    public static Map<String, String> placeholderMap = new ConcurrentHashMap<>();
+
     @Autowired
     RedisUtil redisUtil;
 
@@ -43,27 +52,27 @@ public class MsgNewUtil {
         // 出现2个“具有”,去除一个为空
         if (ConEnum.medEqu.getName().equals(conType) && StringUtil.isNotBlank(content)
                 && content.startsWith("具有") && msg.startsWith("该患者具有")) {
-            msg = msg.replaceAll("具有", "");
+            msg = msg.replace("具有", "");
         }
         if (StringUtil.isNotBlank(unionMsg)) {
-            msg = msg.replaceAll("\\[原因及建议]", "," + unionMsg);
+            msg = msg.replace("[原因及建议]", "," + unionMsg);
         } else {
-            msg = msg.replaceAll("\\[原因及建议]", "");
+            msg = msg.replace("[原因及建议]", "");
         }
         // [性别取反]标签替换
         if (ConEnum.gender.getName().equals(conType)) {
             if ("男".equals(content)) {
-                msg = msg.replaceAll("\\[性别取反]", "女");
+                msg = msg.replace("[性别取反]", "女");
             } else if ("女".equals(content)) {
-                msg = msg.replaceAll("\\[性别取反]", "男");
+                msg = msg.replace("[性别取反]", "男");
             }
         }
 
         // 放到最后统一替换【多处匹配】
-        msg = msg.replaceAll("\\[匹配内容]", content);
-        String orderNameNew = orderName.replaceAll("\\\\","\\\\\\\\"); // 防止开单名称中有\\
-        msg = msg.replaceAll("\\[开单名称]", orderNameNew);
-        msg = msg.replaceAll("\\[项目名称]", structName);
+        msg = msg.replace("[匹配内容]", content);
+        String orderNameNew = orderName.replace("\\", "\\\\"); // 防止开单名称中有\\
+        msg = msg.replace("[开单名称]", orderNameNew);
+        msg = msg.replace("[项目名称]", structName);
         billMsg.setMsg(msg);
         billMsg.setOrderName(orderName);
         billMsg.setOrderStandName(orderStandName);
@@ -92,15 +101,15 @@ public class MsgNewUtil {
                     return null;
                 }
                 if (StringUtil.isNotBlank(suggestMsg)) {
-                    msg = msg.replaceAll("\\[原因及建议]", "," + suggestMsg);
+                    msg = msg.replace("[原因及建议]", "," + suggestMsg);
                 } else {
-                    msg = msg.replaceAll("\\[原因及建议]", "");
+                    msg = msg.replace("[原因及建议]", "");
                 }
                 // 放到最后统一替换【多处匹配】
-                msg = msg.replaceAll("\\[化验结果]", content);
-                msg = msg.replaceAll("\\[匹配内容]", name);
+                msg = msg.replace("[化验结果]", content);
+                msg = msg.replace("[匹配内容]", name);
                 if (msg.contains("[化验套餐和明细]")) {
-                    msg = msg.replaceAll("\\[化验套餐和明细]", lisNameDetail);
+                    msg = msg.replace("[化验套餐和明细]", lisNameDetail);
                 }
                 billMsg.setType(type);
                 billMsg.setOrderName(lis.getName());
@@ -114,12 +123,39 @@ public class MsgNewUtil {
         return billMsg;
     }
 
+    /**
+     * 其他值提醒辅检提示信息
+     *
+     * @param mainMsg
+     * @param templateType
+     * @param suggestMsg
+     * @return
+     */
+    public BillMsg getOtherPacsMsg(String mainMsg, String templateType, String suggestMsg) {
+        String msg = redisUtil.getByKeyAndField(RedisEnum.otherMsg.getName(), TypeEnum.pacs.getName() + "_" + templateType);
+        if (StringUtil.isBlank(msg)) { // 防止报空指针
+            return null;
+        }
+        BillMsg billMsg = new BillMsg();
+        if (StringUtil.isNotBlank(suggestMsg)) {
+            msg = msg.replace("[原因及建议]", "," + suggestMsg);
+        } else {
+            msg = msg.replace("[原因及建议]", "");
+        }
+        // 放到最后统一替换【多处匹配】
+        msg = msg.replace("[辅助检查描述]", mainMsg);
+        billMsg.setType(templateType);
+        billMsg.setMsg(msg);
+        billMsg.setContent(mainMsg);
+        return billMsg;
+    }
+
     /**
      * 危急值化验提示信息
      *
-     * @param type 分类
-     * @param content 化验内容
-     * @param name 条件内容
+     * @param type          分类
+     * @param content       化验内容
+     * @param name          条件内容
      * @param conditionType 条件类型
      * @param suggestMsg
      * @return
@@ -134,13 +170,13 @@ public class MsgNewUtil {
                     return null;
                 }
                 if (StringUtil.isNotBlank(suggestMsg)) {
-                    msg = msg.replaceAll("\\[原因及建议]", "," + suggestMsg);
+                    msg = msg.replace("[原因及建议]", "," + suggestMsg);
                 } else {
-                    msg = msg.replaceAll("\\[原因及建议]", "");
+                    msg = msg.replace("[原因及建议]", "");
                 }
                 // 放到最后统一替换【多处匹配】
-                msg = msg.replaceAll("\\[化验结果]", content);
-                msg = msg.replaceAll("\\[匹配内容]", name);
+                msg = msg.replace("[化验结果]", content);
+                msg = msg.replace("[匹配内容]", name);
                 billMsg.setType(conditionType);
                 break;
             default:
@@ -150,4 +186,46 @@ public class MsgNewUtil {
         billMsg.setContent(content);
         return billMsg;
     }
+
+    /**
+     * 不使用正则,全部替换
+     *
+     * @param msg         文本
+     * @param placeholder 占位符
+     * @param replaceStr  替换字符串
+     * @return
+     */
+    public String replacePlaceholder(String msg, String placeholder, String replaceStr) {
+        if (StringUtil.isBlank(msg)) {
+            return null;
+        }
+        if (StringUtil.isBlank(placeholder)) {
+            return msg;
+        }
+        if (msg.contains(placeholder)) {
+            String s = placeholderMap.get(placeholder);
+            String prefix = ""; // 前缀
+            String suffix = ""; // 后缀
+            if (StringUtil.isNotBlank(s)) {
+                String[] split = s.split(CommonEnum.splitSymbol.getName());
+                prefix = split[0];
+                if (split.length == 2) {
+                    suffix = split[1];
+                } else {
+                    suffix = "";
+                }
+            }
+            if (StringUtil.isNotBlank(prefix)) {
+                replaceStr = prefix + replaceStr;
+            }
+            if (StringUtil.isNotBlank(suffix)) {
+                replaceStr = replaceStr + suffix;
+            }
+            msg = msg.replace(placeholder, replaceStr);
+            if (msg.matches(".*[,|,]$")) {
+                msg = msg.substring(0, msg.length() - 1);
+            }
+        }
+        return msg;
+    }
 }

+ 12 - 0
src/main/java/com/diagbot/vo/RuleParamVO.java

@@ -0,0 +1,12 @@
+package com.diagbot.vo;
+
+/**
+ * @description:
+ * @author: zhoutg
+ * @time: 2021/10/20 11:40
+ */
+public class RuleParamVO {
+    private String name;
+    private String uniqueName;
+    private String dateValue;
+}