Przeglądaj źródła

医学知识量表获取逻辑修改

zhaops 4 lat temu
rodzic
commit
eec2f7fda5

+ 5 - 0
src/main/java/com/diagbot/dto/StaticKnowledgeDTO.java

@@ -42,4 +42,9 @@ public class StaticKnowledgeDTO {
      * 静态知识明细
      */
     private Map<String, List<StaticKnowledgeDetailDTO>> details;
+
+    /**
+     * 量表结构
+     */
+    private KlScaleByIdDTO scale;
 }

+ 96 - 71
src/main/java/com/diagbot/facade/KlConceptStaticFacade.java

@@ -7,6 +7,7 @@ import com.diagbot.dto.ConceptDetailDTO;
 import com.diagbot.dto.DictionaryInfoDTO;
 import com.diagbot.dto.KlConceptDetailDTO;
 import com.diagbot.dto.KlConceptStaticDTO;
+import com.diagbot.dto.KlScaleByIdDTO;
 import com.diagbot.dto.StaticKnowledgeDTO;
 import com.diagbot.dto.StaticKnowledgeDetailDTO;
 import com.diagbot.dto.StaticKnowledgeIndexPageDTO;
@@ -32,6 +33,7 @@ import com.diagbot.vo.GetDetailVO;
 import com.diagbot.vo.IdVO;
 import com.diagbot.vo.KlConceptStaticPageVO;
 import com.diagbot.vo.KlConceptStaticVO;
+import com.diagbot.vo.KlScaleByIdVO;
 import com.diagbot.vo.StaticKnowledgeIndexPageVO;
 import com.diagbot.vo.StaticKnowledgeVO;
 import com.google.common.collect.Lists;
