浏览代码

二期ICSS后台科室维护主页查询

wangyu 6 年之前
父节点
当前提交
0fc937ce13

+ 5 - 2
icssman-service/src/main/java/com/diagbot/dto/ModuleInfoListDTO.java

@@ -14,7 +14,10 @@ import lombok.Setter;
 public class ModuleInfoListDTO extends ModuleInfo {
     //操作人名称
     private String userName;
-    //属名称
+    //属名称
     private String ascriptionName;
-
+    //关联名称
+    private String relationName;
+    //模板类型名称
+    private String moduleTypeName;
 }

+ 50 - 0
icssman-service/src/main/java/com/diagbot/enums/ModuleInfoTypeEnum.java

@@ -0,0 +1,50 @@
+package com.diagbot.enums;
+
+import com.diagbot.core.KeyedNamed;
+import lombok.Setter;
+
+/**
+ * @Description:标签类型
+ * @Author:zhaops
+ * @time: 2018/11/21 11:39
+ */
+public enum ModuleInfoTypeEnum implements KeyedNamed {
+    Common(0, "通用"),
+    ByDept(1, "根据科室划分"),
+    ByDis(2, "慢病"),
+    Nesting(3, "子模板");
+    @Setter
+    private Integer key;
+
+    @Setter
+    private String name;
+
+    ModuleInfoTypeEnum(Integer key, String name) {
+        this.key = key;
+        this.name = name;
+    }
+
+    public static ModuleInfoTypeEnum getEnum(Integer key) {
+        for (ModuleInfoTypeEnum item : ModuleInfoTypeEnum.values()) {
+            if (item.key == key) {
+                return item;
+            }
+        }
+        return null;
+    }
+
+    public static String getName(Integer key) {
+        ModuleInfoTypeEnum item = getEnum(key);
+        return item != null ? item.name : null;
+    }
+
+    @Override
+    public int getKey() {
+        return key;
+    }
+
+    @Override
+    public String getName() {
+        return name;
+    }
+}

+ 45 - 10
icssman-service/src/main/java/com/diagbot/facade/ModuleInfoFacade.java

@@ -10,11 +10,13 @@ import com.diagbot.dto.GetQuestionInfoDTO;
 import com.diagbot.dto.ModuleInfoDTO;
 import com.diagbot.dto.ModuleInfoListDTO;
 import com.diagbot.dto.RespDTO;
+import com.diagbot.entity.DeptInfo;
 import com.diagbot.entity.DictionaryInfo;
 import com.diagbot.entity.ModuleDetail;
 import com.diagbot.entity.ModuleInfo;
 import com.diagbot.entity.QuestionInfo;
 import com.diagbot.enums.IsDeleteEnum;
+import com.diagbot.enums.ModuleInfoTypeEnum;
 import com.diagbot.exception.CommonErrorCode;
 import com.diagbot.exception.CommonException;
 import com.diagbot.service.impl.ModuleInfoServiceImpl;
