瀏覽代碼

推送规则

zhoutg 4 年之前
父節點
當前提交
045b4cb121

+ 12 - 12
src/main/java/com/diagbot/dto/BaseDiagnoseDTO.java

@@ -24,12 +24,12 @@ public class BaseDiagnoseDTO {
     /**
      * 医学基本术语
      */
-    private String libName;
+    private String baseLibName;
 
     /**
      * 术语类型
      */
-    private String libType;
+    private Integer baseLibType;
 
     /**
      * 提示概念id
@@ -39,50 +39,50 @@ public class BaseDiagnoseDTO {
     /**
      * 基础规则类型(1:等于术语本身;2:存在比较;3:不等于术语本身;)
      */
-    private Integer type;
+    private Integer baseType;
 
     /**
      * 最小域比较符
      */
-    private String minOperator;
+    private String baseMinOperator;
 
     /**
      * 最小域值
      */
-    private String minValue;
+    private String baseMinValue;
 
     /**
      * 最小域单位
      */
-    private String minUnit;
+    private String baseMinUnit;
 
     /**
      * 最大域比较符
      */
-    private String maxOperator;
+    private String baseMaxOperator;
 
     /**
      * 最大域值
      */
-    private String maxValue;
+    private String baseMaxValue;
 
     /**
      * 最大域单位
      */
-    private String maxUnit;
+    private String baseMaxUnit;
 
     /**
      * 等于域比较符
      */
-    private String eqOperator;
+    private String baseEqOperator;
 
     /**
      * 等于域值
      */
-    private String eqValue;
+    private String baseEqValue;
 
     /**
      * 等于域单位
      */
-    private String eqUnit;
+    private String baseEqUnit;
 }

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

@@ -3,6 +3,7 @@ package com.diagbot.dto;
 import lombok.Getter;
 import lombok.Setter;
 
+import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
 
@@ -34,5 +35,5 @@ public class PushDTO {
     private List<TreatDTO> treat;
 
     // 记录调试信息
-    private Map<String, Object> debug;
+    private Map<String, Object> debug = new LinkedHashMap<>();
 }

+ 64 - 0
src/main/java/com/diagbot/enums/BaseDiagnoseTypeEnum.java

@@ -0,0 +1,64 @@
+package com.diagbot.enums;
+
+import com.diagbot.core.KeyedNamed;
+import lombok.Setter;
+
+/**
+ * @author zhoutg
+ * @Description: 类型枚举
+ * @date 2018年10月11日 下午3:33:22
+ */
+
+public enum BaseDiagnoseTypeEnum implements KeyedNamed {
+
+    B1(1, "等于术语本身"),
+    B2(2, "存在比较"),
+    B3(3, "主诉现病史正则"),
+    B4(4, "既往史正则");
+
+    @Setter
+    private int key;
+
+    @Setter
+    private String name;
+
+    BaseDiagnoseTypeEnum(int key, String name) {
+        this.key = key;
+        this.name = name;
+    }
+
+    public static BaseDiagnoseTypeEnum getEnum(int key) {
+        for (BaseDiagnoseTypeEnum item : BaseDiagnoseTypeEnum.values()) {
+            if (item.key == key) {
+                return item;
+            }
+        }
+        return null;
+    }
+
+    public static BaseDiagnoseTypeEnum getEnum(String value) {
+        for (BaseDiagnoseTypeEnum item : BaseDiagnoseTypeEnum.values()) {
+            if (item.getName().equals(value)) {
+                return item;
+            }
+        }
+        return null;
+    }
+
+    public static String getName(int key) {
+        BaseDiagnoseTypeEnum item = getEnum(key);
+        return item != null ? item.name : null;
+    }
+
+    @Override
+    public int getKey() {
+        return key;
+    }
+
+    @Override
+    public String getName() {
+        return name;
+    }
+
+
+}

+ 63 - 0
src/main/java/com/diagbot/enums/DiagnoseTypeEnum.java

