소스 검색

Merge branch 'develop' into dev/mapping20210603

# Conflicts:
#	src/main/java/com/diagbot/facade/CommonFacade.java
gaodm 3 년 전
부모
커밋
2daf1745d0

+ 4 - 0
doc/011.20210715开单合理性重复开立/med_2021_init.sql

@@ -0,0 +1,4 @@
+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 ('161', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '40', '单次', '^(24小时维持|一次|1次|空)$|ALWAYS|BID|ONCE|每日', '1', '0', '开单频次');
+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 ('162', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '40', '持续', '每周|每月|每年|每半年|(一|二|三)月一次|qw|biw', '1', '0', '开单频次');

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

@@ -48,6 +48,9 @@ public class CacheDeleteInit implements CommandLineRunner {
         cacheFacade.loadDeptPush();
         log.info("CDSS-CORE服务启动加载科室和推送映射成功!");
 
+        cacheFacade.loadFrequency();
+        log.info("CDSS-CORE服务启动加载开单频次成功!");
+
         conceptInfoFacade.loadCustomDictionary();
         log.info("CDSS-CORE服务启动加载NLP分词字典成功!");
 

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

@@ -25,7 +25,8 @@ public enum RedisEnum implements KeyedNamed {
     allBaseRegulation(12, "allBaseRegulation"),
     pushModel(13, "pushModel"),
     hospitalId_(14, "hospitalId_"),
-    deptPush(15, "deptPush");
+    deptPush(15, "deptPush"),
+    frequency(20, "frequency");
 
     @Setter
     private int key;

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

@@ -2,6 +2,7 @@ package com.diagbot.facade;
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.diagbot.client.PushNewServiceClient;
+import com.diagbot.dto.DictionaryInfoDTO;
 import com.diagbot.dto.PushReloadDTO;
 import com.diagbot.entity.SysDeptPush;
 import com.diagbot.entity.TranHospitalInfo;
@@ -199,4 +200,15 @@ public class CacheFacade {
                     deptPushList.stream().collect(Collectors.toMap(k -> k.getDeptName(), v -> v.getPush(), (v1, v2) -> (v2))));
         }
     }
+
+    /**
+     * 加载开单频次
+     */
+    public void loadFrequency() {
+        // 删除
+        redisUtil.delete(RedisEnum.frequency.getName());
+        // 加载
+        List<DictionaryInfoDTO> dictionaryInfoDTOList = klDictionaryInfoFacade.getListByGroupType(40);
+        redisUtil.set(RedisEnum.frequency.getName(), dictionaryInfoDTOList);
+    }
 }

+ 2 - 2
src/main/java/com/diagbot/facade/CommonFacade.java

