|
@@ -56,31 +56,26 @@ public class PartFacade {
|
|
|
}
|
|
|
List<PartSymptomDTO> res = new ArrayList<>();
|
|
|
|
|
|
- // 获取顶级部位信息
|
|
|
+ // 获取部位信息
|
|
|
ConceptWrapper conceptWrapper = new ConceptWrapper();
|
|
|
conceptWrapper.setStartNameList(partList);
|
|
|
conceptWrapper.setStartType(LexiconTypeEnum.BODYPART.getKey());
|
|
|
-// conceptWrapper.setEndNameList(partList);
|
|
|
conceptWrapper.setEndType(LexiconTypeEnum.BODYPART.getKey());
|
|
|
conceptWrapper.setEndSex(partSymptomVO.getSexType());
|
|
|
conceptWrapper.setEndAge(partSymptomVO.getAge());
|
|
|
List<ConceptWithOrderRes> list = conceptFacade.getConceptWithOrder(conceptWrapper);
|
|
|
- for (String s : partList) {
|
|
|
- PartSymptomDTO dto = new PartSymptomDTO();
|
|
|
- dto.setName(s);
|
|
|
- res.add(dto);
|
|
|
- }
|
|
|
// 设置一级部位
|
|
|
- for (PartSymptomDTO dto : res) {
|
|
|
- for (ConceptWithOrderRes concept : list) {
|
|
|
- if(dto.getName().equals(concept.getStartName()) && dto.getName().equals(concept.getEndName())) {
|
|
|
- dto.setConceptId(concept.getStartId());
|
|
|
- break;
|
|
|
- }
|
|
|
+ for (ConceptWithOrderRes concept : list) {
|
|
|
+ if (concept.getStartId().equals(concept.getEndId())) { //startId 和 endId相同标识一级部位
|
|
|
+ PartSymptomDTO dto = new PartSymptomDTO();
|
|
|
+ dto.setName(concept.getStartName());
|
|
|
+ dto.setConceptId(concept.getStartId());
|
|
|
+ res.add(dto);
|
|
|
}
|
|
|
}
|
|
|
- List<String> secPart = new ArrayList<>();
|
|
|
+
|
|
|
// 设置二级部位
|
|
|
+ List<String> secPart = new ArrayList<>();
|
|
|
for (PartSymptomDTO dto : res) {
|
|
|
List<PartDTO> partDTO = new ArrayList<>();
|
|
|
for (ConceptWithOrderRes concept : list) {
|
|
@@ -96,7 +91,7 @@ public class PartFacade {
|
|
|
dto.setPartDTO(partDTO);
|
|
|
}
|
|
|
|
|
|
- // 获取二级部位信息
|
|
|
+ // 获取二级部位下症状信息
|
|
|
ConceptWrapper wrapper = new ConceptWrapper();
|
|
|
wrapper.setStartNameList(secPart);
|
|
|
wrapper.setStartType(LexiconTypeEnum.BODYPART.getKey());
|
|
@@ -106,8 +101,9 @@ public class PartFacade {
|
|
|
wrapper.setEndAge(partSymptomVO.getAge());
|
|
|
List<ConceptWithOrderRes> sympton = conceptFacade.getConceptWithOrder(wrapper);
|
|
|
|
|
|
+ // 出参转化
|
|
|
List<Symptom> symptomList = new ArrayList<>();
|
|
|
- for(ConceptWithOrderRes conceptWithOrderRes : sympton) {
|
|
|
+ for (ConceptWithOrderRes conceptWithOrderRes : sympton) {
|
|
|
Symptom bean = new Symptom();
|
|
|
bean.setName(conceptWithOrderRes.getEndName());
|
|
|
bean.setConceptId(conceptWithOrderRes.getEndId());
|
|
@@ -116,58 +112,27 @@ public class PartFacade {
|
|
|
}
|
|
|
Map<Long, List<Symptom>> keyMap = EntityUtil.makeEntityListMap(symptomList, "partConceptId");
|
|
|
|
|
|
- // 设置部位对应的症状
|
|
|
+ // 设置二级部位对应的症状
|
|
|
for (PartSymptomDTO dto : res) {
|
|
|
for (PartDTO partDTO : dto.getPartDTO()) {
|
|
|
- if(keyMap.get(partDTO.getConceptId()) != null) {
|
|
|
+ if (keyMap.get(partDTO.getConceptId()) != null) { // 去除null数据
|
|
|
partDTO.setSymptomList(keyMap.get(partDTO.getConceptId()));
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
// 如二级部位无关联的症状,则删除二级部位
|
|
|
-
|
|
|
- //添加默认部位-全身
|
|
|
-// QueryWrapper wrapper = new QueryWrapper();
|
|
|
-// wrapper.eq("name", "全身");
|
|
|
-// Part part = this.getOne(wrapper);
|
|
|
-// partIds.add(part.getId());
|
|
|
-// Map paramMap = new HashMap<>();
|
|
|
-// paramMap.put("ids", partIds);
|
|
|
-// List<PartSymptomDTO> res = this.getByPartId(paramMap);
|
|
|
-// List<PartDTO> partList = this.getByParentId(paramMap);
|
|
|
-//
|
|
|
-// //添加二级部位信息
|
|
|
-// Map<Long, List<PartDTO>> keyMap = EntityUtil.makeEntityListMap(partList, "parentId");
|
|
|
-// for(PartSymptomDTO bean : res) {
|
|
|
-// bean.setPartDTO(keyMap.get(bean.getId()));
|
|
|
-// }
|
|
|
-//
|
|
|
-// //添加部位和症状的关联信息
|
|
|
-// List<Long> idList = new ArrayList<>();
|
|
|
-// for(PartDTO bean : partList) {
|
|
|
-// idList.add(bean.getId());
|
|
|
-// }
|
|
|
-// Map paramMap1 = new HashMap<>();
|
|
|
-// paramMap1.put("ids", idList);
|
|
|
-// paramMap1.put("sexType", partSymptomVO.getSexType());
|
|
|
-// paramMap1.put("age", partSymptomVO.getAge());
|
|
|
-// List<SymptomWrapper> symptomList = symptomFacade.getByPartIdsFac(paramMap1);
|
|
|
-// Map<Long, List<SymptomWrapper>> partSymptomMap = EntityUtil.makeEntityListMap(symptomList, "partId");
|
|
|
-// for(PartDTO bean : partList) {
|
|
|
-// bean.setSymptomList(partSymptomMap.get(bean.getId()));
|
|
|
-// }
|
|
|
-//
|
|
|
-// // 如二级部位无关联的症状,删除二级部位
|
|
|
-// for(int i = 0; i < res.size(); i++) {
|
|
|
-// List<PartDTO> partDTO = res.get(i).getPartDTO();
|
|
|
-// for(int j = 0; j < partDTO.size(); j++) {
|
|
|
-// if(ListUtil.isEmpty(partDTO.get(j).getSymptomList())) {
|
|
|
-// partDTO.remove(j--);
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
-// return res;
|
|
|
+ for (PartSymptomDTO dto : res) {
|
|
|
+ for (int i = 0; i < dto.getPartDTO().size(); i++) {
|
|
|
+ PartDTO partDTO = dto.getPartDTO().get(i);
|
|
|
+ if (keyMap.get(partDTO.getConceptId()) != null) { // 去除null数据
|
|
|
+ partDTO.setSymptomList(keyMap.get(partDTO.getConceptId()));
|
|
|
+ }
|
|
|
+ if (ListUtil.isEmpty(partDTO.getSymptomList())) {
|
|
|
+ dto.getPartDTO().remove(i--);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
return res;
|
|
|
}
|
|
|
|