Browse Source

Merge remote-tracking branch 'origin/dev/neo2mysql20210120' into dev/neo2mysql20210120

wangfeng 4 years ago
parent
commit
a40880f050
28 changed files with 367 additions and 1071 deletions
  1. 19 0
      src/main/java/com/diagbot/dto/BillMsg.java
  2. 2 1
      src/main/java/com/diagbot/dto/LisOtherDTO.java
  3. 13 1
      src/main/java/com/diagbot/enums/ConEnum.java
  4. 0 81
      src/main/java/com/diagbot/enums/LibTypeEnum.java
  5. 0 67
      src/main/java/com/diagbot/enums/NeoEnum.java
  6. 2 1
      src/main/java/com/diagbot/enums/TypeEnum.java
  7. 7 7
      src/main/java/com/diagbot/facade/BillFacade.java
  8. 5 5
      src/main/java/com/diagbot/facade/CommonFacade.java
  9. 0 51
      src/main/java/com/diagbot/facade/CriticalFacade.java
  10. 4 2
      src/main/java/com/diagbot/facade/HighRiskFacade.java
  11. 1 1
      src/main/java/com/diagbot/facade/IndicationFacade.java
  12. 6 8
      src/main/java/com/diagbot/facade/OtherTipFacade.java
  13. 8 2
      src/main/java/com/diagbot/facade/TestFacade.java
  14. 23 238
      src/main/java/com/diagbot/process/BillProcess.java
  15. 3 3
      src/main/java/com/diagbot/process/CriticalProcess.java
  16. 33 27
      src/main/java/com/diagbot/process/HighRiskProcess.java
  17. 3 69
      src/main/java/com/diagbot/process/OtherTipProcess.java
  18. 1 1
      src/main/java/com/diagbot/rule/AgeRule.java
  19. 27 34
      src/main/java/com/diagbot/rule/CommonRule.java
  20. 6 9
      src/main/java/com/diagbot/rule/DrugRule.java
  21. 58 30
      src/main/java/com/diagbot/rule/LisRule.java
  22. 1 1
      src/main/java/com/diagbot/rule/MedEquRule.java
  23. 17 10
      src/main/java/com/diagbot/rule/PacsRule.java
  24. 1 1
      src/main/java/com/diagbot/rule/VitalRule.java
  25. 35 0
      src/main/java/com/diagbot/util/CatalogueUtil.java
  26. 0 217
      src/main/java/com/diagbot/util/CoreUtil.java
  27. 83 204
      src/main/java/com/diagbot/util/MsgUtil.java
  28. 9 0
      src/main/java/com/diagbot/web/CacheController.java

+ 19 - 0
src/main/java/com/diagbot/dto/BillMsg.java

@@ -2,6 +2,8 @@ package com.diagbot.dto;
 
 import lombok.Data;
 
