Browse Source

互斥开单项修改逻辑

zhoutg 3 years ago
parent
commit
ae4701bba4

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

@@ -19,7 +19,6 @@ import com.diagbot.facade.KlDictionaryInfoFacade;
 import com.diagbot.model.entity.Clinical;
 import com.diagbot.model.entity.Negative;
 import com.diagbot.util.BeanUtil;
-import com.diagbot.util.CatalogueUtil;
 import com.diagbot.util.CoreUtil;
 import com.diagbot.util.EntityUtil;
 import com.diagbot.util.ListUtil;
@@ -37,7 +36,6 @@ import org.springframework.stereotype.Component;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.Comparator;
-import java.util.Date;
 import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
@@ -362,41 +360,8 @@ public class CommonRule {
         repeat24BillWithStruct(billMsgList, wordCrfDTO.getPacsOrder(), wordCrfDTO.getPacs(), TypeEnum.pacs.getName(), ConEnum.repeat24.getName()); // 辅检重复开单
     }
 
-    // /**
-    //  * 互斥开单项——辅检
-    //  *
-    //  * @param wordCrfDTO
-    //  * @param ruleBaseDTO
-    //  * @param billMsgList
-    //  * @param ruleSimpleDTO
-    //  * @param set           用于记录:A与B不宜同时进行, B与A不宜同时进行 只能提示一个
-    //  */
-    // 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) {
-    //         // 不同的辅检项目可能对应同一个uniqueName,提示显示多条
-    //         Map<String, List<Pacs>> map = EntityUtil.makeEntityListMap(pacsOrder, "uniqueName");
-    //         List<Pacs> orginNameList = map.get(ruleBaseDTO.getBaseLibName()); // 互斥名称
-    //         if (map.get(ruleBaseDTO.getBaseLibName()) != null) {
-    //             for (Pacs pacs : orginNameList) {
-    //                 String orginName = pacs.getName();
-    //                 // A与B不宜同时进行, B与A不宜同时进行 只能提示一个
-    //                 if (!set.contains(ruleSimpleDTO.getLibName() + "******" + orginName)) {
-    //                     set.add(ruleSimpleDTO.getLibName() + "******" + orginName);
-    //                     set.add(orginName + "******" + ruleSimpleDTO.getLibName());
-    //                     ruleSimpleDTO.setContent(orginName);
-    //                     ruleSimpleDTO.setConType(conType);
-    //                     BillMsg billMsg = msgNewUtil.getCommonBillMsg(ruleSimpleDTO);
-    //                     CoreUtil.addBeanToList(billMsgList, billMsg);
-    //                 }
-    //             }
-    //         }
-    //     }
-    // }
-
     /**
-     * 互斥开单项
+     * 互斥开单项(结构化)
      *
      * @param orderList     开单列表
      * @param ruleBaseDTO
@@ -418,10 +383,10 @@ public class CommonRule {
             if (map.get(ruleBaseDTO.getBaseLibName()) != null) {
                 for (T bean : orginNameList) {
                     String orginName = ReflectUtil.getProperty(bean, "name");
-                    // A与B不宜同时进行, B与A不宜同时进行 只能提示一个
-                    if (!set.contains(libName + "******" + orginName)) {
-                        set.add(libName + "******" + orginName);
-                        set.add(orginName + "******" + libName);
+                    // A与B不宜同时进行, B与A不宜同时进行只能提示一个
+                    if (!set.contains(libName + CommonEnum.splitSymbol.getName() + orginName)) {
+                        set.add(libName + CommonEnum.splitSymbol.getName() + orginName);
+                        set.add(orginName + CommonEnum.splitSymbol.getName() + libName);
                         ruleSimpleDTO.setContent(orginName);
                         ruleSimpleDTO.setConType(conType);
                         BillMsg billMsg = msgNewUtil.getCommonBillMsg(ruleSimpleDTO);
@@ -433,9 +398,9 @@ public class CommonRule {
     }
 
     /**
-     * 互斥开单项(结构化化验)
+     * 互斥开单项(结构化)
      *
-     * @param orderList      开单列表
+     * @param orderList     开单列表
      * @param ruleBaseDTO
      * @param billMsgList
      * @param ruleSimpleDTO
@@ -443,6 +408,12 @@ public class CommonRule {
      */
     public <T> void exclusionBillStruct(List<T> orderList, RuleBaseDTO ruleBaseDTO, List<BillMsg> billMsgList, String conType, RuleSimpleDTO ruleSimpleDTO, Set<String> set) {
         if (ListUtil.isNotEmpty(orderList)) {
+            String baseLibName = ruleBaseDTO.getBaseLibName(); // 互斥名称
+            String libName = ruleSimpleDTO.getLibName(); // 标准名称
+            // 加入集合后,会出现自己与自己互斥的数据,这些数据不提示
+            if (libName.equals(baseLibName)) {
+                return;
+            }
             // 不同的项目可能对应同一个uniqueName,提示显示多条
             Map<String, List<T>> map = EntityUtil.makeEntityListMap(orderList, "uniqueName");
             List<T> orginNameList = map.get(ruleBaseDTO.getBaseLibName());
@@ -456,22 +427,22 @@ public class CommonRule {
                         }
                     }
                     String finishDateValue = ReflectUtil.getProperty(bean, "finishDateValue");
-                    // 报告时间不为空,说明已出报告,可以再次开单
+                    // 报告时间为空,再比较时间间隔
                     if (StringUtil.isBlank(finishDateValue)) {
                         String orderDateValue = ReflectUtil.getProperty(ruleSimpleDTO, "dateValue");
                         String beanDateValue = ReflectUtil.getProperty(bean, "dateValue");
-                        int dateFlag = CoreUtil.compareTime(beanDateValue, orderDateValue, 24 * 60L, false, false);
+                        int dateFlag = CoreUtil.compareTime(beanDateValue, orderDateValue, 60L * 24, false, false);
                         if (dateFlag == 1) {
                             String orginName = ReflectUtil.getProperty(bean, "name");
-                            // A与B不宜同时进行, B与A不宜同时进行 只能提示一个
-                            // if (!set.contains(ruleSimpleDTO.getLibName() + "******" + orginName)) {
-                            //     set.add(ruleSimpleDTO.getLibName() + "******" + orginName);
-                            //     set.add(orginName + "******" + ruleSimpleDTO.getLibName());
-                            ruleSimpleDTO.setContent(orginName);
-                            ruleSimpleDTO.setConType(conType);
-                            BillMsg billMsg = msgNewUtil.getCommonBillMsg(ruleSimpleDTO);
-                            CoreUtil.addBeanToList(billMsgList, billMsg);
-                            // }
+                            // A与B不宜同时进行, B与A不宜同时进行只能提示一个
+                            if (!set.contains(libName + CommonEnum.splitSymbol.getName() + orginName)) {
+                                set.add(libName + CommonEnum.splitSymbol.getName() + orginName);
+                                set.add(orginName + CommonEnum.splitSymbol.getName() + libName);
+                                ruleSimpleDTO.setContent(orginName);
+                                ruleSimpleDTO.setConType(conType);
+                                BillMsg billMsg = msgNewUtil.getCommonBillMsg(ruleSimpleDTO);
+                                CoreUtil.addBeanToList(billMsgList, billMsg);
+                            }
                         }
                     }
                 }