@@ -0,0 +1,63 @@
+package com.diagbot.enums;
+
+import com.diagbot.core.KeyedNamed;
+import lombok.Setter;
+
+/**
+ * @author zhoutg
+ * @Description: 类型枚举
+ * @date 2018年10月11日 下午3:33:22
+ */
+
+public enum DiagnoseTypeEnum implements KeyedNamed {
+
+    protocol(2, "拟诊"),
+    definite(3, "确诊"),
+    vigilant(4, "警惕");
+
+    @Setter
+    private int key;
+
+    @Setter
+    private String name;
+
+    DiagnoseTypeEnum(int key, String name) {
+        this.key = key;
+        this.name = name;
+    }
+
+    public static DiagnoseTypeEnum getEnum(int key) {
+        for (DiagnoseTypeEnum item : DiagnoseTypeEnum.values()) {
+            if (item.key == key) {
+                return item;
+            }
+        }
+        return null;
+    }
+
+    public static DiagnoseTypeEnum getEnum(String value) {
+        for (DiagnoseTypeEnum item : DiagnoseTypeEnum.values()) {
+            if (item.getName().equals(value)) {
+                return item;
+            }
+        }
+        return null;
+    }
+
+    public static String getName(int key) {
+        DiagnoseTypeEnum item = getEnum(key);
+        return item != null ? item.name : null;
+    }
+
+    @Override
+    public int getKey() {
+        return key;
+    }
+
+    @Override
+    public String getName() {
+        return name;
+    }
+
+
+}

+ 8 - 11
src/main/java/com/diagbot/facade/PushFacade.java

@@ -70,7 +70,6 @@ public class PushFacade {
         return pushDTO;
     }
 
