浏览代码

智能预问诊模板添加时获取模板类型下拉

wangyu 6 年之前
父节点
当前提交
56d4ab763b
共有 1 个文件被更改,包括 11 次插入18 次删除
  1. 11 18
      precman-service/src/main/java/com/diagbot/facade/ModuleInfoFacade.java

+ 11 - 18
precman-service/src/main/java/com/diagbot/facade/ModuleInfoFacade.java

@@ -25,6 +25,7 @@ import com.diagbot.enums.QuestionTypeEnum;
 import com.diagbot.service.impl.ModuleInfoServiceImpl;
 import com.diagbot.util.BeanUtil;
 import com.diagbot.util.DateUtil;
+import com.diagbot.util.EnumEntriesBuilder;
 import com.diagbot.util.ListUtil;
 import com.diagbot.util.RespDTOUtil;
 import com.diagbot.util.StringUtil;
@@ -339,27 +340,19 @@ public class ModuleInfoFacade extends ModuleInfoServiceImpl {
         List<ModuleInfo> moduleInfos = this.list(moduleInfoQueryWrapper);
         List<String> types = moduleInfos.stream().map(moduleInfo -> moduleInfo.getType()).collect(Collectors.toList());
         //获取模板类型
-        QueryWrapper<DictionaryInfo> dictionaryInfoQueryWrapper = new QueryWrapper<>();
-        dictionaryInfoQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
-                .eq("group_type", 4)
-                .eq("return_type", 1)
-                .notIn("val",types)
-                .orderByAsc("order_no");
-        if(getModuleTypeVO.getRelationId() != null && getModuleTypeVO.getRelationId().intValue() == -1){//如果是-1时返回所有子模板
-            dictionaryInfoQueryWrapper.in("val","322","31","32");
-        }
-        if(getModuleTypeVO.getModuleType() != null && getModuleTypeVO.getModuleType().intValue() == 2){//为慢病时过滤现病史空模板、主诉模板、现病史空模板子模板
-            dictionaryInfoQueryWrapper.notIn("val","1","22","31","322");
-        }
-        if(getModuleTypeVO.getModuleType() != null && getModuleTypeVO.getModuleType().intValue() == 0 || getModuleTypeVO.getModuleType() != null && getModuleTypeVO.getModuleType().intValue() == 1){//为通用或科室时过滤化验附件诊断
-            dictionaryInfoQueryWrapper.notIn("val","4","5","6","7");
+        Map<String, List<EnumEntriesBuilder.Entry>> enumMap = new EnumEntriesBuilder()
+                .addEnums("moduleTypeEnum", ModuleTypeEnum.values()).build();
+        Iterator<EnumEntriesBuilder.Entry> iterator =  enumMap.get("moduleTypeEnum").iterator();
+        while (iterator.hasNext()){
+            if (types.contains(iterator.next().getKey())){//过滤掉添加过的模板类型
+                iterator.remove();
+            }
         }
-        List<DictionaryInfo> dictionaryInfoList = dictionaryFacade.list(dictionaryInfoQueryWrapper);
         List<GetModuleTypeDTO> getModuleTypeDTOS = new ArrayList<>();
-        for (DictionaryInfo dictionaryInfo: dictionaryInfoList) {
+        for (EnumEntriesBuilder.Entry entry : enumMap.get("moduleTypeEnum")) {
             GetModuleTypeDTO getModuleTypeDTO = new GetModuleTypeDTO();
-            getModuleTypeDTO.setName(dictionaryInfo.getName());
-            getModuleTypeDTO.setType(dictionaryInfo.getVal());
+            getModuleTypeDTO.setName(entry.getName());
+            getModuleTypeDTO.setType(entry.getKey().toString());
             getModuleTypeDTOS.add(getModuleTypeDTO);
         }
         return getModuleTypeDTOS;