Jelajahi Sumber

icss-service获取模板维护

wangyu 6 tahun lalu
induk
melakukan
4367685ed0

+ 1 - 5
icssman-service/src/main/java/com/diagbot/dto/DeptDTO.java

@@ -10,10 +10,6 @@ import lombok.Setter;
  */
 @Setter
 @Getter
-public class DeptDTO {
+public class DeptDTO extends ConceptBaseDTO {
 
-    //id
-    private Long id;
-    //名称
-    private String name;
 }

+ 1 - 5
icssman-service/src/main/java/com/diagbot/dto/DisDTO.java

@@ -10,10 +10,6 @@ import lombok.Setter;
  */
 @Setter
 @Getter
-public class DisDTO {
-    //id
-    private Long id;
-    //名称
-    private String name;
+public class DisDTO extends ConceptBaseDTO{
 
 }

+ 44 - 40
icssman-service/src/main/java/com/diagbot/facade/ModuleInfoFacade.java

@@ -3,7 +3,9 @@ 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.client.KnowledgemanServiceClient;
 import com.diagbot.client.UserServiceClient;
+import com.diagbot.dto.ConceptBaseDTO;
 import com.diagbot.dto.DeptDTO;
 import com.diagbot.dto.DisDTO;
 import com.diagbot.dto.GetAllDeptAndDisInfoDTO;
@@ -15,9 +17,7 @@ import com.diagbot.dto.GetQuestiongAndModuleRelationsDTO;
 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.DisType;
 import com.diagbot.entity.ModuleDetail;
 import com.diagbot.entity.ModuleInfo;
 import com.diagbot.entity.QuestionInfo;
@@ -30,9 +30,11 @@ import com.diagbot.service.impl.ModuleInfoServiceImpl;
 import com.diagbot.util.BeanUtil;
 import com.diagbot.util.DateUtil;
 import com.diagbot.util.ListUtil;
+import com.diagbot.util.RespDTOUtil;
 import com.diagbot.util.StringUtil;
 import com.diagbot.util.UserUtils;
 import com.diagbot.vo.AddModuleInfoVO;
+import com.diagbot.vo.ConceptTypeVO;
 import com.diagbot.vo.GetAllDeptAndDisInfoVO;
 import com.diagbot.vo.GetModuleDetailInfoVO;
 import com.diagbot.vo.GetModuleInfoOneVO;
@@ -48,6 +50,7 @@ import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Date;
 import java.util.HashMap;
+import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.stream.Collectors;
@@ -69,7 +72,8 @@ public class ModuleInfoFacade extends ModuleInfoServiceImpl {
     UserServiceClient userServiceClient;
     @Autowired
     DictionaryFacade dictionaryFacade;
-
+    @Autowired
+    KnowledgemanServiceClient knowledgemanServiceClient;
     /**
      * 根据id删除标签模板
      *
@@ -252,11 +256,11 @@ public class ModuleInfoFacade extends ModuleInfoServiceImpl {
             }
         }
         //获取科室名称
-        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));
+        ConceptTypeVO conceptTypeVO = new ConceptTypeVO();
+        conceptTypeVO.setType(1);
+        RespDTO<List<ConceptBaseDTO>> deptInfoList = knowledgemanServiceClient.getConceptListByType(conceptTypeVO);
+        RespDTOUtil.respNGDeal(deptInfoList,"获取科室信息失败");
+        Map<Long, ConceptBaseDTO> deptInfoMap = deptInfoList.data.stream().collect(Collectors.toMap(ConceptBaseDTO::getConceptId,conceptBaseDTO -> conceptBaseDTO));
         //获取疾病名称
         QueryWrapper<QuestionInfo> questionInfoQueryWrapper = new QueryWrapper<>();
         questionInfoQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
@@ -372,11 +376,11 @@ public class ModuleInfoFacade extends ModuleInfoServiceImpl {
             disId.add(moduleInfo.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));
+        ConceptTypeVO conceptTypeVO = new ConceptTypeVO();
+        conceptTypeVO.setType(1);
+        RespDTO<List<ConceptBaseDTO>> deptInfoList = knowledgemanServiceClient.getConceptListByType(conceptTypeVO);
+        RespDTOUtil.respNGDeal(deptInfoList,"获取科室信息失败");
+        Map<Long, ConceptBaseDTO> deptInfoMap = deptInfoList.data.stream().collect(Collectors.toMap(ConceptBaseDTO::getConceptId,conceptBaseDTO -> conceptBaseDTO));
         //获取疾病名称
         QueryWrapper<QuestionInfo> questionInfoQueryWrapper = new QueryWrapper<>();
         questionInfoQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
@@ -452,43 +456,43 @@ public class ModuleInfoFacade extends ModuleInfoServiceImpl {
      */
     public GetAllDeptAndDisInfoDTO getAllDeptAndDisInfo(GetAllDeptAndDisInfoVO getAllDeptAndDisInfoVO){
         //获取所有科室
-        QueryWrapper<DeptInfo> deptInfoQueryWrapper = new QueryWrapper<>();
-        deptInfoQueryWrapper.eq("is_deleted",IsDeleteEnum.N.getKey());
+        ConceptTypeVO deptType = new ConceptTypeVO();
+        deptType.setType(1);
+        RespDTO<List<ConceptBaseDTO>> deptInfoList = knowledgemanServiceClient.getConceptListByType(deptType);
+        RespDTOUtil.respNGDeal(deptInfoList,"获取科室信息失败");
         if(getAllDeptAndDisInfoVO.getModuleType() != null && getAllDeptAndDisInfoVO.getModuleType().intValue() == 1){//过滤添加过得科室
             List<ModuleInfo> moduleInfoList = getModuleInfos(getAllDeptAndDisInfoVO.getModuleType(),getAllDeptAndDisInfoVO.getType());
             List<Long> deptIds = moduleInfoList.stream().map(ModuleInfo::getRelationId).collect(Collectors.toList());
-            deptInfoQueryWrapper.notIn("id",deptIds);
+            Iterator<ConceptBaseDTO> deptIterator = deptInfoList.data.iterator();
+            for (Long deptId : deptIds) {
+                while (deptIterator.hasNext()){
+                    Long deptConceptId = deptIterator.next().getConceptId();
+                    if(deptId.intValue() == deptConceptId.intValue()){
+                        deptIterator.remove();
+                    }
+                }
+            }
         }
-        List<DeptInfo> deptInfoList = deptInfoFacade.list(deptInfoQueryWrapper);
-        List<DeptDTO> deptDTOS = BeanUtil.listCopyTo(deptInfoList,DeptDTO.class);
+        List<DeptDTO> deptDTOS = BeanUtil.listCopyTo(deptInfoList.data,DeptDTO.class);
         //获取所有疾病
-        QueryWrapper<DisType> disTypeQueryWrapper = new QueryWrapper<>();
-        disTypeQueryWrapper.eq("is_deleted",IsDeleteEnum.N.getKey())
-                .eq("type",1);
+        ConceptTypeVO disType = new ConceptTypeVO();
+        disType.setType(3);
+        RespDTO<List<ConceptBaseDTO>> disTypes = knowledgemanServiceClient.getConceptListByType(disType);
+        RespDTOUtil.respNGDeal(disTypes,"获取疾病信息失败");
         if(getAllDeptAndDisInfoVO.getModuleType() != null && getAllDeptAndDisInfoVO.getModuleType().intValue() == 2){//过滤添加过得疾病
             List<ModuleInfo> moduleInfoList = getModuleInfos(getAllDeptAndDisInfoVO.getModuleType(),getAllDeptAndDisInfoVO.getType());
             List<Long> disIds = moduleInfoList.stream().map(ModuleInfo::getRelationId).collect(Collectors.toList());
-            disTypeQueryWrapper.notIn("dis_id",disIds);
-        }
-        List<DisType> disTypes = disTypeFacade.list(disTypeQueryWrapper);
-        List<DisDTO> disDTOS = new ArrayList<>();
-        for (DisType disType: disTypes) {
-            DisDTO disDTO = new DisDTO();
-            disDTO.setId(disType.getDisId());
-            disDTOS.add(disDTO);
-        }
-        List<Long> questionIds = disTypes.stream().map(DisType::getDisId).collect(Collectors.toList());
-        QueryWrapper<QuestionInfo> questionInfoQueryWrapper = new QueryWrapper<>();
-        questionInfoQueryWrapper.eq("is_deleted",IsDeleteEnum.N.getKey())
-                .in("id",questionIds);
-        Map<Long,QuestionInfo> questionInfoMap = questionFacade.list(questionInfoQueryWrapper)
-                .stream()
-                .collect(Collectors.toMap(QuestionInfo::getId,questionInfo -> questionInfo));
-        for (DisDTO disDTO: disDTOS) {
-            if(questionInfoMap.get(disDTO.getId()) != null){
-                disDTO.setName(questionInfoMap.get(disDTO.getId()).getTagName());
+            Iterator<ConceptBaseDTO> disIterator = disTypes.data.iterator();
+            for (Long disId : disIds) {
+                while (disIterator.hasNext()){
+                    Long disConceptId = disIterator.next().getConceptId();
+                    if(disId.intValue() == disConceptId.intValue()){
+                        disIterator.remove();
+                    }
+                }
             }
         }
+        List<DisDTO> disDTOS = BeanUtil.listCopyTo(deptInfoList.data,DisDTO.class);
         GetAllDeptAndDisInfoDTO getAllDeptAndDisInfoDTO = new GetAllDeptAndDisInfoDTO();
         getAllDeptAndDisInfoDTO.setDeptDTOS(deptDTOS);
         getAllDeptAndDisInfoDTO.setDisDTOS(disDTOS);