-
     /**
      * 推送业务6.0
      *
@@ -79,13 +78,11 @@ public class PushFacade {
      */
     public PushDTO pushFac(PushVO pushVo) {
         Map<String, Object> debug = new LinkedHashMap<>();
-        WordCrfDTO wordCrfDTO = new WordCrfDTO();
-        long l1 = System.currentTimeMillis();
 
         // 模型处理数据
-        long crfStart = System.currentTimeMillis();
-        wordCrfDTO = commonFacade.crf_process(pushVo);
-        CoreUtil.getDebugStr(crfStart, "模型处理耗时", debug);
+        long start = System.currentTimeMillis();
+        WordCrfDTO wordCrfDTO = commonFacade.crf_process(pushVo);
+        CoreUtil.getDebugStr(start, "模型处理耗时", debug);
 
         // 标准词转换
         long standStart = System.currentTimeMillis();
@@ -97,13 +94,13 @@ public class PushFacade {
 
         // 推送
         long pushStart = System.currentTimeMillis();
-        PushDTO process = pushProcess.process(pushVo, standConvertMap, wordCrfDTO);
-        CoreUtil.getDebugStr(pushStart, "推送耗时", debug);
-        process.setDebug(debug);
+        PushDTO pushDTO = pushProcess.process(pushVo, standConvertMap, wordCrfDTO);
+        CoreUtil.getDebugStr(pushStart, "规则业务耗时", debug);
 
-        CoreUtil.getDebugStr(l1, "本次调用总计耗时", debug);
+        CoreUtil.getDebugStr(start, "总计耗时", debug);
         CoreUtil.getDebugObject("数据", debug, wordCrfDTO);
-        return process;
+        pushDTO.getDebug().putAll(debug);
+        return pushDTO;
     }
 
     /**

+ 173 - 32
src/main/java/com/diagbot/process/PushProcess.java

@@ -4,27 +4,44 @@ import com.diagbot.biz.push.entity.Item;
 import com.diagbot.biz.push.entity.Lis;
 import com.diagbot.biz.push.entity.Pacs;
 import com.diagbot.client.IcssPushServiceClient;
+import com.diagbot.dto.BaseDiagnoseDTO;
+import com.diagbot.dto.DiagnoseDTO;
 import com.diagbot.dto.NeoPushDTO;
 import com.diagbot.dto.PushBaseDTO;
 import com.diagbot.dto.PushDTO;
-import com.diagbot.dto.PushDiagnoseDTO;
+import com.diagbot.dto.RuleBaseDTO;
 import com.diagbot.dto.TreatDTO;
 import com.diagbot.dto.WordCrfDTO;
 import com.diagbot.dto.icss.FeatureRate;
 import com.diagbot.dto.icss.Response;
 import com.diagbot.dto.icss.ResponseData;
 import com.diagbot.entity.PreResult;
+import com.diagbot.enums.BaseDiagnoseTypeEnum;
+import com.diagbot.enums.DiagnoseTypeEnum;
 import com.diagbot.enums.DiseaseTypeEnum;
+import com.diagbot.enums.LexiconEnum;
 import com.diagbot.enums.MedicalAdviceEnum;
 import com.diagbot.enums.PushRelationTypeEnum;
 import com.diagbot.enums.RedisEnum;
 import com.diagbot.enums.StandConvertEnum;
 import com.diagbot.facade.CommonFacade;
+import com.diagbot.facade.KlDiagnoseFacade;
 import com.diagbot.facade.KlRelationFacade;
 import com.diagbot.facade.NeoFacade;
 import com.diagbot.facade.TranLisConfigIcssFacade;
+import com.diagbot.model.entity.Clinical;
+import com.diagbot.model.entity.Operation;
+import com.diagbot.model.label.ChiefLabel;
+import com.diagbot.model.label.PacsLabel;
+import com.diagbot.model.label.PastLabel;
+import com.diagbot.model.label.PresentLabel;
+import com.diagbot.rule.CommonRule;
+import com.diagbot.rule.LisRule;
+import com.diagbot.util.BeanUtil;
+import com.diagbot.util.CoreUtil;
 import com.diagbot.util.ListUtil;
 import com.diagbot.util.RedisUtil;
+import com.diagbot.vo.DiagnoseVO;
 import com.diagbot.vo.DiseaseItemVO;
 import com.diagbot.vo.IcssVo;
 import com.diagbot.vo.NeoPushVO;
@@ -68,7 +85,14 @@ public class PushProcess {
     @Autowired
     RedisUtil redisUtil;
     @Autowired
-    private KlRelationFacade klRelationFacade;
+    KlRelationFacade klRelationFacade;
+    @Autowired
+    CommonRule commonRule;
+    @Autowired
+    LisRule lisRule;
+    @Autowired
+    KlDiagnoseFacade klDiagnoseFacade;
+
 
     public PushDTO processIcss(PushVO pushVo) {
 
@@ -327,44 +351,161 @@ public class PushProcess {
     public PushDTO process(PushVO pushVo, Map<String, Map<String, String>> standConvertMap, WordCrfDTO wordCrfDTO) {
         int length = pushVo.getLength();
         PushDTO pushDTO = new PushDTO();
-//        List<String> ruleTypeList = Arrays.asList(pushVo.getFeatureType().split(","));
-//        Map<String, List<String>> typeWords = typeWords(standConvertMap);
-//        //生成push入参,供图谱调用
-//        NeoPushVO pushVO = commonFacade.generatePushInput(wordCrfDTO);
-//        Map<String, List<PushBaseDTO>> dis = new HashMap<>();
-//        List<String> push = neoFacade.getPush(pushVO);
-//        if (ListUtil.isNotEmpty(push)) {
-//            //先把所有疾病推出来
-//            if (ruleTypeList.contains("7")) {
-//                List<PushBaseDTO> diseeases = push.stream().map(x -> {
-//                    PushBaseDTO pushBaseDTO = new PushBaseDTO();
-//                    pushBaseDTO.setName(x);
-//                    return pushBaseDTO;
-//                }).collect(Collectors.toList());
-//                diseeases = diseeases.subList(0, diseeases.size() >= length ? length : diseeases.size());
-//                dis.put(DiseaseTypeEnum.possibleDis.getName(), diseeases);
-//                pushDTO.setDis(dis);
-//            }
-//            //把第一个推送出来的诊断set到diagOrder中,再反推
-//            setPushVo(pushVO, push);
-//            //调用反推
-//            reversePushPackage(length, pushDTO, ruleTypeList, typeWords, pushVO, dis);
-//        }
+        // 推送诊断
+        pushDiagnose(wordCrfDTO, pushDTO);
+        // List<String> ruleTypeList = Arrays.asList(pushVo.getFeatureType().split(","));
+        // Map<String, List<String>> typeWords = typeWords(standConvertMap);
+        // Map<String, List<PushBaseDTO>> dis = new HashMap<>();
+        // if (ListUtil.isNotEmpty(push)) {
+        //     //先把所有疾病推出来
+        //     if (ruleTypeList.contains("7")) {
+        //         List<PushBaseDTO> diseeases = push.stream().map(x -> {
+        //             PushBaseDTO pushBaseDTO = new PushBaseDTO();
+        //             pushBaseDTO.setName(x);
+        //             return pushBaseDTO;
+        //         }).collect(Collectors.toList());
+        //         diseeases = diseeases.subList(0, diseeases.size() >= length ? length : diseeases.size());
+        //         dis.put(DiseaseTypeEnum.possibleDis.getName(), diseeases);
+        //         pushDTO.setDis(dis);
+        //     }
+        //     //把第一个推送出来的诊断set到diagOrder中,再反推
+        //     setPushVo(pushVO, push);
+        //     //调用反推
+        //     reversePushPackage(length, pushDTO, ruleTypeList, typeWords, pushVO, dis);
+        // }
         return pushDTO;
-
     }
 
     /**
      * 根据诊断依据推送疾病
      * @param wordCrfDTO
      */
-    public PushDiagnoseDTO pushDiagnose(WordCrfDTO wordCrfDTO) {
-        PushDiagnoseDTO pushDiagnoseDTO = new PushDiagnoseDTO();
-        // TODO 读取所有的诊断依据规则
-
-        // TODO 规则匹配
+    public void pushDiagnose(WordCrfDTO wordCrfDTO, PushDTO pushDTO) {
+        // 读取所有的诊断依据规则——已去重处理
+        List<BaseDiagnoseDTO> diagnoselist = redisUtil.get(RedisEnum.allBaseDiagnose.getName());
+        // 匹配的诊断依据规则
+        List<Long> baseIdList = new ArrayList<>();
+
+        /**---------------------------数据统一处理开始--------------------------------- */
+        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()); // 现病史临床表现
+        /**---------------------------数据统一处理结束--------------------------------- */
+
+        // TODO 规则处理
+        for (BaseDiagnoseDTO base : diagnoselist) {
+            RuleBaseDTO ruleBaseDTO = new RuleBaseDTO();
+            BeanUtil.copyProperties(base, ruleBaseDTO);
+            String baseIds = base.getIds();
+            switch (BaseDiagnoseTypeEnum.getEnum(base.getBaseType())) {
+                case B1: // 等于术语本身
+                    switch (LexiconEnum.getEnum(base.getBaseLibType())) {
+                        case Symptom: // 症状
+                            commonRule.compareNameWithPush(clinicals, ruleBaseDTO, baseIdList, baseIds);
+                            break;
+                        case VitalResult: // 体格检查结果
+                            break;
+                        case Disease: // 疾病
+                            break;
+                        case Group: // 人群
+                            break;
+                        case PacsResult: // 辅助检查结果
+                            break;
+                    }
+                    break;
+                case B2: // 比较
+                    switch (LexiconEnum.getEnum(base.getBaseLibType())) {
+                        case LisSubName: // 化验
+                            lisRule.push(wordCrfDTO.getLis(), ruleBaseDTO, baseIdList, baseIds);
+                            break;
+                        case Age: // 年龄
+                            break;
+                        case VitalResult: // 体格检查结果
+                            break;
+                    }
+                    break;
+                case B3: // 主诉现病史正则
+                    break;
+                case B4: // 既往史正则
+                    break;
+            }
+        }
+        // 根据诊断依据推送诊断
+        pushDTO.getDebug().put("诊断依据ID列表", StringUtils.join(baseIdList, ","));
+        Map<String, List<PushBaseDTO>> pushDiagnoseDTO = setPushDiagnose(wordCrfDTO, baseIdList);
+        pushDTO.setDis(pushDiagnoseDTO);
+    }
 
-        // TODO 返回诊断
+    /**
+     * 根据诊断依据推送诊断
+     *
+     * @param wordCrfDTO
+     * @param baseIdList
+     */
+    public Map<String, List<PushBaseDTO>> setPushDiagnose(WordCrfDTO wordCrfDTO, List<Long> baseIdList) {
+        Map<String, List<PushBaseDTO>> pushDiagnoseDTO = new LinkedHashMap<>();
+        // 设置诊断
+        if (ListUtil.isNotEmpty(baseIdList)) {
+            DiagnoseVO diagnoseVO = new DiagnoseVO();
+            diagnoseVO.setAge(wordCrfDTO.getAgeNum());
+            diagnoseVO.setSexType(wordCrfDTO.getSex());
+            diagnoseVO.setIds(baseIdList);
+            List<DiagnoseDTO> diagnoseDTOList = klDiagnoseFacade.getDiagnoseByIds(diagnoseVO);
+            List<PushBaseDTO> protocolList = new ArrayList<>(); // 拟诊
+            List<PushBaseDTO> definiteList = new ArrayList<>(); // 确诊
+            List<PushBaseDTO> vigilantList = new ArrayList<>(); // 警惕
+            for (DiagnoseDTO diagnoseDTO : diagnoseDTOList) {
+                PushBaseDTO pushBaseDTO = new PushBaseDTO();
+                pushBaseDTO.setName(diagnoseDTO.getLibName());
+                switch (DiagnoseTypeEnum.getEnum(diagnoseDTO.getConditionType())) {
+                    case protocol: // 拟诊
+                        protocolList.add(pushBaseDTO);
+                        break;
+                    case definite: // 确诊
+                        definiteList.add(pushBaseDTO);
+                        break;
+                    case vigilant: // 警惕
+                        vigilantList.add(pushBaseDTO);
+                        break;
+                }
+            }
+            if (ListUtil.isNotEmpty(protocolList)) {
+                pushDiagnoseDTO.put("拟诊", protocolList);
+            }
+            if (ListUtil.isNotEmpty(definiteList)) {
+                pushDiagnoseDTO.put("确诊", definiteList);
+            }
+            if (ListUtil.isNotEmpty(vigilantList)) {
+                pushDiagnoseDTO.put("警惕", vigilantList);
+            }
+        }
         return pushDiagnoseDTO;
     }
 

+ 28 - 2
src/main/java/com/diagbot/rule/CommonRule.java

@@ -26,6 +26,8 @@ import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
+import java.util.concurrent.atomic.AtomicReference;
+import java.util.concurrent.locks.ReentrantLock;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
@@ -66,6 +68,29 @@ public class CommonRule {
         }
     }
 
