浏览代码

规则临时代码

zhoutg 4 年之前
父节点
当前提交
c3121c81e8

+ 81 - 0
doc/20210727提示规则新需求/temp.sql

@@ -0,0 +1,81 @@
+USE `med_2021`;
+-- 临时表
+DROP TABLE IF EXISTS `temp_msg`;
+CREATE TABLE `temp_msg` (
+  `cond_id` bigint(20) DEFAULT NULL COMMENT 'con_id',
+  `msg` varchar(255) DEFAULT NULL COMMENT '提示语',
+   KEY (`cond_id`)
+) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
+
+-- 更新提示语:原因及建议
+update kl_rule_condition a, temp_msg b set a.msg = b.msg where a.id = b.cond_id;
+
+-- 查询已有的开单条目
+SELECT
+	tt1.cond_id,
+	tt1.par_name,
+	tt1.par_type,
+	tt2.lib_name base_name,
+	xx2. NAME base_type,
+	CASE tt1.type
+WHEN '4' THEN
+	'过敏原'
+WHEN '5' THEN
+	'辅检开单互斥'
+ELSE
+	''
+END other_type,
+ tt1.max_value,
+ tt1.max_operator,
+ tt1.min_value,
+ tt1.min_operator,
+ tt1.cond_msg
+FROM
+	(
+		SELECT
+			c1.lib_name par_name,
+			c1.id par_id,
+			x1.`name` par_type,
+			t1.id rule_id,
+			t1.description,
+			t1.rule_type,
+			t1.has_sub_cond,
+			t1.msg,
+			t3.type,
+			t3.concept_id base_id,
+			t3.eq_value,
+			t3.min_value,
+			t3.min_operator,
+			t3.min_unit,
+			t3.max_value,
+			t3.max_operator,
+			t3.max_unit,
+			t2.id cond_id,
+			t2.msg cond_msg
+		FROM
+			kl_concept c1,
+			kl_lexicon x1,
+			kl_rule t1,
+			kl_rule_condition t2,
+			kl_rule_base t3
+		WHERE
+			c1.is_deleted = 'N'
+		AND t1.is_deleted = 'N'
+		AND t2.is_deleted = 'N'
+		AND t3.is_deleted = 'N'
+		AND c1.`status` = 1
+		AND t1.`status` = 1
+		AND c1.id = t1.concept_id
+		AND t1.id = t2.rule_id
+		AND t2.rule_base_id = t3.id
+		AND t1.rule_type = 1
+		AND x1.`code` = c1.lib_type
+	) tt1
+LEFT JOIN kl_concept tt2 ON tt2.is_deleted = 'N'
+AND tt2.`status` = 1
+AND tt1.base_id = tt2.id
+LEFT JOIN kl_lexicon xx2 ON tt2.lib_type = xx2. CODE
+ORDER BY
+	rule_id;
+
+

+ 3 - 0
src/main/java/com/diagbot/config/CacheDeleteInit.java

