This commit is contained in:
ls
2025-05-27 21:59:54 +08:00
parent aeb676bc6b
commit d3c6c23ed1
3 changed files with 58 additions and 12 deletions

View File

@@ -649,20 +649,66 @@ public class ExperimentDocServiceImpl extends ServiceImpl<ExperimentDocMapper, E
s -> s.getCalibrationDistance()).findFirst();
root.put("标定距离", first.orElse(""));
OptionalDouble maxActualMeasurementRate = detailDTOList.stream().map(obj -> obj.getActualMeasurementRate()) // 获取point字段
.filter(point -> StringUtils.isNotBlank(point)).filter(str -> str.matches("-?\\d+(\\.\\d+)?")) // 只保留数字格式的字符串
.mapToDouble(Double::parseDouble) // 转换为double
.max();
OptionalDouble maxPoint = detailDTOList.stream().map(obj -> obj.getPoint()) // 获取point字段
.filter(point -> StringUtils.isNotBlank(point)).filter(str -> str.matches("-?\\d+(\\.\\d+)?")) // 只保留数字格式的字符串
.mapToDouble(Double::parseDouble) // 转换为double
.max();
//OptionalDouble maxActualMeasurementRate = detailDTOList.stream().map(obj -> obj.getActualMeasurementRate()) // 获取point字段
// .filter(point -> StringUtils.isNotBlank(point)).filter(str -> str.matches("-?\\d+(\\.\\d+)?")) // 只保留数字格式的字符串
// .mapToDouble(Double::parseDouble) // 转换为double
// .max();
//OptionalDouble maxPoint = detailDTOList.stream().map(obj -> obj.getPoint()) // 获取point字段
// .filter(point -> StringUtils.isNotBlank(point)).filter(str -> str.matches("-?\\d+(\\.\\d+)?")) // 只保留数字格式的字符串
// .mapToDouble(Double::parseDouble) // 转换为double
// .max();
//
//root.put("剂量率", maxActualMeasurementRate);
//root.put("总剂量", maxPoint);
if (CollUtil.isNotEmpty(radiationProcessList)) {
radiationProcessList.forEach(radiationProcess -> {
String radiationDetail = radiationProcess.getRadiationDetail();
if (StringUtils.isNotBlank(radiationDetail)) {
RadiationMapDTO radiationMap = JSON.parseObject(radiationDetail, RadiationMapDTO.class);
List<RadiationDetailDTO> xgy = radiationMap.getXgy();
if (CollUtil.isNotEmpty(xgy)) {
extractJhb("小钴源", xgy, root);
}
List<RadiationDetailDTO> dgy = radiationMap.getDgy();
if (CollUtil.isNotEmpty(dgy)) {
extractJhb("大钴源", dgy, root);
}
List<RadiationDetailDTO> x = radiationMap.getX();
if (CollUtil.isNotEmpty(x)) {
extractJhb("X光机", x, root);
}
List<RadiationDetailDTO> electronics = radiationMap.getElectronics();
if (CollUtil.isNotEmpty(electronics)) {
extractJhb("电子加速器", electronics, root);
}
List<RadiationDetailDTO> proton = radiationMap.getProton();
if (CollUtil.isNotEmpty(proton)) {
extractJhb("质子加速器", proton, root);
}
root.put("剂量率", maxActualMeasurementRate);
root.put("总剂量", maxPoint);
}
});
}
return root;
}
private void extractJhb(String type, List<RadiationDetailDTO> detailDTOList, Map<String, Object> root) {
if (CollUtil.isEmpty(detailDTOList)) {
return;
}
String actualMeasurementRate = detailDTOList.stream().map(x -> x.getActualMeasurementRate()).filter(
point -> StringUtils.isNotBlank(point)).collect(Collectors.joining(","));
OptionalDouble maxMeasurementPoint = detailDTOList.stream().map(obj -> obj.getPoint()) // 获取point字段
.filter(point -> StringUtils.isNotBlank(point)).filter(str -> str.matches("-?\\d+(\\.\\d+)?")) // 只保留数字格式的字符串
.mapToDouble(Double::parseDouble) // 转换为double
.max();
String actualInjectionRate = detailDTOList.stream().map(x -> x.getActualInjectionRate()).filter(
point -> StringUtils.isNotBlank(point)).collect(Collectors.joining(","));
root.put(type + "剂量率", chooseStr(actualMeasurementRate, actualInjectionRate));
root.put(type + "总剂量", chooseStr(maxMeasurementPoint.getAsDouble() + "", ""));
}
@Override
public ExperimentDoc generate(String experimentId, String type) {
String version = DateUtil.format(new Date(), DatePattern.PURE_DATETIME_PATTERN);