Browse Source

危急值结构定义

zhoutg 4 years atrás
parent
commit
7e036988c4

+ 33 - 4
src/main/java/com/diagbot/aggregate/IndicationAggregate.java

@@ -3,6 +3,7 @@ package com.diagbot.aggregate;
 import com.diagbot.dto.IndicationDTO;
 import com.diagbot.dto.WordCrfDTO;
 import com.diagbot.facade.BillFacade;
+import com.diagbot.facade.CriticalFacade;
 import com.diagbot.facade.HighRiskFacade;
 import com.diagbot.util.CoreUtil;
 import com.diagbot.vo.IndicationPushVO;
@@ -26,6 +27,8 @@ public class IndicationAggregate {
     BillFacade billFacade;
     @Autowired
     HighRiskFacade highRiskFacade;
+    @Autowired
+    CriticalFacade criticalFacade;
 
     @DataProvider("indicationAll")
     public IndicationDTO indicationAll(
@@ -33,15 +36,20 @@ public class IndicationAggregate {
             @InvokeParameter("indicationPushVO") IndicationPushVO indicationPushVO,
             @InvokeParameter("debug") Map<String, Object> debug,
             @DataConsumer("bill") IndicationDTO billDTO,
-            @DataConsumer("highrisk") IndicationDTO highrisk) {
+            @DataConsumer("highrisk") IndicationDTO highriskDTO,
+            @DataConsumer("critical") IndicationDTO criticalDTO) {
         IndicationDTO res = new IndicationDTO();
         if (billDTO != null) {
             res.setBillMsgList(billDTO.getBillMsgList());
             debug.putAll(billDTO.getDebug()); // 调试信息
         }
-        if (highrisk != null) {
-            res.setHighRiskList(highrisk.getHighRiskList());
-            debug.putAll(highrisk.getDebug()); // 调试信息
+        if (highriskDTO != null) {
+            res.setHighRiskList(highriskDTO.getHighRiskList());
+            debug.putAll(highriskDTO.getDebug()); // 调试信息
+        }
+        if (criticalDTO != null) {
+            res.setCriticalValList(criticalDTO.getCriticalValList());
+            debug.putAll(criticalDTO.getDebug()); // 调试信息
         }
         res.setDebug(debug);
         return res;
@@ -88,4 +96,25 @@ public class IndicationAggregate {
         }
         return null;
     }
+
+    /**
+     * 危急值提示
+     *
+     * @param wordCrfDTO
+     * @param indicationPushVO
+     * @return
+     */
+    @DataProvider("critical")
+    public IndicationDTO critical(@InvokeParameter("wordCrfDTO") WordCrfDTO wordCrfDTO,
+                                  @InvokeParameter("indicationPushVO") IndicationPushVO indicationPushVO) {
+        long start = System.currentTimeMillis();
+        IndicationDTO res = new IndicationDTO();
+        // 危急值提示
+        if (indicationPushVO != null && indicationPushVO.getRuleTypeList().contains("1")) {
+            criticalFacade.criticalFac(indicationPushVO, wordCrfDTO, res);
+            CoreUtil.getDebugStr(start, "危急值提示耗时", res.getDebug());
+            return res;
+        }
+        return null;
+    }
 }

+ 58 - 0
src/main/java/com/diagbot/enums/TypeEnum.java

@@ -0,0 +1,58 @@
+package com.diagbot.enums;
+
+import com.diagbot.core.KeyedNamed;
+import lombok.Setter;
+
+/**
+ * @author zhoutg
+ * @Description: 类型枚举
+ * @date 2018年10月11日 下午3:33:22
+ */
+
+public enum TypeEnum implements KeyedNamed {
+
+    lis(1, "化验"),
+    pacs(2, "辅检"),
+    disease(3, "诊断"),
+    drug(4, "药品"),
+    clinical(5, "临床表现"),
+    operation(6, "手术"),
+    vital(7, "体征");
+
+    @Setter
+    private int key;
+
+    @Setter
+    private String name;
+
+    TypeEnum(int key, String name) {
+        this.key = key;
+        this.name = name;
+    }
+
+    public static TypeEnum getEnum(int key) {
+        for (TypeEnum item : TypeEnum.values()) {
+            if (item.key == key) {
+                return item;
+            }
+        }
+        return null;
+    }
+
+    public static String getName(int key) {
+        TypeEnum item = getEnum(key);
+        return item != null ? item.name : null;
+    }
+
+    @Override
+    public int getKey() {
+        return key;
+    }
+
+    @Override
+    public String getName() {
+        return name;
+    }
+
+
+}

+ 9 - 30
src/main/java/com/diagbot/facade/CriticalFacade.java

@@ -1,15 +1,14 @@
 package com.diagbot.facade;
 
-import com.diagbot.biz.push.entity.Item;
-import com.diagbot.dto.HighRiskNeoDTO;
+import com.diagbot.dto.CriticalNeoDTO;
 import com.diagbot.dto.IndicationDTO;
 import com.diagbot.dto.WordCrfDTO;
-import com.diagbot.process.HighRiskProcess;
-import com.diagbot.vo.HighRiskNeoVO;
+import com.diagbot.process.CriticalProcess;
 import com.diagbot.vo.IndicationPushVO;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
+import java.util.ArrayList;
 import java.util.List;
 
 /**
@@ -23,9 +22,7 @@ public class CriticalFacade {
     @Autowired
     NeoFacade neoFacade;
     @Autowired
-    HighRiskProcess highRiskProcess;
-    @Autowired
-    CommonFacade commonFacade;
+    CriticalProcess criticalProcess;
 
     /**
      * 高风险提示
@@ -33,30 +30,12 @@ public class CriticalFacade {
      * @return
      */
     public void criticalFac(IndicationPushVO indicationPushVO, WordCrfDTO wordCrfDTO, IndicationDTO res) {
-        // 高风险图谱接口调用
-        HighRiskNeoVO highRiskNeoVO = fillHighRiskNeo(wordCrfDTO);
-        List<HighRiskNeoDTO> highRiskNeoDTOList = neoFacade.getHighRiskNeo(highRiskNeoVO);
+        // 危急值图谱接口调用
+        // TODO
+        List<CriticalNeoDTO> criticalNeoDTOList = new ArrayList<>();
+
         // 规则处理
-        highRiskProcess.process(highRiskNeoDTOList, res);
+        criticalProcess.process(criticalNeoDTOList, wordCrfDTO, res);
     }
 
-
-    public HighRiskNeoVO fillHighRiskNeo(WordCrfDTO wordCrfDTO) {
-        HighRiskNeoVO highRiskNeoVO = new HighRiskNeoVO();
-
-        List<Item> items = wordCrfDTO.getDrugOrder();
-
-        for (Item item : items) {
-            highRiskNeoVO.getDrugList().put(item.getName(), item.getUniqueName());
-        }
-
-        items = wordCrfDTO.getOperationOrder();
-
-        for (Item item : items) {
-            highRiskNeoVO.getOperationList().put(item.getName(), item.getUniqueName());
-        }
-
-
-        return highRiskNeoVO;
-    }
 }

+ 16 - 2
src/main/java/com/diagbot/process/CriticalProcess.java

@@ -1,11 +1,16 @@
 package com.diagbot.process;
 
+import com.diagbot.biz.push.entity.Lis;
 import com.diagbot.dto.CriticalNeoDTO;
 import com.diagbot.dto.IndicationDTO;
 import com.diagbot.dto.NodeNeoDTO;
+import com.diagbot.dto.WordCrfDTO;
+import com.diagbot.enums.TypeEnum;
+import com.diagbot.util.CoreUtil;
 import org.springframework.stereotype.Component;
 
 import java.util.List;
+import java.util.Map;
 
 /**
  * @Description: 危急值总入口
@@ -20,10 +25,19 @@ public class CriticalProcess {
      * @param criticalNeoDTOList
      * @param res
      */
-    public void process(List<CriticalNeoDTO> criticalNeoDTOList, IndicationDTO res) {
+    public void process(List<CriticalNeoDTO> criticalNeoDTOList, WordCrfDTO wordCrfDTO, IndicationDTO res) {
         for (CriticalNeoDTO critical : criticalNeoDTOList) {
             NodeNeoDTO nodeNeoDTO = critical.getCritical();
-
+            // 化验
+            if (TypeEnum.lis.getName().equals(critical.getType())) {
+                List<Lis> lisList = wordCrfDTO.getLis();
+                for (Lis bean : lisList) {
+                    Map<String, Object> map = CoreUtil.compareLis(nodeNeoDTO, bean);
+                    if ((Boolean) map.get("flag") == true) {
+                        // CoreUtil.getCommonBillMsg()
+                    }
+                }
+            }
         }
     }
 }

+ 58 - 40
src/main/java/com/diagbot/util/CoreUtil.java

@@ -1,14 +1,14 @@
 package com.diagbot.util;
 
+import com.diagbot.biz.push.entity.Lis;
 import com.diagbot.dto.BillMsg;
 import com.diagbot.dto.NodeNeoDTO;
-import com.diagbot.model.entity.Clinical;
 import org.apache.commons.lang.StringUtils;
 
 import java.lang.reflect.Field;
 import java.math.BigDecimal;
 import java.util.ArrayList;
-import java.util.HashMap;
+import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
 
@@ -215,38 +215,25 @@ public class CoreUtil {
     }
 
     /**
-     * 开单合理性通用提示信息
-     *
-     * @param errMsg 提心信息
-     * @param name 项目名称
-     * @return
-     */
-    public static BillMsg getCommonBillMsg(String errMsg, String name,String standName) {
-        BillMsg billMsg = new BillMsg();
-        String msg = String.format(errMsg + ",不宜开%s", name);
-        billMsg.setMsg(msg);
-        billMsg.setCompareName(errMsg);
-        billMsg.setCompareStandName(standName);
-        return billMsg;
-    }
-
-    /**
-     * 开单合理性通用提示信息
+     * 危急值通用提示信息
      *
      * @param orderName 原开单项
      * @param orderStandName 标准开单项
      * @param compareName 匹配名称
      * @param compareStandName 匹配标准名称
+     * @param type 类型
      * @return
      */
-    public static BillMsg getCommonBillMsg(String orderName, String orderStandName, String compareName, String compareStandName) {
+    public static BillMsg getCommonCriticalMsg(String orderName, String orderStandName, String compareName,
+                                           String compareStandName, String type) {
         BillMsg billMsg = new BillMsg();
-        String msg = String.format(compareName + ",不宜开%s", orderName);
+        String msg = String.format("该患者" + compareName + ",不宜开%s", orderName);
         billMsg.setMsg(msg);
         billMsg.setCompareName(compareName);
         billMsg.setCompareStandName(compareStandName);
         billMsg.setOrderName(orderName);
         billMsg.setOrderStandName(orderStandName);
+        billMsg.setType(type);
         return billMsg;
     }
 
@@ -302,6 +289,55 @@ public class CoreUtil {
         }
     }
 
+    /**
+     * 比较化验是否匹配
+     *
+     * @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())) {
+                map.put("msg", lis.getName() + lis.getDetailName() + lis.getOtherValue());
+                flag = true;
+            }
+        } else if (lis.getValue() != null) {
+            double value = lis.getValue();
+            BigDecimal min = nodeNeoDTO.getMin();
+            BigDecimal max = nodeNeoDTO.getMax();
+
+            if (min != null && max != null) {
+                int minAge = min.intValue();
+                int maxAge = max.intValue();
+                if (minAge <= value && value <= maxAge) {
+                    flag = true;
+                }
+            } else if (min != null && max == null) {
+                int minAge = min.intValue();
+                if (minAge <= value) {
+                    flag = true;
+                }
+            } else if (min == null && max != null) {
+                int maxAge = max.intValue();
+                if (value <= maxAge) {
+                    flag = true;
+                }
+            }
+            if (flag) {
+                map.put("msg", lis.getName() + lis.getDetailName() + lis.getValue());
+            }
+        }
+        map.put("flag", flag);
+        return map;
+    }
+
     /**
      * 比较字符串是否相等
      *
@@ -485,24 +521,6 @@ public class CoreUtil {
 
     public static void main(String[] args) {
 
-        System.out.println(getCommonBillMsg("男性", "尿常规",""));
-
-        List<Clinical> clinicals = new ArrayList<>();
-        Clinical c1 = new Clinical();
-        c1.setName("a");
-        clinicals.add(c1);
-        Clinical c2 = new Clinical();
-        c2.setName("b");
-        clinicals.add(c2);
-        Clinical c3 = new Clinical();
-        c3.setName("c");
-        clinicals.add(c3);
-
-        System.out.println(getPropertyList(clinicals));
-        Map<String, String> map = new HashMap<>();
-        map.put("a", "A");
-        map.put("b", "B");
-
-        setPropertyList(clinicals, map);
+
     }
 }