+    /**
+     * 比较阳性属性是否匹配
+     *
+     * @param input
+     * @param ruleBaseDTO
+     * @param baseIdList
+     * @param ids
+     * @param <T>
+     */
+    public <T> void compareNameWithPush(List<T> input, RuleBaseDTO ruleBaseDTO, List<Long> baseIdList, String ids) {
+        if (ListUtil.isNotEmpty(input)) {
+            for (T d : input) {
+                Negative val = (Negative) CoreUtil.getFieldValue(d, "negative");
+                if (val == null) {
+                    String c = (String) CoreUtil.getFieldValue(d, "standName");
+                    if (StringUtils.isNotBlank(c) && CoreUtil.compareName(ruleBaseDTO, c)) {
+                        CoreUtil.addSplitString(baseIdList, ids);
+                    }
+                }
+            }
+        }
+    }
+
     /**
      * 比较是否包含
      *
@@ -431,8 +456,9 @@ public class CommonRule {
         for (Pacs bean : pacsList) {
             System.out.println(bean.getName());
         }
-
-
+        AtomicReference<Integer> integerAtomicReference = new AtomicReference<>(20);
+        integerAtomicReference.set(1020);
+        new ReentrantLock().lock();
     }
 
 }

+ 19 - 0
src/main/java/com/diagbot/rule/LisRule.java

@@ -325,4 +325,23 @@ public class LisRule {
             criticalList.add(criticalMsg);
         }
     }
+
+    /**
+     * 比较化验——推理
+     *
+     * @param inputLis
+     * @param ruleBaseDTO
+     * @param baseIdList
+     * @param ids
+     */
+    public void push(List<Lis> inputLis, RuleBaseDTO ruleBaseDTO, List<Long> baseIdList, String ids) {
+        if (ListUtil.isNotEmpty(inputLis) && StringUtil.isNotBlank(ruleBaseDTO.getBaseLibName())) {
+            for (Lis lis : inputLis) {
+                Map<String, Object> map = CoreUtil.compareLis(ruleBaseDTO, lis);
+                if (CoreUtil.getMapFlag(map)) {
+                    CoreUtil.addSplitString(baseIdList, ids);
+                }
+            }
+        }
+    }
 }

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

