zhaops 4 лет назад
Родитель
Сommit
ea9cfd184b

+ 3 - 10
src/main/java/com/diagbot/aggregate/AssemblePushAggregate.java

@@ -184,19 +184,12 @@ public class AssemblePushAggregate {
             List<String> uniqueNameList = retDrug.stream()
                     .map(i -> i.getName())
                     .collect(Collectors.toList());
-            Map<String, Map<String, Map<String, Long>>> uniqueNameMap
-                    = drugConfigFacade.getUniqueNameConfigMap(hospitalId, null, uniqueNameList);
+            Map<String, Map<String, Long>> uniqueNameMap
+                    = drugConfigFacade.getUniqueNameConfigMapWithoutForm(hospitalId, null, uniqueNameList);
             if (uniqueNameMap != null && uniqueNameMap.size() > 0) {
                 retDrug.forEach(item -> {
                     if (uniqueNameMap.get(item.getName()) != null) {
-                        List<String> hisNameList = Lists.newLinkedList();
-                        for (Map.Entry<String, Map<String, Long>> entry : uniqueNameMap.get(item.getName()).entrySet()) {
-                            if (entry.getValue() != null) {
-                                hisNameList.addAll(new ArrayList<>(entry.getValue().keySet()));
-                            }
-                        }
-                        item.setHisNameList(hisNameList);
-                        //item.setHisNameList(new ArrayList<>(uniqueNameMap.get(item.getName()).keySet()));
+                        item.setHisNameList(new ArrayList<>(uniqueNameMap.get(item.getName()).keySet()));
                     }
                 });
             }

+ 6 - 2
src/main/java/com/diagbot/facade/ConceptInfoFacade.java

@@ -459,8 +459,8 @@ public class ConceptInfoFacade extends ConceptInfoServiceImpl {
                 }
                 break;
             case 2:
-                Map<String, Map<String, Map<String,Long>>> drugConfigMap
-                        = drugConfigFacade.getConfigMap(Long.valueOf(hospitalId),
+                Map<String, Map<String, Long>> drugConfigMap
+                        = drugConfigFacade.getConfigMapWithoutForm(Long.valueOf(hospitalId),
                         ListUtil.arrayToList(new String[] { staticKnowledgeHISVO.getHisName() }), null);
                 if (drugConfigMap != null) {
                     nameList = new ArrayList<>(drugConfigMap.get(staticKnowledgeHISVO.getHisName()).keySet());
@@ -503,6 +503,10 @@ public class ConceptInfoFacade extends ConceptInfoServiceImpl {
                 break;
 
         }
+        nameList = nameList
+                .stream()
+                .distinct()
+                .collect(Collectors.toList());
         return nameList;
     }
 

+ 74 - 0
src/main/java/com/diagbot/facade/DrugConfigFacade.java

@@ -329,6 +329,80 @@ public class DrugConfigFacade {
         return retMap;
     }
 
+    /**
+     * 获取映射关系-公表名
+     *
+     * @param hospitalId
+     * @param hisNames
+     * @param uniqueNames
+     * @return Map<hisName,Map<uniqueName,id>>
+     */
+    public Map<String, Map<String,Long>> getConfigMapWithoutForm(Long hospitalId, List<String> hisNames, List<String> uniqueNames) {
+        Map<String, Map<String, Long>> retMap = new HashMap<>();
+        QueryWrapper<DrugConfig> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
+                .eq("hospital_id", hospitalId);
+        if (ListUtil.isNotEmpty(hisNames)) {
+            queryWrapper.in("his_name", hisNames);
+        }
+        if (ListUtil.isNotEmpty(uniqueNames)) {
+            queryWrapper.in("unique_name", uniqueNames);
+        }
+        List<DrugConfig> records = drugConfigService.list(queryWrapper);
+        if (ListUtil.isEmpty(records)) {
+            return retMap;
+        }
+        Map<String, List<DrugConfig>> hisNameMap
+                = EntityUtil.makeEntityListMap(records, "hisName");
+        for (Map.Entry<String, List<DrugConfig>> entry : hisNameMap.entrySet()) {
+            if (ListUtil.isNotEmpty(entry.getValue())) {
+                retMap.put(entry.getKey(),
+                        EntityUtil.makeMapWithKeyValue(records, "uniqueName", "id"));
+            }
+        }
+        return retMap;
+    }
+
+    /**
+     * 获取映射关系
+     * Map<uniqueName,Map<hisName,id>>
+     *
+     * @param hospitalId
+     * @param hisNames
+     * @param uniqueNames
+     * @return
+     */
+    public Map<String,Map<String,Long>> getUniqueNameConfigMapWithoutForm(Long hospitalId, List<String> hisNames, List<String> uniqueNames) {
+        Map<String, Map<String, Long>> retMap = new HashMap<>();
+        QueryWrapper<DrugConfig> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
+                .eq("hospital_id", hospitalId);
+        if (ListUtil.isNotEmpty(hisNames)) {
+            queryWrapper.in("his_name", hisNames);
+        }
+        if (ListUtil.isNotEmpty(uniqueNames)) {
+            queryWrapper.in("unique_name", uniqueNames);
+        }
+        List<DrugConfig> records = drugConfigService.list(queryWrapper);
+        if (ListUtil.isEmpty(records)) {
+            return retMap;
+        }
+        records.forEach(i -> {
+            if (StringUtil.isBlank(i.getForm())) {
+                i.setForm("");
+            }
+        });
+        Map<String, List<DrugConfig>> uniqueNameMap
+                = EntityUtil.makeEntityListMap(records, "uniqueName");
+        for (Map.Entry<String, List<DrugConfig>> entry : uniqueNameMap.entrySet()) {
+            if (ListUtil.isNotEmpty(entry.getValue())) {
+                retMap.put(entry.getKey(),
+                        EntityUtil.makeMapWithKeyValue(records, "hisName", "id"));
+            }
+        }
+        return retMap;
+    }
+
     /**
      * 数据导出
      *

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

@@ -49,6 +49,11 @@ public class PushFacade {
      * @param pushVO
      */
     public PushDTO push(PushVO pushVO) {
+        if (pushVO.getDiseaseName() != null
+                && StringUtil.isBlank(pushVO.getDiseaseName().getName())
+                && StringUtil.isBlank(pushVO.getDiseaseName().getUniqueName())) {
+            pushVO.setDiseaseName(null);
+        }
         SearchData searchData = new SearchData();
         BeanUtil.copyProperties(pushVO, searchData);
         //TODO 入参映射

+ 6 - 0
src/main/java/com/diagbot/service/impl/MrServiceImpl.java

@@ -3,6 +3,7 @@ package com.diagbot.service.impl;
 import com.diagbot.idc.VisibleIdCreater;
 import com.diagbot.service.MrService;
 import com.diagbot.util.DateUtil;
+import com.diagbot.util.StringUtil;
 import com.diagbot.vo.PushJoinVO;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -53,6 +54,11 @@ public class MrServiceImpl implements MrService {
      */
     @Override
     public String createMr(PushJoinVO pushJoinVO) {
+        if (pushJoinVO.getDiseaseName() != null
+                && StringUtil.isBlank(pushJoinVO.getDiseaseName().getName())
+                && StringUtil.isBlank(pushJoinVO.getDiseaseName().getUniqueName())) {
+            pushJoinVO.setDiseaseName(null);
+        }
         Date now = DateUtil.now();
         final Date expireDate = DateUtil.addMinutes(now, 15);
         pushJoinVO.setCreateTime(now);