+import java.util.Objects;
+
 /**
  * @description: 开单合理性提示语
  * @author: zhoutg
@@ -22,4 +24,21 @@ public class BillMsg {
     private String content;
     // 类型
     private String type;
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) {
+            return true;
+        }
+        if (o == null || getClass() != o.getClass()) {
+            return false;
+        }
+        BillMsg billMsg = (BillMsg) o;
+        return Objects.equals(msg, billMsg.msg);
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(msg);
+    }
 }

+ 2 - 1
src/main/java/com/diagbot/dto/LisOtherDTO.java

@@ -12,7 +12,8 @@ import java.util.List;
  */
 @Data
 public class LisOtherDTO {
-    private String name; // 提示名称
+    private String name; // 化验拼接提示语
+    private String msg; // 输血名称
     private List<String> drugMsg = new ArrayList<>(); // 药品拼接提示语
     private List<String> diseaseMsg = new ArrayList<>(); // 诊断拼接提示语
     private List<String> groupMsg = new ArrayList<>(); // 人群拼接提示语

+ 13 - 1
src/main/java/com/diagbot/enums/ConEnum.java

@@ -27,7 +27,10 @@ public enum ConEnum implements KeyedNamed {
     pacsDesc(14, "禁忌辅助检查描述"),
     medEqu(15, "禁忌医疗器械及物品"),
     exclusion(16, "开单项互斥"),
-    otherAllergy(17, "禁忌其他过敏原");
+    otherAllergy(17, "禁忌其他过敏原"),
+    repeat24(18, "24小时重复开立"),
+    repeat(19, "正常项目重复开立"),
+    ;
 
     @Setter
     private int key;
@@ -54,6 +57,15 @@ public enum ConEnum implements KeyedNamed {
         return item != null ? item.name : null;
     }
 
+    public static ConEnum getEnum(String value) {
+        for (ConEnum item : ConEnum.values()) {
+            if (item.getName().equals(value)) {
+                return item;
+            }
+        }
+        return null;
+    }
+
     @Override
     public int getKey() {
         return key;

+ 0 - 81
src/main/java/com/diagbot/enums/LibTypeEnum.java

@@ -1,81 +0,0 @@
-package com.diagbot.enums;
-
-import com.diagbot.core.KeyedNamed;
-import lombok.Setter;
-
-/**
- * @description: 词性类型枚举
- * @author: zhoutg
- * @date: 2021/2/22 13:44
- */
-public enum LibTypeEnum implements KeyedNamed {
-
-    disease(100, "疾病"),
-    drug(101, "药品通用名"),
-    clinical(103, "症状"),
-    vital(104, "体格检查项目"),
-    vitalRes(105, "体格检查结果"),
-    operation(106, "手术和操作"),
-    lis(107, "实验室检查套餐"),
-    lisDetail(108, "实验室检查子项目"),
-    pacs(109, "辅助检查项目"),
-    pacsSub(110, "辅助检查子项目"),
-    pacsResult(112, "辅助检查结果"),
-    transfusion(113, "输血类型"),
-    sex(116, "性别"),
-    group(117, "人群"),
-    otherAllergy(119, "其他过敏原"),
-    ylqxjwp(120, "医疗器械及物品"),
-    yphxwzlb(301, "药品化学物质类别"),
-    ypzlxlb(302, "药品治疗学类别"),
-    ypylxlb(303, "药品药理学类别"),
-    ypjpxlb(304, "药品解剖学类别"),
-    age(410, "年龄"),
-    ;
-
-    @Setter
-    private int key;
-
-    @Setter
-    private String name;
-
-    LibTypeEnum(int key, String name) {
-        this.key = key;
-        this.name = name;
-    }
-
-    public static LibTypeEnum getEnum(int key) {
-        for (LibTypeEnum item : LibTypeEnum.values()) {
-            if (item.key == key) {
-                return item;
-            }
-        }
-        return null;
-    }
-
-    public static LibTypeEnum getEnum(String value) {
-        for (LibTypeEnum item : LibTypeEnum.values()) {
-            if (item.getName().equals(value)) {
-                return item;
-            }
-        }
-        return null;
-    }
-
-    public static String getName(int key) {
-        LibTypeEnum item = getEnum(key);
-        return item != null ? item.name : null;
-    }
-
-    @Override
-    public int getKey() {
-        return key;
-    }
-
-    @Override
-    public String getName() {
-        return name;
-    }
-
-
-}

+ 0 - 67
src/main/java/com/diagbot/enums/NeoEnum.java

@@ -1,67 +0,0 @@
-package com.diagbot.enums;
-
-import com.diagbot.core.KeyedNamed;
-import lombok.Setter;
-
-/**
- * @author zhoutg
- * @Description: 图谱禁忌类型
- * @date 2018年10月11日 下午3:33:22
- */
-
-public enum NeoEnum implements KeyedNamed {
-
-    gender(1, "禁忌性别"),
-    ageNeoDTO(2, "禁忌年龄"),
-    clinicfindings(3, "禁忌临床表现"),
-    oralmeds(4, "禁忌服用药品"),
-    allergicmeds(5, "禁忌过敏药品"),
-    operations(6, "禁忌手术"),
-    procedures(7, "禁忌操作"),
-    lis(8, "禁忌实验室检查"),
-    pacs(9, "禁忌辅助检查"),
-    disease(10, "禁忌疾病"),
-    group(11, "禁忌人群"),
-    conflictmeds(12, "配伍禁忌"),
-    vitals(13, "禁忌查体"),
-    pacsDesc(14, "禁忌辅助检查描述"),
-    medEqu(15, "禁忌医疗器械及物品"),
-    exclusion(16, "开单项互斥");
-
-    @Setter
-    private int key;
-
-    @Setter
-    private String name;
-
-    NeoEnum(int key, String name) {
-        this.key = key;
-        this.name = name;
-    }
-
-    public static NeoEnum getEnum(int key) {
-        for (NeoEnum item : NeoEnum.values()) {
-            if (item.key == key) {
-                return item;
-            }
-        }
-        return null;
-    }
-
-    public static String getName(int key) {
-        NeoEnum item = getEnum(key);
-        return item != null ? item.name : null;
-    }
-
-    @Override
-    public int getKey() {
-        return key;
-    }
-
-    @Override
-    public String getName() {
-        return name;
-    }
-
-
-}

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

@@ -19,7 +19,8 @@ public enum TypeEnum implements KeyedNamed {
     operation(6, "手术"),
     vital(7, "查体"),
     transfusion(8, "输血"),
-    age(9,"年龄");
+    age(9,"年龄"),
+    group(10, "人群");
 
     @Setter
     private int key;

+ 7 - 7
src/main/java/com/diagbot/facade/BillFacade.java

@@ -5,7 +5,7 @@ import com.diagbot.biz.push.entity.Lis;
 import com.diagbot.biz.push.entity.Pacs;
 import com.diagbot.dto.IndicationDTO;
 import com.diagbot.dto.WordCrfDTO;
-import com.diagbot.enums.LibTypeEnum;
+import com.diagbot.enums.LexiconEnum;
 import com.diagbot.enums.RuleTypeEnum;
 import com.diagbot.enums.TypeEnum;
 import com.diagbot.process.BillProcess;
@@ -67,7 +67,7 @@ public class BillFacade {
                 RuleVO ruleVO = new RuleVO();
                 ruleVO.setInputName(item.getName());
                 ruleVO.setLibName(item.getUniqueName());
-                ruleVO.setLibType(LibTypeEnum.drug.getKey());
+                ruleVO.setLibType(LexiconEnum.Medicine.getKey());
                 ruleVO.setLibTypeName(TypeEnum.drug.getName());
                 ruleVO.setDateValue(item.getDateValue());
                 ruleVOList.add(ruleVO);
@@ -81,7 +81,7 @@ public class BillFacade {
                 RuleVO ruleVO = new RuleVO();
                 ruleVO.setInputName(pacs.getName());
                 ruleVO.setLibName(pacs.getUniqueName());
-                ruleVO.setLibType(LibTypeEnum.pacs.getKey());
+                ruleVO.setLibType(LexiconEnum.PacsName.getKey());
                 ruleVO.setLibTypeName(TypeEnum.pacs.getName());
                 ruleVO.setDateValue(pacs.getDateValue());
                 ruleVOList.add(ruleVO);
@@ -89,7 +89,7 @@ public class BillFacade {
                 RuleVO ruleVO1 = new RuleVO();
                 ruleVO1.setInputName(pacs.getName());
                 ruleVO1.setLibName(pacs.getUniqueName());
-                ruleVO1.setLibType(LibTypeEnum.pacs.getKey());
+                ruleVO1.setLibType(LexiconEnum.PacsName.getKey());
                 ruleVO1.setLibTypeName(TypeEnum.pacs.getName());
                 ruleVO1.setSuffix(String.valueOf(RuleTypeEnum.repeat.getKey()));
                 ruleVO1.setDateValue(pacs.getDateValue());
@@ -104,7 +104,7 @@ public class BillFacade {
                 RuleVO ruleVO = new RuleVO();
                 ruleVO.setInputName(lis.getName());
                 ruleVO.setLibName(lis.getUniqueName());
-                ruleVO.setLibType(LibTypeEnum.lis.getKey());
+                ruleVO.setLibType(LexiconEnum.LisName.getKey());
                 ruleVO.setLibTypeName(TypeEnum.lis.getName());
                 ruleVO.setDateValue(lis.getDateValue());
                 ruleVOList.add(ruleVO);
@@ -118,7 +118,7 @@ public class BillFacade {
                 RuleVO ruleVO = new RuleVO();
                 ruleVO.setInputName(item.getName());
                 ruleVO.setLibName(item.getUniqueName());
-                ruleVO.setLibType(LibTypeEnum.operation.getKey());
+                ruleVO.setLibType(LexiconEnum.Operation.getKey());
                 ruleVO.setLibTypeName(TypeEnum.operation.getName());
                 ruleVO.setDateValue(item.getDateValue());
                 ruleVOList.add(ruleVO);
@@ -132,7 +132,7 @@ public class BillFacade {
                 RuleVO ruleVO = new RuleVO();
                 ruleVO.setInputName(item.getName());
                 ruleVO.setLibName(item.getUniqueName());
-                ruleVO.setLibType(LibTypeEnum.transfusion.getKey());
+                ruleVO.setLibType(LexiconEnum.Transfusion.getKey());
                 ruleVO.setLibTypeName(TypeEnum.transfusion.getName());
                 ruleVO.setDateValue(item.getDateValue());
                 ruleVOList.add(ruleVO);

+ 5 - 5
src/main/java/com/diagbot/facade/CommonFacade.java

@@ -7,7 +7,7 @@ import com.diagbot.dto.BillMsg;
 import com.diagbot.dto.RuleDTO;
 import com.diagbot.dto.RuleExtDTO;
 import com.diagbot.dto.WordCrfDTO;
-import com.diagbot.enums.LibTypeEnum;
+import com.diagbot.enums.LexiconEnum;
 import com.diagbot.enums.RedisEnum;
 import com.diagbot.enums.StandConvertEnum;
 import com.diagbot.model.ai.AIAnalyze;
@@ -686,10 +686,10 @@ public class CommonFacade {
         RuleDTO ruleDTO = redisUtil.get(RedisEnum.allRule.getName() + ruleVO.getLibType() + "_" + ruleVO.getLibName() + "_" + ruleVO.getSuffix());
         if (ruleDTO == null) {
             // 辅检特殊处理,如果为空,再获取【辅助检查项目】【辅助检查子项目】中另外一个
-            if (ruleVO.getLibType().equals(LibTypeEnum.pacs.getKey())) {
-                ruleDTO = redisUtil.get("allRule:" + LibTypeEnum.pacsSub.getKey() + "_" + ruleVO.getLibName() + "_" + ruleVO.getSuffix());
-            } else if (ruleVO.getLibType().equals(LibTypeEnum.pacsSub.getKey())) {
-                ruleDTO = redisUtil.get("allRule:" + LibTypeEnum.pacs.getKey() + "_" + ruleVO.getLibName() + "_" + ruleVO.getSuffix());
+            if (ruleVO.getLibType().equals(LexiconEnum.PacsName.getKey())) {
+                ruleDTO = redisUtil.get("allRule:" + LexiconEnum.PacsSubName.getKey() + "_" + ruleVO.getLibName() + "_" + ruleVO.getSuffix());
+            } else if (ruleVO.getLibType().equals(LexiconEnum.PacsSubName.getKey())) {
+                ruleDTO = redisUtil.get("allRule:" + LexiconEnum.PacsName.getKey() + "_" + ruleVO.getLibName() + "_" + ruleVO.getSuffix());
             }
         }
         if (ruleDTO != null) {

+ 0 - 51
src/main/java/com/diagbot/facade/CriticalFacade.java

@@ -1,21 +1,11 @@
 package com.diagbot.facade;
 
-import com.diagbot.biz.push.entity.Lis;
-import com.diagbot.biz.push.entity.Pacs;
 import com.diagbot.dto.IndicationDTO;
 import com.diagbot.dto.WordCrfDTO;
-import com.diagbot.enums.LibTypeEnum;
-import com.diagbot.enums.RuleTypeEnum;
-import com.diagbot.enums.TypeEnum;
 import com.diagbot.process.CriticalProcess;
-import com.diagbot.util.StringUtil;
-import com.diagbot.vo.RuleVO;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
-import java.util.ArrayList;
-import java.util.List;
-
 /**
  * @Description: 危急值facade
  * @author: zhoutg
@@ -44,45 +34,4 @@ public class CriticalFacade {
         // 结果去重处理
         commonFacade.dealMsg(res.getCriticalValList());
     }
-
-
-
-    /**
-     * 获取危急值入参
-     *
-     * @param wordCrfDTO
-     * @return
-     */
-    public List<RuleVO> getRuleVO(WordCrfDTO wordCrfDTO) {
-        List<RuleVO> ruleVOList = new ArrayList<>();
-        // 化验数值
-        List<Lis> lisList = wordCrfDTO.getLis();
-        for (Lis lis : lisList) {
-            if (StringUtil.isNotBlank(lis.getUniqueName())) {
-                RuleVO ruleVO = new RuleVO();
-                ruleVO.setInputName(lis.getName());
-                ruleVO.setLibName(lis.getUniqueName());
-                ruleVO.setLibType(LibTypeEnum.lis.getKey());
-                ruleVO.setLibTypeName(TypeEnum.lis.getName());
-                ruleVO.setDateValue(lis.getDateValue());
-                ruleVO.setSuffix(String.valueOf(RuleTypeEnum.critical.getKey()));
-                ruleVOList.add(ruleVO);
-            }
-        }
-
-        // 辅检
-        List<Pacs> pacsList = wordCrfDTO.getPacs();
-        for (Pacs pacs : pacsList) {
-            if (StringUtil.isNotBlank(pacs.getUniqueName())) {
-                RuleVO ruleVO = new RuleVO();
-                ruleVO.setInputName(pacs.getName());
-                ruleVO.setLibName(pacs.getUniqueName());
-                ruleVO.setLibType(LibTypeEnum.pacs.getKey());
-                ruleVO.setLibTypeName(TypeEnum.pacs.getName());
-                ruleVO.setDateValue(pacs.getDateValue());
-                ruleVOList.add(ruleVO);
-            }
-        }
-        return ruleVOList;
-    }
 }

+ 4 - 2
src/main/java/com/diagbot/facade/HighRiskFacade.java

@@ -32,9 +32,11 @@ public class HighRiskFacade {
      * @return
      */
     public void highRiskFac(IndicationPushVO indicationPushVO, WordCrfDTO wordCrfDTO, IndicationDTO res) {
-        // 高危药品 TODO
+        // 高危药品
+        highRiskProcess.processDrug(wordCrfDTO, res);
 
-        // 高危手术 TODO
+        // 高危手术
+        highRiskProcess.processOperation(wordCrfDTO, res);
         // // 高风险图谱接口调用
         // // HighRiskNeoVO highRiskNeoVO = fillHighRiskNeo(wordCrfDTO);
         // List<HighRiskNeoDTO> highRiskNeoDTOList = neoFacade.getHighRiskNeo(wordCrfDTO);

+ 1 - 1
src/main/java/com/diagbot/facade/IndicationFacade.java

@@ -97,7 +97,7 @@ public class IndicationFacade {
         }
         CoreUtil.getDebugStr(standStart, "标准词转换耗时", debug);
         //正则匹配开始
-        wordCrfDTO = klRegularConfigFacade.getRegularConfigs(wordCrfDTO,indicationPushVO);
+        wordCrfDTO = klRegularConfigFacade.getRegularConfigs(wordCrfDTO, indicationPushVO);
         //正则匹配结束
         // 合并【数据来源】
         wordCrfDTO.setDiagSource(commonRule.getDiseaseSource(wordCrfDTO));

+ 6 - 8
src/main/java/com/diagbot/facade/OtherTipFacade.java

@@ -28,16 +28,14 @@ public class OtherTipFacade {
      * @return
      */
     public void otherTipFac(WordCrfDTO wordCrfDTO, IndicationDTO res) {
-        // 其他值提醒——化验 TODO
+        // 其他值提醒——化验
+        otherTipProcess.processLis(wordCrfDTO, res);
 
-        // 其他值提醒——辅检 TODO
+        // 其他值提醒——辅检
+        otherTipProcess.processPacs(wordCrfDTO, res);
 
-        // 其他值提醒——输血 TODO
-
-        // // 其他提示——建议输血
-        // List<OtherTipTransfusionNeoDTO> otherTipTransfusionNeoDTOList = neoFacade.getRecommendTransfs(wordCrfDTO);
-        // // TODO 测试数据结束
-        // otherTipProcess.processTransfusion(otherTipTransfusionNeoDTOList, res);
+        // 其他值提醒——输血
+        otherTipProcess.processTransfusion(wordCrfDTO, res);
 
         // 结果去重处理
         commonFacade.dealMsg(res.getOtherList());

+ 8 - 2
src/main/java/com/diagbot/facade/TestFacade.java

@@ -212,7 +212,10 @@ public class TestFacade {
                                 }
                             }
                         }
-
+                        // 防止数据被删报错
+                        if  (ListUtil.isEmpty(drugAll)) {
+                            continue;
+                        }
                         if (testLineVO.isGetOne()) { // 随机取一条
                             pastStr.append("对“").append(drugAll.get(getRandomNum(drugAll.size()))).append("”过敏。");
                             indicationPushVO.setPasts(pastStr.toString());
@@ -597,6 +600,7 @@ public class TestFacade {
         long start = System.currentTimeMillis();
         List<IndicationPushVO> indicationPushVOList = new ArrayList<>();
         List<TestIndicationVO> data = ExcelUtils.importExcelMultiSheets(file, 0, 1, testLineVO.getSheetIndex(), TestIndicationVO.class);
+        List<String> drugForm = Arrays.asList("注射剂", "片剂", "缓释剂", "胶囊剂", "滴丸剂");
         for (TestIndicationVO bean : data) {
             if (StringUtil.isNotEmpty(testLineVO.getIdNum()) && !testLineVO.getIdNum().equals(bean.getIdNum())) {
                 continue;
@@ -604,6 +608,9 @@ public class TestFacade {
             if (StringUtil.isEmpty(bean.getDrugLevel())) {
                 continue;
             }
+            if (!drugForm.contains(bean.getDrugForm())) {
+                continue;
+            }
             IndicationPushVO indicationPushVO = new IndicationPushVO();
             indicationPushVO.setRuleType("3");
             indicationPushVO.setIdNum(bean.getIdNum());
@@ -882,7 +889,6 @@ public class TestFacade {
                                 indicationPushVOList.add(indphysiquePushVO);
                             }
                         } else {
-                            //TODO 血氧饱和度 待删除
                             if ("血氧饱和度".equals(vitalArr[0].trim())) {
                                 sbVital.append(vitalArr[0]);
                                 sbVital.append(getValue(vitalArr));

+ 23 - 238
src/main/java/com/diagbot/process/BillProcess.java

@@ -10,7 +10,7 @@ import com.diagbot.dto.RuleSimpleDTO;
 import com.diagbot.dto.WordCrfDTO;
 import com.diagbot.enums.BaseTypeEnum;
 import com.diagbot.enums.ConEnum;
-import com.diagbot.enums.LibTypeEnum;
+import com.diagbot.enums.LexiconEnum;
 import com.diagbot.enums.RuleTypeEnum;
 import com.diagbot.facade.CommonFacade;
 import com.diagbot.facade.NeoFacade;
@@ -132,43 +132,43 @@ public class BillProcess {
                 switch (RuleTypeEnum.getEnum(ruleExtDTO.getRuleType())) {
                     case bill: // redis 数据以 _1结尾
                         for (RuleBaseDTO ruleBaseDTO : ruleBaseDTOList) {
-                            if (LibTypeEnum.getEnum(ruleBaseDTO.getBaseLibType()) != null) { // 避免空指针
-                                switch (LibTypeEnum.getEnum(ruleBaseDTO.getBaseLibType())) {
-                                    case sex: // 性别
+                            if (LexiconEnum.getEnum(ruleBaseDTO.getBaseLibType()) != null) { // 避免空指针
+                                switch (LexiconEnum.getEnum(ruleBaseDTO.getBaseLibType())) {
+                                    case Gender: // 性别
                                         sexRule.bill(wordCrfDTO, ruleBaseDTO, billMsgList, ConEnum.gender.getName(), ruleSimpleDTO);
-                                    case age: // 年龄
+                                    case Age: // 年龄
                                         ageRule.bill(wordCrfDTO, ruleBaseDTO, billMsgList, ConEnum.age.getName(), ruleSimpleDTO);
                                         break;
-                                    case disease: // 诊断
+                                    case Disease: // 诊断
                                         commonRule.compareItemWithBill(diags, ruleBaseDTO, billMsgList, ConEnum.disease.getName(), ruleSimpleDTO);
                                         break;
-                                    case lisDetail: // 化验
+                                    case LisSubName: // 化验
                                         lisRule.bill(wordCrfDTO.getLis(), ruleBaseDTO, billMsgList, ConEnum.lis.getName(), ruleSimpleDTO);
                                         break;
-                                    case vitalRes: //体格检查结果
-                                    case vital: // 体格检查项目
+                                    case VitalResult: //体格检查结果
+                                    case Vital: // 体格检查项目
                                         vitalRule.bill(wordCrfDTO.getVitalLabel(), ruleBaseDTO, billMsgList, ConEnum.vitals.getName(), ruleSimpleDTO);
                                         break;
-                                    case pacs: // 辅检项目
+                                    case PacsName: // 辅检项目
                                         if (ruleBaseDTO.getBaseType() != null && ruleBaseDTO.getBaseType().equals(BaseTypeEnum.B5.getKey())) {
                                             // 开单项互斥
-                                            commonRule.exclusionBill(wordCrfDTO, ruleBaseDTO, billMsgList, ruleSimpleDTO, set);
+                                            commonRule.exclusionBill(wordCrfDTO, ruleBaseDTO, billMsgList, ConEnum.exclusion.getName(), ruleSimpleDTO, set);
                                         } else {
                                             // 辅检项目,暂无数据
                                             pacsRule.bill(wordCrfDTO.getPacs(), ruleBaseDTO, billMsgList, ConEnum.pacs.getName(), ruleSimpleDTO);
                                         }
                                         break;
-                                    case clinical: // 临床表现
+                                    case Symptom: // 临床表现
                                         commonRule.compareNameWithBill(clinicals, ruleBaseDTO, billMsgList, ConEnum.clinicfindings.getName(), ruleSimpleDTO);
                                         break;
-                                    case operation: // 手术(既往史、现病史、医嘱手术)
+                                    case Operation: // 手术(既往史、现病史、医嘱手术)
                                         commonRule.compareNameWithBill(operations_all, ruleBaseDTO, billMsgList, ConEnum.operations.getName(), ruleSimpleDTO);
                                         break;
-                                    case drug:
-                                    case yphxwzlb:
-                                    case ypzlxlb:
-                                    case ypylxlb:
-                                    case ypjpxlb:
+                                    case Medicine:
+                                    case MedChemClass:
+                                    case MedZhiLiaoClass:
+                                    case MedYaoLiClass:
+                                    case MedJiePouClass:
                                         if (ruleBaseDTO.getBaseType().equals(4)) {
                                             // 禁忌过敏药品(既往史)
                                             drugRule.bill(allergyMedicines, ruleBaseDTO, billMsgList, ConEnum.allergicmeds.getName(), ruleSimpleDTO);
@@ -177,16 +177,16 @@ public class BillProcess {
                                             drugRule.bill(medicineAll, ruleBaseDTO, billMsgList, ConEnum.oralmeds.getName(), ruleSimpleDTO);
                                         }
                                         break;
-                                    case otherAllergy: // 其他过敏原
+                                    case Allergen: // 其他过敏原
                                         drugRule.bill(allergyMedicines, ruleBaseDTO, billMsgList, ConEnum.otherAllergy.getName(), ruleSimpleDTO);
                                         break;
-                                    case group: // 禁忌人群
+                                    case Group: // 禁忌人群
                                         groupRule.bill(wordCrfDTO, ruleBaseDTO, billMsgList, ConEnum.group.getName(), ruleSimpleDTO);
                                         break;
-                                    case pacsResult: // 禁用辅助检查描述
+                                    case PacsResult: // 禁用辅助检查描述
                                         commonRule.compareItemWithBill(pacsDescList, ruleBaseDTO, billMsgList, ConEnum.pacsDesc.getName(), ruleSimpleDTO);
                                         break;
-                                    case ylqxjwp: // 禁忌医疗器械及物品
+                                    case Device: // 禁忌医疗器械及物品
                                         medEquRule.bill(wordCrfDTO, ruleBaseDTO, billMsgList, ConEnum.medEqu.getName(), ruleSimpleDTO);
                                         break;
                                     default:
@@ -198,7 +198,7 @@ public class BillProcess {
                     case repeat:  // redis 数据以 _6结尾
                         for (RuleBaseDTO ruleBaseDTO : ruleBaseDTOList) {
                             // 无需重复开单项
-                            commonRule.needlessRepeatOrder(wordCrfDTO, ruleBaseDTO, billMsgList, ruleSimpleDTO);
+                            commonRule.needlessRepeatOrder(wordCrfDTO, ruleBaseDTO, billMsgList, ConEnum.repeat.getName(), ruleSimpleDTO);
                         }
                         break;
                     default:
@@ -209,219 +209,4 @@ public class BillProcess {
         // 24小时重复开单项
         commonRule.repeat24Bill(wordCrfDTO, billMsgList);
     }
-
-    // public void process(List<BillNeoDTO> billNeoDTOList, WordCrfDTO wordCrfDTO, IndicationDTO res) {
-    //     // 合并图谱数据到同一个对象中
-    //     List<BillNeoMaxDTO> billNeoMaxDTOList = new ArrayList<>();
-    //     for (BillNeoDTO billNeoDTO : billNeoDTOList) {
-    //         BillNeoMaxDTO billNeoMaxDTO = new BillNeoMaxDTO();
-    //         if (billNeoDTO.getDrugBillNeoDTO() != null) {
-    //             BeanUtil.copyProperties(billNeoDTO.getDrugBillNeoDTO(), billNeoMaxDTO);
-    //             billNeoMaxDTO.setType(TypeEnum.drug.getName());
-    //         } else if (billNeoDTO.getLisBillNeoDTO() != null) {
-    //             BeanUtil.copyProperties(billNeoDTO.getLisBillNeoDTO(), billNeoMaxDTO);
-    //             billNeoMaxDTO.setType(TypeEnum.lis.getName());
-    //         } else if (billNeoDTO.getPacsBillNeoDTO() != null) {
-    //             BeanUtil.copyProperties(billNeoDTO.getPacsBillNeoDTO(), billNeoMaxDTO);
-    //             billNeoMaxDTO.setType(TypeEnum.pacs.getName());
-    //         } else if (billNeoDTO.getOperationBillNeoDTO() != null) {
-    //             BeanUtil.copyProperties(billNeoDTO.getOperationBillNeoDTO(), billNeoMaxDTO);
-    //             if (ListUtil.isNotEmpty(billNeoDTO.getOperationBillNeoDTO().getMedallegen())) {
-    //                 billNeoMaxDTO.getAllergicmeds().addAll(billNeoDTO.getOperationBillNeoDTO().getMedallegen());
-    //             }
-    //             billNeoMaxDTO.setType(TypeEnum.operation.getName());
-    //         } else if (billNeoDTO.getTransfusionBillNeoDTO() != null) {
-    //             BeanUtil.copyProperties(billNeoDTO.getTransfusionBillNeoDTO(), billNeoMaxDTO);
-    //             billNeoMaxDTO.setType(TypeEnum.transfusion.getName());
-    //         }
-    //         billNeoMaxDTO.setOrderName(billNeoDTO.getName()); // 开单名称
-    //         billNeoMaxDTO.setOrderStandName(billNeoDTO.getStandname()); // 开单标准名称
-    //         // // TODO 测试数据开始
-    //         // if (billNeoDTO.getStandname().equals("胸部CT")) {
-    //         //     NodeNeoDTO nodeNeoDTO = new NodeNeoDTO();
-    //         //     nodeNeoDTO.setName("幼儿");
-    //         //     billNeoMaxDTO.getGroup().add(nodeNeoDTO);
-    //         // }
-    //         // if (billNeoDTO.getStandname().equals("胸部CT")) {
-    //         //     NodeNeoDTO nodeNeoDTO = new NodeNeoDTO();
-    //         //     nodeNeoDTO.setName("心电图");
-    //         //     billNeoMaxDTO.getPacsOrder().add(nodeNeoDTO);
-    //         // }
-    //         // if (billNeoDTO.getStandname().equals("心电图")) {
-    //         //     NodeNeoDTO nodeNeoDTO = new NodeNeoDTO();
-    //         //     nodeNeoDTO.setName("胸部CT");
-    //         //     billNeoMaxDTO.getPacsOrder().add(nodeNeoDTO);
-    //         // }
-    //         // if (billNeoDTO.getName().equals("普通胃镜检查")) {
-    //         //     NodeNeoDTO sexNeo = new NodeNeoDTO();
-    //         //     sexNeo.setName("男");
-    //         //     billNeoMaxDTO.setGender(sexNeo);
-    //         //
-    //         //     NodeNeoDTO nodeNeoDTO = new NodeNeoDTO();
-    //         //     nodeNeoDTO.setName("红细胞压积");
-    //         //     nodeNeoDTO.setVal("阳性");
-    //         //     billNeoDTO.getPacsBillNeoDTO().getLis().add(nodeNeoDTO);
-    //         //
-    //         //     NodeNeoDTO nodepacsDTO = new NodeNeoDTO();
-    //         //     nodepacsDTO.setName("上腹部平扫");
-    //         //     billNeoDTO.getPacsBillNeoDTO().getPacs().add(nodepacsDTO);
-    //         //
-    //         //     NodeNeoDTO opereat = new NodeNeoDTO();
-    //         //     opereat.setName("胸腔镜下左下肺叶切除术");
-    //         //     billNeoDTO.getPacsBillNeoDTO().getOperations().add(opereat);
-    //         //     NodeNeoDTO opereat2 = new NodeNeoDTO();
-    //         //     opereat2.setName("区域淋巴结清扫术");
-    //         //     billNeoDTO.getPacsBillNeoDTO().getOperations().add(opereat2);
-    //         //
-    //         //     NodeNeoDTO drug = new NodeNeoDTO();
-    //         //     drug.setName("青霉素类");
-    //         //     billNeoDTO.getPacsBillNeoDTO().getAllergicmeds().add(drug);
-    //         //
-    //         //     NodeNeoDTO drug3 = new NodeNeoDTO();
-    //         //     drug3.setName("泰舒达类");
-    //         //     billNeoDTO.getPacsBillNeoDTO().getOralmeds().add(drug3);
-    //         //
-    //         //     // NodeNeoDTO vital = new NodeNeoDTO();
-    //         //     // vital.setName("体温");
-    //         //     // vital.setMax(new BigDecimal("39.1"));
-    //         //     // vital.setMin(new BigDecimal("35.1"));
-    //         //     // vital.setValType(1);
-    //         //     // billNeoDTO.getPacsBillNeoDTO().getVitals().add(vital);
-    //         //
-    //         //     NodeNeoDTO vitalBp = new NodeNeoDTO();
-    //         //     vitalBp.setName("舒张压");
-    //         //     vitalBp.setMax(new BigDecimal("120"));
-    //         //     vitalBp.setMin(new BigDecimal("100"));
-    //         //     vitalBp.setValType(1);
-    //         //     billNeoDTO.getPacsBillNeoDTO().getVitals().add(vitalBp);
-    //         //
-    //         //     NodeNeoDTO vitalBp2 = new NodeNeoDTO();
-    //         //     vitalBp2.setName("收缩压");
-    //         //     vitalBp2.setMax(new BigDecimal("120"));
-    //         //     vitalBp2.setMin(new BigDecimal("100"));
-    //         //     vitalBp2.setValType(1);
-    //         //     billNeoDTO.getPacsBillNeoDTO().getVitals().add(vitalBp2);
-    //         // }
-    //         // 测试数据结束
-    //
-    //         System.out.println(billNeoMaxDTO);
-    //         billNeoMaxDTOList.add(billNeoMaxDTO);
-    //     }
-    //
-    //     // 辅检开单项时间赋值,用于规则【无需重复开单项】
-    //     // 由于mark之前返回的billNeoDTOList没有时间字段,就用辅检开单的原始数据name和uniqueName两个字段相同时
-    //     // 进行赋值。可能会存在多个相同的开单项,时间需要分别赋值:处理方式是时间只用一次,刚好可以对上
-    //     if (ListUtil.isNotEmpty(billNeoMaxDTOList) && ListUtil.isNotEmpty(wordCrfDTO.getPacsOrder())) {
-    //         List<Integer> useList = new ArrayList<>();
-    //         for (int i = 0; i < billNeoMaxDTOList.size(); i++) {
-    //             BillNeoMaxDTO billNeoMaxDTO = billNeoMaxDTOList.get(i);
-    //             for (int j = 0; j < wordCrfDTO.getPacsOrder().size(); j++) {
-    //                 Pacs pacs = wordCrfDTO.getPacsOrder().get(j);
-    //                 if (StringUtil.isNotBlank(pacs.getName()) && StringUtil.isNotBlank(pacs.getUniqueName())
-    //                         && pacs.getName().equals(billNeoMaxDTO.getOrderName())
-    //                         && pacs.getUniqueName().equals(billNeoMaxDTO.getOrderStandName())) {
-    //                     if (!useList.contains(j)) { // 判断使用标识
-    //                         billNeoMaxDTO.setDateValue(pacs.getDateValue());
-    //                         useList.add(j);
-    //                         break;
-    //                     }
-    //                 }
-    //             }
-    //         }
-    //     }
-    //     processRule(billNeoMaxDTOList, wordCrfDTO, res);
-    // }
-    //
-    // // 规则处理
-    // public void processRule(List<BillNeoMaxDTO> billNeoMaxDTOList, WordCrfDTO wordCrfDTO, IndicationDTO indicationDTO) {
-    //     ChiefLabel chiefLabel = wordCrfDTO.getChiefLabel();
-    //     PresentLabel presentLabel = wordCrfDTO.getPresentLabel();
-    //     PastLabel pastLabel = wordCrfDTO.getPastLabel();
-    //
-    //     // 【过敏药品数据来源】
-    //     List<Item> allergyMedicines = commonRule.getDrugAllergySource(wordCrfDTO);
-    //
-    //     // 【药品数据来源】(主诉、现病史、既往史、结构化药品)
-    //     List<Item> medicineAll = wordCrfDTO.getDrugSource();
-    //
-    //     // 【诊断数据来源】
-    //     List<Item> diags = wordCrfDTO.getDiagSource();
-    //
-    //     // 【辅检结果数据来源】
-    //     PacsLabel pacsLabel = wordCrfDTO.getPacsLabel();
-    //     List<Item> pacsDescList = pacsLabel.getRes();
-    //
-    //     // 【手术数据来源】
-    //     List<Operation> operations_all = new ArrayList<>();
-    //     List<Item> operation = wordCrfDTO.getOperation();
-    //     List<Operation> operationsItem = new ArrayList<>();
-    //     for (Item item : operation) {
-    //         Operation operaData = new Operation();
-    //         operaData.setName(item.getName());
-    //         operaData.setStandName(item.getUniqueName());
-    //         operationsItem.add(operaData);
-    //     }
-    //     CoreUtil.addList(operations_all, chiefLabel.getOperations()); // 主诉手术
-    //     CoreUtil.addList(operations_all, presentLabel.getOperations()); // 现病史手术
-    //     CoreUtil.addList(operations_all, pastLabel.getOperations()); // 既往史手术
-    //     CoreUtil.addList(operations_all, operationsItem); // 结构化手术
-    //
-    //     // 【临床表现数据来源】(主诉、现病史)
-    //     List<Clinical> clinicals = new ArrayList<>();
-    //     CoreUtil.addList(clinicals, chiefLabel.getClinicals()); // 主诉临床表现
-    //     CoreUtil.addList(clinicals, presentLabel.getClinicals()); // 现病史临床表现
-    //
-    //     List<BillMsg> billMsgList = new ArrayList<>();
-    //     for (BillNeoMaxDTO bill : billNeoMaxDTOList) {
-    //         // 性别
-    //         // sexRule.bill(wordCrfDTO, bill, billMsgList, NeoEnum.gender.getName());
-    //
-    //         // 年龄
-    //         // ageRule.bill(wordCrfDTO, bill, billMsgList, NeoEnum.ageNeoDTO.getName());
-    //
-    //         // 诊断
-    //         // commonRule.compareItemWithBill(bill.getDisease(), diags, bill, billMsgList, NeoEnum.disease.getName());
-    //         //
-    //         // // 化验
-    //         // lisRule.bill(wordCrfDTO.getLis(), bill, billMsgList, NeoEnum.lis.getName());
-    //
-    //         // 体征
-    //         // vitalRule.bill(wordCrfDTO.getVitalLabel(), bill, billMsgList, NeoEnum.vitals.getName());
-    //         //
-    //         // // 辅检
-    //         // pacsRule.bill(bill.getPacs(), wordCrfDTO.getPacs(), bill, billMsgList, NeoEnum.pacs.getName());
-    //         //
-    //         // // 临床表现
-    //         // commonRule.compareNameWithBill(bill.getClinicfindings(), clinicals, bill, billMsgList, NeoEnum.clinicfindings.getName());
-    //         //
-    //         // // 手术(既往史、现病史、医嘱手术)
-    //         // commonRule.compareNameWithBill(bill.getOperations(), operations_all, bill, billMsgList, NeoEnum.operations.getName());
-    //         //
-    //         // // 禁忌过敏药品(既往史)
-    //         // drugRule.bill(bill.getAllergicmeds(), allergyMedicines, bill, billMsgList, NeoEnum.allergicmeds.getName());
-    //         //
-    //         // // 服用药品(主诉、现病史、既往史、结构化药品)
-    //         // drugRule.bill(bill.getOralmeds(), medicineAll, bill, billMsgList, NeoEnum.oralmeds.getName());
-    //         //
-    //         // // 禁忌人群
-    //         // groupRule.bill(wordCrfDTO, bill, billMsgList, NeoEnum.group.getName());
-    //         //
-    //         // // 禁用辅助检查描述
-    //         // commonRule.compareItemWithBill(bill.getPacsDesc(), pacsDescList, bill, billMsgList, NeoEnum.pacsDesc.getName());
-    //         //
-    //         // // 禁忌医疗器械及物品
-    //         // medEquRule.bill(wordCrfDTO, bill, billMsgList, NeoEnum.medEqu.getName());
-    //         //
-    //         // // 无需重复开单项
-    //         // commonRule.needlessRepeatOrder(wordCrfDTO, bill, billMsgList);
-    //     }
-    //
-    //     // 24小时重复开单项
-    //     commonRule.repeat24Bill(wordCrfDTO, billMsgList);
-    //
-    //     // 互斥开单项
-    //     commonRule.exclusionBill(billNeoMaxDTOList, wordCrfDTO, billMsgList);
-    //     indicationDTO.setBillMsgList(billMsgList);
-    // }
-
 }

+ 3 - 3
src/main/java/com/diagbot/process/CriticalProcess.java

@@ -8,7 +8,7 @@ import com.diagbot.dto.RuleBaseDTO;
 import com.diagbot.dto.RuleConditionDTO;
 import com.diagbot.dto.RuleExtDTO;
 import com.diagbot.dto.WordCrfDTO;
-import com.diagbot.enums.LibTypeEnum;
+import com.diagbot.enums.LexiconEnum;
 import com.diagbot.enums.RuleTypeEnum;
 import com.diagbot.enums.TypeEnum;
 import com.diagbot.facade.CommonFacade;
@@ -117,7 +117,7 @@ public class CriticalProcess {
             RuleVO ruleVO = new RuleVO();
             ruleVO.setInputName(lis.getName());
             ruleVO.setLibName(lis.getUniqueName());
-            ruleVO.setLibType(LibTypeEnum.lisDetail.getKey());
+            ruleVO.setLibType(LexiconEnum.LisSubName.getKey());
             ruleVO.setLibTypeName(TypeEnum.lis.getName());
             ruleVO.setDateValue(lis.getDateValue());
             ruleVO.setSuffix(String.valueOf(RuleTypeEnum.critical.getKey()));
@@ -137,7 +137,7 @@ public class CriticalProcess {
             RuleVO ruleVO = new RuleVO();
             ruleVO.setInputName(item.getName());
             ruleVO.setLibName(item.getUniqueName());
-            ruleVO.setLibType(LibTypeEnum.pacsResult.getKey());
+            ruleVO.setLibType(LexiconEnum.PacsResult.getKey());
             ruleVO.setLibTypeName(TypeEnum.pacs.getName());
             ruleVO.setDateValue(item.getDateValue());
             ruleVO.setSuffix(String.valueOf(RuleTypeEnum.critical.getKey()));

+ 33 - 27
src/main/java/com/diagbot/process/HighRiskProcess.java

@@ -10,7 +10,7 @@ import com.diagbot.dto.RuleConditionDTO;
 import com.diagbot.dto.RuleExtDTO;
 import com.diagbot.dto.RuleSimpleDTO;
 import com.diagbot.dto.WordCrfDTO;
-import com.diagbot.enums.LibTypeEnum;
+import com.diagbot.enums.LexiconEnum;
 import com.diagbot.enums.RuleTypeEnum;
 import com.diagbot.enums.TypeEnum;
 import com.diagbot.facade.CommonFacade;
@@ -20,6 +20,7 @@ import com.diagbot.rule.CommonRule;
 import com.diagbot.rule.LisRule;
 import com.diagbot.rule.VitalRule;
 import com.diagbot.util.BeanUtil;
+import com.diagbot.util.MsgUtil;
 import com.diagbot.util.StringUtil;
 import com.diagbot.vo.Drug;
 import com.diagbot.vo.RuleVO;
@@ -84,7 +85,7 @@ public class HighRiskProcess {
     }
 
     /**
-     * 处理业务——高危药品
+     * 处理业务——高危手术
      *
      * @param wordCrfDTO
      * @param res
@@ -106,29 +107,34 @@ public class HighRiskProcess {
                 // 3、规则匹配
                 List<RuleConditionDTO> ruleConditionDTOList = ruleExtDTO.getRuleConditionDTOList();
                 for (RuleConditionDTO ruleConditionDTO : ruleConditionDTOList) {
-                    List<RuleBaseDTO> ruleBaseDTOList = ruleConditionDTO.getRuleBaseDTOList();
-                    for (RuleBaseDTO ruleBaseDTO : ruleBaseDTOList ) {
-                        if (LibTypeEnum.getEnum(ruleBaseDTO.getBaseLibType()) != null) { // 避免空指针
-                            switch (LibTypeEnum.getEnum(ruleBaseDTO.getBaseLibType())) {
-                                case age: // 年龄
-                                    ageRule.highOperation(wordCrfDTO, ruleBaseDTO, highRiskList, ruleSimpleDTO);
-                                    break;
-                                case disease: // 诊断
-                                    commonRule.compareItemWithHighRisk(wordCrfDTO.getDiag(), ruleBaseDTO, highRiskList, ruleSimpleDTO);
-                                    break;
-                                case lisDetail: // 化验
-                                    lisRule.highOperation(wordCrfDTO.getLis(), ruleBaseDTO, highRiskList, ruleSimpleDTO);
-                                    break;
-                                case vitalRes: //体格检查结果
-                                case vital: // 体格检查项目
-                                    vitalRule.highOperation(wordCrfDTO.getVitalLabel(), ruleBaseDTO, highRiskList, ruleSimpleDTO);
-                                    break;
-                                case pacsResult: // 禁用辅助检查描述
-                                    // 【辅检结果数据来源】
-                                    PacsLabel pacsLabel = wordCrfDTO.getPacsLabel();
-                                    List<Item> pacsDescList = pacsLabel.getRes();
-                                    commonRule.compareItemWithHighRisk(pacsDescList, ruleBaseDTO, highRiskList, ruleSimpleDTO);
-                                    break;
+                    if (ruleConditionDTO.getHasSubCond().equals(0)) { // 3,4级高危手术,本身高危
+                        BillMsg highRisk = MsgUtil.getCommonHighRiskMsg("", ruleExtDTO.getInputName(), TypeEnum.operation.getName());
+                        highRiskList.add(highRisk);
+                    } else { // 2级高危手术
+                        List<RuleBaseDTO> ruleBaseDTOList = ruleConditionDTO.getRuleBaseDTOList();
+                        for (RuleBaseDTO ruleBaseDTO : ruleBaseDTOList) {
+                            if (LexiconEnum.getEnum(ruleBaseDTO.getBaseLibType()) != null) { // 避免空指针
+                                switch (LexiconEnum.getEnum(ruleBaseDTO.getBaseLibType())) {
+                                    case Age: // 年龄
+                                        ageRule.highOperation(wordCrfDTO, ruleBaseDTO, highRiskList, ruleSimpleDTO);
+                                        break;
+                                    case Disease: // 诊断
+                                        commonRule.compareItemWithHighRisk(wordCrfDTO.getDiag(), ruleBaseDTO, highRiskList, ruleSimpleDTO);
+                                        break;
+                                    case LisSubName: // 化验
+                                        lisRule.highOperation(wordCrfDTO.getLis(), ruleBaseDTO, highRiskList, ruleSimpleDTO);
+                                        break;
+                                    case VitalResult: //体格检查结果
+                                    case Vital: // 体格检查项目
+                                        vitalRule.highOperation(wordCrfDTO.getVitalLabel(), ruleBaseDTO, highRiskList, ruleSimpleDTO);
+                                        break;
+                                    case PacsResult: // 禁用辅助检查描述
+                                        // 【辅检结果数据来源】
+                                        PacsLabel pacsLabel = wordCrfDTO.getPacsLabel();
+                                        List<Item> pacsDescList = pacsLabel.getRes();
+                                        commonRule.compareItemWithHighRisk(pacsDescList, ruleBaseDTO, highRiskList, ruleSimpleDTO);
+                                        break;
+                                }
                             }
                         }
                     }
@@ -148,7 +154,7 @@ public class HighRiskProcess {
             RuleVO ruleVO = new RuleVO();
             ruleVO.setInputName(bean.getName());
             ruleVO.setLibName(bean.getUniqueName());
-            ruleVO.setLibType(LibTypeEnum.drug.getKey());
+            ruleVO.setLibType(LexiconEnum.Medicine.getKey());
             ruleVO.setLibTypeName(TypeEnum.drug.getName());
             ruleVO.setDateValue(bean.getDateValue());
             ruleVO.setSuffix(String.valueOf(RuleTypeEnum.high.getKey()));
@@ -169,7 +175,7 @@ public class HighRiskProcess {
             RuleVO ruleVO = new RuleVO();
             ruleVO.setInputName(bean.getName());
             ruleVO.setLibName(bean.getUniqueName());
-            ruleVO.setLibType(LibTypeEnum.operation.getKey());
+            ruleVO.setLibType(LexiconEnum.Operation.getKey());
             ruleVO.setLibTypeName(TypeEnum.operation.getName());
             ruleVO.setDateValue(bean.getDateValue());
             ruleVO.setSuffix(String.valueOf(RuleTypeEnum.high.getKey()));

+ 3 - 69
src/main/java/com/diagbot/process/OtherTipProcess.java

@@ -4,12 +4,11 @@ import com.diagbot.biz.push.entity.Item;
 import com.diagbot.biz.push.entity.Lis;
 import com.diagbot.dto.BillMsg;
 import com.diagbot.dto.IndicationDTO;
-import com.diagbot.dto.OtherTipTransfusionNeoDTO;
 import com.diagbot.dto.RuleBaseDTO;
 import com.diagbot.dto.RuleConditionDTO;
 import com.diagbot.dto.RuleExtDTO;
 import com.diagbot.dto.WordCrfDTO;
-import com.diagbot.enums.LibTypeEnum;
+import com.diagbot.enums.LexiconEnum;
 import com.diagbot.enums.RuleTypeEnum;
 import com.diagbot.enums.TypeEnum;
 import com.diagbot.facade.CommonFacade;
@@ -18,17 +17,12 @@ import com.diagbot.rule.CommonRule;
 import com.diagbot.rule.GroupRule;
 import com.diagbot.rule.LisRule;
 import com.diagbot.rule.PacsRule;
-import com.diagbot.util.CoreUtil;
-import com.diagbot.util.ListUtil;
-import com.diagbot.util.MsgUtil;
 import com.diagbot.util.StringUtil;
 import com.diagbot.vo.RuleVO;
-import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
 import java.util.List;
-import java.util.stream.Collectors;
 
 /**
  * @Description: 其他提示总入口
@@ -142,7 +136,7 @@ public class OtherTipProcess {
             RuleVO ruleVO = new RuleVO();
             ruleVO.setInputName(bean.getName());
             ruleVO.setLibName(bean.getUniqueName());
-            ruleVO.setLibType(LibTypeEnum.pacsResult.getKey());
+            ruleVO.setLibType(LexiconEnum.PacsResult.getKey());
             ruleVO.setLibTypeName(TypeEnum.pacs.getName());
             ruleVO.setDateValue(bean.getDateValue());
             ruleVO.setSuffix(String.valueOf(RuleTypeEnum.other.getKey()));
@@ -162,7 +156,7 @@ public class OtherTipProcess {
             RuleVO ruleVO = new RuleVO();
             ruleVO.setInputName(lis.getName());
             ruleVO.setLibName(lis.getUniqueName());
-            ruleVO.setLibType(LibTypeEnum.lisDetail.getKey());
+            ruleVO.setLibType(LexiconEnum.LisSubName.getKey());
             ruleVO.setLibTypeName(TypeEnum.lis.getName());
             ruleVO.setDateValue(lis.getDateValue());
             ruleVO.setSuffix(String.valueOf(key));
@@ -170,64 +164,4 @@ public class OtherTipProcess {
         }
         return null;
     }
-
-    /**
-     * 处理业务——输血
-     *
-     * @param otherTipTransfusionNeoDTOList
-     * @param res
-     */
-    public void processTransfusion(List<OtherTipTransfusionNeoDTO> otherTipTransfusionNeoDTOList, IndicationDTO res) {
-        for (OtherTipTransfusionNeoDTO bean : otherTipTransfusionNeoDTOList) {
-            if (StringUtil.isBlank(bean.getName())) {
-                continue;
-            }
-            StringBuffer sb = new StringBuffer();
-            // 诊断
-            if (ListUtil.isNotEmpty(bean.getDiag())) {
-                sb.append("诊断");
-                List<String> diag = bean.getDiag().stream().map(r -> r.getName()).collect(Collectors.toList());
-                sb.append(StringUtils.join(diag, ","));
-            }
-            // 辅检结果
-            if (ListUtil.isNotEmpty(bean.getPacsRes())) {
-                List<String> pacsRes = bean.getPacsRes().stream().map(r -> r.getName()).collect(Collectors.toList());
-                sb.append(StringUtils.join(pacsRes, ","));
-            }
-            // 化验
-            if (ListUtil.isNotEmpty(bean.getLisList())) {
-                for (Lis lis : bean.getLisList()) {
-                    if (sb.toString().length() > 0) {
-                        sb.append(",");
-                    }
-                    if (lis.getName() == null || lis.getDetailName() == null
-                            || !lis.getName().equals(lis.getDetailName())) {
-                        sb.append(lis.getName() + lis.getDetailName() + CoreUtil.getLisValue(lis));
-                    } else {
-                        sb.append(lis.getDetailName() + CoreUtil.getLisValue(lis));
-                    }
-                }
-            }
-            // 辅检名称
-            if (ListUtil.isNotEmpty(bean.getPacs())) {
-                if (sb.toString().length() > 0) {
-                    sb.append(",");
-                }
-                sb.append("已开");
-                List<String> pacs = bean.getPacs().stream().map(r -> r.getName()).collect(Collectors.toList());
-                sb.append(StringUtils.join(pacs, ","));
-            }
-            // 手术
-            if (ListUtil.isNotEmpty(bean.getOperation())) {
-                List<String> operation = bean.getOperation().stream().map(r -> r.getName()).collect(Collectors.toList());
-                if (sb.toString().length() > 0) {
-                    sb.append(",");
-                }
-                sb.append("已开");
-                sb.append(StringUtils.join(operation, ","));
-            }
-            BillMsg billMsg = MsgUtil.getCommonOtherTipTransfusionMsg(sb.toString(), bean.getName());
-            res.getOtherList().add(billMsg);
-        }
-    }
 }

+ 1 - 1
src/main/java/com/diagbot/rule/AgeRule.java

@@ -49,7 +49,7 @@ public class AgeRule {
         Boolean flag = getFlag(wordCrfDTO, ruleBaseDTO);
         if (flag) {
             String message = "年龄:" + wordCrfDTO.getAge();
-            BillMsg billMsg = MsgUtil.getComplexOperationMsg(message, ruleSimpleDTO.getInputName(), ruleSimpleDTO.getLibTypeName());
+            BillMsg billMsg = MsgUtil.getCommonHighRiskMsg(message, ruleSimpleDTO.getInputName(), ruleSimpleDTO.getLibTypeName());
             highRiskList.add(billMsg);
         }
     }

+ 27 - 34
src/main/java/com/diagbot/rule/CommonRule.java

@@ -8,7 +8,7 @@ import com.diagbot.dto.NodeNeoDTO;
 import com.diagbot.dto.RuleBaseDTO;
 import com.diagbot.dto.RuleSimpleDTO;
 import com.diagbot.dto.WordCrfDTO;
-import com.diagbot.enums.NeoEnum;
+import com.diagbot.enums.ConEnum;
 import com.diagbot.enums.TypeEnum;
 import com.diagbot.model.entity.Negative;
 import com.diagbot.util.CatalogueUtil;
@@ -18,7 +18,6 @@ import com.diagbot.util.ListUtil;
 import com.diagbot.util.MsgUtil;
 import com.diagbot.util.StringUtil;
 import org.apache.commons.lang3.StringUtils;
-import org.apache.poi.ss.formula.functions.T;
 import org.springframework.stereotype.Component;
 
 import java.util.ArrayList;
@@ -59,17 +58,10 @@ public class CommonRule {
                     String c = (String) CoreUtil.getFieldValue(d, "standName");
                     String c_name = (String) CoreUtil.getFieldValue(d, "name");
                     if (StringUtils.isNotBlank(c) && CoreUtil.compareName(ruleBaseDTO, c)) {
-                        if ("禁忌手术".equals(conType)) {
-                            BillMsg commonBillMsg = MsgUtil.getCommonSurgeryMsg(
-                                    ruleSimpleDTO.getInputName(), ruleSimpleDTO.getLibName(),
-                                    c_name, conType, ruleSimpleDTO.getLibTypeName());
-                            billMsgList.add(commonBillMsg);
-                        } else {
-                            BillMsg commonBillMsg = MsgUtil.getCommonBillMsg(
-                                    ruleSimpleDTO.getInputName(), ruleSimpleDTO.getLibName(),
-                                    c_name, conType, ruleSimpleDTO.getLibTypeName());
-                            billMsgList.add(commonBillMsg);
-                        }
+                        BillMsg commonBillMsg = MsgUtil.getCommonBillMsg(
+                                ruleSimpleDTO.getInputName(), ruleSimpleDTO.getLibName(),
+                                c_name, conType, ruleSimpleDTO.getLibTypeName());
+                        billMsgList.add(commonBillMsg);
                     }
                 }
             }
@@ -164,7 +156,7 @@ public class CommonRule {
                 String c = (String) CoreUtil.getFieldValue(t, "uniqueName"); // 标准名称
                 String c_name = (String) CoreUtil.getFieldValue(t, "name"); // 界面名称
                 if (CoreUtil.compareName(ruleBaseDTO, c)) {
-                    BillMsg billMsg = MsgUtil.getComplexOperationMsg(c_name, ruleSimpleDTO.getInputName(), ruleSimpleDTO.getLibTypeName());
+                    BillMsg billMsg = MsgUtil.getCommonHighRiskMsg(c_name, ruleSimpleDTO.getInputName(), ruleSimpleDTO.getLibTypeName());
                     highRiskList.add(billMsg);
                 }
             }
@@ -179,7 +171,7 @@ public class CommonRule {
      * @param billMsgList
      * @param ruleSimpleDTO
      */
-    public void needlessRepeatOrder(WordCrfDTO wordCrfDTO, RuleBaseDTO ruleBaseDTO, List<BillMsg> billMsgList, RuleSimpleDTO ruleSimpleDTO) {
+    public void needlessRepeatOrder(WordCrfDTO wordCrfDTO, RuleBaseDTO ruleBaseDTO, List<BillMsg> billMsgList, String conType, RuleSimpleDTO ruleSimpleDTO) {
         String orderStandName = ruleBaseDTO.getBaseLibName();
         Map<String, List<Pacs>> map = EntityUtil.makeEntityListMap(wordCrfDTO.getPacs(), "uniqueName");
         List<Pacs> pacsList = map.get(orderStandName);
@@ -195,10 +187,10 @@ public class CommonRule {
                     Date dateValueDate = CatalogueUtil.parseStringDate(dateValue);
                     Date orderDateValueDate = CatalogueUtil.parseStringDate(orderDateValue);
                     if (dateValueDate != null && orderDateValueDate != null) {
-                        if (!CatalogueUtil.compareTime(dateValueDate, orderDateValueDate, 60L * 24 * 7)) {
-                            BillMsg commonBillMsg = MsgUtil.getNeedlessRepeatOrderMsg(
+                        if (!CatalogueUtil.compareTime(dateValueDate, orderDateValueDate, 60L * 24 * 7, false)) {
+                            BillMsg commonBillMsg = MsgUtil.getCommonBillMsg(
                                     ruleSimpleDTO.getInputName(), ruleSimpleDTO.getLibName(),
-                                    pacs.getName(), ruleSimpleDTO.getLibTypeName());
+                                    pacs.getName(), conType, ruleSimpleDTO.getLibTypeName());
                             billMsgList.add(commonBillMsg);
                         }
                     }
@@ -265,11 +257,11 @@ public class CommonRule {
      * @param billMsgList
      */
     public void repeat24Bill(WordCrfDTO wordCrfDTO, List<BillMsg> billMsgList) {
-        repeat24BillWithType(billMsgList, wordCrfDTO.getLisOrder(), TypeEnum.lis.getName()); // 化验重复开单
-        repeat24BillWithType(billMsgList, wordCrfDTO.getPacsOrder(), TypeEnum.pacs.getName()); // 辅检重复开单
-        // repeat24BillWithType(billMsgList, wordCrfDTO.getDrugOrder(), TypeEnum.drug.getName()); // 药品重复开单
-        // repeat24BillWithType(billMsgList, wordCrfDTO.getOperationOrder(), TypeEnum.operation.getName()); // 手术重复开单
-        // repeat24BillWithType(billMsgList, wordCrfDTO.getTransfusionOrder(), TypeEnum.transfusion.getName()); // 输血重复开单
+        repeat24BillWithType(billMsgList, wordCrfDTO.getLisOrder(), TypeEnum.lis.getName(), ConEnum.repeat24.getName()); // 化验重复开单
+        repeat24BillWithType(billMsgList, wordCrfDTO.getPacsOrder(), TypeEnum.pacs.getName(), ConEnum.repeat24.getName()); // 辅检重复开单
+        // repeat24BillWithType(billMsgList, wordCrfDTO.getDrugOrder(), TypeEnum.drug.getName(), ConEnum.repeat24.getName()); // 药品重复开单
+        // repeat24BillWithType(billMsgList, wordCrfDTO.getOperationOrder(), TypeEnum.operation.getName(), ConEnum.repeat24.getName()); // 手术重复开单
+        // repeat24BillWithType(billMsgList, wordCrfDTO.getTransfusionOrder(), TypeEnum.transfusion.getName(), ConEnum.repeat24.getName()); // 输血重复开单
     }
 
     /**
@@ -281,7 +273,7 @@ public class CommonRule {
      * @param ruleSimpleDTO
      * @param set 用于记录:A与B不宜同时进行, B与A不宜同时进行 只能提示一个
      */
-    public void exclusionBill(WordCrfDTO wordCrfDTO, RuleBaseDTO ruleBaseDTO, List<BillMsg> billMsgList, RuleSimpleDTO ruleSimpleDTO, Set<String> set) {
+    public void exclusionBill(WordCrfDTO wordCrfDTO, RuleBaseDTO ruleBaseDTO, List<BillMsg> billMsgList, String conType, RuleSimpleDTO ruleSimpleDTO, Set<String> set) {
         // 辅检开单项互斥
         List<Pacs> pacsOrder = wordCrfDTO.getPacsOrder();
         if (ListUtil.isNotEmpty(pacsOrder) && pacsOrder.size() > 1) {
@@ -295,10 +287,9 @@ public class CommonRule {
                     if (!set.contains(ruleSimpleDTO.getLibName() + "******" + orginName)) {
                         set.add(ruleSimpleDTO.getLibName() + "******" + orginName);
                         set.add(orginName + "******" + ruleSimpleDTO.getLibName());
-                        BillMsg commonBillMsg = MsgUtil.getBillExclusionMsg(
-                                ruleSimpleDTO.getInputName(), orginName,
-                                ruleSimpleDTO.getInputName() + "," + orginName,
-                                NeoEnum.exclusion.getName());
+                        BillMsg commonBillMsg = MsgUtil.getCommonBillMsg(
+                                ruleSimpleDTO.getInputName(), "",
+                                orginName, conType, ruleSimpleDTO.getLibTypeName());
                         billMsgList.add(commonBillMsg);
                     }
                 }
@@ -312,8 +303,10 @@ public class CommonRule {
      * @param billMsgList
      * @param itemList
      * @param type
+     * @param conType 禁忌条件
+     * @param <T>
      */
-    public <T> void repeat24BillWithType(List<BillMsg> billMsgList, List<T> itemList, String type) {
+    public <T> void repeat24BillWithType(List<BillMsg> billMsgList, List<T> itemList, String type, String conType) {
         if (ListUtil.isEmpty(itemList)) {
             return;
         }
@@ -351,8 +344,8 @@ public class CommonRule {
                                 if (!CatalogueUtil.compareTime(last, cur, 60L * 24)) {
                                     String name = (String) CoreUtil.getFieldValue(it, "name");
                                     String uniqueName = (String) CoreUtil.getFieldValue(it, "uniqueName");
-                                    BillMsg commonBillMsg = MsgUtil.getBill24RepeatMsg(
-                                            name, uniqueName, name, type);
+                                    BillMsg commonBillMsg = MsgUtil.getCommonBillMsg(
+                                            name, uniqueName, name, ConEnum.repeat24.getName(), type);
                                     billMsgList.add(commonBillMsg);
                                     break;
                                 } else {
@@ -387,8 +380,8 @@ public class CommonRule {
      * @param highRiskList
      */
     public void highRisk(RuleSimpleDTO ruleSimpleDTO, List<BillMsg> highRiskList) {
-        BillMsg billMsg = MsgUtil.getCommonHighRiskMsg(ruleSimpleDTO.getInputName(),
-                ruleSimpleDTO.getMsg(), ruleSimpleDTO.getLibTypeName());
+        BillMsg billMsg = MsgUtil.getCommonHighRiskMsg(ruleSimpleDTO.getMsg(),
+                ruleSimpleDTO.getInputName(), ruleSimpleDTO.getLibTypeName());
         highRiskList.add(billMsg);
     }
 
@@ -399,7 +392,7 @@ public class CommonRule {
      * @param highRiskList
      */
     public void highRiskComplex(NodeNeoDTO nodeNeoDTO, List<BillMsg> highRiskList, HighRiskNeoDTO highRiskNeoDTO) {
-        BillMsg billMsg = MsgUtil.getComplexOperationMsg(nodeNeoDTO.getVal(), highRiskNeoDTO.getName(), nodeNeoDTO.getTermtype());
+        BillMsg billMsg = MsgUtil.getCommonHighRiskMsg(nodeNeoDTO.getVal(), highRiskNeoDTO.getName(), nodeNeoDTO.getTermtype());
         highRiskList.add(billMsg);
     }
 

+ 6 - 9
src/main/java/com/diagbot/rule/DrugRule.java

@@ -3,6 +3,7 @@ package com.diagbot.rule;
 import com.diagbot.dto.BillMsg;
 import com.diagbot.dto.RuleBaseDTO;
 import com.diagbot.dto.RuleSimpleDTO;
+import com.diagbot.enums.LexiconEnum;
 import com.diagbot.enums.RedisEnum;
 import com.diagbot.util.CoreUtil;
 import com.diagbot.util.ListUtil;
@@ -40,8 +41,10 @@ public class DrugRule {
                          RuleSimpleDTO ruleSimpleDTO) {
         if (ListUtil.isNotEmpty(inputList)) {
             List<String> allDrug = new ArrayList<>();
-            if (ruleBaseDTO.getBaseLibType().equals(301) || ruleBaseDTO.getBaseLibType().equals(302)
-                    || ruleBaseDTO.getBaseLibType().equals(303) || ruleBaseDTO.getBaseLibType().equals(304)) {
+            if (ruleBaseDTO.getBaseLibType().equals(LexiconEnum.MedChemClass.getKey())
+                    || ruleBaseDTO.getBaseLibType().equals(LexiconEnum.MedZhiLiaoClass.getKey())
+                    || ruleBaseDTO.getBaseLibType().equals(LexiconEnum.MedYaoLiClass.getKey())
+                    || ruleBaseDTO.getBaseLibType().equals(LexiconEnum.MedJiePouClass.getKey())) {
                 List<String> drugRedis = redisUtil.get(RedisEnum.drugType.getName() + ruleBaseDTO.getBaseLibName());
                 if (ListUtil.isNotEmpty(drugRedis)) {
                     allDrug.addAll(drugRedis);
@@ -53,15 +56,9 @@ public class DrugRule {
                 String uniqueName = (String) CoreUtil.getFieldValue(d, "uniqueName");
                 String name = (String) CoreUtil.getFieldValue(d, "name");
                 if (StringUtils.isNotBlank(uniqueName) && allDrug.contains(uniqueName)) {
-                    String message = "";
-                    if ("禁忌过敏药品".equals(conType)) {
-                        message = name + "过敏";
-                    } else {
-                        message = "可能正在用药" + name;
-                    }
                     BillMsg commonBillMsg = MsgUtil.getCommonBillMsg(
                             ruleSimpleDTO.getInputName(), ruleSimpleDTO.getLibName(),
-                            message, conType, ruleSimpleDTO.getLibTypeName());
+                            name, conType, ruleSimpleDTO.getLibTypeName());
                     billMsgList.add(commonBillMsg);
                 }
             }

+ 58 - 30
src/main/java/com/diagbot/rule/LisRule.java

@@ -6,7 +6,7 @@ import com.diagbot.dto.LisOtherDTO;
 import com.diagbot.dto.RuleBaseDTO;
 import com.diagbot.dto.RuleSimpleDTO;
 import com.diagbot.dto.WordCrfDTO;
-import com.diagbot.enums.LibTypeEnum;
+import com.diagbot.enums.LexiconEnum;
 import com.diagbot.enums.TypeEnum;
 import com.diagbot.util.CoreUtil;
 import com.diagbot.util.ListUtil;
@@ -71,7 +71,7 @@ public class LisRule {
                 if (StringUtil.isNotBlank(uniqueName) && uniqueName.equals(ruleBaseDTO.getBaseLibName())) {
                     Map<String, Object> map = CoreUtil.compareLis(ruleBaseDTO, lis);
                     if ((Boolean) map.get("flag") == true) {
-                        BillMsg billMsg = MsgUtil.getComplexOperationMsg((String) map.get("msg"), ruleSimpleDTO.getInputName(), ruleSimpleDTO.getLibTypeName());
+                        BillMsg billMsg = MsgUtil.getCommonHighRiskMsg((String) map.get("msg"), ruleSimpleDTO.getInputName(), ruleSimpleDTO.getLibTypeName());
                         highRiskList.add(billMsg);
                     }
                 }
@@ -94,10 +94,10 @@ public class LisRule {
         LisOtherDTO lisOtherDTO = new LisOtherDTO();
         int i = 0;
         for (RuleBaseDTO ruleBaseDTO : ruleBaseDTOList) {
-            if (LibTypeEnum.getEnum(ruleBaseDTO.getBaseLibType()) != null) { // 避免空指针
+            if (LexiconEnum.getEnum(ruleBaseDTO.getBaseLibType()) != null) { // 避免空指针
                 Map<String, Object> map = null;
-                switch (LibTypeEnum.getEnum(ruleBaseDTO.getBaseLibType())) {
-                    case lisDetail: // 化验细项
+                switch (LexiconEnum.getEnum(ruleBaseDTO.getBaseLibType())) {
+                    case LisSubName: // 化验细项
                         if (ruleBaseDTO.getBaseLibName().equals(lisBean.getUniqueName())) {
                             map = CoreUtil.compareLis(ruleBaseDTO, lisBean);
                             if ((Boolean) map.get("flag") == true) {
@@ -106,21 +106,21 @@ public class LisRule {
                             }
                         }
                         break;
-                    case group: // 人群
+                    case Group: // 人群
                         map = groupRule.rule(wordCrfDTO, ruleBaseDTO);
                         if (CoreUtil.getMapFlag(map)) {
                             lisOtherDTO.getGroupMsg().add((String)map.get("msg"));
                             i++;
                         }
                         break;
-                    case disease: // 诊断
+                    case Disease: // 诊断
                         map = commonRule.compareItem(wordCrfDTO.getDiag(), ruleBaseDTO);
                         if (CoreUtil.getMapFlag(map)) {
                             lisOtherDTO.setDiseaseMsg((List<String>)map.get("msgList"));
                             i++;
                         }
                         break;
-                    case drug:
+                    case Medicine:
                         map = commonRule.compareItem(wordCrfDTO.getDrug(), ruleBaseDTO);
                         if (CoreUtil.getMapFlag(map)) {
                             lisOtherDTO.setDrugMsg((List<String>)map.get("msgList"));
@@ -135,18 +135,28 @@ public class LisRule {
         // 条件全部符合
         if (i == ruleBaseDTOList.size()) {
             if (StringUtil.isNotBlank(lisOtherDTO.getName())) {
+                // 诊断
                 if (ListUtil.isNotEmpty(lisOtherDTO.getDiseaseMsg())) {
                     for (String str : lisOtherDTO.getDiseaseMsg()) {
-                        BillMsg billMsg = MsgUtil.getCommonOtherTipLisMsg(lisOtherDTO.getName(), str, TypeEnum.disease.getName(), lisBean);
+                        BillMsg billMsg = MsgUtil.getCommonOtherMsg(TypeEnum.lis.getName(), lisOtherDTO.getName(), str, TypeEnum.disease.getName(), lisBean);
                         otherList.add(billMsg);
                     }
                 }
+                // 药品
                 if (ListUtil.isNotEmpty(lisOtherDTO.getDrugMsg())) {
                     for (String str : lisOtherDTO.getDrugMsg()) {
-                        BillMsg billMsg = MsgUtil.getCommonOtherTipLisMsg(lisOtherDTO.getName(), str, TypeEnum.drug.getName(), lisBean);
+                        BillMsg billMsg = MsgUtil.getCommonOtherMsg(TypeEnum.lis.getName(), lisOtherDTO.getName(), str, TypeEnum.drug.getName(), lisBean);
                         otherList.add(billMsg);
                     }
                 }
+                // 人群
+                if (ListUtil.isNotEmpty(lisOtherDTO.getGroupMsg())) {
+                    for (String str : lisOtherDTO.getGroupMsg()) {
+                        BillMsg billMsg = MsgUtil.getCommonOtherMsg(TypeEnum.lis.getName(), lisOtherDTO.getName(), str, TypeEnum.group.getName(), lisBean);
+                        otherList.add(billMsg);
+                    }
+                }
+
             }
         }
     }
@@ -164,34 +174,35 @@ public class LisRule {
             return ;
         }
         LisOtherDTO lisOtherDTO = new LisOtherDTO();
+        lisOtherDTO.setMsg(msg);
         int i = 0;
         for (RuleBaseDTO ruleBaseDTO : ruleBaseDTOList) {
-            if (LibTypeEnum.getEnum(ruleBaseDTO.getBaseLibType()) != null) { // 避免空指针
+            if (LexiconEnum.getEnum(ruleBaseDTO.getBaseLibType()) != null) { // 避免空指针
                 Map<String, Object> map = null;
-                switch (LibTypeEnum.getEnum(ruleBaseDTO.getBaseLibType())) {
-                    case lisDetail: // 化验细项
+                switch (LexiconEnum.getEnum(ruleBaseDTO.getBaseLibType())) {
+                    case LisSubName: // 化验细项
                         if (ruleBaseDTO.getBaseLibName().equals(lisBean.getUniqueName())) {
                             map = CoreUtil.compareLis(ruleBaseDTO, lisBean);
                             if ((Boolean) map.get("flag") == true) {
-                                lisOtherDTO.setName(msg);
+                                lisOtherDTO.setName((String)map.get("msg"));
                                 i++;
                             }
                         }
                         break;
-                    case disease: // 诊断
+                    case Disease: // 诊断
                         map = commonRule.compareItem(wordCrfDTO.getDiag(), ruleBaseDTO);
                         if (CoreUtil.getMapFlag(map)) {
                             lisOtherDTO.setDiseaseMsg((List<String>)map.get("msgList"));
                             i++;
                         }
                         break;
-                    case drug:
+                    case Medicine: // 药品
                         map = commonRule.compareItem(wordCrfDTO.getDrug(), ruleBaseDTO);
                         if (CoreUtil.getMapFlag(map)) {
                             lisOtherDTO.setDrugMsg((List<String>)map.get("msgList"));
                             i++;
                         }
-                    case operation:
+                    case Operation: // 手术
                         map = commonRule.compareItem(wordCrfDTO.getOperation(), ruleBaseDTO);
                         if (CoreUtil.getMapFlag(map)) {
                             lisOtherDTO.setOperationMsg((List<String>)map.get("msgList"));
@@ -206,17 +217,34 @@ public class LisRule {
         // 条件全部符合
         if (i == ruleBaseDTOList.size()) {
             if (StringUtil.isNotBlank(lisOtherDTO.getName())) {
-                if (ListUtil.isNotEmpty(lisOtherDTO.getDiseaseMsg())) {
-                    for (String str : lisOtherDTO.getDiseaseMsg()) {
-                        BillMsg billMsg = MsgUtil.getCommonOtherTipLisMsg(lisOtherDTO.getName(), str, TypeEnum.disease.getName(), lisBean);
-                        otherList.add(billMsg);
+                // 化验本身符合,其他不符号
+                if (ListUtil.isEmpty(lisOtherDTO.getDiseaseMsg()) && ListUtil.isEmpty(lisOtherDTO.getOperationMsg())) {
+                    BillMsg billMsg = MsgUtil.getCommonOtherMsg(TypeEnum.transfusion.getName(),
+                            lisOtherDTO.getName(), msg, TypeEnum.lis.getName(), lisBean);
+                    otherList.add(billMsg);
+                } else {
+                    if (ListUtil.isNotEmpty(lisOtherDTO.getDiseaseMsg())) {
+                        for (String str : lisOtherDTO.getDiseaseMsg()) {
+                            BillMsg billMsg = MsgUtil.getCommonOtherMsg(TypeEnum.transfusion.getName(),
+                                    "诊断" + str + "," + lisOtherDTO.getName(), msg, TypeEnum.disease.getName(), lisBean);
+                            otherList.add(billMsg);
+                        }
                     }
-                }
-                if (ListUtil.isNotEmpty(lisOtherDTO.getDrugMsg())) {
-                    for (String str : lisOtherDTO.getDrugMsg()) {
-                        BillMsg billMsg = MsgUtil.getCommonOtherTipLisMsg(lisOtherDTO.getName(), str, TypeEnum.drug.getName(), lisBean);
-                        otherList.add(billMsg);
+                    if (ListUtil.isNotEmpty(lisOtherDTO.getOperationMsg())) {
+                        for (String str : lisOtherDTO.getOperationMsg()) {
+                            BillMsg billMsg = MsgUtil.getCommonOtherMsg(TypeEnum.transfusion.getName(),
+                                    lisOtherDTO.getName() + ",已开" + str, msg, TypeEnum.operation.getName(), lisBean);
+                            otherList.add(billMsg);
+                        }
                     }
+                    // // 药品暂未用
+                    // if (ListUtil.isNotEmpty(lisOtherDTO.getDrugMsg())) {
+                    //     for (String str : lisOtherDTO.getDrugMsg()) {
+                    //         BillMsg billMsg = MsgUtil.getCommonOtherMsg(TypeEnum.transfusion.getName(),
+                    //                 lisOtherDTO.getName(), msg, TypeEnum.drug.getName(), lisBean);
+                    //         otherList.add(billMsg);
+                    //     }
+                    // }
                 }
             }
         }
@@ -236,9 +264,9 @@ public class LisRule {
         String msg = "";
         int i = 0;
         for (RuleBaseDTO ruleBaseDTO : ruleBaseDTOList) {
-            if (LibTypeEnum.getEnum(ruleBaseDTO.getBaseLibType()) != null) { // 避免空指针
-                switch (LibTypeEnum.getEnum(ruleBaseDTO.getBaseLibType())) {
-                    case lisDetail: // 化验细项
+            if (LexiconEnum.getEnum(ruleBaseDTO.getBaseLibType()) != null) { // 避免空指针
+                switch (LexiconEnum.getEnum(ruleBaseDTO.getBaseLibType())) {
+                    case LisSubName: // 化验细项
                         if (ruleBaseDTO.getBaseLibName().equals(lisBean.getUniqueName())) {
                             Map<String, Object> map = CoreUtil.compareLis(ruleBaseDTO, lisBean);
                             if ((Boolean) map.get("flag") == true) {
@@ -247,7 +275,7 @@ public class LisRule {
                             }
                         }
                         break;
-                    case group: // 人群
+                    case Group: // 人群
                         Map map = groupRule.rule(wordCrfDTO, ruleBaseDTO);
                         if (CoreUtil.getMapFlag(map)) {
                             i++;

+ 1 - 1
src/main/java/com/diagbot/rule/MedEquRule.java

@@ -37,7 +37,7 @@ public class MedEquRule {
             flag = true;
         }
         if (flag) {
-            BillMsg billMsg = MsgUtil.getBillMedEquMsg(ruleSimpleDTO.getInputName(), ruleSimpleDTO.getLibName(),
+            BillMsg billMsg = MsgUtil.getCommonBillMsg(ruleSimpleDTO.getInputName(), ruleSimpleDTO.getLibName(),
                     ruleBaseDTO.getBaseLibName(), conType, ruleSimpleDTO.getLibTypeName());
             billMsgList.add(billMsg);
         }

+ 17 - 10
src/main/java/com/diagbot/rule/PacsRule.java

@@ -4,7 +4,8 @@ import com.diagbot.dto.BillMsg;
 import com.diagbot.dto.RuleBaseDTO;
 import com.diagbot.dto.RuleSimpleDTO;
 import com.diagbot.dto.WordCrfDTO;
-import com.diagbot.enums.LibTypeEnum;
+import com.diagbot.enums.BaseTypeEnum;
+import com.diagbot.enums.LexiconEnum;
 import com.diagbot.enums.TypeEnum;
 import com.diagbot.util.CoreUtil;
 import com.diagbot.util.ListUtil;
@@ -86,31 +87,37 @@ public class PacsRule {
         }
         int i = 0;
         for (RuleBaseDTO ruleBaseDTO : ruleBaseDTOList) {
-            if (LibTypeEnum.getEnum(ruleBaseDTO.getBaseLibType()) != null) { // 避免空指针
+            if (LexiconEnum.getEnum(ruleBaseDTO.getBaseLibType()) != null) { // 避免空指针
                 boolean flag = false;
-                switch (LibTypeEnum.getEnum(ruleBaseDTO.getBaseLibType())) {
-                    case age: // 年龄
+                switch (LexiconEnum.getEnum(ruleBaseDTO.getBaseLibType())) {
+                    case Age: // 年龄
                         flag = ageRule.getFlag(wordCrfDTO, ruleBaseDTO);
                         if (flag) {
                             i++;
                         }
                         break;
-                    case sex: // 性别
+                    case Gender: // 性别
                         flag = sexRule.getFlag(wordCrfDTO, ruleBaseDTO);
                         if (flag) {
                             i++;
                         }
                         break;
-                    case group: // 人群
+                    case Group: // 人群
                         Map map = groupRule.rule(wordCrfDTO, ruleBaseDTO);
                         if (CoreUtil.getMapFlag(map)) {
                             i++;
                         }
                         break;
-                    case pacsResult: // 辅检结果
+                    case PacsResult: // 辅检结果
                         map = commonRule.compareItem(wordCrfDTO.getPacsLabel().getRes(), ruleBaseDTO);
-                        if (CoreUtil.getMapFlag(map)) {
-                            i++;
+                        if (ruleBaseDTO.getBaseType().equals(BaseTypeEnum.B3.getKey())) {
+                            if (!CoreUtil.getMapFlag(map)) {
+                                i++;
+                            }
+                        } else {
+                            if (CoreUtil.getMapFlag(map)) {
+                                i++;
+                            }
                         }
                         break;
                     default:
@@ -120,7 +127,7 @@ public class PacsRule {
         }
         // 条件全部符合
         if (i == ruleBaseDTOList.size()) {
-            BillMsg otherMsg = MsgUtil.getCommonOtherTipPacsMsg(msg);
+            BillMsg otherMsg = MsgUtil.getCommonOtherMsg(TypeEnum.pacs.getName(), msg, msg, null, null);
             otherList.add(otherMsg);
         }
     }

+ 1 - 1
src/main/java/com/diagbot/rule/VitalRule.java

@@ -49,7 +49,7 @@ public class VitalRule {
     public void highOperation(VitalLabel vitalLabel, RuleBaseDTO ruleBaseDTO, List<BillMsg> highRiskList, RuleSimpleDTO ruleSimpleDTO) {
         Map<String, Object> map = CoreUtil.compareVital(ruleBaseDTO, vitalLabel);
         if ((Boolean) map.get("flag") == true) {
-            BillMsg billMsg = MsgUtil.getComplexOperationMsg((String) map.get("msg"), ruleSimpleDTO.getInputName(), ruleSimpleDTO.getLibTypeName());
+            BillMsg billMsg = MsgUtil.getCommonHighRiskMsg((String) map.get("msg"), ruleSimpleDTO.getInputName(), ruleSimpleDTO.getLibTypeName());
             highRiskList.add(billMsg);
         }
     }

+ 35 - 0
src/main/java/com/diagbot/util/CatalogueUtil.java

@@ -187,6 +187,41 @@ public class CatalogueUtil {
         return overtime;
     }
 
+    /**
+     * 比较时间,以分钟为单位
+     * endDate比startDate多diff分钟则返回true
+     *
+     * @param startDate
+     * @param endDate
+     * @param diff
+     * @param hasEqual 是否包含“等号”
+     * @return
+     */
+    public static boolean compareTime(Date startDate, Date endDate, Long diff, boolean hasEqual) {
+        boolean overtime = false;
+        if (startDate == null || endDate == null) {
+            return false;
+        }
+        Calendar calendar_s = Calendar.getInstance();
+        Calendar calendar_e = Calendar.getInstance();
+        Long time_s, time_e;
+        try {
+            calendar_s.setTime(startDate);
+            calendar_e.setTime(endDate);
+
+            time_s = calendar_s.getTimeInMillis();
+            time_e = calendar_e.getTimeInMillis();
+            if (hasEqual) {
+                return (time_e - time_s) >=  diff * 1000 * 60;
+            } else {
+                return (time_e - time_s) >  diff * 1000 * 60;
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return overtime;
+    }
+
     /**
      * 获取查房记录标题中医师职称
      *

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

@@ -267,30 +267,6 @@ public class CoreUtil {
         }
     }
 
-    /**
-     * 比较name是否一样
-     *
-     * @param nodeNeoDTO
-     * @param item
-     * @return
-     */
-    public static Map compareNameWithNode(NodeNeoDTO nodeNeoDTO, List<? extends Item> item) {
-        Map<String, Object> map = new LinkedHashMap<>();
-        boolean flag = false;
-        List<String> msgList = new ArrayList<>();
-        if (ListUtil.isNotEmpty(item) && nodeNeoDTO != null) {
-            for (Item it : item) {
-                if (it.getUniqueName().equals(nodeNeoDTO.getName())) {
-                    flag = true;
-                    msgList.add(it.getName());
-                }
-            }
-        }
-        map.put("flag", flag);
-        map.put("msg", msgList);
-        return map;
-    }
-
     /**
      * 比较化验是否匹配
      *
@@ -330,47 +306,6 @@ public class CoreUtil {
         return map;
     }
 
-    /**
-     * 比较化验是否匹配
-     *
-     * @param nodeNeoDTO
-     * @param lis
-     * @return
-     */
-    public static Map<String, Object> compareLis(NodeNeoDTO nodeNeoDTO, Lis lis) {
-        Map<String, Object> map = new LinkedHashMap<>();
-        boolean flag = false;
-        if (nodeNeoDTO == null || lis == null) {
-            map.put("flag", flag);
-            return map;
-        }
-        if (StringUtil.isNotBlank(lis.getOtherValue())) {
-            if (lis.getOtherValue().equals(nodeNeoDTO.getVal())) {
-                // 套餐和明细一样,提示语只取其中一个
-                if (lis.getName() == null || lis.getDetailName() == null
-                        || !lis.getName().equals(lis.getDetailName())) {
-                    map.put("msg", lis.getName() + lis.getDetailName() + lis.getOtherValue());
-                } else {
-                    map.put("msg", lis.getDetailName() + lis.getOtherValue());
-                }
-                flag = true;
-            }
-        } else if (lis.getValue() != null) {
-            double value = lis.getValue();
-            flag = compareNum(nodeNeoDTO, value);
-            if (flag) {
-                if (lis.getName() == null || lis.getDetailName() == null
-                        || !lis.getName().equals(lis.getDetailName())) {
-                    map.put("msg", lis.getName() + lis.getDetailName() + subZeroAndDot(String.valueOf(lis.getValue())));
-                } else {
-                    map.put("msg", lis.getDetailName() + subZeroAndDot(String.valueOf(lis.getValue())));
-                }
-            }
-        }
-        map.put("flag", flag);
-        return map;
-    }
-
     /**
      * 比较查体是否匹配
      *
@@ -425,60 +360,6 @@ public class CoreUtil {
         return map;
     }
 
-    /**
-     * 比较查体是否匹配
-     *
-     * @param nodeNeoDTO
-     * @param vitalLabel
-     * @return
-     */
-    public static Map<String, Object> compareVital(NodeNeoDTO nodeNeoDTO, VitalLabel vitalLabel) {
-        Map<String, Object> map = new LinkedHashMap<>();
-        List<Vital> vitalList = vitalLabel.getVitals(); // 体征数据
-        List<Clinical> clinicals = vitalLabel.getClinicals(); // 体征临床表现
-        boolean flag = false;
-        if (nodeNeoDTO == null) {
-            map.put("flag", flag);
-            return map;
-        }
-        if (nodeNeoDTO.getMax() == null && nodeNeoDTO.getMin() == null) {
-            // 体征名称比较(例如:喉头水肿)
-            for (Clinical clinical : clinicals) {
-                if (nodeNeoDTO.getName().contains(clinical.getStandName())) {
-                    map.put("msg", clinical.getName());
-                    flag = true;
-                    break;
-                }
-            }
-        } else {
-            // 体征数值比较(例如:体温,血压)
-            for (Vital vital : vitalList) {
-                List<Usual> usualList = vital.getUsualList();
-                if (nodeNeoDTO.getName().equals(vital.getStandName()) && vital.getPd() != null
-                        && StringUtil.isNotBlank(vital.getPd().getValue())) {
-                    flag = compareNum(nodeNeoDTO, Double.parseDouble(vital.getPd().getValue()));
-                    if (flag) {
-                        map.put("msg", vital.getName() + subZeroAndDot(String.valueOf(vital.getPd().getValue())));
-                        break;
-                    }
-                } else if (ListUtil.isNotEmpty(usualList)) {
-                    for (Usual usual : usualList) {
-                        if (nodeNeoDTO.getName().equals(usual.getStandName())) {
-                            flag = compareNum(nodeNeoDTO, Double.parseDouble(usual.getValue()));
-                            if (flag) {
-                                map.put("msg", vital.getName() + subZeroAndDot(String.valueOf(vital.getPd().getValue())));
-                                break;
-                            }
-                        }
-                    }
-                }
-            }
-        }
-
-        map.put("flag", flag);
-        return map;
-    }
-
     /**
      * 比较数值大小(double)
      *
@@ -542,88 +423,6 @@ public class CoreUtil {
         return flag;
     }
 
-    /**
-     * 比较数值大小(double)
-     *
-     * @param nodeNeoDTO
-     * @param value
-     * @return
-     */
-    public static boolean compareNum(NodeNeoDTO nodeNeoDTO, double value) {
-        boolean flag = false;
-        BigDecimal min = nodeNeoDTO.getMin();
-        BigDecimal max = nodeNeoDTO.getMax();
-
-        // 取区间
-        if (nodeNeoDTO.getValType() == 0) {
-            if (min != null && max != null) {
-                double minNeo = min.doubleValue();
-                double maxNeo = max.doubleValue();
-                if (minNeo <= value && value <= maxNeo) {
-                    flag = true;
-                }
-            } else if (min != null && max == null) {
-                double minNeo = min.doubleValue();
-                if (minNeo <= value) {
-                    flag = true;
-                }
-            } else if (min == null && max != null) {
-                double maxNeo = max.doubleValue();
-                if (value <= maxNeo) {
-                    flag = true;
-                }
-            }
-        } else {
-            // 取两头
-            if (min != null) {
-                double minNeo = min.doubleValue();
-                if (value <= minNeo) {
-                    flag = true;
-                }
-            }
-            // 取两头
-            if (max != null) {
-                double maxNeo = max.doubleValue();
-                if (value >= maxNeo) {
-                    flag = true;
-                }
-            }
-        }
-        return flag;
-    }
-
-    /**
-     * 获取提示信息(double)
-     *
-     * @param nodeNeoDTO
-     * @param value
-     * @return
-     */
-    public static String getNumMsg(NodeNeoDTO nodeNeoDTO, String name, double value, String unit) {
-        if (nodeNeoDTO == null) {
-            return "";
-        }
-        StringBuffer sb = new StringBuffer();
-        sb.append(name);
-        sb.append(subZeroAndDot(String.valueOf(value))); // 去掉小数点后的0
-        if (StringUtil.isBlank(unit)) {
-            sb.append(unit);
-        }
-        sb.append("(禁忌范围[");
-        if (nodeNeoDTO.getMin() != null) {
-            sb.append(nodeNeoDTO.getMin());
-        }
-        sb.append(",");
-        if (nodeNeoDTO.getMax() != null) {
-            sb.append(nodeNeoDTO.getMax());
-        }
-        // if (nodeNeoDTO.getUnit() != null) {
-        //     sb.append(nodeNeoDTO.getUnit());
-        // }
-        sb.append("])");
-        return sb.toString();
-    }
-
     public static String subZeroAndDot(String s){
         if(s.indexOf(".") > 0){
             s = s.replaceAll("0+?$", "");//去掉多余的0
@@ -655,22 +454,6 @@ public class CoreUtil {
         return sb.toString();
     }
 
-    /**
-     * 获取提示信息(String)
-     *
-     * @param nodeNeoDTO
-     * @param value
-     * @return
-     */
-    public static String getStrMsg(NodeNeoDTO nodeNeoDTO, String name, String value) {
-        if (nodeNeoDTO == null) {
-            return "";
-        }
-        StringBuffer sb = new StringBuffer();
-        sb.append(name).append(value);
-        return sb.toString();
-    }
-
     /**
      * list 转 string
      * @param list

+ 83 - 204
src/main/java/com/diagbot/util/MsgUtil.java

@@ -2,7 +2,7 @@ package com.diagbot.util;
 
 import com.diagbot.biz.push.entity.Lis;
 import com.diagbot.dto.BillMsg;
-import com.diagbot.enums.NeoEnum;
+import com.diagbot.enums.ConEnum;
 import com.diagbot.enums.TypeEnum;
 
 /**
@@ -15,18 +15,29 @@ public class MsgUtil {
     /**
      * 高危药品、手术通用提示信息
      *
-     * @param name
-     * @param highLevel
-     * @param type
+     * @param content
+     * @param name    名称
+     * @param type    类型
      * @return
      */
-    public static BillMsg getCommonHighRiskMsg(String name, String highLevel, String type) {
+    public static BillMsg getCommonHighRiskMsg(String content, String name, String type) {
         BillMsg billMsg = new BillMsg();
+        String msg = "";
         if (TypeEnum.operation.getName().equals(type)) {
-            billMsg.setMsg(name + "为高风险手术,请留意");
+            if (StringUtil.isBlank(content)) {
+                // 本身高危手术
+                msg = String.format("%s为高风险手术,请留意", name);
+            } else {
+                // 复杂情况高危手术
+                msg = String.format("该患者%s,%s为高风险手术,请留意", content, name);
+                billMsg.setContent(content);
+            }
         } else if (TypeEnum.drug.getName().equals(type)) {
-            billMsg.setMsg(name + "为" + highLevel + "药品,请留意");
+            msg = String.format("%s为%s药品,请留意", name, content);
+            billMsg.setContent(content);
         }
+        billMsg.setOrderName(name);
+        billMsg.setMsg(msg);
         billMsg.setType(type);
         return billMsg;
     }
@@ -35,7 +46,7 @@ public class MsgUtil {
      * 危急值通用提示信息
      *
      * @param content 匹配内容
-     * @param type 类型
+     * @param type    类型
      * @return
      */
     public static BillMsg getCommonCriticalMsg(String content, String type) {
@@ -51,88 +62,7 @@ public class MsgUtil {
     }
 
     /**
-     * 开单合理性通用提示信息
-     *
-     * @param orderName 原开单项
-     * @param orderStandName 标准开单项
-     * @param content 匹配内容
-     * @param type 类型
-     * @param type 开单项类型
-     * @return
-     */
-    public static BillMsg getCommonBillMsg(String orderName, String orderStandName, String content, String type, String orderType) {
-        BillMsg billMsg = new BillMsg();
-        String msg = String.format("该患者%s,不宜开%s", content, orderName);
-        // 输血提示语是另一种写法
-        if (TypeEnum.transfusion.getName().equals(orderType)) {
-            msg = String.format("该患者%s,谨慎输注%s", content, orderName);
-        }
-        billMsg.setMsg(msg);
-        billMsg.setOrderName(orderName);
-        billMsg.setOrderStandName(orderStandName);
-        billMsg.setContent(content);
-        billMsg.setType(type);
-        return billMsg;
-    }
-
-    /**
-     * 开单合理性通用提示信息
-     *
-     * @param orderName 原开单项
-     * @param orderStandName 标准开单项
-     * @param content 匹配内容
-     * @param type 类型
-     * @return
-     */
-    public static BillMsg getBillLisOrderMsg(String orderName, String orderStandName, String content, String type) {
-        BillMsg billMsg = new BillMsg();
-        String msg = String.format("该患者可能正在用药%s,会影响%s结果,请留意", content, orderName);
-        billMsg.setMsg(msg);
-        billMsg.setOrderName(orderName);
-        billMsg.setOrderStandName(orderStandName);
-        billMsg.setContent(content);
-        billMsg.setType(type);
-        return billMsg;
-    }
-
-    /**
-     * 开单合理性——互斥提示信息
-     *
-     * @param complexOrderName 多个开单项
-     * @param orderName 原开单项
-     * @param content 匹配内容
-     * @param type 类型
-     * @return
-     */
-    public static BillMsg getBillExclusionMsg(String orderName, String content, String complexOrderName, String type) {
-        BillMsg billMsg = new BillMsg();
-        String msg = String.format("检查项目互斥:%s与%s不宜同时进行", orderName, content);
-        billMsg.setMsg(msg);
-        billMsg.setOrderName(complexOrderName);
-        billMsg.setContent(content);
-        billMsg.setType(type);
-        return billMsg;
-    }
-
-    /**
-     * 复杂情况高危手术提示
-     *
-     * @param content
-     * @param name
-     * @param type
-     * @return
-     */
-    public static BillMsg getComplexOperationMsg(String name, String content, String type) {
-        BillMsg billMsg = new BillMsg();
-        String msg = String.format("该患者%s,%s为高风险手术,请留意", name, content);
-        billMsg.setMsg(msg);
-        billMsg.setContent(content);
-        billMsg.setType(type);
-        return billMsg;
-    }
-
-    /**
-     * 其他提醒——化验
+     * 其他值通用提示信息
      *
      * @param content
      * @param name
@@ -140,141 +70,90 @@ public class MsgUtil {
      * @param lis
      * @return
      */
-    public static BillMsg getCommonOtherTipLisMsg(String content, String name, String type, Lis lis) {
+    public static BillMsg getCommonOtherMsg(String otherType, String content, String name, String type, Lis lis) {
         BillMsg billMsg = new BillMsg();
         String msg = "";
-        if (TypeEnum.disease.getName().equals(type)) {
-            msg = String.format("该患者%s,患有%s,请留意", content, name);
-        } else if (TypeEnum.drug.getName().equals(type)) {
-            msg = String.format("该患者%s,可能正在服用%s,请留意", content, name);
-        } else if (NeoEnum.group.getName().equals(type)) {
-            msg = String.format("该患者%s,%s,请留意", content, name);
+        switch (TypeEnum.getEnum(otherType)) {
+            case lis: // 其他值提醒——化验
+                if (TypeEnum.disease.getName().equals(type)) {
+                    msg = String.format("该患者%s,患有%s,请留意", content, name);
+                } else if (TypeEnum.drug.getName().equals(type)) {
+                    msg = String.format("该患者%s,可能正在服用%s,请留意", content, name);
+                } else if (ConEnum.group.getName().equals(type)) {
+                    msg = String.format("该患者%s,%s,请留意", content, name);
+                }
+                billMsg.setType(type);
+                billMsg.setOrderName(lis.getName());
+                billMsg.setOrderDetailName(lis.getDetailName());
+                break;
+            case pacs: // 其他值提醒——辅检
+                msg = content;
+                break;
+            case transfusion: // 其他值提醒——输血
+                msg = String.format("该患者%s,建议输注%s", content, name);
+                break;
+            default:
+                break;
         }
         billMsg.setMsg(msg);
         billMsg.setContent(content);
-        billMsg.setType(type);
-        billMsg.setOrderName(lis.getName());
-        billMsg.setOrderDetailName(lis.getDetailName());
-        return billMsg;
-    }
-
-    /**
-     * 其他提醒——辅检
-     *
-     * @param content
-     * @return
-     */
-    public static BillMsg getCommonOtherTipPacsMsg(String content) {
-        BillMsg billMsg = new BillMsg();
-        billMsg.setMsg(content);
-        billMsg.setContent(content);
-        return billMsg;
-    }
-
-    /**
-     * 其他提醒——输血
-     *
-     * @param content
-     * @param name
-     * @return
-     */
-    public static BillMsg getCommonOtherTipTransfusionMsg(String content, String name) {
-        BillMsg billMsg = new BillMsg();
-        String msg = String.format("该患者%s,建议输注%s", content, name);
-        billMsg.setMsg(msg);
-        billMsg.setContent(content);
-        return billMsg;
-    }
-
-    /**
-     * 开单合理性24小时重复开通用提示信息
-     *
-     * @param orderName 原开单项
-     * @param orderStandName 标准开单项
-     * @param content 匹配内容
-     * @param type 类型
-     * @return
-     */
-    public static BillMsg getBill24RepeatMsg(String orderName, String orderStandName, String content, String type) {
-        BillMsg billMsg = new BillMsg();
-        String msg = String.format("%s重复开立", orderName);
-        billMsg.setMsg(msg);
-        billMsg.setOrderName(orderName);
-        billMsg.setOrderStandName(orderStandName);
-        billMsg.setContent(content);
-        billMsg.setType(type);
-        return billMsg;
-    }
-
-    /**
-     * 无需重复辅检开单项
-     *
-     * @param orderName 原开单项
-     * @param orderStandName 标准开单项
-     * @param content 匹配内容
-     * @param type 类型
-     * @return
-     */
-    public static BillMsg getNeedlessRepeatOrderMsg(String orderName, String orderStandName, String content, String type) {
-        BillMsg billMsg = new BillMsg();
-        String msg = String.format("重复开立:该患者近期做过%s,且结果无异常", content);
-        billMsg.setMsg(msg);
-        billMsg.setOrderName(orderName);
-        billMsg.setOrderStandName(orderStandName);
-        billMsg.setContent(content);
-        billMsg.setType(type);
         return billMsg;
     }
 
-
     /**
-     * 开单合理性禁忌医疗器械及物品提示信息
+     * 开单合理性通用提示信息
      *
-     * @param orderName 原开单项
+     * @param orderName      原开单项
      * @param orderStandName 标准开单项
-     * @param content 匹配内容
-     * @param type 类型
+     * @param content        匹配内容
+     * @param conType        禁忌类型
+     * @param orderType      开单项类型
      * @return
      */
-    public static BillMsg getBillMedEquMsg(String orderName, String orderStandName, String content, String type, String orderType) {
+    public static BillMsg getCommonBillMsg(String orderName, String orderStandName, String content, String conType, String orderType) {
         BillMsg billMsg = new BillMsg();
-        if (content.startsWith("具有")) {
-            content = content.replaceFirst("具有", ""); // 将“具有”替换成空
-        }
-        String msg = String.format("该患者具有%s,不宜开%s", content, orderName);
-        // 输血提示语是另一种写法
-        if (TypeEnum.transfusion.getName().equals(orderType)) {
-            msg = String.format("该患者具有%s,谨慎输注%s", content, orderName);
+        // 禁忌项拼接提示语
+        switch (ConEnum.getEnum(conType)) {
+            case oralmeds: // 服用药品
+                content = "可能正在用药" + content;
+                break;
+            case allergicmeds: // 禁忌药品
+                content = content + "过敏";
+                break;
+            case operations: // 手术
+                content = "有" + content + "史";
+                break;
+            case medEqu: // 禁忌医疗器械及物品
+                if (!content.startsWith("具有")) {
+                    content = "具有" + content;
+                }
+                break;
         }
-        billMsg.setMsg(msg);
-        billMsg.setOrderName(orderName);
-        billMsg.setOrderStandName(orderStandName);
-        billMsg.setContent(content);
-        billMsg.setType(type);
-        return billMsg;
-    }
-
-    /**
-     * 开单合理性手术提示信息
-     *
-     * @param orderName 原开单项
-     * @param orderStandName 标准开单项
-     * @param content 匹配内容
-     * @param type 类型
-     * @return
-     */
-    public static BillMsg getCommonSurgeryMsg(String orderName, String orderStandName, String content, String type, String orderType) {
-        BillMsg billMsg = new BillMsg();
-        String msg = String.format("该患者有%s史,不宜开%s", content, orderName);
-        // 输血提示语是另一种写法
+        // 通用提示语
+        String msg = String.format("该患者%s,不宜开%s", content, orderName);
+        // 特殊情况下提示语
         if (TypeEnum.transfusion.getName().equals(orderType)) {
-            msg = String.format("该患者有%s史,谨慎输注%s", content, orderName);
+            // 输血开单项提示语
+            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(type);
+        billMsg.setType(conType);
         return billMsg;
     }
 }

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

@@ -47,6 +47,15 @@ public class CacheController {
         return RespDTO.onSuc(true);
     }
 
+    @ApiOperation(value = "重新加载药物缓存[by:zhoutg]",
+            notes = "")
+    @PostMapping("/clearDrug")
+    @SysLogger("clearDrug")
+    public RespDTO<Boolean> clearDrug() {
+        cacheFacade.loadDrugTypeCache();
+        return RespDTO.onSuc(true);
+    }
+
     @ApiOperation(value = "清除标准词转换缓存[by:zhoutg]",
             notes = "")
     @PostMapping("/clearStandConvert")