@@ -18,6 +18,7 @@ import org.springframework.stereotype.Component;
 import java.lang.reflect.Field;
 import java.math.BigDecimal;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
@@ -882,6 +883,18 @@ public class CoreUtil {
         return map;
     }
 
+    /**
+     * 将字符串以“,”分隔,添加到list列表中
+     * @param list
+     * @param s
+     */
+    public static void addSplitString(List<Long> list, String s) {
+        if (StringUtil.isBlank(s)) {
+            return ;
+        }
+        list.addAll(Arrays.stream(s.split(",")).map(r -> Long.parseLong(r)).collect(Collectors.toList()));
+    }
+
 
     public static void main(String[] args) {
         List<Item> list = new ArrayList<>();

+ 7 - 7
src/main/java/com/diagbot/util/ParamUtil.java

@@ -30,33 +30,33 @@ public class ParamUtil {
                 switch (otherValue) {
                     case "阳性":
                     case "阴性":
-                        lis.setResult(otherValue);
+                        lis.setOtherValue(otherValue);
                         break;
                     case "+":
                     case "++":
                     case "+++":
                     case "++++":
-                        lis.setResult("阳性");
+                        lis.setOtherValue("阳性");
                         break;
                     case "-":
                     case "--":
                     case "---":
                     case "----":
-                        lis.setResult("阴性");
+                        lis.setOtherValue("阴性");
                         break;
                     default: // 其他类型
-                        lis.setResult(otherValue);
+                        lis.setOtherValue(otherValue);
                         break;
                 }
             } else if (value != null) {
                 Double max = lis.getMaxValue();
                 Double min = lis.getMinValue();
                 if (max != null && max < value) {
-                    lis.setResult("升高");
+                    lis.setOtherValue("升高");
                 } else if (min != null && value < min) {
-                    lis.setResult("降低");
+                    lis.setOtherValue("降低");
                 } else {
-                    lis.setResult("正常");
+                    lis.setOtherValue("正常");
                 }
             }
         }

