From 3d6752a6440dde2f1659f72f057e82f3728b3c8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=B5=B7=E8=88=AA?= <11918452+yang-haihang@user.noreply.gitee.com> Date: Sun, 27 Apr 2025 09:59:31 +0800 Subject: [PATCH] update --- .../impl/InspectRecordServiceImpl.java | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/service/impl/InspectRecordServiceImpl.java b/dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/service/impl/InspectRecordServiceImpl.java index e8c11c0..d7f1baa 100644 --- a/dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/service/impl/InspectRecordServiceImpl.java +++ b/dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/service/impl/InspectRecordServiceImpl.java @@ -296,7 +296,7 @@ public class InspectRecordServiceImpl implements InspectRecordService { vo.setPIonAbundanceRatio(expand.getIonAbundanceRatio() != null ? expand.getIonAbundanceRatio().setScale(2, RoundingMode.HALF_UP).toString() : "/"); vo.setPIonAbundanceRatioError(expand.getIonAbundanceRatioError() != null ? expand.getIonAbundanceRatioError().setScale(2, RoundingMode.HALF_UP).toString() : "/"); vo.setPIonAbundanceRatioWithinError(expand.getIonAbundanceRatioWithinError() != null ? expand.getIonAbundanceRatioWithinError() : "/"); - break; // 只取第一个符合条件的扩展数据 + break; // 只取第一个符合条件的扩展数据· } } } @@ -333,13 +333,14 @@ public class InspectRecordServiceImpl implements InspectRecordService { data.put("inspectOpinion", this.buildInspectOpinion(testRecordSampleDataService.lambdaQuery() .eq(TestRecordSampleData::getTestId, testRecord.getId()) .eq(TestRecordSampleData::getSampleType, "Analyte").list())); + // 构建称量数据 + this.createWeighingData(data); return data; } public Map buildInVitroRecordData(EntrustInfo entrustInfo, TestRecord testRecord, Map data) { - // 1️⃣ 按化合物名称分组 TestRecordSampleData List dataList = testRecordSampleDataService @@ -1200,4 +1201,19 @@ public class InspectRecordServiceImpl implements InspectRecordService { // 使用 ";" 连接所有描述,并返回最终的检测意见字符串 return String.join(";", finalSentences); } + + public void createWeighingData(Map data) { + List candidates = new ArrayList<>(); + for (int j = 1; j <= 3; j++) { + for (int i = 1995; i <= 2005; i++) { + if (i != 2000) { + candidates.add(i); + } + } + Random random = new Random(); + int value = candidates.get(random.nextInt(candidates.size())); + double result = value / 100.0; + data.put("weightData" + j, result); + } + } }