diff --git a/physical-base-core/src/main/java/org/jeecg/common/util/DateUtils.java b/physical-base-core/src/main/java/org/jeecg/common/util/DateUtils.java index ee2fd26..4d074c8 100644 --- a/physical-base-core/src/main/java/org/jeecg/common/util/DateUtils.java +++ b/physical-base-core/src/main/java/org/jeecg/common/util/DateUtils.java @@ -437,10 +437,10 @@ public class DateUtils extends PropertyEditorSupport { } public static String formatDate(String dateStr, String pattern) { - if (StringUtils.hasText(dateStr)) { + if (!StringUtils.hasText(dateStr)) { return ""; } - if (StringUtils.hasText(pattern)) { + if (!StringUtils.hasText(pattern)) { return dateStr; } try { diff --git a/physical-module-system/physical-system-biz/src/main/java/org/jeecg/modules/database/service/impl/ExperimentDocServiceImpl.java b/physical-module-system/physical-system-biz/src/main/java/org/jeecg/modules/database/service/impl/ExperimentDocServiceImpl.java index a9a7b50..4662e3b 100755 --- a/physical-module-system/physical-system-biz/src/main/java/org/jeecg/modules/database/service/impl/ExperimentDocServiceImpl.java +++ b/physical-module-system/physical-system-biz/src/main/java/org/jeecg/modules/database/service/impl/ExperimentDocServiceImpl.java @@ -649,20 +649,66 @@ public class ExperimentDocServiceImpl extends ServiceImpl 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 xgy = radiationMap.getXgy(); + if (CollUtil.isNotEmpty(xgy)) { + extractJhb("小钴源", xgy, root); + } + List dgy = radiationMap.getDgy(); + if (CollUtil.isNotEmpty(dgy)) { + extractJhb("大钴源", dgy, root); + } + List x = radiationMap.getX(); + if (CollUtil.isNotEmpty(x)) { + extractJhb("X光机", x, root); + } + List electronics = radiationMap.getElectronics(); + if (CollUtil.isNotEmpty(electronics)) { + extractJhb("电子加速器", electronics, root); + } + List proton = radiationMap.getProton(); + if (CollUtil.isNotEmpty(proton)) { + extractJhb("质子加速器", proton, root); + } - root.put("剂量率", maxActualMeasurementRate); - root.put("总剂量", maxPoint); + } + }); + } return root; } + private void extractJhb(String type, List detailDTOList, Map 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); diff --git a/templates/fzsyjhb.docx b/templates/fzsyjhb.docx index 2e8e777..ed4dbc4 100644 Binary files a/templates/fzsyjhb.docx and b/templates/fzsyjhb.docx differ