Ver código fonte

重复开立时间间隔改到数据库配置

zhoutg 3 anos atrás
pai
commit
25d80402c9

+ 3 - 0
doc/022.20211210开单时间间隔配置/med2021_init.sql

@@ -0,0 +1,3 @@
+USE `med_2021`;
+
+INSERT INTO `med_2021`.`kl_dictionary_info` (`id`, `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `group_type`, `name`, `val`, `return_type`, `order_no`, `remark`) VALUES ('370', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '8', '重复开立时间间隔', '12', '1', '0', '重复开立时间间隔(24小时)');

+ 3 - 0
src/main/java/com/diagbot/config/CacheDeleteInit.java

@@ -54,6 +54,9 @@ public class CacheDeleteInit implements CommandLineRunner {
         cacheFacade.loadMsg();
         log.info("CDSS-CORE服务启动加载开单提示语成功!");
 
+        cacheFacade.loadDateInterval();
+        log.info("CDSS-CORE加载开单时间间隔成功!");
+
         cacheFacade.loadVteAdviceCache();
         log.info("CDSS-CORE服务启动加载vte医嘱数据成功!");
 

+ 2 - 1
src/main/java/com/diagbot/enums/RedisEnum.java

@@ -31,7 +31,8 @@ public enum RedisEnum implements KeyedNamed {
     vteAdvice(22, "vteAdvice:"),
     drugAllergen(23, "drugAllergen"),
     otherMsg(24, "otherMsg"),
-    criticalMsg(25, "criticalMsg");
+    criticalMsg(25, "criticalMsg"),
+    dateInterval(26, "dateInterval");
 
 
     @Setter

+ 15 - 0
src/main/java/com/diagbot/facade/CacheFacade.java

@@ -231,6 +231,21 @@ public class CacheFacade {
         redisUtil.set(RedisEnum.frequency.getName(), dictionaryInfoDTOList);
     }
 
+    /**
+     * 加载时间间隔
+     */
+    public void loadDateInterval() {
+        // 删除
+        redisUtil.delete(RedisEnum.dateInterval.getName());
+        // 加载
+        List<DictionaryInfoDTO> dictionaryInfoDTOList = klDictionaryInfoFacade.getListByGroupType(8);
+        if (ListUtil.isNotEmpty(dictionaryInfoDTOList)) {
+            // 加载时间间隔
+            redisUtil.putHashMap(RedisEnum.dateInterval.getName(),
+                    dictionaryInfoDTOList.stream().collect(Collectors.toMap(k -> k.getName(), v -> Integer.parseInt(v.getVal()), (v1, v2) -> (v2))));
+        }
+    }
+
     /**
      * 加载提示语
      */

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

@@ -111,7 +111,7 @@ public class BillProcess {
                 }
             }
         }
-        // 24小时重复开单项
-        commonRule.repeat24Bill(wordCrfDTO, billMsgList);
+        // xx小时重复开单项
+        commonRule.repeatBill(wordCrfDTO, billMsgList);
     }
 }

+ 17 - 15
src/main/java/com/diagbot/rule/CommonRule.java

@@ -68,9 +68,6 @@ public class CommonRule {
     @Autowired
     MsgNewUtil msgNewUtil;
 
-    // 重复开立的时间间隔( xxL表示xx小时)
-    public static final Long REPEAT_DATA = 12L * 60;
-
     /**
      * 比较阳性属性是否匹配
      *
@@ -352,22 +349,25 @@ public class CommonRule {
     }
 
     /**
-     * 24小时重复开单总入口
+     * xx小时重复开单总入口
      *
      * @param wordCrfDTO
      * @param billMsgList
      */
-    public void repeat24Bill(WordCrfDTO wordCrfDTO, List<BillMsg> billMsgList) {
+    public void repeatBill(WordCrfDTO wordCrfDTO, List<BillMsg> billMsgList) {
+        Integer repeat = redisUtil.getByKeyAndField(RedisEnum.dateInterval.getName(), "重复开立时间间隔");
+        // 转换为分钟
+        Long repeatDate = 60L * repeat;
         // 当前开单项与当前开单项重复开立
-        repeat24BillWithOrder(billMsgList, wordCrfDTO.getLisOrder(), TypeEnum.lis.getName(), ConEnum.repeat24.getName()); // 化验重复开单
-        repeat24BillWithOrder(billMsgList, wordCrfDTO.getPacsOrder(), TypeEnum.pacs.getName(), ConEnum.repeat24.getName()); // 辅检重复开单
+        repeatBillWithOrder(billMsgList, wordCrfDTO.getLisOrder(), TypeEnum.lis.getName(), ConEnum.repeat24.getName(), repeatDate); // 化验重复开单
+        repeatBillWithOrder(billMsgList, wordCrfDTO.getPacsOrder(), TypeEnum.pacs.getName(), ConEnum.repeat24.getName(), repeatDate); // 辅检重复开单
         // repeat24BillWithType(billMsgList, wordCrfDTO.getDrugOrder(), TypeEnum.drug.getName(), ConEnum.repeat24.getName()); // 药品重复开单
         // repeat24BillWithType(billMsgList, wordCrfDTO.getOperationOrder(), TypeEnum.operation.getName(), ConEnum.repeat24.getName()); // 手术重复开单
         // repeat24BillWithType(billMsgList, wordCrfDTO.getTransfusionOrder(), TypeEnum.transfusion.getName(), ConEnum.repeat24.getName()); // 输血重复开单
 
         // 当前开单项和结构化开单项重复开立
-        repeat24BillWithStruct(billMsgList, wordCrfDTO.getLisOrder(), wordCrfDTO.getLis(), TypeEnum.lis.getName(), ConEnum.repeat24.getName()); // 化验重复开单
-        repeat24BillWithStruct(billMsgList, wordCrfDTO.getPacsOrder(), wordCrfDTO.getPacs(), TypeEnum.pacs.getName(), ConEnum.repeat24.getName()); // 辅检重复开单
+        repeatBillWithStruct(billMsgList, wordCrfDTO.getLisOrder(), wordCrfDTO.getLis(), TypeEnum.lis.getName(), ConEnum.repeat24.getName(), repeatDate); // 化验重复开单
+        repeatBillWithStruct(billMsgList, wordCrfDTO.getPacsOrder(), wordCrfDTO.getPacs(), TypeEnum.pacs.getName(), ConEnum.repeat24.getName(), repeatDate); // 辅检重复开单
     }
 
     /**
@@ -496,15 +496,16 @@ public class CommonRule {
     }
 
     /**
-     * 24小时重复开单入口——与开单项比较
+     * xx小时重复开单入口——与开单项比较
      *
      * @param billMsgList
      * @param itemList
      * @param type
      * @param conType     禁忌条件
+     * @param repeatDate
      * @param <T>
      */
-    public <T> void repeat24BillWithOrder(List<BillMsg> billMsgList, List<T> itemList, String type, String conType) {
+    public <T> void repeatBillWithOrder(List<BillMsg> billMsgList, List<T> itemList, String type, String conType, Long repeatDate) {
         if (ListUtil.isEmpty(itemList)) {
             return;
         }
@@ -522,7 +523,7 @@ public class CommonRule {
                             T itNext = items.get(j);
                             String nextDateValue = ReflectUtil.getProperty(itNext, "dateValue");
                             if (StringUtil.isNotBlank(nextDateValue)) {
-                                int dateFlag = CoreUtil.compareTime(curDateValue, nextDateValue, REPEAT_DATA, false, true);
+                                int dateFlag = CoreUtil.compareTime(curDateValue, nextDateValue, repeatDate, false, true);
                                 if (dateFlag == 1
                                         && getFrquenceType(ReflectUtil.getProperty(it, "frequency"))
                                         .equals(getFrquenceType(ReflectUtil.getProperty(itNext, "frequency")))) {
@@ -541,16 +542,17 @@ public class CommonRule {
     }
 
     /**
-     * 24小时重复开单——与结构化比较
+     * xx小时重复开单——与结构化比较
      *
      * @param billMsgList
      * @param orderList
      * @param itemList
      * @param type
      * @param conType
+     * @param repeatDate
      * @param <T>
      */
-    public <T> void repeat24BillWithStruct(List<BillMsg> billMsgList, List<T> orderList, List<T> itemList, String type, String conType) {
+    public <T> void repeatBillWithStruct(List<BillMsg> billMsgList, List<T> orderList, List<T> itemList, String type, String conType, Long repeatDate) {
         if (ListUtil.isEmpty(itemList) || ListUtil.isEmpty(orderList)) {
             return;
         }
@@ -574,7 +576,7 @@ public class CommonRule {
                     if (StringUtil.isBlank(finishDateValue)) {
                         String curDateValue = ReflectUtil.getProperty(order, "dateValue"); // 当前开单时间
                         String pastDateValue = ReflectUtil.getProperty(it, "dateValue"); // 历史开单时间
-                        int dateFlag = CoreUtil.compareTime(pastDateValue, curDateValue, REPEAT_DATA, false, false);
+                        int dateFlag = CoreUtil.compareTime(pastDateValue, curDateValue, repeatDate, false, false);
                         // 规定时间内,并且频次相同
                         if (dateFlag == 1 &&
                                 getFrquenceType(ReflectUtil.getProperty(it, "frequency"))

+ 1 - 0
src/main/java/com/diagbot/web/CacheController.java

@@ -47,6 +47,7 @@ public class CacheController {
         conceptInfoFacade.loadCustomDictionary(); // 重新加载NLP分词字典
         cacheFacade.loadMsg(); // 加载开单提示语
         cacheFacade.loadVteAdviceCache(); // 重新加载vte医嘱数据
+        cacheFacade.loadDateInterval(); // 重新加载开单时间间隔成功
         cacheFacade.loadAllBaseDiagnoseCache(); // 重新加载诊断依据
         cacheFacade.loadAllRuleCache(); // 重新加载开单规则
         return RespDTO.onSuc(true);