zhoutg %!s(int64=4) %!d(string=hai) anos
pai
achega
1f5f5680d5

+ 2 - 2
src/main/java/com/diagbot/aggregate/PushNewAggregate.java

@@ -81,7 +81,7 @@ public class PushNewAggregate {
             log.error("【诊断依据推理出错】", e);
             CoreUtil.getDebugStr("【诊断依据推理出错】", e, pushDTO.getDebug());
         }
-        CoreUtil.getDebugStr(start, "诊断依据推送诊断耗时", pushDTO.getDebug());
+        CoreUtil.getDebugStr(start, "推送诊断耗时_诊断依据", pushDTO.getDebug());
         return pushDTO;
     }
 
@@ -119,7 +119,7 @@ public class PushNewAggregate {
             log.error("【大数据推理出错】", e);
             CoreUtil.getDebugStr("【大数据推理出错】", "大数据推理出错", pushDTO.getDebug());
         }
-        CoreUtil.getDebugStr(start, "大数据推送诊断耗时", pushDTO.getDebug());
+        CoreUtil.getDebugStr(start, "推送诊断耗时_大数据", pushDTO.getDebug());
         return pushDTO;
     }
 }

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

@@ -1,18 +1,20 @@
 package com.diagbot.facade;
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.diagbot.dto.DictionaryInfoDTO;
 import com.diagbot.entity.TranHospitalInfo;
 import com.diagbot.enums.IsDeleteEnum;
 import com.diagbot.enums.RedisEnum;
 import com.diagbot.enums.StandConvertEnum;
 import com.diagbot.util.ListUtil;
 import com.diagbot.util.RedisUtil;
+import com.diagbot.util.StringUtil;
+import org.apache.commons.collections4.map.LinkedMap;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.cache.annotation.CacheEvict;
 import org.springframework.stereotype.Component;
 
 import java.util.List;
+import java.util.Map;
 import java.util.stream.Collectors;
 
 /**
@@ -126,23 +128,30 @@ public class CacheFacade {
     }
 
     /**
-     * 加载大数据推送类型【tran_hospital_info】和推送版本【kl_dictionary_info】
+     * 加载大数据推送类型【push_mode】和推送版本【remark】【tran_hospital_info】
      */
     public void loadHostipalPush() {
-        // 加载大数据推送类型
+        // 删除
         redisUtil.delete(RedisEnum.hospitalPushType.getName());
+        redisUtil.delete(RedisEnum.pushVersion.getName());
+
+        // 加载
         List<TranHospitalInfo> hospitalList = tranHospitalInfoFacade.list(new QueryWrapper<TranHospitalInfo>()
                 .eq("is_deleted", IsDeleteEnum.N.getKey())
         );
-        redisUtil.putHashMap(RedisEnum.hospitalPushType.getName(),
-                hospitalList.stream().collect(Collectors.toMap(k -> String.valueOf(k.getId()), v -> String.valueOf(v.getPushMode()), (v1, v2) -> (v2))));
-
-        // 加载推送版本
-        redisUtil.delete(RedisEnum.pushVersion.getName());
-        List<DictionaryInfoDTO> listByGroupType = klDictionaryInfoFacade.getListByGroupType(100);
-        if (ListUtil.isNotEmpty(listByGroupType)) {
-            redisUtil.putHashMap(RedisEnum.pushVersion.getName(),
-                    listByGroupType.stream().collect(Collectors.toMap(k -> k.getName(), v -> v.getVal(), (v1, v2) -> (v2))));
+        if (ListUtil.isNotEmpty(hospitalList)) {
+            // 推送类型
+            redisUtil.putHashMap(RedisEnum.hospitalPushType.getName(),
+                    hospitalList.stream().collect(Collectors.toMap(k -> String.valueOf(k.getId()), v -> String.valueOf(v.getPushMode()), (v1, v2) -> (v2))));
+
+            // 推送版本
+            Map<String, Object> versionMap = new LinkedMap<>();
+            for (TranHospitalInfo hospitalInfo : hospitalList) {
+                if (StringUtil.isNotBlank(hospitalInfo.getRemark()) || "old".equals(hospitalInfo.getRemark())) {
+                    versionMap.put(RedisEnum.hospitalId_.getName() + hospitalInfo.getId(), "old");
+                }
+            }
+            redisUtil.putHashMap(RedisEnum.pushVersion.getName(), versionMap);
         }
     }
 }

