Browse Source

开单新规则

zhoutg 4 năm trước cách đây
mục cha
commit
9cad7d080b

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

@@ -22,6 +22,9 @@ public class BillNeoMaxDTO {
 
     // 类型
     private String type;
+
+    // 日期
+    private String dateValue;
     /****************扩展数据结束******************/
 
     // 禁忌性别

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

@@ -1,6 +1,7 @@
 package com.diagbot.process;
 
 import com.diagbot.biz.push.entity.Item;
+import com.diagbot.biz.push.entity.Pacs;
 import com.diagbot.dto.BillMsg;
 import com.diagbot.dto.BillNeoDTO;
 import com.diagbot.dto.BillNeoMaxDTO;
@@ -27,6 +28,7 @@ import com.diagbot.rule.VitalRule;
 import com.diagbot.util.BeanUtil;
 import com.diagbot.util.CoreUtil;
 import com.diagbot.util.ListUtil;
+import com.diagbot.util.StringUtil;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
@@ -159,6 +161,28 @@ public class BillProcess {
             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);
     }
 

+ 14 - 4
src/main/java/com/diagbot/rule/CommonRule.java

@@ -128,10 +128,20 @@ public class CommonRule {
                 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);
+                    String dateValue = pacs.getDateValue(); // 结果日期
+                    String orderDateValue = billNeoMaxDTO.getDateValue(); // 开单项日期
+                    if (StringUtil.isNotBlank(dateValue) && StringUtil.isNotBlank(orderDateValue)) {
+                        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(
+                                        billNeoMaxDTO.getOrderName(), billNeoMaxDTO.getOrderStandName(),
+                                        pacs.getName(), billNeoMaxDTO.getType());
+                                billMsgList.add(commonBillMsg);
+                            }
+                        }
+                    }
                 }
             }
         }

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

@@ -210,7 +210,7 @@ public class MsgUtil {
      * @param type 类型
      * @return
      */
-    public static BillMsg getNeedlessRepeatOrder(String orderName, String orderStandName, String content, String type) {
+    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);