@@ -51,6 +51,9 @@ public class CacheDeleteInit implements CommandLineRunner {
         cacheFacade.loadFrequency();
         log.info("CDSS-CORE服务启动加载开单频次成功!");
 
+        cacheFacade.loadMsg();
+        log.info("CDSS-CORE服务启动加载开单提示语成功!");
+
         conceptInfoFacade.loadCustomDictionary();
         log.info("CDSS-CORE服务启动加载NLP分词字典成功!");
 

+ 4 - 0
src/main/java/com/diagbot/dto/RuleSimpleDTO.java

@@ -23,4 +23,8 @@ public class RuleSimpleDTO {
     private String form;
     // 提示语
     private String msg;
+    // 界面匹配内容
+    private String content;
+    // 禁忌类型
+    private String conType;
 }

+ 2 - 1
src/main/java/com/diagbot/enums/RedisEnum.java

@@ -26,7 +26,8 @@ public enum RedisEnum implements KeyedNamed {
     pushModel(13, "pushModel"),
     hospitalId_(14, "hospitalId_"),
     deptPush(15, "deptPush"),
-    frequency(20, "frequency");
+    frequency(20, "frequency"),
+    msg(21, "msg");
 
     @Setter
     private int key;

+ 18 - 0
src/main/java/com/diagbot/facade/CacheFacade.java

@@ -211,4 +211,22 @@ public class CacheFacade {
         List<DictionaryInfoDTO> dictionaryInfoDTOList = klDictionaryInfoFacade.getListByGroupType(40);
         redisUtil.set(RedisEnum.frequency.getName(), dictionaryInfoDTOList);
     }
+
+    /**
+     * 加载提示语
+     */
+    public void loadMsg() {
+        // 删除
+        redisUtil.delete(RedisEnum.msg.getName());
+        // 加载
+        List<DictionaryInfoDTO> dictionaryInfoDTOList = klDictionaryInfoFacade.getListByGroupType(41);
+        if (ListUtil.isNotEmpty(dictionaryInfoDTOList)) {
+            // 提示语
+            Map<String, Object> msgMap = new LinkedMap<>();
+            for (DictionaryInfoDTO dic : dictionaryInfoDTOList) {
+                msgMap.put(dic.getName(), dic.getVal());
+            }
+            redisUtil.putHashMap(RedisEnum.msg.getName(), msgMap);
+        }
+    }
 }

+ 1 - 0
src/main/java/com/diagbot/process/BillProcess.java

@@ -102,6 +102,7 @@ public class BillProcess {
             /** 3、规则处理 */
             List<RuleConditionDTO> ruleConditionDTOList = ruleExtDTO.getRuleConditionDTOList();
             for (RuleConditionDTO ruleConditionDTO : ruleConditionDTOList) {
+                ruleSimpleDTO.setMsg(ruleConditionDTO.getMsg());
                 List<RuleBaseDTO> ruleBaseDTOList = ruleConditionDTO.getRuleBaseDTOList();
                 switch (RuleTypeEnum.getEnum(ruleExtDTO.getRuleType())) {
                     case bill: // redis 数据以 _1结尾

+ 9 - 4
src/main/java/com/diagbot/rule/AgeRule.java

@@ -5,7 +5,9 @@ import com.diagbot.dto.RuleBaseDTO;
 import com.diagbot.dto.RuleSimpleDTO;
 import com.diagbot.dto.WordCrfDTO;
 import com.diagbot.util.CoreUtil;
+import com.diagbot.util.MsgNewUtil;
 import com.diagbot.util.MsgUtil;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
 import java.util.List;
@@ -18,6 +20,9 @@ import java.util.List;
 @Component
 public class AgeRule {
 
+    @Autowired
+    MsgNewUtil msgNewUtil;
+
     /**
      * 比较年龄——开单项
      *
@@ -30,10 +35,10 @@ public class AgeRule {
     public void bill(WordCrfDTO wordCrfDTO, RuleBaseDTO ruleBaseDTO, List<BillMsg> billMsgList, String conType, RuleSimpleDTO ruleSimpleDTO) {
         Boolean flag = getFlag(wordCrfDTO, ruleBaseDTO);
         if (flag) {
-            String message = "年龄" + wordCrfDTO.getAge();
-            BillMsg billMsg = MsgUtil.getCommonBillMsg(ruleSimpleDTO.getInputName(), ruleSimpleDTO.getLibName(),
-                    message, conType, ruleSimpleDTO.getLibTypeName());
-            billMsgList.add(billMsg);
+            ruleSimpleDTO.setContent(wordCrfDTO.getAge());
+            ruleSimpleDTO.setConType(conType);
+            BillMsg billMsg = msgNewUtil.getCommonBillMsg(ruleSimpleDTO);
+            CoreUtil.addBeanToList(billMsgList, billMsg);
         }
     }
 

+ 33 - 25
src/main/java/com/diagbot/rule/CommonRule.java

@@ -21,6 +21,7 @@ import com.diagbot.util.CatalogueUtil;
 import com.diagbot.util.CoreUtil;
 import com.diagbot.util.EntityUtil;
 import com.diagbot.util.ListUtil;
+import com.diagbot.util.MsgNewUtil;
 import com.diagbot.util.MsgUtil;
 import com.diagbot.util.RedisUtil;
 import com.diagbot.util.ReflectUtil;
@@ -62,6 +63,8 @@ public class CommonRule {
     KlDictionaryInfoFacade klDictionaryInfoFacade;
     @Autowired
     RedisUtil redisUtil;
+    @Autowired
+    MsgNewUtil msgNewUtil;
 
     /**
      * 比较阳性属性是否匹配
@@ -79,13 +82,13 @@ public class CommonRule {
             for (T d : input) {
                 Negative val = (Negative) CoreUtil.getFieldValue(d, "negative");
                 if (val == null) {
-                    String c = (String) CoreUtil.getFieldValue(d, "standName");
-                    String c_name = (String) CoreUtil.getFieldValue(d, "name");
-                    if (StringUtils.isNotBlank(c) && CoreUtil.compareName(ruleBaseDTO, c)) {
-                        BillMsg commonBillMsg = MsgUtil.getCommonBillMsg(
-                                ruleSimpleDTO.getInputName(), ruleSimpleDTO.getLibName(),
-                                c_name, conType, ruleSimpleDTO.getLibTypeName());
-                        billMsgList.add(commonBillMsg);
+                    String standName = (String) CoreUtil.getFieldValue(d, "standName");
+                    String name = (String) CoreUtil.getFieldValue(d, "name");
+                    if (StringUtils.isNotBlank(standName) && CoreUtil.compareName(ruleBaseDTO, standName)) {
+                        ruleSimpleDTO.setContent(name);
+                        ruleSimpleDTO.setConType(conType);
+                        BillMsg billMsg = msgNewUtil.getCommonBillMsg(ruleSimpleDTO);
+                        CoreUtil.addBeanToList(billMsgList, billMsg);
                     }
                 }
             }
@@ -176,13 +179,13 @@ public class CommonRule {
                                         String conType, RuleSimpleDTO ruleSimpleDTO) {
         if (ListUtil.isNotEmpty(input)) {
             for (T t : input) {
-                String c = (String) CoreUtil.getFieldValue(t, "uniqueName"); // 标准名称
-                String c_name = (String) CoreUtil.getFieldValue(t, "name"); // 界面名称
-                if (CoreUtil.compareName(ruleBaseDTO, c)) {
-                    BillMsg commonBillMsg = MsgUtil.getCommonBillMsg(
-                            ruleSimpleDTO.getInputName(), ruleSimpleDTO.getLibName(),
-                            c_name, conType, ruleSimpleDTO.getLibTypeName());
-                    billMsgList.add(commonBillMsg);
+                String uniqueName = (String) CoreUtil.getFieldValue(t, "uniqueName"); // 标准名称
+                String inputName = (String) CoreUtil.getFieldValue(t, "name"); // 界面名称
+                if (CoreUtil.compareName(ruleBaseDTO, uniqueName)) {
+                    ruleSimpleDTO.setContent(inputName);
+                    ruleSimpleDTO.setConType(conType);
+                    BillMsg billMsg = msgNewUtil.getCommonBillMsg(ruleSimpleDTO);
+                    CoreUtil.addBeanToList(billMsgList, billMsg);
                 }
             }
         }
@@ -255,10 +258,10 @@ public class CommonRule {
                     Date orderDateValueDate = CatalogueUtil.parseStringDate(orderDateValue);
                     if (dateValueDate != null && orderDateValueDate != null) {
                         if (!CatalogueUtil.compareTime(dateValueDate, orderDateValueDate, 60L * 24 * 7, false)) {
-                            BillMsg commonBillMsg = MsgUtil.getCommonBillMsg(
-                                    ruleSimpleDTO.getInputName(), ruleSimpleDTO.getLibName(),
-                                    pacs.getName(), conType, ruleSimpleDTO.getLibTypeName());
-                            billMsgList.add(commonBillMsg);
+                            ruleSimpleDTO.setContent(pacs.getName());
+                            ruleSimpleDTO.setConType(conType);
+                            BillMsg billMsg = msgNewUtil.getCommonBillMsg(ruleSimpleDTO);
+                            CoreUtil.addBeanToList(billMsgList, billMsg);
                         }
                     }
                 }
@@ -345,10 +348,10 @@ public class CommonRule {
                     if (!set.contains(ruleSimpleDTO.getLibName() + "******" + orginName)) {
                         set.add(ruleSimpleDTO.getLibName() + "******" + orginName);
                         set.add(orginName + "******" + ruleSimpleDTO.getLibName());
-                        BillMsg commonBillMsg = MsgUtil.getCommonBillMsg(
-                                ruleSimpleDTO.getInputName(), "",
-                                orginName, conType, ruleSimpleDTO.getLibTypeName());
-                        billMsgList.add(commonBillMsg);
+                        ruleSimpleDTO.setContent(orginName);
+                        ruleSimpleDTO.setConType(conType);
+                        BillMsg billMsg = msgNewUtil.getCommonBillMsg(ruleSimpleDTO);
+                        CoreUtil.addBeanToList(billMsgList, billMsg);
                     }
                 }
             }
@@ -407,9 +410,14 @@ public class CommonRule {
                                         .equals(getFrquenceType(ReflectUtil.getProperty(itNext, "frequency")))) {
                                     String name = (String) CoreUtil.getFieldValue(it, "name");
                                     String uniqueName = (String) CoreUtil.getFieldValue(it, "uniqueName");
-                                    BillMsg commonBillMsg = MsgUtil.getCommonBillMsg(
-                                            name, uniqueName, name, ConEnum.repeat24.getName(), type);
-                                    billMsgList.add(commonBillMsg);
+                                    RuleSimpleDTO ruleSimpleDTO = new RuleSimpleDTO();
+                                    ruleSimpleDTO.setInputName(name);
+                                    ruleSimpleDTO.setLibName(uniqueName);
+                                    ruleSimpleDTO.setLibTypeName(type);
+                                    ruleSimpleDTO.setContent(name);
+                                    ruleSimpleDTO.setConType(ConEnum.repeat24.getName());
+                                    BillMsg billMsg = msgNewUtil.getCommonBillMsg(ruleSimpleDTO);
+                                    CoreUtil.addBeanToList(billMsgList, billMsg);
                                     break;
                                 }
                             }

+ 7 - 5
src/main/java/com/diagbot/rule/DrugRule.java

@@ -7,7 +7,7 @@ import com.diagbot.enums.LexiconEnum;
 import com.diagbot.enums.RedisEnum;
 import com.diagbot.util.CoreUtil;
 import com.diagbot.util.ListUtil;
-import com.diagbot.util.MsgUtil;
+import com.diagbot.util.MsgNewUtil;
 import com.diagbot.util.RedisUtil;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -26,6 +26,8 @@ public class DrugRule {
 
     @Autowired
     RedisUtil redisUtil;
+    @Autowired
+    MsgNewUtil msgNewUtil;
 
     /**
      * 比较药品是否匹配(先根据baseLibType判断返回的是药品通用名还是药品分类,如果返回的是药品分类,从redis获取药品通用名)
@@ -56,10 +58,10 @@ public class DrugRule {
                 String uniqueName = (String) CoreUtil.getFieldValue(d, "uniqueName");
                 String name = (String) CoreUtil.getFieldValue(d, "name");
                 if (StringUtils.isNotBlank(uniqueName) && allDrug.contains(uniqueName)) {
-                    BillMsg commonBillMsg = MsgUtil.getCommonBillMsg(
-                            ruleSimpleDTO.getInputName(), ruleSimpleDTO.getLibName(),
-                            name, conType, ruleSimpleDTO.getLibTypeName());
-                    billMsgList.add(commonBillMsg);
+                    ruleSimpleDTO.setContent(name);
+                    ruleSimpleDTO.setConType(conType);
+                    BillMsg billMsg = msgNewUtil.getCommonBillMsg(ruleSimpleDTO);
+                    CoreUtil.addBeanToList(billMsgList, billMsg);
                 }
             }
         }

+ 7 - 5
src/main/java/com/diagbot/rule/GroupRule.java

@@ -6,7 +6,7 @@ import com.diagbot.dto.RuleBaseDTO;
 import com.diagbot.dto.RuleSimpleDTO;
 import com.diagbot.dto.WordCrfDTO;
 import com.diagbot.util.CoreUtil;
-import com.diagbot.util.MsgUtil;
+import com.diagbot.util.MsgNewUtil;
 import com.diagbot.util.RegexUtil;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
@@ -26,6 +26,8 @@ public class GroupRule {
 
     @Autowired
     CommonRule commonRule;
+    @Autowired
+    MsgNewUtil msgNewUtil;
 
     /**
      * 禁忌人群开单项
@@ -39,10 +41,10 @@ public class GroupRule {
     public void bill(WordCrfDTO wordCrfDTO, RuleBaseDTO ruleBaseDTO, List<BillMsg> billMsgList, String conType, RuleSimpleDTO ruleSimpleDTO) {
         Map map = rule(wordCrfDTO, ruleBaseDTO);
         if (CoreUtil.getMapFlag(map)) {
-            BillMsg commonBillMsg = MsgUtil.getCommonBillMsg(
-                    ruleSimpleDTO.getInputName(), ruleSimpleDTO.getLibName(),
-                    ruleBaseDTO.getBaseLibName(), conType, ruleSimpleDTO.getLibTypeName());
-            billMsgList.add(commonBillMsg);
+            ruleSimpleDTO.setContent(ruleBaseDTO.getBaseLibName());
+            ruleSimpleDTO.setConType(conType);
+            BillMsg billMsg = msgNewUtil.getCommonBillMsg(ruleSimpleDTO);
+            CoreUtil.addBeanToList(billMsgList, billMsg);
         }
     }
 

+ 7 - 3
src/main/java/com/diagbot/rule/LisRule.java

@@ -10,6 +10,7 @@ import com.diagbot.enums.LexiconEnum;
 import com.diagbot.enums.TypeEnum;
 import com.diagbot.util.CoreUtil;
 import com.diagbot.util.ListUtil;
+import com.diagbot.util.MsgNewUtil;
 import com.diagbot.util.MsgUtil;
 import com.diagbot.util.StringUtil;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -30,6 +31,8 @@ public class LisRule {
     GroupRule groupRule;
     @Autowired
     CommonRule commonRule;
+    @Autowired
+    MsgNewUtil msgNewUtil;
 
     /**
      * 比较化验——开单合理性
@@ -45,9 +48,10 @@ public class LisRule {
             for (Lis lis : inputLis) {
                 Map<String, Object> map = CoreUtil.compareLis(ruleBaseDTO, lis);
                 if (CoreUtil.getMapFlag(map)) {
-                    BillMsg commonBillMsg = MsgUtil.getCommonBillMsg(ruleSimpleDTO.getInputName(),
-                            ruleSimpleDTO.getLibName(), (String) map.get("msg"), conType, ruleSimpleDTO.getLibTypeName());
-                    billMsgList.add(commonBillMsg);
+                    ruleSimpleDTO.setContent((String) map.get("msg"));
+                    ruleSimpleDTO.setConType(conType);
+                    BillMsg billMsg = msgNewUtil.getCommonBillMsg(ruleSimpleDTO);
+                    CoreUtil.addBeanToList(billMsgList, billMsg);
                 }
             }
         }

+ 10 - 4
src/main/java/com/diagbot/rule/MedEquRule.java

@@ -4,7 +4,9 @@ import com.diagbot.dto.BillMsg;
 import com.diagbot.dto.RuleBaseDTO;
 import com.diagbot.dto.RuleSimpleDTO;
 import com.diagbot.dto.WordCrfDTO;
-import com.diagbot.util.MsgUtil;
+import com.diagbot.util.CoreUtil;
+import com.diagbot.util.MsgNewUtil;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
 import java.util.List;
@@ -17,6 +19,9 @@ import java.util.List;
 @Component
 public class MedEquRule {
 
+    @Autowired
+    MsgNewUtil msgNewUtil;
+
     /**
      * 比较文本内容是否存在
      *
@@ -37,9 +42,10 @@ public class MedEquRule {
             flag = true;
         }
         if (flag) {
-            BillMsg billMsg = MsgUtil.getCommonBillMsg(ruleSimpleDTO.getInputName(), ruleSimpleDTO.getLibName(),
-                    ruleBaseDTO.getBaseLibName(), conType, ruleSimpleDTO.getLibTypeName());
-            billMsgList.add(billMsg);
+            ruleSimpleDTO.setContent(ruleBaseDTO.getBaseLibName());
+            ruleSimpleDTO.setConType(conType);
+            BillMsg billMsg = msgNewUtil.getCommonBillMsg(ruleSimpleDTO);
+            CoreUtil.addBeanToList(billMsgList, billMsg);
         }
     }
 }

+ 11 - 8
src/main/java/com/diagbot/rule/PacsRule.java

@@ -9,6 +9,7 @@ import com.diagbot.enums.LexiconEnum;
 import com.diagbot.enums.TypeEnum;
 import com.diagbot.util.CoreUtil;
 import com.diagbot.util.ListUtil;
+import com.diagbot.util.MsgNewUtil;
 import com.diagbot.util.MsgUtil;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -33,6 +34,8 @@ public class PacsRule {
     GroupRule groupRule;
     @Autowired
     CommonRule commonRule;
+    @Autowired
+    MsgNewUtil msgNewUtil;
 
     /**
      * 比较辅检名称——开单合理性
@@ -47,14 +50,14 @@ public class PacsRule {
     public <T> void bill(List<T> inputList, RuleBaseDTO ruleBaseDTO, List<BillMsg> billMsgList, String conType,
                          RuleSimpleDTO ruleSimpleDTO) {
         if (ListUtil.isNotEmpty(inputList)) {
-            for (T lis : inputList) {
-                String val = (String) CoreUtil.getFieldValue(lis, "uniqueName");
-                String val_name = (String) CoreUtil.getFieldValue(lis, "name");
-                if (StringUtils.isNotBlank(val) && CoreUtil.compareName(ruleBaseDTO, val)) {
-                    BillMsg commonBillMsg = MsgUtil.getCommonBillMsg(
-                            ruleSimpleDTO.getInputName(), ruleSimpleDTO.getLibName(),
-                            "已开" + val_name, conType, ruleSimpleDTO.getLibTypeName());
-                    billMsgList.add(commonBillMsg);
+            for (T bean : inputList) {
+                String uniqueName = (String) CoreUtil.getFieldValue(bean, "uniqueName");
+                String name = (String) CoreUtil.getFieldValue(bean, "name");
+                if (StringUtils.isNotBlank(uniqueName) && CoreUtil.compareName(ruleBaseDTO, uniqueName)) {
+                    ruleSimpleDTO.setContent(name);
+                    ruleSimpleDTO.setConType(conType);
+                    BillMsg billMsg = msgNewUtil.getCommonBillMsg(ruleSimpleDTO);
+                    CoreUtil.addBeanToList(billMsgList, billMsg);
                 }
             }
         }

+ 10 - 4
src/main/java/com/diagbot/rule/SexRule.java

@@ -4,8 +4,10 @@ import com.diagbot.dto.BillMsg;
 import com.diagbot.dto.RuleBaseDTO;
 import com.diagbot.dto.RuleSimpleDTO;
 import com.diagbot.dto.WordCrfDTO;
-import com.diagbot.util.MsgUtil;
+import com.diagbot.util.CoreUtil;
+import com.diagbot.util.MsgNewUtil;
 import com.diagbot.util.StringUtil;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
 import java.util.List;
@@ -18,6 +20,9 @@ import java.util.List;
 @Component
 public class SexRule {
 
+    @Autowired
+    MsgNewUtil msgNewUtil;
+
     /**
      * 比较性别
      *
@@ -30,9 +35,10 @@ public class SexRule {
     public void bill(WordCrfDTO wordCrfDTO, RuleBaseDTO ruleBaseDTO, List<BillMsg> billMsgList, String conType,
                      RuleSimpleDTO ruleSimpleDTO) {
         if (getFlag(wordCrfDTO, ruleBaseDTO)) {
-            BillMsg billMsg = MsgUtil.getCommonBillMsg(ruleSimpleDTO.getInputName(), ruleSimpleDTO.getLibName(),
-                    ruleBaseDTO.getBaseLibName(), conType, ruleSimpleDTO.getLibTypeName());
-            billMsgList.add(billMsg);
+            ruleSimpleDTO.setContent(ruleBaseDTO.getBaseLibName());
+            ruleSimpleDTO.setConType(conType);
+            BillMsg billMsg = msgNewUtil.getCommonBillMsg(ruleSimpleDTO);
+            CoreUtil.addBeanToList(billMsgList, billMsg);
         }
     }
 

+ 9 - 3
src/main/java/com/diagbot/rule/VitalRule.java

@@ -5,7 +5,9 @@ import com.diagbot.dto.RuleBaseDTO;
 import com.diagbot.dto.RuleSimpleDTO;
 import com.diagbot.model.label.VitalLabel;
 import com.diagbot.util.CoreUtil;
+import com.diagbot.util.MsgNewUtil;
 import com.diagbot.util.MsgUtil;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
 import java.util.List;
@@ -19,6 +21,9 @@ import java.util.Map;
 @Component
 public class VitalRule {
 
+    @Autowired
+    MsgNewUtil msgNewUtil;
+
     /**
      * 比较体征——开单合理性
      *
@@ -33,9 +38,10 @@ public class VitalRule {
         Map<String, Object> map = CoreUtil.compareVital(ruleBaseDTO, vitalLabel);
         List<String> msgList = CoreUtil.getMapMsgList(map);
         for (String s : msgList) {
-            BillMsg commonBillMsg = MsgUtil.getCommonBillMsg(ruleSimpleDTO.getInputName(),
-                    ruleSimpleDTO.getLibName(), s, conType, ruleSimpleDTO.getLibTypeName());
-            billMsgList.add(commonBillMsg);
+            ruleSimpleDTO.setContent(s);
+            ruleSimpleDTO.setConType(conType);
+            BillMsg billMsg = msgNewUtil.getCommonBillMsg(ruleSimpleDTO);
+            CoreUtil.addBeanToList(billMsgList, billMsg);
         }
     }
 

+ 58 - 0
src/main/java/com/diagbot/util/MsgNewUtil.java

@@ -0,0 +1,58 @@
+package com.diagbot.util;
+
+import com.diagbot.dto.BillMsg;
+import com.diagbot.dto.RuleSimpleDTO;
+import com.diagbot.enums.ConEnum;
+import com.diagbot.enums.RedisEnum;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+/**
+ * @description: 提示语工具类
+ * @author: zhoutg
+ * @time: 2020/9/14 11:16
+ */
+@Component
+public class MsgNewUtil {
+
+    @Autowired
+    RedisUtil redisUtil;
+
+    /**
+     * 开单合理性通用提示信息
+     *
+     * @param ruleSimpleDTO
+     * @return
+     */
+    public BillMsg getCommonBillMsg(RuleSimpleDTO ruleSimpleDTO) {
+        String orderName = ruleSimpleDTO.getInputName(); // 医院名称
+        String orderStandName = ruleSimpleDTO.getLibName(); // 标准名称
+        String orderType = ruleSimpleDTO.getLibTypeName(); // 开单项类型
+        String content = ruleSimpleDTO.getContent(); // 界面匹配内容
+        String conType = ruleSimpleDTO.getConType(); // 禁忌类型
+        String unionMsg = ruleSimpleDTO.getMsg(); // 原因及建议
+        String msg = redisUtil.getByKeyAndField(RedisEnum.msg.getName(), orderType + "_" + conType);
+        if (StringUtil.isBlank(msg)) {
+            msg = redisUtil.getByKeyAndField(RedisEnum.msg.getName(), "通用" + "_" + "默认提示语");
+        }
+        BillMsg billMsg = new BillMsg();
+        // 去除2个“具有”的提示语
+        if (ConEnum.medEqu.getName().equals(conType) && StringUtil.isNotBlank(content)
+                && content.startsWith("具有") && msg.endsWith("具有")) {
+            msg.replaceAll("具有", "");
+        }
+        msg = msg.replaceAll("\\[匹配内容]", content);
+        msg = msg.replaceAll("\\[开单名称]", orderName);
+        if (StringUtil.isNotBlank(unionMsg)) {
+            msg = msg.replaceAll("\\[原因及建议]", unionMsg);
+        } else {
+            msg = msg.replaceAll("\\[原因及建议]", "");
+        }
+        billMsg.setMsg(msg);
+        billMsg.setOrderName(orderName);
+        billMsg.setOrderStandName(orderStandName);
+        billMsg.setContent(content);
+        billMsg.setType(conType);
+        return billMsg;
+    }
+}

+ 47 - 48
src/main/java/com/diagbot/util/MsgUtil.java

@@ -2,7 +2,6 @@ package com.diagbot.util;
 
 import com.diagbot.biz.push.entity.Lis;
 import com.diagbot.dto.BillMsg;
-import com.diagbot.enums.ConEnum;
 import com.diagbot.enums.TypeEnum;
 
 /**
@@ -118,51 +117,51 @@ public class MsgUtil {
      * @param orderType      开单项类型
      * @return
      */
-    public static BillMsg getCommonBillMsg(String orderName, String orderStandName, String content, String conType, String orderType) {
-        BillMsg billMsg = new BillMsg();
-        // 禁忌项拼接提示语
-        switch (ConEnum.getEnum(conType)) {
-            case oralmeds: // 服用药品
-                content = "可能正在用药" + content;
-                break;
-            case allergicmeds: // 禁忌药品
-            case otherAllergy: // 禁忌其他过敏原
-                content = content + "过敏";
-                break;
-            case operations: // 手术
-                content = "有" + content + "史";
-                break;
-            case medEqu: // 禁忌医疗器械及物品
-                if (!content.startsWith("具有")) {
-                    content = "具有" + content;
-                }
-                break;
-        }
-        // 通用提示语
-        String msg = String.format("该患者%s,不宜开%s", content, orderName);
-        // 特殊情况下提示语
-        if (TypeEnum.transfusion.getName().equals(orderType)) {
-            // 输血开单项提示语
-            msg = String.format("该患者%s,谨慎输注%s", content, orderName);
-        } else if (TypeEnum.lis.getName().equals(orderType) && ConEnum.oralmeds.getName().equals(conType)) {
-            // 化验开单项 + 禁忌服用药品提示语
-            msg = String.format("该患者%s,会影响%s结果,请留意", content, orderName);
-        } else if (ConEnum.repeat24.getName().equals(conType)) {
-            // 24小时重复开立
-            msg = String.format("%s重复开立", orderName);
-        } else if (ConEnum.repeat.getName().equals(conType)) {
-            // 辅检正常项目无需重复开立
-            msg = String.format("重复开立:该患者近期做过%s,且结果无异常", content);
-        } else  if (ConEnum.exclusion.getName().equals(conType)) {
-            // 开单项互斥
-            msg = String.format("检查项目互斥:%s与%s不宜同时进行", orderName, content);
-            billMsg.setMsg(msg);
-        }
-        billMsg.setMsg(msg);
-        billMsg.setOrderName(orderName);
-        billMsg.setOrderStandName(orderStandName);
-        billMsg.setContent(content);
-        billMsg.setType(conType);
-        return billMsg;
-    }
+    // public static BillMsg getCommonBillMsg(String orderName, String orderStandName, String content, String conType, String orderType) {
+    //     BillMsg billMsg = new BillMsg();
+    //     // 禁忌项拼接提示语
+    //     switch (ConEnum.getEnum(conType)) {
+    //         case oralmeds: // 服用药品
+    //             content = "可能正在用药" + content;
+    //             break;
+    //         case allergicmeds: // 禁忌药品
+    //         case otherAllergy: // 禁忌其他过敏原
+    //             content = content + "过敏";
+    //             break;
+    //         case operations: // 手术
+    //             content = "有" + content + "史";
+    //             break;
+    //         case medEqu: // 禁忌医疗器械及物品
+    //             if (!content.startsWith("具有")) {
+    //                 content = "具有" + content;
+    //             }
+    //             break;
+    //     }
+    //     // 通用提示语
+    //     String msg = String.format("该患者%s,不宜开%s", content, orderName);
+    //     // 特殊情况下提示语
+    //     if (TypeEnum.transfusion.getName().equals(orderType)) {
+    //         // 输血开单项提示语
+    //         msg = String.format("该患者%s,谨慎输注%s", content, orderName);
+    //     } else if (TypeEnum.lis.getName().equals(orderType) && ConEnum.oralmeds.getName().equals(conType)) {
+    //         // 化验开单项 + 禁忌服用药品提示语
+    //         msg = String.format("该患者%s,会影响%s结果,请留意", content, orderName);
+    //     } else if (ConEnum.repeat24.getName().equals(conType)) {
+    //         // 24小时重复开立
+    //         msg = String.format("%s重复开立", orderName);
+    //     } else if (ConEnum.repeat.getName().equals(conType)) {
+    //         // 辅检正常项目无需重复开立
+    //         msg = String.format("重复开立:该患者近期做过%s,且结果无异常", content);
+    //     } else  if (ConEnum.exclusion.getName().equals(conType)) {
+    //         // 开单项互斥
+    //         msg = String.format("检查项目互斥:%s与%s不宜同时进行", orderName, content);
+    //         billMsg.setMsg(msg);
+    //     }
+    //     billMsg.setMsg(msg);
+    //     billMsg.setOrderName(orderName);
+    //     billMsg.setOrderStandName(orderStandName);
+    //     billMsg.setContent(content);
+    //     billMsg.setType(conType);
+    //     return billMsg;
+    // }
 }

+ 1 - 0
src/main/java/com/diagbot/web/CacheController.java

@@ -45,6 +45,7 @@ public class CacheController {
         cacheFacade.loadDeptPush(); // 重新加载标准科室和推送类型的映射关系
         cacheFacade.loadFrequency(); // 重新加载频次
         conceptInfoFacade.loadCustomDictionary(); // 重新加载NLP分词字典
+        cacheFacade.loadMsg();
         cacheFacade.loadAllBaseDiagnoseCache(); // 重新加载诊断依据
         cacheFacade.loadAllRuleCache(); // 重新加载开单规则
         return RespDTO.onSuc(true);