+ 4 - 1
src/main/java/com/diagbot/facade/LisConfigFacade.java

@@ -6,6 +6,7 @@ import com.diagbot.dto.WordCrfDTO;
 import com.diagbot.entity.LisConfig;
 import com.diagbot.enums.IsDeleteEnum;
 import com.diagbot.service.impl.LisConfigServiceImpl;
+import com.diagbot.util.CoreUtil;
 import com.diagbot.util.EntityUtil;
 import com.diagbot.util.ListUtil;
 import com.google.common.collect.Lists;
@@ -125,10 +126,12 @@ public class LisConfigFacade extends LisConfigServiceImpl {
                     .in("his_name", itemList)
                     .apply("(his_detail_name is null or his_detail_name = '')")
             );
-            // 映射套餐名称
+            // 获取映射套餐名称
             List<String> uniqueName = records.stream().map(r -> r.getUniqueName()).collect(Collectors.toList());
             // 追加医院套餐名称
             uniqueName.addAll(itemList);
+            // 去重
+            uniqueName = CoreUtil.removeRepeat(uniqueName);
             return uniqueName;
         }
         return Lists.newArrayList();

+ 0 - 1
src/main/java/com/diagbot/facade/PushFacade.java

@@ -159,7 +159,6 @@ public class PushFacade {
         CoreUtil.getDebugStr(reverseStart, "反推业务耗时", debug);
 
         CoreUtil.getDebugStr(start, "总计耗时", debug);
-        CoreUtil.getDebugObject("数据", debug, wordCrfDTO);
         pushDTO.getDebug().putAll(debug);
         return pushDTO;
     }

+ 24 - 25
src/main/java/com/diagbot/process/PushProcess.java

