Browse Source

药品分类展示信息补全

SGTY 11 months ago
parent
commit
975a232545

+ 36 - 5
src/main/java/com/diagbot/aggregate/AssemblePushAggregate.java

@@ -15,11 +15,7 @@ import org.apache.commons.collections4.MapUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 import java.util.stream.Collectors;
 
 /**
@@ -42,6 +38,7 @@ public class AssemblePushAggregate {
             @DataConsumer("retDiagMap") Map<String, List<PushBaseDTO>> retDiagMap,
             @DataConsumer("retOperation") List<PushBaseDTO> retOperation,
             @DataConsumer("retDrug") List<PushBaseDTO> retDrug,
+            @DataConsumer("retDrugs") Map<String, List<PushBaseDTO>> retDrugs,
             @DataConsumer("retScale") List<PushScaleDTO> retScale,
             @DataConsumer("retNurse") List<PushBaseDTO> retNurse) {
         //检验
@@ -64,6 +61,10 @@ public class AssemblePushAggregate {
         if (ListUtil.isNotEmpty(retDrug)) {
             data.setMedicines(retDrug);
         }
+        //分类药品
+        if (MapUtils.isNotEmpty(retDrugs)) {
+            data.setMedicine(retDrugs);
+        }
         //量表
         if (ListUtil.isNotEmpty(retScale)) {
             data.setScale(retScale);
@@ -223,6 +224,36 @@ public class AssemblePushAggregate {
         return retDrug;
     }
 
+    @DataProvider("retDrugs")
+    public Map<String, List<PushBaseDTO>> retDrugs(@InvokeParameter("pushDTO") PushDTO data,
+                                     @InvokeParameter("hospitalId") Long hospitalId) {
+        //药品
+        Map<String, List<PushBaseDTO>> retDrugs = new LinkedHashMap<>();
+        if(MapUtils.isNotEmpty(data.getMedicine())) {
+            retDrugs = data.getMedicine();
+            for(Map.Entry<String, List<PushBaseDTO>> entry : retDrugs.entrySet()) {
+                List<String> uniqueNameList = entry.getValue().stream()
+                        .map(i -> i.getName())
+                        .collect(Collectors.toList());
+                Map<String, Map<String, Map<String, List<String>>>> uniqueNameMap
+                        = mappingConfigFacade.groupByUniqueNameWithName(uniqueNameList, ConceptTypeEnum.Drug.getKey(), hospitalId, StatusEnum.Enable.getKey());
+
+                if (uniqueNameMap != null && uniqueNameMap.size() > 0) {
+                    entry.getValue().forEach(item -> {
+                        if (uniqueNameMap.get(item.getName()) != null) {
+                            item.setHisNameList(uniqueNameMap.get(item.getName())
+                                    .values().stream()
+                                    .map(i -> i.keySet())
+                                    .flatMap(Collection::stream)
+                                    .collect(Collectors.toList()));
+                        }
+                    });
+                }
+            }
+        }
+        return retDrugs;
+    }
+
     @DataProvider("retScale")
     public List<PushScaleDTO> retScale(@InvokeParameter("pushDTO") PushDTO data,
                                        @InvokeParameter("hospitalId") Long hospitalId) {

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

@@ -200,6 +200,18 @@ public class PushFacade {
                     }
                 }
             }
+            if (pushDTO.getMedicine() != null) {
+                for (Map.Entry<String, List<PushBaseDTO>> entry : pushDTO.getMedicine().entrySet()) {
+                    if (ListUtil.isNotEmpty(entry.getValue())) {
+                        entry.getValue().forEach(item -> {
+                            item.setType(2);
+                            if (conceptDetailMap.containsKey(item.getName() + "_" + dicStaticTypeValNameMap.get("2"))) {
+                                item.setHasInfo(1);
+                            }
+                        });
+                    }
+                }
+            }
             if (ListUtil.isNotEmpty(pushDTO.getLis())) {
                 pushDTO.getLis().forEach(item -> {
                     item.setType(3);