Browse Source

开单新规则

zhoutg 4 years ago
parent
commit
feaaa9c880

+ 2 - 0
src/main/java/com/diagbot/dto/BillNeoMaxDTO.java

@@ -69,4 +69,6 @@ public class BillNeoMaxDTO {
     // 互斥开单辅助检查
     private List<NodeNeoDTO> pacsOrder = new ArrayList<>();
 
+    // 无需重复辅检开单项
+    private List<NodeNeoDTO> needlessPacsOrder = new ArrayList<>();
 }

+ 3 - 0
src/main/java/com/diagbot/dto/NodeNeoDTO.java

@@ -23,6 +23,9 @@ public class NodeNeoDTO {
     // 名称
     private String name;
 
+    // 正则规则
+    private String regex;
+
     // 类型
     private String termtype;
 

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

@@ -241,6 +241,9 @@ public class BillProcess {
 
             // 禁忌医疗器械及物品
             medEquRule.bill(wordCrfDTO, bill, billMsgList, NeoEnum.medEqu.getName());
+
+            // 无需重复开单项
+            commonRule.needlessRepeatOrder(wordCrfDTO, bill, billMsgList);
         }
 
         // 24小时重复开单项

+ 81 - 1
src/main/java/com/diagbot/rule/CommonRule.java

@@ -109,6 +109,61 @@ public class CommonRule {
         }
     }
 
+    /**
+     * 无需重复开单项
+     *
+     * @param wordCrfDTO
+     * @param billNeoMaxDTO
+     * @param billMsgList
+     */
+    public void needlessRepeatOrder(WordCrfDTO wordCrfDTO, BillNeoMaxDTO billNeoMaxDTO, List<BillMsg> billMsgList) {
+        List<NodeNeoDTO> needlessPacsOrder = billNeoMaxDTO.getNeedlessPacsOrder();
+        String orderStandName = billNeoMaxDTO.getOrderStandName();
+        for (NodeNeoDTO nodeNeoDTO : needlessPacsOrder) {
+            Map<String, List<Pacs>> map = EntityUtil.makeEntityListMap(wordCrfDTO.getPacs(), "uniqueName");
+            List<Pacs> pacsList = map.get(orderStandName);
+            if (ListUtil.isNotEmpty(pacsList)) {
+                sortByProperty(pacsList, "dateValue");
+                Pacs pacs = pacsList.get(pacsList.size() - 1);
+                String result = pacs.getResult();
+                if (StringUtil.isNotBlank(result) && StringUtil.isNotBlank(nodeNeoDTO.getRegex())
+                        && result.matches(nodeNeoDTO.getRegex())) {
+                    BillMsg commonBillMsg = MsgUtil.getNeedlessRepeatOrder(
+                            billNeoMaxDTO.getOrderName(), billNeoMaxDTO.getOrderStandName(),
+                            pacs.getName(), billNeoMaxDTO.getType());
+                    billMsgList.add(commonBillMsg);
+                }
+            }
+        }
+    }
+
+    /**
+     * 根据指定字段按照字符串排序
+     *
+     * @param tList
+     * @param property
+     * @param <T>
+     */
+    public <T> void sortByProperty(List<T> tList, String property) {
+        if (ListUtil.isNotEmpty(tList) && tList.size() > 1) {
+            // items 按照时间排序
+            Collections.sort(tList, new Comparator<T>() {
+                @Override
+                public int compare(T o1, T o2) {
+                    String o1Str = (String) CoreUtil.getFieldValue(o1, property);
+                    String o2Str = (String) CoreUtil.getFieldValue(o2, property);
+                    if (StringUtil.isBlank(o1Str)) {
+                        return -1;
+                    }
+                    if (StringUtil.isBlank(o2Str)) {
+                        return 1;
+                    }
+                    return o1Str.compareTo(o2Str);
+                }
+            });
+        }
+    }
+
     /**
      * 24小时重复开单总入口
      *
@@ -206,7 +261,7 @@ 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.getBillMsg24Repeat(
+                                    BillMsg commonBillMsg = MsgUtil.getBill24RepeatMsg(
                                             name, uniqueName, name, type);
                                     billMsgList.add(commonBillMsg);
                                     break;
@@ -285,4 +340,29 @@ public class CommonRule {
         return drugAllergyAll;
     }
 
+    public static void main(String[] args) {
+        List<Pacs> pacsList = new ArrayList<>();
+        Pacs pacs = new Pacs();
+        pacs.setName("d1");
+        pacs.setDateValue("2020-01-01");
+        pacsList.add(pacs);
+
+        Pacs pacs1 = new Pacs();
+        pacs1.setName("d2");
+        pacs1.setDateValue("2020-01-07");
+        pacsList.add(pacs1);
+
+        Pacs pacs3 = new Pacs();
+        pacs3.setName("d3");
+        pacs3.setDateValue("2020-01-09");
+        pacsList.add(pacs3);
+        CommonRule commonRule = new CommonRule();
+        commonRule.sortByProperty(pacsList, "dateValue");
+        for (Pacs bean : pacsList) {
+            System.out.println(bean.getName());
+        }
+
+
+    }
+
 }

+ 22 - 1
src/main/java/com/diagbot/util/MsgUtil.java

@@ -190,7 +190,7 @@ public class MsgUtil {
      * @param type 类型
      * @return
      */
-    public static BillMsg getBillMsg24Repeat(String orderName, String orderStandName, String content, String type) {
+    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);
@@ -201,6 +201,27 @@ public class MsgUtil {
         return billMsg;
     }
 
+    /**
+     * 无需重复辅检开单项
+     *
+     * @param orderName 原开单项
+     * @param orderStandName 标准开单项
+     * @param content 匹配内容
+     * @param type 类型
+     * @return
+     */
+    public static BillMsg getNeedlessRepeatOrder(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;
+    }
+
+
     /**
      * 开单合理性禁忌医疗器械及物品提示信息
      *