manage: 修改 queryTree 疾病身体部位树。添加默认值字段、修改flag逻辑

dev_2.1.0
xueqingkun 1 year ago
parent ecc5187c15
commit 92776b1703

@ -97,29 +97,30 @@ public class DiseasePhysicalManageServiceImpl implements DiseasePhysicalManageSe
}
// 3. 填充疾病体格检查树中的flag属性
// 3.1 检查该位置是否已经配置
// 3.2检查工具没有配置检查位,设置禁用标识
List<String> locationIds = diseasePhysicalResVos.stream().filter(vo->toolId.equals(vo.getToolId()))
.map(DiseasePhysical::getLocationId).distinct().collect(Collectors.toList());
populateDiseasePhysicalLocationNodeFlag(bean,locationIds);
// 4. 检查工具没有配置检查位,设置禁用标识
.map(DiseasePhysical::getLocationId).filter(Objects::nonNull).distinct().collect(Collectors.toList());
List<DefaultPhysicalIndicator> defaultPhysicalIndicatorList = defaultPhysicalIndicatorService.lambdaQuery().eq(DefaultPhysicalIndicator::getItemId, toolId).list();
if (CollectionUtil.isEmpty(defaultPhysicalIndicatorList)){
return bean.getChild();
}
// node: 现在认为一个检查项目和一个位置组成一条唯一数据
// node: 现在认为一个检查项目和一个位置组成一条唯一数据
Map<String, DefaultPhysicalIndicator> indicatorMap = defaultPhysicalIndicatorList.stream()
.collect(Collectors.toMap(DefaultPhysicalIndicator::getLocationId, p -> p, (v1, v2) -> v1));
for (DiseasePhysicalLocationNodeVo diseasePhysicalLocationNodeVo : bean.getChild()) {
// 一级不做处理,只处理二级数据
List<DiseasePhysicalLocationNodeVo> child = diseasePhysicalLocationNodeVo.getChild();
if (CollectionUtil.isEmpty(child)) {
continue;
}
for (DiseasePhysicalLocationNodeVo physicalLocationNodeVo : child) {
physicalLocationNodeVo.setFlag(indicatorMap.containsKey(physicalLocationNodeVo.getId()));
if (Objects.nonNull(indicatorMap.get(physicalLocationNodeVo.getId()))) {
physicalLocationNodeVo.setIndicatorValue(indicatorMap.get(physicalLocationNodeVo.getId()).getIndicatorValue());
String nodeId = physicalLocationNodeVo.getId();
physicalLocationNodeVo.setFlag(
locationIds.contains(nodeId) || indicatorMap.containsKey(nodeId));
if (Objects.nonNull(indicatorMap.get(nodeId))) {
physicalLocationNodeVo.setIndicatorValue(indicatorMap.get(nodeId).getIndicatorValue());
}
}
}
return bean.getChild();

Loading…
Cancel
Save