Browse Source

加入报告时间字段

zhoutg 3 years ago
parent
commit
1d4518a59f

+ 4 - 2
src/main/java/com/diagbot/process/BillProcess.java

@@ -118,7 +118,8 @@ public class BillProcess {
                                         commonRule.compareItemWithBill(diags, ruleBaseDTO, billMsgList, ConEnum.disease.getName(), ruleSimpleDTO);
                                         break;
                                     case LisName: // 化验开单互斥
-                                        commonRule.exclusionBill(wordCrfDTO.getLisOrder(), ruleBaseDTO, billMsgList, ConEnum.exclusion.getName(), ruleSimpleDTO, set);
+                                        commonRule.exclusionBillOrder(wordCrfDTO.getLisOrder(), ruleBaseDTO, billMsgList, ConEnum.exclusion.getName(), ruleSimpleDTO, set);
+                                        commonRule.exclusionBillLis(wordCrfDTO.getLis(), ruleBaseDTO, billMsgList, ConEnum.exclusion.getName(), ruleSimpleDTO, set);
                                         break;
                                     case LisSubName: // 化验结果
                                         lisRule.bill(wordCrfDTO.getLis(), ruleBaseDTO, billMsgList, ConEnum.lis.getName(), ruleSimpleDTO);
@@ -131,7 +132,8 @@ public class BillProcess {
                                     case PacsSubName: // 辅助检查子项目
                                         if (ruleBaseDTO.getBaseType() != null && ruleBaseDTO.getBaseType().equals(BaseTypeEnum.B5.getKey())) {
                                             // 开单项互斥
-                                            commonRule.exclusionBill(wordCrfDTO.getPacsOrder(), ruleBaseDTO, billMsgList, ConEnum.exclusion.getName(), ruleSimpleDTO, set);
+                                            commonRule.exclusionBillOrder(wordCrfDTO.getPacsOrder(), ruleBaseDTO, billMsgList, ConEnum.exclusion.getName(), ruleSimpleDTO, set);
+                                            commonRule.exclusionBillPacs(wordCrfDTO.getPacs(), ruleBaseDTO, billMsgList, ConEnum.exclusion.getName(), ruleSimpleDTO, set);
                                         } else {
                                             // 辅检项目,暂无数据
                                             pacsRule.bill(wordCrfDTO.getPacs(), ruleBaseDTO, billMsgList, ConEnum.pacs.getName(), ruleSimpleDTO);

+ 86 - 3
src/main/java/com/diagbot/rule/CommonRule.java

@@ -255,7 +255,7 @@ public class CommonRule {
                     && RegexUtil.getRegexRes(result, ruleBaseDTO.getBaseEqValue())) {
                 String dateValue = pacs.getDateValue(); // 结果日期
                 String orderDateValue = ruleSimpleDTO.getDateValue(); // 开单项日期
-                int flag = CoreUtil.compareTime(dateValue, orderDateValue, 60L * 24 * 7, false);
+                int flag = CoreUtil.compareTime(dateValue, orderDateValue, 60L * 24 * 7, false, false);
                 if (flag == 1) {
                     ruleSimpleDTO.setContent(result);
                     ruleSimpleDTO.setConType(conType);
@@ -285,7 +285,7 @@ public class CommonRule {
             if (CoreUtil.getMapFlag(lisMap)) {
                 String dateValue = lis.getDateValue(); // 结果日期
                 String orderDateValue = ruleSimpleDTO.getDateValue(); // 开单项日期
-                int flag = CoreUtil.compareTime(dateValue, orderDateValue, 60L * 24 * 7, false);
+                int flag = CoreUtil.compareTime(dateValue, orderDateValue, 60L * 24 * 7, false, false);
                 if (flag == 1) { // 有效期范围内
                     ruleSimpleDTO.setContent(CoreUtil.getMapMsg(lisMap));
                     ruleSimpleDTO.setConType(conType);
@@ -394,7 +394,7 @@ public class CommonRule {
      * @param ruleSimpleDTO
      * @param set           用于记录:A与B不宜同时进行, B与A不宜同时进行 只能提示一个
      */
-    public <T> void exclusionBill(List<T> orderList, RuleBaseDTO ruleBaseDTO, List<BillMsg> billMsgList, String conType, RuleSimpleDTO ruleSimpleDTO, Set<String> set) {
+    public <T> void exclusionBillOrder(List<T> orderList, RuleBaseDTO ruleBaseDTO, List<BillMsg> billMsgList, String conType, RuleSimpleDTO ruleSimpleDTO, Set<String> set) {
         if (ListUtil.isNotEmpty(orderList) && orderList.size() > 1) {
             // 不同的项目可能对应同一个uniqueName,提示显示多条
             Map<String, List<T>> map = EntityUtil.makeEntityListMap(orderList, "uniqueName");
@@ -421,6 +421,89 @@ public class CommonRule {
         }
     }
 
+    /**
+     * 互斥开单项(结构化化验)
+     *
+     * @param orderList      开单列表
+     * @param ruleBaseDTO
+     * @param billMsgList
+     * @param ruleSimpleDTO
+     * @param set           用于记录:A与B不宜同时进行, B与A不宜同时进行 只能提示一个
+     */
+    public <T> void exclusionBillLis(List<T> orderList, RuleBaseDTO ruleBaseDTO, List<BillMsg> billMsgList, String conType, RuleSimpleDTO ruleSimpleDTO, Set<String> set) {
+        if (ListUtil.isNotEmpty(orderList)) {
+            // 不同的项目可能对应同一个uniqueName,提示显示多条
+            Map<String, List<T>> map = EntityUtil.makeEntityListMap(orderList, "uniqueName");
+            List<T> orginNameList = map.get(ruleBaseDTO.getBaseLibName());
+            if (map.get(ruleBaseDTO.getBaseLibName()) != null) {
+                for (T bean : orginNameList) {
+                    String detailName = ReflectUtil.getProperty(bean, "detailName");
+                    if (StringUtil.isBlank(detailName)) { // 获取开单项信息,detail为空,说明是开单项
+                        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);
+                            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);
+                                // }
+                            }
+                        }
+                    }
+                }
+            }
+        }
+    }
+
+    /**
+     * 互斥开单项(结构化辅检)
+     *
+     * @param orderList      开单列表
+     * @param ruleBaseDTO
+     * @param billMsgList
+     * @param ruleSimpleDTO
+     * @param set           用于记录:A与B不宜同时进行, B与A不宜同时进行 只能提示一个
+     */
+    public <T> void exclusionBillPacs(List<T> orderList, RuleBaseDTO ruleBaseDTO, List<BillMsg> billMsgList, String conType, RuleSimpleDTO ruleSimpleDTO, Set<String> set) {
+        if (ListUtil.isNotEmpty(orderList)) {
+            // 不同的项目可能对应同一个uniqueName,提示显示多条
+            Map<String, List<T>> map = EntityUtil.makeEntityListMap(orderList, "uniqueName");
+            List<T> orginNameList = map.get(ruleBaseDTO.getBaseLibName());
+            if (map.get(ruleBaseDTO.getBaseLibName()) != null) {
+                for (T bean : orginNameList) {
+                    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);
+                        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);
+                            // }
+                        }
+                    }
+                }
+            }
+        }
+    }
+
     /**
      * 获取频次分组
      *

+ 14 - 5
src/main/java/com/diagbot/util/CoreUtil.java

@@ -1203,15 +1203,16 @@ public class CoreUtil {
     }
 
     /**
-     * 时间差值(绝对值)和指定分钟数进行比较
+     * 时间差值(endDateStr - startDateStr)和指定分钟数进行比较
      *
      * @param startDateStr 开始时间
      * @param endDateStr   结束时间
      * @param minute       分钟
      * @param hasEqual     是否包含等于
+     * @param abs          是否加绝对值
      * @return 返回值:-1:无法比较或出错,0:时间差超出范围,1:时间差在范围内
      */
-    public static int compareTime(String startDateStr, String endDateStr, Long minute, boolean hasEqual) {
+    public static int compareTime(String startDateStr, String endDateStr, Long minute, boolean hasEqual, boolean abs) {
         int flag = -1;
         if (StringUtil.isBlank(startDateStr) || StringUtil.isBlank(endDateStr)) {
             return flag;
@@ -1221,15 +1222,23 @@ public class CoreUtil {
             Date endDate = CatalogueUtil.parseStringDate(endDateStr);
             Long timeStart = startDate.getTime();
             Long timeEnd = endDate.getTime();
-
+            Long timeDiff = timeEnd - timeStart;// 时间差
+            // 是否加绝对值
+            if (abs) {
+                timeDiff = Math.abs(timeDiff);// 时间差绝对值
+            } else {
+                if (timeDiff < 0) {
+                    return flag;
+                }
+            }
             if (hasEqual) {
-                if (Math.abs(timeEnd - timeStart) >= minute * 1000 * 60) {
+                if (timeDiff >= minute * 1000 * 60) {
                     flag = 0;
                 } else {
                     flag = 1;
                 }
             } else {
-                if (Math.abs(timeEnd - timeStart) > minute * 1000 * 60) {
+                if (timeDiff > minute * 1000 * 60) {
                     flag = 0;
                 } else {
                     flag = 1;