|
@@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
|
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.DictionaryInfoDTO;
|
|
|
import com.diagbot.dto.KlConceptDetailDTO;
|
|
|
import com.diagbot.dto.KlConceptStaticDTO;
|
|
@@ -192,13 +194,7 @@ public class KlConceptStaticFacade extends KlConceptStaticServiceImpl {
|
|
|
|
|
|
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));
|
|
|
- }
|
|
|
+ staticKnowledgeDTO.setScale(getScaleStructure(concept.getId()));
|
|
|
} else {
|
|
|
//医学知识详情
|
|
|
String sql = "";
|
|
@@ -788,4 +784,48 @@ public class KlConceptStaticFacade extends KlConceptStaticServiceImpl {
|
|
|
}
|
|
|
return retMap;
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取量表结构
|
|
|
+ * @param conceptId
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public ConceptScaleDTO getScaleStructure(Long conceptId) {
|
|
|
+ ConceptScaleDTO retDTO = new ConceptScaleDTO();
|
|
|
+ List<KlConceptScale> scaleList = klConceptScaleFacade.list(new QueryWrapper<KlConceptScale>()
|
|
|
+ .eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
+ .eq("concept_id", conceptId)
|
|
|
+ .orderByAsc("parent_id", "order_no"));
|
|
|
+ if (ListUtil.isEmpty(scaleList)) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ List<ConceptScaleDetailDTO> scaleDetailList = BeanUtil.listCopyTo(scaleList, ConceptScaleDetailDTO.class);
|
|
|
+ Map<Long, List<ConceptScaleDetailDTO>> parentMap
|
|
|
+ = scaleDetailList.stream().collect(Collectors.groupingBy(ConceptScaleDetailDTO::getParentId));
|
|
|
+ List<ConceptScaleDetailDTO> retScacleDetailList = parentMap.get(-1L);
|
|
|
+ if (ListUtil.isEmpty(retScacleDetailList)) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ for (ConceptScaleDetailDTO detail : retScacleDetailList) {
|
|
|
+ scaleRecursion(detail, parentMap);
|
|
|
+ }
|
|
|
+ retDTO.setScaleDetails(retScacleDetailList);
|
|
|
+ return retDTO;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 递归
|
|
|
+ * @param item
|
|
|
+ * @param treeMap
|
|
|
+ */
|
|
|
+ public void scaleRecursion(ConceptScaleDetailDTO item,
|
|
|
+ Map<Long, List<ConceptScaleDetailDTO>> treeMap) {
|
|
|
+ List<ConceptScaleDetailDTO> list = treeMap.get(item.getId());
|
|
|
+ if (ListUtil.isNotEmpty(list)) {
|
|
|
+ item.setSubList(list);
|
|
|
+ for (ConceptScaleDetailDTO bean : list) {
|
|
|
+ scaleRecursion(bean, treeMap);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|