@@ -777,13 +777,13 @@ public class CommonFacade {
                 return retList;
             }
             for (T item : list) {
-                String name = item.getClass().getMethod("getName").invoke(item).toString();
+                String name = ReflectUtil.getProperty(item, "name");
                 if (StringUtil.isBlank(name)) {
                     retList.add(item);
                     continue;
                 }
                 if (fieldName.equals("uniqueName")) {
-                    String uniqueName = item.getClass().getMethod("getUniqueName").invoke(item).toString();
+                    String uniqueName = ReflectUtil.getProperty(item, "uniqueName");
                     if (StringUtil.isNotBlank(uniqueName)) {
                         retList.add(item);
                         continue;

+ 46 - 31
src/main/java/com/diagbot/rule/CommonRule.java

@@ -3,14 +3,17 @@ package com.diagbot.rule;
 import com.diagbot.biz.push.entity.Pacs;
 import com.diagbot.dto.BaseDiagnoseDTO;
 import com.diagbot.dto.BillMsg;
+import com.diagbot.dto.DictionaryInfoDTO;
 import com.diagbot.dto.RuleBaseDTO;
 import com.diagbot.dto.RuleSimpleDTO;
 import com.diagbot.dto.WordCrfDTO;
 import com.diagbot.enums.BaseDiagnoseTypeEnum;
 import com.diagbot.enums.ConEnum;
 import com.diagbot.enums.LexiconEnum;
+import com.diagbot.enums.RedisEnum;
 import com.diagbot.enums.TypeEnum;
 import com.diagbot.facade.CommonFacade;
+import com.diagbot.facade.KlDictionaryInfoFacade;
 import com.diagbot.model.entity.Clinical;
 import com.diagbot.model.entity.Negative;
 import com.diagbot.util.BeanUtil;
@@ -19,6 +22,8 @@ import com.diagbot.util.CoreUtil;
 import com.diagbot.util.EntityUtil;
 import com.diagbot.util.ListUtil;
 import com.diagbot.util.MsgUtil;
+import com.diagbot.util.RedisUtil;
+import com.diagbot.util.ReflectUtil;
 import com.diagbot.util.RegexUtil;
 import com.diagbot.util.StringUtil;
 import org.apache.commons.lang3.StringUtils;
@@ -53,6 +58,10 @@ public class CommonRule {
     AgeRule ageRule;
     @Autowired
     LisRule lisRule;
+    @Autowired
+    KlDictionaryInfoFacade klDictionaryInfoFacade;
+    @Autowired
+    RedisUtil redisUtil;
 
     /**
      * 比较阳性属性是否匹配
@@ -346,6 +355,25 @@ public class CommonRule {
         }
     }
 
+    /**
+     * 获取频次分组
+     *
+     * @param frequency
+     * @return
+     */
+    public String getFrquenceType(String frequency) {
+        if (StringUtil.isEmpty(frequency)) {
+            frequency = "空";
+        }
+        List<DictionaryInfoDTO> listByGroupType = redisUtil.get(RedisEnum.frequency.getName());
+        for (DictionaryInfoDTO dic : listByGroupType) {
+            if (RegexUtil.getRegexRes(frequency, dic.getVal())) {
+                return dic.getName();
+            }
+        }
+        return "单次";
+    }
+
     /**
      * 24小时重复开单入口
      *
@@ -359,49 +387,31 @@ public class CommonRule {
         if (ListUtil.isEmpty(itemList)) {
             return;
         }
-        // Map<String, List<T>> map = EntityUtil.makeEntityListMap(itemList, "name");
         Map<String, List<T>> map = CoreUtil.makeEntityListMap(itemList, "name", "uniqueName");
         for (String key : map.keySet()) {
             List<T> items = map.get(key);
 
-            // 个数大于2个才比较
             if (ListUtil.isNotEmpty(items) && items.size() > 1) {
-                // items 按照时间排序
-                Collections.sort(items, new Comparator<T>() {
-                    @Override
-                    public int compare(T o1, T o2) {
-                        String o1Str = (String) CoreUtil.getFieldValue(o1, "dateValue");
-                        String o2Str = (String) CoreUtil.getFieldValue(o2, "dateValue");
-                        if (StringUtil.isBlank(o1Str) || StringUtil.isBlank(o2Str)) {
-                            return -1;
-                        } else {
-                            return o1Str.compareTo(o2Str);
-                        }
-                    }
-                });
-
-                // 比较时间是否在24小时内
-                List<Date> dateList = new ArrayList<>();
-                for (T it : items) {
-                    String dateValue = (String) CoreUtil.getFieldValue(it, "dateValue");
-                    if (StringUtil.isNotBlank(dateValue)) {
-                        Date cur = CatalogueUtil.parseStringDate(dateValue);
-                        // 如果为null,说明日期格式出错,不比较
-                        if (cur != null) {
-                            if (ListUtil.isNotEmpty(dateList)) {
-                                Date last = dateList.get(dateList.size() - 1);
-                                if (!CatalogueUtil.compareTime(last, cur, 60L * 24)) {
+                for (int i = 0; i < items.size() - 1; i++) {
+                    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 < itemList.size(); j++) {
+                            T itNext = items.get(j);
+                            String nextDateValue = ReflectUtil.getProperty(itNext, "dateValue");
+                            if (StringUtil.isNotBlank(nextDateValue)) {
+                                Date netDate = CatalogueUtil.parseStringDate(nextDateValue);
+                                if (!CatalogueUtil.compareTime(netDate, curDate, 60L * 24, true)
+                                        && getFrquenceType(ReflectUtil.getProperty(it, "frequency"))
+                                        .equals(getFrquenceType(ReflectUtil.getProperty(itNext, "frequency")))) {
                                     String name = (String) CoreUtil.getFieldValue(it, "name");
                                     String uniqueName = (String) CoreUtil.getFieldValue(it, "uniqueName");
                                     BillMsg commonBillMsg = MsgUtil.getCommonBillMsg(
                                             name, uniqueName, name, ConEnum.repeat24.getName(), type);
                                     billMsgList.add(commonBillMsg);
                                     break;
-                                } else {
-                                    dateList.add(cur);
                                 }
-                            } else {
-                                dateList.add(cur);
                             }
                         }
                     }
@@ -498,4 +508,9 @@ public class CommonRule {
         Collections.sort(baseIdList); // id排序,方便调试查看
         return baseIdList;
     }
+
+    public static void main(String[] args) {
+        CommonRule commonRule = new CommonRule();
+        System.out.println(commonRule.getFrquenceType(null));
+    }
 }

+ 16 - 10
src/main/java/com/diagbot/web/CacheController.java

@@ -41,15 +41,12 @@ public class CacheController {
         cacheFacade.loadDrugTypeCache();
         cacheFacade.getDiseaseCorrespondCache();
         cacheFacade.getdiseaseFilterCache();
-        cacheFacade.loadAllRuleCache();
-        cacheFacade.loadAllBaseDiagnoseCache();
-        //无用的缓存
-//        cacheFacade.loadDiseaseTypeCache();
-//        cacheFacade.getSymptomCache();
-//        cacheFacade.getSymptomMainCache();
-//        cacheFacade.getVitalCache();
-//        cacheFacade.getSymptomNumCache();
-//        cacheFacade.getSymptomFeatureCache();
+        cacheFacade.loadPushModel(); // 重新加载推送类型
+        cacheFacade.loadDeptPush(); // 重新加载标准科室和推送类型的映射关系
+        cacheFacade.loadFrequency(); // 重新加载频次
+        conceptInfoFacade.loadCustomDictionary(); // 重新加载NLP分词字典
+        cacheFacade.loadAllBaseDiagnoseCache(); // 重新加载诊断依据
+        cacheFacade.loadAllRuleCache(); // 重新加载开单规则
         return RespDTO.onSuc(true);
     }
 
@@ -149,7 +146,7 @@ public class CacheController {
         return RespDTO.onSuc(true);
     }
 
-    @ApiOperation(value = "重新加载NLP分词字典[by:gaodm]",
+    @ApiOperation(value = "重新加载NLP分词字典[by:zhoutg]",
             notes = "")
     @PostMapping("/reloadCustomDictionary")
     @SysLogger("reloadCustomDictionary")
@@ -157,4 +154,13 @@ public class CacheController {
         conceptInfoFacade.loadCustomDictionary();
         return RespDTO.onSuc(true);
     }
+
+    @ApiOperation(value = "重新加载开单频次[by:zhoutg]",
+            notes = "")
+    @PostMapping("/reloadFrequency")
+    @SysLogger("reloadFrequency")
+    public RespDTO<Boolean> reloadFrequency() {
+        cacheFacade.loadFrequency();
+        return RespDTO.onSuc(true);
+    }
 }

+ 28 - 0
src/main/java/com/diagbot/web/UtilController.java

@@ -0,0 +1,28 @@
+package com.diagbot.web;
+
+import com.diagbot.dto.RespDTO;
+import com.diagbot.util.RegexUtil;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * @Description: 工具类测试API
+ * @author: zhoutg
+ * @time: 2018/8/30 10:12
+ */
+@RestController
+@RequestMapping("/util")
+@Api(value = "工具类测试API", tags = { "工具类测试API" })
+@SuppressWarnings("unchecked")
+public class UtilController {
+
+    @ApiOperation(value = "正则匹配[zhoutg]", notes = "content:文本内容,regex:正则表达式")
+    @PostMapping("/getMatch")
+    public RespDTO<Boolean> getMatch(String content, String regex) {
+        return RespDTO.onSuc(RegexUtil.getRegexRes(content, regex));
+    }
+
+}

+ 2 - 2
src/main/resources/application-dev.yml

@@ -181,8 +181,8 @@ StandConvertNew:
 IcssPush:
   url: http://192.168.2.234:5008
 
-# 新版推送
+# 新版推送:9212【本地,236】,9211【241】,9210【121,122】
 PushNew:
-  url: http://192.168.2.234:9210
+  url: http://192.168.2.234:9212
 
 debugFlag: true

+ 2 - 2
src/main/resources/application-local.yml

@@ -181,8 +181,8 @@ StandConvertNew:
 IcssPush:
   url: http://192.168.2.234:5008
 
-# 新版推送
+# 新版推送:9212【本地,236】,9211【241】,9210【121,122】
 PushNew:
-  url: http://192.168.2.234:9210
+  url: http://192.168.2.234:9212
 
 debugFlag: true

+ 1 - 1
src/main/resources/application-pre.yml

@@ -181,7 +181,7 @@ StandConvertNew:
 IcssPush:
   url: http://192.168.2.186:5008
 
-# 新版推送
+# 新版推送:9212【本地,236】,9211【241】,9210【121,122】
 PushNew:
   url: http://192.168.2.234:9210
 

+ 1 - 1
src/main/resources/application-pro.yml

@@ -181,7 +181,7 @@ StandConvertNew:
 IcssPush:
   url: http://192.168.2.122:5008
 
-# 新版推送
+# 新版推送:9212【本地,236】,9211【241】,9210【121,122】
 PushNew:
   url: http://192.168.2.234:9210
 

+ 1 - 1
src/main/resources/application-test.yml

@@ -181,7 +181,7 @@ StandConvertNew:
 IcssPush:
   url: http://192.168.2.241:5008
 
-# 新版推送:9210是241环境,9211其他环境
+# 新版推送:9212【本地,236】,9211【241】,9210【121,122】
 PushNew:
   url: http://192.168.2.234:9211