+ 11 - 0
src/main/java/com/diagbot/web/TestController.java

@@ -1,12 +1,15 @@
 package com.diagbot.web;
 
 import com.diagbot.dto.DiagnoseDTO;
+import com.diagbot.dto.PushDTO;
 import com.diagbot.dto.RespDTO;
 import com.diagbot.dto.StandConvertCrfBatchDTO;
 import com.diagbot.dto.StandConvertCrfDTO;
 import com.diagbot.facade.KlDiagnoseFacade;
+import com.diagbot.facade.PushFacade;
 import com.diagbot.facade.TestFacade;
 import com.diagbot.vo.DiagnoseVO;
+import com.diagbot.vo.PushVO;
 import com.diagbot.vo.StandConvertCrfVO;
 import com.diagbot.vo.TestAllVO;
 import com.diagbot.vo.TestLineVO;
@@ -39,6 +42,8 @@ public class TestController {
     private TestFacade testFacade;
     @Autowired
     private KlDiagnoseFacade klDiagnoseFacade;
+    @Autowired
+    PushFacade pushFacade;
 
     @ApiOperation(value = "开单合理性测试API[zhoutg]",
             notes = "idNum:指定行测试<br>" +
@@ -176,5 +181,11 @@ public class TestController {
     public RespDTO<List<DiagnoseDTO>> getDiagnoseByIds(@RequestBody DiagnoseVO diagnoseVO) {
         return RespDTO.onSuc(klDiagnoseFacade.getDiagnoseByIds(diagnoseVO));
     }
+
+    @ApiOperation(value = "诊断依据规则测试[zhoutg]", notes = "")
+    @PostMapping("/testDiagnose")
+    public RespDTO<PushDTO> testDiagnose(@RequestBody PushVO pushVO) {
+        return RespDTO.onSuc(pushFacade.pushFac(pushVO));
+    }
 }
 

+ 12 - 12
src/main/resources/mapper/KlDiagnoseBaseMapper.xml

@@ -42,19 +42,19 @@
                 t1.eq_unit
             ) AS baseKey,
             GROUP_CONCAT(t1.id) AS ids,
-            IFNULL(t2.lib_name, "") AS libName,
-            IFNULL(t2.lib_type, 0) AS libType,
+            IFNULL(t2.lib_name, "") AS baseLibName,
+            IFNULL(t2.lib_type, 0) AS baseLibType,
             t1.concept_id,
-            t1.type,
-            t1.max_operator,
-            t1.max_value,
-            t1.max_unit,
-            t1.min_operator,
-            t1.min_value,
-            t1.min_unit,
-            t1.eq_operator,
-            t1.eq_value,
-            t1.eq_unit
+            t1.type AS baseType,
+            t1.max_operator AS baseMaxOperator,
+            t1.max_value AS baseMaxValue,
+            t1.max_unit AS baseMaxUnit,
+            t1.min_operator AS baseMinOperator,
+            t1.min_value AS baseMinValue,
+            t1.min_unit AS baseMinUnit,
+            t1.eq_operator AS baseEqOperator,
+            t1.eq_value AS baseEqValue,
+            t1.eq_unit AS baseEqUnit
         FROM
             kl_diagnose_base t1
         LEFT JOIN kl_concept t2 ON t1.concept_id = t2.id