|
@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.diagbot.dto.ConceptDetailDTO;
|
|
|
import com.diagbot.dto.ConceptScaleDTO;
|
|
|
import com.diagbot.dto.ConceptScaleDetailDTO;
|
|
|
+import com.diagbot.dto.ConceptScaleSubDTO;
|
|
|
import com.diagbot.dto.DictionaryInfoDTO;
|
|
|
import com.diagbot.dto.KlConceptDetailDTO;
|
|
|
import com.diagbot.dto.KlConceptStaticDTO;
|
|
@@ -65,8 +66,6 @@ public class KlConceptStaticFacade extends KlConceptStaticServiceImpl {
|
|
|
@Autowired
|
|
|
private KlConceptScaleFacade klConceptScaleFacade;
|
|
|
@Autowired
|
|
|
- private KlScaleFacade klScaleFacade;
|
|
|
- @Autowired
|
|
|
private KlDictionaryInfoFacade klDictionaryInfoFacade;
|
|
|
|
|
|
@Autowired
|
|
@@ -190,92 +189,91 @@ public class KlConceptStaticFacade extends KlConceptStaticServiceImpl {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if (type.equals(LexiconEnum.Scale.getKey())) {
|
|
|
- //量表详情
|
|
|
- staticKnowledgeDTO.setScale(getScaleStructure(concept.getId()));
|
|
|
- } 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)";
|
|
|
+
|
|
|
+ //医学知识详情
|
|
|
+ String sql = "";
|
|
|
+ if (ListUtil.isNotEmpty(staticKnowledgeVO.getContentTypes())) {
|
|
|
+
|
|
|
+ for (Integer contentType : staticKnowledgeVO.getContentTypes()) {
|
|
|
+ if (contentType.equals(0)) {
|
|
|
+ sql = "";
|
|
|
+ break;
|
|
|
}
|
|
|
if (StringUtil.isNotBlank(sql)) {
|
|
|
- sql = "(" + sql + ")";
|
|
|
+ sql += " or ";
|
|
|
}
|
|
|
+ sql += "find_in_set(" + contentType + ",content_type)";
|
|
|
}
|
|
|
- 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);
|
|
|
- }
|
|
|
+ if (StringUtil.isNotBlank(sql)) {
|
|
|
+ sql = "(" + sql + ")";
|
|
|
}
|
|
|
- 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<>();
|
|
|
+ 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);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (type.equals(LexiconEnum.Scale.getKey())) {
|
|
|
+ //量表详情
|
|
|
+ staticKnowledgeDTO.setScale(getScaleStructure(concept.getId()));
|
|
|
+ }
|
|
|
|
|
|
+ staticKnowledgeDTO.setClinicalPathwayName(staticInfo.getClinicalPathwayName());
|
|
|
+ staticKnowledgeDTO.setNoticeName(staticInfo.getNoticeName());
|
|
|
+ staticKnowledgeDTO.setDetails(detailMap);
|
|
|
staticKnowledgeDTO.setId(concept.getId());
|
|
|
staticKnowledgeDTO.setName(concept.getLibName());
|
|
|
Integer retType = convertType(concept.getLibType(), 2);
|
|
|
staticKnowledgeDTO.setType(retType == null ? "" : retType.toString());
|
|
|
|
|
|
-
|
|
|
return staticKnowledgeDTO;
|
|
|
}
|
|
|
|
|
@@ -809,10 +807,20 @@ public class KlConceptStaticFacade extends KlConceptStaticServiceImpl {
|
|
|
if (ListUtil.isEmpty(retScacleDetailList)) {
|
|
|
return null;
|
|
|
}
|
|
|
- for (ConceptScaleDetailDTO detail : retScacleDetailList) {
|
|
|
- scaleRecursion(detail, parentMap);
|
|
|
+ List<ConceptScaleSubDTO> retList = Lists.newLinkedList();
|
|
|
+ Map<Integer, List<ConceptScaleDetailDTO>> groupMap
|
|
|
+ = retScacleDetailList.stream().collect(Collectors.groupingBy(ConceptScaleDetailDTO::getGroupNum));
|
|
|
+ for (Map.Entry<Integer, List<ConceptScaleDetailDTO>> entry : groupMap.entrySet()) {
|
|
|
+ ConceptScaleSubDTO subItem = new ConceptScaleSubDTO();
|
|
|
+ subItem.setGroupNum(entry.getKey());
|
|
|
+ subItem.setDetailList(entry.getValue());
|
|
|
+ retList.add(subItem);
|
|
|
+ }
|
|
|
+ for (ConceptScaleSubDTO subDTO : retList) {
|
|
|
+ scaleRecursion(subDTO, parentMap);
|
|
|
}
|
|
|
- retDTO.setScaleDetails(retScacleDetailList);
|
|
|
+
|
|
|
+ retDTO.setScaleDetails(retList);
|
|
|
return retDTO;
|
|
|
}
|
|
|
|
|
@@ -821,14 +829,27 @@ public class KlConceptStaticFacade extends KlConceptStaticServiceImpl {
|
|
|
* @param item
|
|
|
* @param treeMap
|
|
|
*/
|
|
|
- public void scaleRecursion(ConceptScaleDetailDTO item,
|
|
|
- Map<Long, List<ConceptScaleDetailDTO>> treeMap) {
|
|
|
- List<ConceptScaleDetailDTO> list = treeMap.get(item.getId());
|
|
|
+ public ConceptScaleSubDTO scaleRecursion(ConceptScaleSubDTO item,
|
|
|
+ Map<Long, List<ConceptScaleDetailDTO>> treeMap) {
|
|
|
+ List<ConceptScaleDetailDTO> list = item.getDetailList();
|
|
|
if (ListUtil.isNotEmpty(list)) {
|
|
|
- item.setSubList(list);
|
|
|
- for (ConceptScaleDetailDTO bean : list) {
|
|
|
- scaleRecursion(bean, treeMap);
|
|
|
+ for (ConceptScaleDetailDTO detail : list) {
|
|
|
+ List<ConceptScaleDetailDTO> subDetailList = treeMap.get(detail.getId());
|
|
|
+ if (ListUtil.isNotEmpty(subDetailList)) {
|
|
|
+ Map<Integer, List<ConceptScaleDetailDTO>> subMap
|
|
|
+ = subDetailList.stream().collect(Collectors.groupingBy(ConceptScaleDetailDTO::getGroupNum));
|
|
|
+ List<ConceptScaleSubDTO> subList = Lists.newLinkedList();
|
|
|
+ for (Map.Entry<Integer, List<ConceptScaleDetailDTO>> subEntry : subMap.entrySet()) {
|
|
|
+ ConceptScaleSubDTO subDTO = new ConceptScaleSubDTO();
|
|
|
+ subDTO.setGroupNum(subEntry.getKey());
|
|
|
+ subDTO.setDetailList(subEntry.getValue());
|
|
|
+ scaleRecursion(subDTO, treeMap);
|
|
|
+ subList.add(subDTO);
|
|
|
+ }
|
|
|
+ detail.setSubList(subList);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
+ return item;
|
|
|
}
|
|
|
}
|