Browse Source

根据id获取详情

wangfeng 4 years atrás
parent
commit
6486db029e

+ 12 - 2
src/main/java/com/diagbot/dto/KlDiagnoseGroupDTO.java

@@ -14,10 +14,20 @@ import java.util.List;
 @Getter
 public class KlDiagnoseGroupDTO {
     /**
-     * 规则组别(condition_type为2:拟诊条件;3:确诊条件;4:警惕条件有效)
+     * 基础规则组别(condition_type为1:基础条件;2:拟诊条件;3:确诊条件;4:警惕条件都有效)
+     */
+    private Integer baseGroup;
+    /**
+     * 满足的条件
+     */
+    private Integer fitNo;
+    /**
+     * 上一级的组别
      */
     private Integer conditionGroup;
-
+    /**
+     * 组别里的明细
+     */
     List<KlDiagnoseByIdDTO>  klDiagnoseByIdDTO;
 
 }

+ 3 - 2
src/main/java/com/diagbot/dto/KlDiagnoseTypeDTO.java

@@ -14,13 +14,14 @@ import java.util.List;
 @Getter
 public class KlDiagnoseTypeDTO {
 
+    /**
+     * 条件类型名
+     */
     private String conditionTypeName;
     /**
      * 条件类型(1:基础条件;2:拟诊条件;3:确诊条件;4:警惕条件)
      */
     private Integer conditionType;
 
-
-
     List<KlDiagnoseGroupDTO> byIdDTO;
 }

+ 21 - 28
src/main/java/com/diagbot/facade/KlDiagnoseFacade.java

@@ -3,8 +3,8 @@ package com.diagbot.facade;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.diagbot.dto.DictionaryInfoDTO;
 import com.diagbot.dto.KlDiagnoseByIdDTO;
+import com.diagbot.dto.KlDiagnoseGroupDTO;
 import com.diagbot.dto.KlDiagnoseInfoDTO;
 import com.diagbot.dto.KlDiagnoseTypeDTO;
 import com.diagbot.entity.KlDiagnose;
@@ -49,44 +49,37 @@ public class KlDiagnoseFacade extends KlDiagnoseServiceImpl {
 
     }
 
-    public List<KlDiagnoseByIdDTO> getByIdDiagnoseAll(KlDiagnoseByIdVO klDiagnoseByIdVO) {
+    public List<KlDiagnoseTypeDTO> getByIdDiagnoseAll(KlDiagnoseByIdVO klDiagnoseByIdVO) {
         List<KlDiagnoseByIdDTO> byIdDiagnoses = this.getByIdDiagnoses(klDiagnoseByIdVO);
         //基础条件
         Map<Integer, List<KlDiagnoseByIdDTO>> baseGroupMap = byIdDiagnoses.stream().filter(i -> i.getConditionType().equals(1)).collect(Collectors.groupingBy(KlDiagnoseByIdDTO::getBaseGroup));
+        //根据ConditionType 和 getConditionGroup两个添加分组
+        Map<Integer, Map<Integer, List<KlDiagnoseByIdDTO>>> collect = byIdDiagnoses.stream().filter(i -> !i.getConditionType().equals(1)).collect(Collectors.groupingBy(KlDiagnoseByIdDTO::getConditionType, Collectors.groupingBy(KlDiagnoseByIdDTO::getConditionGroup)));
 
-
-
-
-
-        List<DictionaryInfoDTO> listByGroupType = klDictionaryInfoFacade.getListByGroupType(30);
-        List<KlDiagnoseTypeDTO> KlDiagnoseTypeList = new ArrayList<>();
-        for (DictionaryInfoDTO data : listByGroupType) {
+        List<KlDiagnoseTypeDTO> klDiagnoseTypeList = new ArrayList<>();
+        for (Map.Entry<Integer, Map<Integer, List<KlDiagnoseByIdDTO>>> entry : collect.entrySet()) {
             KlDiagnoseTypeDTO klDiagnoseTypeDTO = new KlDiagnoseTypeDTO();
-            klDiagnoseTypeDTO.setConditionType(Integer.parseInt(data.getVal()));
-            KlDiagnoseTypeList.add(klDiagnoseTypeDTO);
-        }
-        for (KlDiagnoseByIdDTO byIdDTO : byIdDiagnoses) {
-            for (KlDiagnoseTypeDTO typeDTO : KlDiagnoseTypeList) {
-                if (typeDTO.getConditionType().equals(byIdDTO.getConditionType())) {
-
+            klDiagnoseTypeDTO.setConditionType(entry.getKey());
+            Map<Integer, List<KlDiagnoseByIdDTO>> value = entry.getValue();
+            List<KlDiagnoseGroupDTO> byIdDTO = new ArrayList<>();
+            for (Map.Entry<Integer, List<KlDiagnoseByIdDTO>> entry2 : value.entrySet()) {
+                List<KlDiagnoseByIdDTO> value1 = entry2.getValue();
+                for (KlDiagnoseByIdDTO data : value1) {
+                    KlDiagnoseGroupDTO klDiagnoseGroupDTO = new KlDiagnoseGroupDTO();
+                    klDiagnoseGroupDTO.setConditionGroup(entry2.getKey());
+                    klDiagnoseGroupDTO.setFitNo(data.getFitNo());
+                    klDiagnoseGroupDTO.setBaseGroup(data.getBaseGroup());
+                    klDiagnoseGroupDTO.setKlDiagnoseByIdDTO(baseGroupMap.get(data.getBaseGroup()));
+                    byIdDTO.add(klDiagnoseGroupDTO);
 
                 }
 
+                klDiagnoseTypeDTO.setByIdDTO(byIdDTO);
             }
-        }
-
-        Map<Integer, List<KlDiagnoseByIdDTO>> map = byIdDiagnoses.stream().collect(Collectors.groupingBy(KlDiagnoseByIdDTO::getConditionType));
-
-        for (Map.Entry<Integer, List<KlDiagnoseByIdDTO>> entry : map.entrySet()) {
-            if (entry.getKey().equals(2)) {
-
-            }
-
-
+            klDiagnoseTypeList.add(klDiagnoseTypeDTO);
 
         }
-
-        return byIdDiagnoses;
+        return klDiagnoseTypeList;
     }
 
     public Boolean clearDiagnoseAll(KlDiagnoseClearVO klDiagnoseClearVO) {

+ 2 - 1
src/main/java/com/diagbot/web/KlDiagnoseController.java

@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.diagbot.annotation.SysLogger;
 import com.diagbot.dto.KlDiagnoseByIdDTO;
 import com.diagbot.dto.KlDiagnoseInfoDTO;
+import com.diagbot.dto.KlDiagnoseTypeDTO;
 import com.diagbot.dto.KlRuleByIdParDTO;
 import com.diagbot.dto.KlRuleInfoDTO;
 import com.diagbot.dto.RespDTO;
@@ -53,7 +54,7 @@ public class KlDiagnoseController {
     @ApiOperation(value = "根据规则Id获取规则详情[by:wangfeng]")
     @PostMapping("/getByIdDiagnose")
     @SysLogger("getByIdDiagnose")
-    public RespDTO<List<KlDiagnoseByIdDTO>> getByIdDiagnoseAll(@RequestBody @Valid KlDiagnoseByIdVO klDiagnoseByIdVO) {
+    public RespDTO<List<KlDiagnoseTypeDTO>> getByIdDiagnoseAll(@RequestBody @Valid KlDiagnoseByIdVO klDiagnoseByIdVO) {
         return RespDTO.onSuc(klDiagnoseFacade.getByIdDiagnoseAll(klDiagnoseByIdVO));
     }
 /*