@@ -521,13 +492,12 @@ public class CommonRule {
                     T it = items.get(i);
                     String curDateValue = ReflectUtil.getProperty(it, "dateValue");
                     if (StringUtil.isNotBlank(curDateValue)) {
-                        Date curDate = CatalogueUtil.parseStringDate(curDateValue);
                         for (int j = i + 1; j < items.size(); j++) {
                             T itNext = items.get(j);
                             String nextDateValue = ReflectUtil.getProperty(itNext, "dateValue");
                             if (StringUtil.isNotBlank(nextDateValue)) {
-                                Date nextDate = CatalogueUtil.parseStringDate(nextDateValue);
-                                if (!CatalogueUtil.compareTime(curDate, nextDate, 60L * 24, true)
+                                int dateFlag = CoreUtil.compareTime(curDateValue, nextDateValue, 60L * 24, false, true);
+                                if (dateFlag == 1
                                         && getFrquenceType(ReflectUtil.getProperty(it, "frequency"))
                                         .equals(getFrquenceType(ReflectUtil.getProperty(itNext, "frequency")))) {
                                     String name = (String) CoreUtil.getFieldValue(it, "name");
@@ -575,11 +545,11 @@ public class CommonRule {
                         }
                     }
                     String finishDateValue = ReflectUtil.getProperty(it, "finishDateValue");
-                    // 报告时间不为空,说明已出报告,可以再次开单
+                    // 报告时间为空,再比较时间间隔
                     if (StringUtil.isBlank(finishDateValue)) {
                         String curDateValue = ReflectUtil.getProperty(order, "dateValue"); // 当前开单时间
                         String pastDateValue = ReflectUtil.getProperty(it, "dateValue"); // 历史开单时间
-                        int dateFlag = CoreUtil.compareTime(pastDateValue, curDateValue, 24 * 60L, false, false);
+                        int dateFlag = CoreUtil.compareTime(pastDateValue, curDateValue, 60L * 24, false, false);
                         // 规定时间内,并且频次相同
                         if (dateFlag == 1 &&
                                 getFrquenceType(ReflectUtil.getProperty(it, "frequency"))

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

@@ -153,41 +153,6 @@ public class CatalogueUtil {
         return false;
     }
 
-    /**
-     * 比较时间,以分钟为单位
-     * 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 Math.abs(time_e - time_s) >= diff * 1000 * 60;
-            } else {
-                return Math.abs(time_e - time_s) > diff * 1000 * 60;
-            }
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-        return overtime;
-    }
-
     /**
      * 获取查房记录标题中医师职称
      *