Browse Source

1、获取静态信息

zhaops 4 years ago
parent
commit
105ec9696c
1 changed files with 55 additions and 19 deletions
  1. 55 19
      src/main/java/com/diagbot/facade/ConceptInfoFacade.java

+ 55 - 19
src/main/java/com/diagbot/facade/ConceptInfoFacade.java

@@ -128,7 +128,7 @@ public class ConceptInfoFacade extends ConceptInfoServiceImpl {
             conceptInfoQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
                     .in("name", conNameList);
             List<ConceptInfo> conceptInfoList = this.list(conceptInfoQueryWrapper);
-            if(ListUtil.isNotEmpty(conceptInfoList)) {
+            if (ListUtil.isNotEmpty(conceptInfoList)) {
                 //typeName转换
                 conceptInfoList.forEach(item -> {
                     item.setType(convertTypeName(item.getType(), 2, dicTypeMappingList));
@@ -224,12 +224,18 @@ public class ConceptInfoFacade extends ConceptInfoServiceImpl {
         if (ListUtil.isNotEmpty(staticKnowledgeVO.getContentTypes())) {
             String sql = "";
             for (Integer contentType : staticKnowledgeVO.getContentTypes()) {
+                if (contentType.equals(0)) {
+                    sql = "";
+                    break;
+                }
                 if (StringUtil.isNotBlank(sql)) {
                     sql += " or ";
                 }
                 sql += "find_in_set(" + contentType + ",content_type)";
             }
-            sql = "(" + sql + ")";
+            if (StringUtil.isNotBlank(sql)) {
+                sql = "(" + sql + ")";
+            }
             conceptDetailQueryWrapper.apply(sql);
         }
         conceptDetailQueryWrapper.orderByAsc("order_no");
@@ -249,14 +255,26 @@ public class ConceptInfoFacade extends ConceptInfoServiceImpl {
                 .filter(i -> Arrays.asList(i.getContentType().split(",")).contains("3"))
                 .collect(Collectors.toList());
         Map<String, List<StaticKnowledgeDetailDTO>> detailMap = new HashMap<>();
-        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.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);
+            }
+        } 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);
+            }
         }
         staticKnowledgeDTO.setDetails(detailMap);
         return staticKnowledgeDTO;
@@ -299,12 +317,18 @@ public class ConceptInfoFacade extends ConceptInfoServiceImpl {
         if (ListUtil.isNotEmpty(staticKnowledgeHISVO.getContentTypes())) {
             String sql = "";
             for (Integer contentType : staticKnowledgeHISVO.getContentTypes()) {
+                if (contentType.equals(0)) {
+                    sql = "";
+                    break;
+                }
                 if (StringUtil.isNotBlank(sql)) {
                     sql += " or ";
                 }
                 sql += "find_in_set(" + contentType + ",content_type)";
             }
-            sql = "(" + sql + ")";
+            if (StringUtil.isNotBlank(sql)) {
+                sql = "(" + sql + ")";
+            }
             conceptDetailQueryWrapper.apply(sql);
         }
         conceptDetailQueryWrapper.orderByAsc("concept_id", "order_no");
@@ -329,14 +353,26 @@ public class ConceptInfoFacade extends ConceptInfoServiceImpl {
                         .filter(i -> Arrays.asList(i.getContentType().split(",")).contains("3"))
                         .collect(Collectors.toList());
                 Map<String, List<StaticKnowledgeDetailDTO>> subDetailMap = new HashMap<>();
-                if (ListUtil.isNotEmpty(introduceList) && staticKnowledgeHISVO.getContentTypes().contains(1)) {
-                    subDetailMap.put("静态知识", introduceList);
-                }
-                if (ListUtil.isNotEmpty(noticeList) && staticKnowledgeHISVO.getContentTypes().contains(2)) {
-                    subDetailMap.put("注意事项", noticeList);
-                }
-                if (ListUtil.isNotEmpty(clinicalPathwayList) && staticKnowledgeHISVO.getContentTypes().contains(3)) {
-                    subDetailMap.put("临床路径", clinicalPathwayList);
+                if (ListUtil.isEmpty(staticKnowledgeHISVO.getContentTypes()) || staticKnowledgeHISVO.getContentTypes().contains(0)) {
+                    if (ListUtil.isNotEmpty(introduceList)) {
+                        subDetailMap.put("静态知识", introduceList);
+                    }
+                    if (ListUtil.isNotEmpty(noticeList)) {
+                        subDetailMap.put("注意事项", noticeList);
+                    }
+                    if (ListUtil.isNotEmpty(clinicalPathwayList)) {
+                        subDetailMap.put("临床路径", clinicalPathwayList);
+                    }
+                } else {
+                    if (ListUtil.isNotEmpty(introduceList) && staticKnowledgeHISVO.getContentTypes().contains(1)) {
+                        subDetailMap.put("静态知识", introduceList);
+                    }
+                    if (ListUtil.isNotEmpty(noticeList) && staticKnowledgeHISVO.getContentTypes().contains(2)) {
+                        subDetailMap.put("注意事项", noticeList);
+                    }
+                    if (ListUtil.isNotEmpty(clinicalPathwayList) && staticKnowledgeHISVO.getContentTypes().contains(3)) {
+                        subDetailMap.put("临床路径", clinicalPathwayList);
+                    }
                 }
                 staticKnowledgeDTO.setDetails(subDetailMap);
             }