|
|
|
@ -72,9 +72,9 @@ public class DiseasePhysicalManageServiceImpl implements DiseasePhysicalManageSe
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<DiseasePhysicalLocationNodeVo> queryTree(String diseaseId) {
|
|
|
|
|
public List<DiseasePhysicalLocationNodeVo> queryTree(String diseaseId, String toolId) {
|
|
|
|
|
|
|
|
|
|
// 1. 查询体格检查工具树
|
|
|
|
|
// 1. 查询体格检查位置树
|
|
|
|
|
List<PhysicalLocationNode> physicalLocationNodes = physicalToolManageService.queryTree();
|
|
|
|
|
if (CollectionUtil.isEmpty(physicalLocationNodes)){
|
|
|
|
|
return CollectionUtil.newArrayList();
|
|
|
|
@ -84,6 +84,9 @@ public class DiseasePhysicalManageServiceImpl implements DiseasePhysicalManageSe
|
|
|
|
|
physicalLocationNode.setChild(physicalLocationNodes);
|
|
|
|
|
DiseasePhysicalLocationNodeVo bean = BeanUtil.toBean(physicalLocationNode, DiseasePhysicalLocationNodeVo.class);
|
|
|
|
|
|
|
|
|
|
if (StrUtil.isEmpty(toolId)){
|
|
|
|
|
return bean.getChild();
|
|
|
|
|
}
|
|
|
|
|
// 2. 根据疾病id查询疾病体格检查项
|
|
|
|
|
List<DiseasePhysicalResVo> diseasePhysicalResVos = diseasePhysicalService.queryListByDiseaseId(diseaseId);
|
|
|
|
|
if (CollectionUtil.isEmpty(diseasePhysicalResVos)){
|
|
|
|
@ -91,20 +94,21 @@ public class DiseasePhysicalManageServiceImpl implements DiseasePhysicalManageSe
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 3. 填充疾病体格检查树中的flag属性
|
|
|
|
|
List<String> toolIds = diseasePhysicalResVos.stream().map(DiseasePhysical::getToolId).distinct().collect(Collectors.toList());
|
|
|
|
|
populateDiseasePhysicalLocationNodeFlag(bean,toolIds);
|
|
|
|
|
List<String> locationIds = diseasePhysicalResVos.stream().filter(vo->toolId.equals(vo.getToolId()))
|
|
|
|
|
.map(DiseasePhysical::getLocationId).distinct().collect(Collectors.toList());
|
|
|
|
|
populateDiseasePhysicalLocationNodeFlag(bean,locationIds);
|
|
|
|
|
|
|
|
|
|
return bean.getChild();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void populateDiseasePhysicalLocationNodeFlag(DiseasePhysicalLocationNodeVo node,List<String> toolIds) {
|
|
|
|
|
private void populateDiseasePhysicalLocationNodeFlag(DiseasePhysicalLocationNodeVo node,List<String> locationIds) {
|
|
|
|
|
if (StrUtil.isNotEmpty(node.getId())){
|
|
|
|
|
node.setFlag(toolIds.stream().anyMatch(id->node.getId().equals(id)));
|
|
|
|
|
node.setFlag(locationIds.stream().anyMatch(locationId->node.getId().equals(locationId)));
|
|
|
|
|
}
|
|
|
|
|
if (CollectionUtil.isNotEmpty(node.getChild())){
|
|
|
|
|
for (DiseasePhysicalLocationNodeVo childNode : node.getChild()) {
|
|
|
|
|
populateDiseasePhysicalLocationNodeFlag(childNode,toolIds);
|
|
|
|
|
populateDiseasePhysicalLocationNodeFlag(childNode,locationIds);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|