@@ -57,6 +59,8 @@ public class ModuleInfoFacade extends ModuleInfoServiceImpl {
     UserServiceClient userServiceClient;
     @Autowired
     DictionaryFacade dictionaryFacade;
+    @Autowired
+    DeptInfoFacade deptInfoFacade;
 
     /**
      * 根据id删除标签模板
@@ -201,9 +205,29 @@ public class ModuleInfoFacade extends ModuleInfoServiceImpl {
         //获取模板信息
         IPage<ModuleInfoListDTO> moduleInfoDTOIPage = this.getModuleInfoListByType(getModuleInfoVO);
         List<String> ids = new ArrayList<>();
+        List<Long> deptId = new ArrayList<>();
+        List<Long> disId = new ArrayList<>();
         for (ModuleInfoListDTO moduleInfoListDTO : moduleInfoDTOIPage.getRecords()) {
             ids.add(moduleInfoListDTO.getModifier());
+            if(moduleInfoListDTO.getModuleType().intValue() == 1){
+                deptId.add(moduleInfoListDTO.getRelationId());
+            }
+            if(moduleInfoListDTO.getModuleType().intValue() == 2){
+                disId.add(moduleInfoListDTO.getRelationId());
+            }
         }
+        //获取科室名称
+        QueryWrapper<DeptInfo> deptInfoQueryWrapper = new QueryWrapper<>();
+        deptInfoQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
+                .in("id", deptId);
+        List<DeptInfo> deptInfoList = deptInfoFacade.list(deptInfoQueryWrapper);
+        Map<Long, DeptInfo> deptInfoMap = deptInfoList.stream().collect(Collectors.toMap(DeptInfo::getId,deptInfo -> deptInfo));
+        //获取疾病名称
+        QueryWrapper<QuestionInfo> questionInfoQueryWrapper = new QueryWrapper<>();
+        questionInfoQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
+                .in("id", deptId);
+        List<QuestionInfo> questionInfoList = questionFacade.list(questionInfoQueryWrapper);
+        Map<Long, QuestionInfo> questionInfoMap = questionInfoList.stream().collect(Collectors.toMap(QuestionInfo::getId,questionInfo -> questionInfo));
         //获取模板类型名称
         QueryWrapper<DictionaryInfo> dictionaryInfoQueryWrapper = new QueryWrapper<>();
         dictionaryInfoQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
@@ -212,16 +236,27 @@ public class ModuleInfoFacade extends ModuleInfoServiceImpl {
                 .orderByDesc("order_no");
         List<DictionaryInfo> dictionaryInfoList = dictionaryFacade.list(dictionaryInfoQueryWrapper);
         Map<String, DictionaryInfo> dictionaryInfoMap = dictionaryInfoList.stream().collect(Collectors.toMap(DictionaryInfo::getVal,dictionaryInfo -> dictionaryInfo));
-        //获取用户信息
-        RespDTO<Map<String, String>> respDTO = userServiceClient.getUserInfoByIds(ids);
-        if (respDTO == null || !CommonErrorCode.OK.getCode().equals(respDTO.code)) {
-            throw new CommonException(CommonErrorCode.RPC_ERROR,
-                    "获取用户信息失败");
-        }
-        //将用户信息放入实体
-        for (ModuleInfoListDTO moduleInfoListDTO : moduleInfoDTOIPage.getRecords()) {
-            moduleInfoListDTO.setUserName(respDTO.data.get(moduleInfoListDTO.getModifier()));
-            moduleInfoListDTO.setAscriptionName(dictionaryInfoMap.get(String.valueOf(moduleInfoListDTO.getType().intValue())).getName());
+        if(ListUtil.isNotEmpty(moduleInfoDTOIPage.getRecords())){
+            //获取用户信息
+            RespDTO<Map<String, String>> respDTO = userServiceClient.getUserInfoByIds(ids);
+            if (respDTO == null || !CommonErrorCode.OK.getCode().equals(respDTO.code)) {
+                throw new CommonException(CommonErrorCode.RPC_ERROR,
+                        "获取用户信息失败");
+            }
+            //将用户信息放入实体
+            for (ModuleInfoListDTO moduleInfoListDTO : moduleInfoDTOIPage.getRecords()) {
+                moduleInfoListDTO.setUserName(respDTO.data.get(moduleInfoListDTO.getModifier()));
+                if(moduleInfoListDTO.getModuleType().intValue() != 3){
+                    moduleInfoListDTO.setAscriptionName(dictionaryInfoMap.get(String.valueOf(moduleInfoListDTO.getType().intValue())).getName());
+                }
+                if(moduleInfoListDTO.getModuleType().intValue() == 1){
+                    moduleInfoListDTO.setRelationName(deptInfoMap.get(moduleInfoListDTO.getRelationId()).getName());
+                }
+                if(moduleInfoListDTO.getModuleType().intValue() == 2){
+                    moduleInfoListDTO.setRelationName(questionInfoMap.get(moduleInfoListDTO.getRelationId()).getName());
+                }
+                moduleInfoListDTO.setModuleTypeName(ModuleInfoTypeEnum.getName(moduleInfoListDTO.getModuleType().intValue()));
+            }
         }
         return moduleInfoDTOIPage;
     }

+ 2 - 2
icssman-service/src/main/java/com/diagbot/web/ModuleInfoController.java

@@ -109,8 +109,8 @@ public class ModuleInfoController {
         return RespDTO.onSuc(date);
     }
 
-    @ApiOperation(value = "获取模板列表(主页面查询)[by:wangyu]",
-            notes = "type: 模板类型,1:主诉模板 2:现病史模板 3:现病史空模板 4 : 其他史模板 5:嵌套模板 6:慢病模板<br>" +
+    @ApiOperation(value = "【二期】获取模板列表(主页面查询)[by:wangyu]",
+            notes = "type: 模板类型,1.主诉 2.现病史 3.其他史 4.查体 5.化验 6.辅检 7.诊断 8.医嘱<br>" +
                     "<br>")
     @PostMapping("/getModuleInfoList")
     @SysLogger("getModuleInfoList")