@@ -381,9 +381,9 @@ public class PushProcess {
      */
     public void process(PushDTO pushDTO, PushVO pushVo, WordCrfDTO wordCrfDTO) {
         // 一般治疗——界面下的第一个诊断
-        if (ListUtil.isNotEmpty(wordCrfDTO.getDiag())) {
+        if (wordCrfDTO.getDiseaseName() != null) {
             TreatDTO treatDTO = new TreatDTO();
-            BeanUtil.copyProperties(wordCrfDTO.getDiag().get(0), treatDTO);
+            BeanUtil.copyProperties(wordCrfDTO.getDiseaseName(), treatDTO);
             pushDTO.getTreat().add(treatDTO);
         }
         // 生成反推的入参
@@ -391,35 +391,34 @@ public class PushProcess {
         Map<String, List<PushBaseDTO>> dis = pushDTO.getDis();
         ReverseVO reverseVO = generateReverseVO(wordCrfDTO, ruleTypeList, dis);
         if (StringUtil.isBlank(reverseVO.getLibName())) {
-            pushDTO.getDebug().put("反推依据诊断", "无"); // 调试信息
+            pushDTO.getDebug().put("反推诊断", "无"); // 调试信息
             return;
         } else {
-            pushDTO.getDebug().put("反推依据诊断", reverseVO.getLibName()); // 调试信息
+            pushDTO.getDebug().put("反推诊断", reverseVO.getLibName()); // 调试信息
         }
         // 查询数据
         List<ReverseDTO> reverseDTOList = conceptInfoFacade.getReverseFac(reverseVO);
         // 获取各个类型的界面过滤元素
-        // TODO 测试数据开始
-        ReverseDTO reverseDTO = new ReverseDTO();
-        reverseDTO.setSonType(101);
-        reverseDTO.setSonName("氨来呫诺");
-        reverseDTOList.add(reverseDTO);
-
-        ReverseDTO reverseDTO1 = new ReverseDTO();
-        reverseDTO1.setSonType(106);
-        reverseDTO1.setSonName("鞍区病损切除术");
-        reverseDTOList.add(reverseDTO1);
-        for (int i = 0; i <reverseDTOList.size(); i++) {
-            if (reverseDTOList.get(i).getSonType().intValue() == 107) {
-                reverseDTOList.remove(i--);
-            }
-        }
-        ReverseDTO reverseDTO2 = new ReverseDTO();
-        reverseDTO2.setSonType(107);
-        reverseDTO2.setSonName("钾测定");
-        reverseDTOList.add(reverseDTO2);
-        // TODO 测试数据结束
-
+        // // TODO 测试数据开始
+        // ReverseDTO reverseDTO = new ReverseDTO();
+        // reverseDTO.setSonType(101);
+        // reverseDTO.setSonName("氨来呫诺");
+        // reverseDTOList.add(reverseDTO);
+        //
+        // ReverseDTO reverseDTO1 = new ReverseDTO();
+        // reverseDTO1.setSonType(106);
+        // reverseDTO1.setSonName("鞍区病损切除术");
+        // reverseDTOList.add(reverseDTO1);
+        // for (int i = 0; i <reverseDTOList.size(); i++) {
+        //     if (reverseDTOList.get(i).getSonType().intValue() == 107) {
+        //         reverseDTOList.remove(i--);
+        //     }
+        // }
+        // ReverseDTO reverseDTO2 = new ReverseDTO();
+        // reverseDTO2.setSonType(107);
+        // reverseDTO2.setSonName("钾测定");
+        // reverseDTOList.add(reverseDTO2);
+        // // TODO 测试数据结束
         Map<String, List<String>> filterMap = getFilterMap(wordCrfDTO);
         // 设置推送信息(过滤已有)
         setPushItem(pushDTO, ruleTypeList, filterMap, reverseDTOList, pushVo.getLength());

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

@@ -947,7 +947,7 @@ public class CoreUtil {
      * @param propertyName
      * @return
      */
-    public  static <T> List<String> getByPropertyName(List<T> tList, String... propertyName) {
+    public static <T> List<String> getByPropertyName(List<T> tList, String... propertyName) {
         List<String> list = Lists.newArrayList();
         if (ListUtil.isEmpty(tList)) {
             return list;
@@ -955,6 +955,7 @@ public class CoreUtil {
         for (T t : tList) {
             for (String key : propertyName) {
                 String name = (String)getFieldValue(t, key);
+                // 去重
                 if (StringUtil.isNotBlank(name) && !list.contains(name)) {
                     list.add(name);
                 }
@@ -963,6 +964,18 @@ public class CoreUtil {
         return list;
     }
 
+    /**
+     * 去除重复元素
+     *
+     * @param list
+     */
+    public static List<String> removeRepeat(List<String> list) {
+        if (ListUtil.isNotEmpty(list) && list.size() > 1) {
+            list = list.stream().distinct().collect(Collectors.toList());
+        }
+        return list;
+    }
+
     public static void main(String[] args) {
         List<Item> list = new ArrayList<>();
         Item item = new Item();

+ 4 - 1
src/main/java/com/diagbot/util/RedisUtil.java

@@ -2,6 +2,7 @@ package com.diagbot.util;
 
 import com.diagbot.enums.RedisEnum;
 import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.collections4.MapUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Qualifier;
 import org.springframework.dao.DataAccessException;
@@ -304,7 +305,9 @@ public class RedisUtil {
      * @param map
      */
     public void putHashMap(String key, Map<String, Object> map) {
-        redisTemplate.opsForHash().putAll(key, map);
+        if (MapUtils.isNotEmpty(map)) {
+            redisTemplate.opsForHash().putAll(key, map);
+        }
     }
 
     /**

+ 2 - 2
src/main/java/com/diagbot/web/CacheController.java

@@ -96,8 +96,8 @@ public class CacheController {
         return RespDTO.onSuc(true);
     }
 
-    @ApiOperation(value = "加载大数据推送类型【tran_hospital_info】和推送版本【kl_dictionary_info】[by:zhoutg]",
-            notes = "")
+    @ApiOperation(value = "加载大数据推送类型【字段:push_mode】和推送版本【字段:remark】[by:zhoutg]",
+            notes = "表:tran_hospital_info,【remark】字段:old表示使用原5.0推理,其他值:新版推理")
     @PostMapping("/loadHostipalPush")
     @SysLogger("loadHostipalPush")
     public RespDTO<Boolean> loadHostipalPush() {