浏览代码

icss-service获取模板

wangyu 6 年之前
父节点
当前提交
142f596137
共有 1 个文件被更改,包括 37 次插入9 次删除
  1. 37 9
      icss-service/src/main/java/com/diagbot/facade/ModuleFacade.java

+ 37 - 9
icss-service/src/main/java/com/diagbot/facade/ModuleFacade.java

@@ -8,6 +8,7 @@ import com.diagbot.dto.QuestionDTO;
 import com.diagbot.dto.RespDTO;
 import com.diagbot.entity.ModuleDetail;
 import com.diagbot.entity.ModuleInfo;
+import com.diagbot.entity.QuestionInfo;
 import com.diagbot.enums.IsDeleteEnum;
 import com.diagbot.enums.QuestionTypeEnum;
 import com.diagbot.service.impl.ModuleInfoServiceImpl;
@@ -128,6 +129,7 @@ public class ModuleFacade extends ModuleInfoServiceImpl {
         }
         RespDTO<Map<Long,String>> lisRespDTO = null;
         RespDTO<Map<Long,String>> pacsRespDTO = null;
+        List<String> lisNameList = new ArrayList<>();
         //化验
         if(ListUtil.isNotEmpty(lisConceptIds)){
             conceptSearchVO =  new ConceptSearchVO();
@@ -142,18 +144,44 @@ public class ModuleFacade extends ModuleInfoServiceImpl {
             pacsRespDTO = aiptServiceClient.getConceptMap(conceptSearchVO);
             RespDTOUtil.respNGDeal(pacsRespDTO,"获取辅检标签失败");
         }
-        //将化验辅检标签放入出参
-        for (ModuleInfoDTO bean : data) {
-            if (moduleDetailMap.get(bean.getId()) != null) {
-                for (ModuleDetailDTO detailDTO : moduleDetailDTOList) {
-                    if (Integer.parseInt(bean.getType()) == QuestionTypeEnum.Lis.getKey() && lisRespDTO.data != null) {
-                        detailDTO.setName(lisRespDTO.data.get(detailDTO.getQuestionId()));
+        if(ListUtil.isNotEmpty(lisConceptIds) || ListUtil.isNotEmpty(pacsConceptIds)){//如果存在化验辅检相关信息添加数据返回
+            //将化验辅检标签放入出参
+            for (ModuleInfoDTO bean : data) {
+                if (moduleDetailMap.get(bean.getId()) != null) {
+                    for (ModuleDetailDTO detailDTO : moduleDetailDTOList) {
+                        if (Integer.parseInt(bean.getType()) == QuestionTypeEnum.Lis.getKey() && lisRespDTO.data != null) {
+                            detailDTO.setName(lisRespDTO.data.get(detailDTO.getQuestionId()));
+                            lisNameList.add(lisRespDTO.data.get(detailDTO.getQuestionId()));
+                        }
+                        if (Integer.parseInt(bean.getType()) == QuestionTypeEnum.Pacs.getKey() && pacsRespDTO.data != null) {
+                            detailDTO.setName(pacsRespDTO.data.get(detailDTO.getQuestionId()));
+                        }
                     }
-                    if (Integer.parseInt(bean.getType()) == QuestionTypeEnum.Pacs.getKey() && pacsRespDTO.data != null) {
-                        detailDTO.setName(pacsRespDTO.data.get(detailDTO.getQuestionId()));
+                }
+            }
+            //获取化验标签questionInfo
+            QueryWrapper<QuestionInfo> questionInfoQueryWrapper = new QueryWrapper<>();
+            questionInfoQueryWrapper.eq("is_deleted",IsDeleteEnum.N.getKey())
+                    .eq("type",QuestionTypeEnum.Lis.getKey())
+                    .in("tag_name",lisNameList);
+            Map<String,QuestionInfo> questionInfoMap = questionFacade.list(questionInfoQueryWrapper).stream().collect(Collectors.toMap(QuestionInfo::getTagName,questionInfo -> questionInfo));
+            //将化验的填写单类型放入
+            for (ModuleInfoDTO bean : data) {
+                if (moduleDetailMap.get(bean.getId()) != null && bean.getType().equals("5")) {
+                    for (ModuleDetailDTO detailDTO : moduleDetailDTOList) {
+                        if (Integer.parseInt(bean.getType()) == QuestionTypeEnum.Lis.getKey() && lisRespDTO.data != null) {
+                            if (null != detailDTO.getQuestionId() && detailDTO.getName().equals(questionInfoMap.get(detailDTO.getName()).getTagName())) {
+                                QuestionVO questionVO = new QuestionVO();
+                                questionVO.setId(questionInfoMap.get(detailDTO.getName()).getId());
+                                questionVO.setSexType(moduleVO.getSexType());
+                                questionVO.setAge(moduleVO.getAge());
+                                QuestionDTO questionDTO = questionFacade.getById(questionVO);
+                                BeanUtil.copyProperties(questionDTO, detailDTO);
+                            }
+                        }
                     }
+                    bean.setModuleDetailDTOList(moduleDetailDTOList);
                 }
-                bean.setModuleDetailDTOList(moduleDetailDTOList);
             }
         }
         return data;