@@ -63,6 +65,8 @@ public class KlConceptStaticFacade extends KlConceptStaticServiceImpl {
     @Autowired
     private KlConceptScaleFacade klConceptScaleFacade;
     @Autowired
+    private KlScaleFacade klScaleFacade;
+    @Autowired
     private KlDictionaryInfoFacade klDictionaryInfoFacade;
 
     @Autowired
@@ -91,8 +95,9 @@ public class KlConceptStaticFacade extends KlConceptStaticServiceImpl {
                 .eq("is_deleted", IsDeleteEnum.N.getKey())
                 .eq("lib_name", staticKnowledgeVO.getName())
                 .eq("lib_type", type), false);
+
         Integer sameType = null;
-        //标准词不存在,同名的是否存在
+        //标准词不存在,同名的是否存在,仅检验检查
         if (concept == null) {
             //同名静态知识互取
             if (type.equals(LexiconEnum.LisName.getKey())) {
@@ -123,7 +128,7 @@ public class KlConceptStaticFacade extends KlConceptStaticServiceImpl {
             staticKnowledgeVO.setType(sameType);
         }
 
-        //标准术语存在静态知识不存在,取同名静态知识
+        //标准术语存在静态知识不存在,取同名静态知识,仅检验检查
         if (concept != null && staticInfo == null && sameType == null) {
             //同名静态知识互取
             if (type.equals(LexiconEnum.LisName.getKey())) {
@@ -168,95 +173,115 @@ public class KlConceptStaticFacade extends KlConceptStaticServiceImpl {
                             .in("concept_id", relations.stream().map(i -> i.getStartId()).collect(Collectors.toList()))
                             .eq("status", StatusEnum.Enable.getKey()), false);
                     if (staticInfo == null) {
-                        throw new CommonException(CommonErrorCode.NOT_EXISTS, "缺少静态信息");
+                        throw new CommonException(CommonErrorCode.NOT_EXISTS, "缺少" +
+                                (type.equals(LexiconEnum.Scale.getKey()) ? "量表" : "静态") +
+                                "信息");
                     }
                     concept = klConceptFacade.getById(staticInfo.getConceptId());
                 } else {
-                    throw new CommonException(CommonErrorCode.NOT_EXISTS, "缺少静态信息");
+                    throw new CommonException(CommonErrorCode.NOT_EXISTS, "缺少" +
+                            (type.equals(LexiconEnum.Scale.getKey()) ? "量表" : "静态") +
+                            "信息");
                 }
             } else {
-                throw new CommonException(CommonErrorCode.NOT_EXISTS, "缺少静态信息");
+                throw new CommonException(CommonErrorCode.NOT_EXISTS, "缺少" +
+                        (type.equals(LexiconEnum.Scale.getKey()) ? "量表" : "静态") +
+                        "信息");
             }
         }
 
-        //详情信息
-        String sql = "";
-        if (ListUtil.isNotEmpty(staticKnowledgeVO.getContentTypes())) {
-
-            for (Integer contentType : staticKnowledgeVO.getContentTypes()) {
-                if (contentType.equals(0)) {
-                    sql = "";
-                    break;
+        if (type.equals(LexiconEnum.Scale.getKey())) {
+            //量表详情
+            KlScaleByIdVO klScaleByIdVO = new KlScaleByIdVO();
+            //klScaleByIdVO.setId(staticInfo.getId());
+            klScaleByIdVO.setName(concept.getLibName());
+            List<KlScaleByIdDTO> scales = klScaleFacade.getKlScaleById(klScaleByIdVO);
+            if (ListUtil.isNotEmpty(scales)) {
+                staticKnowledgeDTO.setScale(scales.get(0));
+            }
+        } else {
+            //医学知识详情
+            String sql = "";
+            if (ListUtil.isNotEmpty(staticKnowledgeVO.getContentTypes())) {
+
+                for (Integer contentType : staticKnowledgeVO.getContentTypes()) {
+                    if (contentType.equals(0)) {
+                        sql = "";
+                        break;
+                    }
+                    if (StringUtil.isNotBlank(sql)) {
+                        sql += " or ";
+                    }
+                    sql += "find_in_set(" + contentType + ",content_type)";
                 }
                 if (StringUtil.isNotBlank(sql)) {
-                    sql += " or ";
+                    sql = "(" + sql + ")";
                 }
-                sql += "find_in_set(" + contentType + ",content_type)";
             }
-            if (StringUtil.isNotBlank(sql)) {
-                sql = "(" + sql + ")";
+            List<KlConceptDetail> details = klConceptDetailFacade.list(new QueryWrapper<KlConceptDetail>()
+                    .eq("is_deleted", IsDeleteEnum.N.getKey())
+                    .eq("concept_id", concept.getId())
+                    .apply(sql)
+                    .orderByAsc("order_no"));
+
+            List<StaticKnowledgeDetailDTO> detailList
+                    = BeanUtil.listCopyTo(details, StaticKnowledgeDetailDTO.class);
+            List<StaticKnowledgeDetailDTO> introduceList = detailList
+                    .stream()
+                    .filter(i -> Arrays.asList(i.getContentType().split(",")).contains("1"))
+                    .collect(Collectors.toList());
+            List<StaticKnowledgeDetailDTO> noticeList = detailList
+                    .stream()
+                    .filter(i -> Arrays.asList(i.getContentType().split(",")).contains("2"))
+                    .collect(Collectors.toList());
+            List<StaticKnowledgeDetailDTO> clinicalPathwayList = detailList
+                    .stream()
+                    .filter(i -> Arrays.asList(i.getContentType().split(",")).contains("3"))
+                    .collect(Collectors.toList());
+            List<StaticKnowledgeDetailDTO> treatInfoList = detailList
+                    .stream()
+                    .filter(i -> Arrays.asList(i.getContentType().split(",")).contains("4"))
+                    .collect(Collectors.toList());
+            Map<String, List<StaticKnowledgeDetailDTO>> detailMap = new HashMap<>();
+            if (ListUtil.isEmpty(staticKnowledgeVO.getContentTypes()) || staticKnowledgeVO.getContentTypes().contains(0)) {
+                if (ListUtil.isNotEmpty(introduceList)) {
+                    detailMap.put("静态知识", introduceList);
+                }
+                if (ListUtil.isNotEmpty(noticeList)) {
+                    detailMap.put("注意事项", noticeList);
+                }
+                if (ListUtil.isNotEmpty(clinicalPathwayList)) {
+                    detailMap.put("临床路径", clinicalPathwayList);
+                }
+                if (ListUtil.isNotEmpty(treatInfoList)) {
+                    detailMap.put("治疗方案", treatInfoList);
+                }
+            } else {
+                if (ListUtil.isNotEmpty(introduceList) && staticKnowledgeVO.getContentTypes().contains(1)) {
+                    detailMap.put("静态知识", introduceList);
+                }
+                if (ListUtil.isNotEmpty(noticeList) && staticKnowledgeVO.getContentTypes().contains(2)) {
+                    detailMap.put("注意事项", noticeList);
+                }
+                if (ListUtil.isNotEmpty(clinicalPathwayList) && staticKnowledgeVO.getContentTypes().contains(3)) {
+                    detailMap.put("临床路径", clinicalPathwayList);
+                }
+                if (ListUtil.isNotEmpty(treatInfoList) && staticKnowledgeVO.getContentTypes().contains(4)) {
+                    detailMap.put("治疗方案", treatInfoList);
+                }
             }
+            staticKnowledgeDTO.setClinicalPathwayName(staticInfo.getClinicalPathwayName());
+            staticKnowledgeDTO.setNoticeName(staticInfo.getNoticeName());
+            staticKnowledgeDTO.setDetails(detailMap);
         }
-        List<KlConceptDetail> details = klConceptDetailFacade.list(new QueryWrapper<KlConceptDetail>()
-                .eq("is_deleted", IsDeleteEnum.N.getKey())
-                .eq("concept_id", concept.getId())
-                .apply(sql)
-                .orderByAsc("order_no"));
 
-        List<StaticKnowledgeDetailDTO> detailList
-                = BeanUtil.listCopyTo(details, StaticKnowledgeDetailDTO.class);
-        List<StaticKnowledgeDetailDTO> introduceList = detailList
-                .stream()
-                .filter(i -> Arrays.asList(i.getContentType().split(",")).contains("1"))
-                .collect(Collectors.toList());
-        List<StaticKnowledgeDetailDTO> noticeList = detailList
-                .stream()
-                .filter(i -> Arrays.asList(i.getContentType().split(",")).contains("2"))
-                .collect(Collectors.toList());
-        List<StaticKnowledgeDetailDTO> clinicalPathwayList = detailList
-                .stream()
-                .filter(i -> Arrays.asList(i.getContentType().split(",")).contains("3"))
-                .collect(Collectors.toList());
-        List<StaticKnowledgeDetailDTO> treatInfoList = detailList
-                .stream()
-                .filter(i -> Arrays.asList(i.getContentType().split(",")).contains("4"))
-                .collect(Collectors.toList());
-        Map<String, List<StaticKnowledgeDetailDTO>> detailMap = new HashMap<>();
-        if (ListUtil.isEmpty(staticKnowledgeVO.getContentTypes()) || staticKnowledgeVO.getContentTypes().contains(0)) {
-            if (ListUtil.isNotEmpty(introduceList)) {
-                detailMap.put("静态知识", introduceList);
-            }
-            if (ListUtil.isNotEmpty(noticeList)) {
-                detailMap.put("注意事项", noticeList);
-            }
-            if (ListUtil.isNotEmpty(clinicalPathwayList)) {
-                detailMap.put("临床路径", clinicalPathwayList);
-            }
-            if (ListUtil.isNotEmpty(treatInfoList)) {
-                detailMap.put("治疗方案", treatInfoList);
-            }
-        } else {
-            if (ListUtil.isNotEmpty(introduceList) && staticKnowledgeVO.getContentTypes().contains(1)) {
-                detailMap.put("静态知识", introduceList);
-            }
-            if (ListUtil.isNotEmpty(noticeList) && staticKnowledgeVO.getContentTypes().contains(2)) {
-                detailMap.put("注意事项", noticeList);
-            }
-            if (ListUtil.isNotEmpty(clinicalPathwayList) && staticKnowledgeVO.getContentTypes().contains(3)) {
-                detailMap.put("临床路径", clinicalPathwayList);
-            }
-            if (ListUtil.isNotEmpty(treatInfoList) && staticKnowledgeVO.getContentTypes().contains(4)) {
-                detailMap.put("治疗方案", treatInfoList);
-            }
-        }
 
         staticKnowledgeDTO.setId(concept.getId());
         staticKnowledgeDTO.setName(concept.getLibName());
         Integer retType = convertType(concept.getLibType(), 2);
         staticKnowledgeDTO.setType(retType == null ? "" : retType.toString());
-        staticKnowledgeDTO.setClinicalPathwayName(staticInfo.getClinicalPathwayName());
-        staticKnowledgeDTO.setNoticeName(staticInfo.getNoticeName());
-        staticKnowledgeDTO.setDetails(detailMap);
+
+
         return staticKnowledgeDTO;
     }
 

+ 2 - 1
src/main/resources/mapper/KlConceptStaticMapper.xml

@@ -44,7 +44,8 @@
         kl_concept a,
         kl_concept_static b
         WHERE
-        a.id = b.concept_id
+        a.lib_type != 124
+        and a.id = b.concept_id
         and a.is_deleted = 'N'
         and b.is_deleted = 'N'
         <if test="klConceptStaticPageVO.status!=null ">