From 2f952f30a0a7a55330fc96e16a68fa1111e0771f 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: Tue, 18 Mar 2025 11:11:46 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=BA=86=E4=B8=80?= =?UTF-8?q?=E4=BA=9B=E9=80=82=E9=85=8D=E8=B4=B5=E9=98=B3=E5=B8=82=E5=B1=80?= =?UTF-8?q?=E7=9A=84=E6=96=B0=E5=AD=97=E6=AE=B5=EF=BC=8C=E7=8E=B0=E5=9C=A8?= =?UTF-8?q?=E6=88=91=E4=BB=AC=E4=B8=8D=E9=9C=80=E8=A6=81=E5=AF=BC=E5=85=A5?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=EF=BC=8C=E9=80=9A=E8=BF=87=E6=89=8B=E5=8A=A8?= =?UTF-8?q?=E5=BD=95=E5=85=A5=E6=95=B0=E6=8D=AE=E7=9A=84=E6=96=B9=E5=BC=8F?= =?UTF-8?q?=E6=9D=A5=E8=BF=9B=E8=A1=8C=E6=A3=80=E9=AA=8C=E5=88=86=E6=9E=90?= =?UTF-8?q?=E4=BB=A5=E5=8F=8A=E7=94=9F=E6=88=90=E6=A3=80=E9=AA=8C=E8=AE=B0?= =?UTF-8?q?=E5=BD=95=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../TestRecordSampleDataController.java | 10 ++ .../entity/TestRecordSampleData.java | 4 + .../service/TestRecordSampleDataService.java | 7 ++ .../impl/TestRecordReagentServiceImpl.java | 27 ++++- .../impl/TestRecordSampleDataServiceImpl.java | 113 ++++++++++++++++-- .../service/impl/TestRecordServiceImpl.java | 12 +- 6 files changed, 154 insertions(+), 19 deletions(-) diff --git a/dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/controller/TestRecordSampleDataController.java b/dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/controller/TestRecordSampleDataController.java index a58d8b7..01f4f23 100644 --- a/dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/controller/TestRecordSampleDataController.java +++ b/dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/controller/TestRecordSampleDataController.java @@ -299,4 +299,14 @@ public class TestRecordSampleDataController { }); return R.ok("更新成功!"); } + + @PutMapping("/updateData") + public R updateData(@RequestBody TestRecordSampleData data) { + + TestRecordSampleData sampleData = testRecordSampleDataService.updateData(data); + + return sampleData != null ? R.ok(sampleData, "修改成功!") : R.failed("修改失败!"); + + } + } diff --git a/dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/entity/TestRecordSampleData.java b/dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/entity/TestRecordSampleData.java index 96cd573..b38001a 100644 --- a/dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/entity/TestRecordSampleData.java +++ b/dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/entity/TestRecordSampleData.java @@ -48,6 +48,10 @@ public class TestRecordSampleData extends BaseEntity { private String compoundCnName;//检测的化合物的中文名字 + private double mainArea;//主要产物峰面积 + + private double minorArea;//次要产物峰面积 + @ApiModelProperty("任务数据审核状态, 状态:\n" + "0 待审核,\n" + "1 已审核,\n" + diff --git a/dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/service/TestRecordSampleDataService.java b/dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/service/TestRecordSampleDataService.java index e7d21a8..b1fb9d0 100644 --- a/dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/service/TestRecordSampleDataService.java +++ b/dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/service/TestRecordSampleDataService.java @@ -11,6 +11,7 @@ import digital.laboratory.platform.inspection.entity.TestRecordSampleData; import digital.laboratory.platform.inspection.utils.datafile.hair.HairSewageCompoundData; import digital.laboratory.platform.inspection.utils.datafile.nps.NPSDataFileStruct; import digital.laboratory.platform.inspection.vo.TestResultBusinessVO; +import digital.laboratory.platform.inspetion.api.entity.TestRecord; import javax.servlet.http.HttpServletRequest; import java.util.List; @@ -156,6 +157,12 @@ public interface TestRecordSampleDataService extends IService getStdSampleTestDataByTestId(String testId); diff --git a/dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/service/impl/TestRecordReagentServiceImpl.java b/dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/service/impl/TestRecordReagentServiceImpl.java index df22b8c..52c1e67 100644 --- a/dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/service/impl/TestRecordReagentServiceImpl.java +++ b/dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/service/impl/TestRecordReagentServiceImpl.java @@ -9,10 +9,12 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import digital.laboratory.platform.inspection.dto.TestRecordArgumentDto; import digital.laboratory.platform.inspection.entity.TestRecordReagent; import digital.laboratory.platform.inspection.constant.TestRecordArgumentType; +import digital.laboratory.platform.inspection.entity.TestRecordSampleData; import digital.laboratory.platform.inspection.mapper.TestRecordMapper; import digital.laboratory.platform.inspection.mapper.TestRecordReagentMapper; import digital.laboratory.platform.inspection.mapper.TestTemplateMapper; import digital.laboratory.platform.inspection.service.TestRecordReagentService; +import digital.laboratory.platform.inspection.service.TestRecordSampleDataService; import digital.laboratory.platform.inspection.service.TestRecordService; import digital.laboratory.platform.inspection.service.TestTemplateService; import digital.laboratory.platform.inspetion.api.vo.TestRecordVo; @@ -48,13 +50,16 @@ public class TestRecordReagentServiceImpl extends ServiceImpl reagentConsumablesList = testRecordVo.getReagentConsumablesList(); + List reagentConsumablesList = testRecordVo.getReagentConsumablesList(); if (reagentConsumablesList == null || reagentConsumablesList.size() == 0) { //下面两步是为了能使参数正常查询 reagentConsumablesList = new ArrayList<>(); @@ -237,6 +246,7 @@ public class TestRecordReagentServiceImpl extends ServiceImpl 1) { - stringBuilder.append("至").append(value.get(value.size() - 1).getOrderNo()).append("号"); - } - stringBuilder.append("检材") - .append(first.getIsDetected() == 1 ? TestRecordSampleDataConstant.CHECK_OUT : TestRecordSampleDataConstant.NOT_CHECK_OUT) - .append(first.getCompoundName()) - .append("\n"); + if (value.size() > 1) { + stringBuilder.append("至").append(value.get(value.size() - 1).getOrderNo()).append("号"); + } + stringBuilder.append("检材") + .append(first.getIsDetected() == 1 ? TestRecordSampleDataConstant.CHECK_OUT : TestRecordSampleDataConstant.NOT_CHECK_OUT) + .append(first.getCompoundName()) + .append("\n"); }); } else { dataMap.forEach((key, value) -> { @@ -927,7 +926,7 @@ public class TestRecordSampleDataServiceImpl extends ServiceImpl testRecordSampleDataList = buildSampleDataFromNps(npsDataFileStructList, testId);//构造实验数据 testRecordService.update(Wrappers.lambdaUpdate().eq(TestRecord::getId, testId).set(TestRecord::getStatus, 2)); - return true; + return true; // } catch (Exception err) { // log.info("程序执行异常{}", err.getMessage()); // err.printStackTrace(); @@ -1562,6 +1561,7 @@ public class TestRecordSampleDataServiceImpl extends ServiceImpl sampleIdList = testRecord.getSampleTestList(); + + // 根据样本ID列表查询样本信息列表 + List sampleInfos = sampleInfoService.list(Wrappers.lambdaQuery() + .in(SampleInfo::getId, sampleIdList)); + + // 用于存储生成的测试记录样本数据的列表 + ArrayList sampleDataList = new ArrayList<>(); + + // 创建一个标准样本数据对象 + TestRecordSampleData data = new TestRecordSampleData(); + // 设置化合物名称 + data.setCompoundName(compoundName); + // 设置样本编号,格式为 "STD-" 加上化合物名称 + data.setSampleNo("STD-" + compoundName); + // 设置样本类型为 "STD" + data.setSampleType("STD"); + // 设置样本名称,格式为 "STD-" 加上化合物名称 + data.setName("STD-" + compoundName); + // 设置样本状态为 0 + data.setStatus(0); + // 生成一个32位的大写UUID作为样本数据ID + data.setId(IdWorker.get32UUID().toUpperCase()); + + // 将标准样本数据添加到样本数据列表中 + sampleDataList.add(data); + + // 遍历样本信息列表,为每个样本创建对应的测试记录样本数据 + sampleInfos.forEach(item -> { + TestRecordSampleData sampleData = new TestRecordSampleData(); + // 设置化合物名称 + data.setCompoundName(compoundName); + // 设置样本编号为样本的受理编号 + data.setSampleNo(item.getAcceptNo()); + // 设置样本类型为 "Analyte" + data.setSampleType("Analyte"); + // 设置样本名称为样本的受理编号 + data.setName(item.getAcceptNo()); + // 设置样本状态为 0 + data.setStatus(0); + // 生成一个32位的大写UUID作为样本数据ID + data.setId(IdWorker.get32UUID().toUpperCase()); + // 将样本数据添加到样本数据列表中 + sampleDataList.add(data); + }); + } + + /** + * 自动删除指定测试记录和化合物名称对应的测试记录样本数据 + * + * @param testId 测试记录的ID + * @param compoundName 化合物名称 + * @return 如果删除成功返回 true,否则返回 false + */ + @Override + public boolean autoDelData(String testId, String compoundName) { + // 根据测试记录ID和化合物名称删除对应的测试记录样本数据 + return this.remove(Wrappers.lambdaQuery() + .eq(TestRecordSampleData::getTestId, testId) + .eq(TestRecordSampleData::getCompoundName, compoundName)); + } + + @Override + public TestRecordSampleData updateData(TestRecordSampleData data) { + if (this.getById(data.getId()) == null) { + throw new RuntimeException("数据不存在"); + } + String compoundName = data.getCompoundName(); + + TestRecordSampleData std = this.getOne(Wrappers.lambdaQuery() + .eq(TestRecordSampleData::getCompoundName, compoundName) + .eq(TestRecordSampleData::getTestId, data.getTestId()) + .eq(TestRecordSampleData::getSampleType, "STD")); + + if (data.getMainArea() != 0.0 && + data.getMinorArea() != 0.0 && + data.getTargetRtTime() != 0.0 && + std.getMainArea() != 0.0 && + std.getMinorArea() != 0.0 && + std.getTargetRtTime() != 0.0) { + } + return this.updateById(data) ? data : null; + } } diff --git a/dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/service/impl/TestRecordServiceImpl.java b/dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/service/impl/TestRecordServiceImpl.java index faefc52..8965b8a 100644 --- a/dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/service/impl/TestRecordServiceImpl.java +++ b/dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/service/impl/TestRecordServiceImpl.java @@ -1336,12 +1336,12 @@ public class TestRecordServiceImpl extends ServiceImpl 0) { - // 删除之前上传的 - JSONObject oldObject = testAtlas.getJSONObject(0); - ossFile.fileDelete(oldObject.getString("path")); - testAtlas = new JSONArray(); - } +// if (testAtlas.size() > 0) { +// // 删除之前上传的 +// JSONObject oldObject = testAtlas.getJSONObject(0); +// ossFile.fileDelete(oldObject.getString("path")); +// testAtlas = new JSONArray(); +// } JSONObject jsonObject = new JSONObject(); jsonObject.put("fileId", fileId); jsonObject.put("fileName", fileName); From 83244629be244973ca5180405a4f2a9dd50d8b3b 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: Tue, 18 Mar 2025 11:14:45 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=BA=86=E4=B8=80?= =?UTF-8?q?=E4=BA=9B=E9=80=82=E9=85=8D=E8=B4=B5=E9=98=B3=E5=B8=82=E5=B1=80?= =?UTF-8?q?=E7=9A=84=E6=96=B0=E5=AD=97=E6=AE=B5=EF=BC=8C=E7=8E=B0=E5=9C=A8?= =?UTF-8?q?=E6=88=91=E4=BB=AC=E4=B8=8D=E9=9C=80=E8=A6=81=E5=AF=BC=E5=85=A5?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=EF=BC=8C=E9=80=9A=E8=BF=87=E6=89=8B=E5=8A=A8?= =?UTF-8?q?=E5=BD=95=E5=85=A5=E6=95=B0=E6=8D=AE=E7=9A=84=E6=96=B9=E5=BC=8F?= =?UTF-8?q?=E6=9D=A5=E8=BF=9B=E8=A1=8C=E6=A3=80=E9=AA=8C=E5=88=86=E6=9E=90?= =?UTF-8?q?=E4=BB=A5=E5=8F=8A=E7=94=9F=E6=88=90=E6=A3=80=E9=AA=8C=E8=AE=B0?= =?UTF-8?q?=E5=BD=95=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../inspection/entity/TestRecordSampleData.java | 8 ++++---- .../impl/TestRecordSampleDataServiceImpl.java | 13 +++++++------ 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/entity/TestRecordSampleData.java b/dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/entity/TestRecordSampleData.java index b38001a..47beed0 100644 --- a/dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/entity/TestRecordSampleData.java +++ b/dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/entity/TestRecordSampleData.java @@ -34,9 +34,9 @@ public class TestRecordSampleData extends BaseEntity { private String rtTimeWithinError;//保留时间是否在误差范围 ±1 以内 - private double targetRtTime;//目标物保留时间 + private Double targetRtTime;//目标物保留时间 - private double stdRtTime;//标准物保留时间 + private Double stdRtTime;//标准物保留时间 private int isDetected;//是否检出目标化合物 @@ -48,9 +48,9 @@ public class TestRecordSampleData extends BaseEntity { private String compoundCnName;//检测的化合物的中文名字 - private double mainArea;//主要产物峰面积 + private Double mainArea;//主要产物峰面积 - private double minorArea;//次要产物峰面积 + private Double minorArea;//次要产物峰面积 @ApiModelProperty("任务数据审核状态, 状态:\n" + "0 待审核,\n" + diff --git a/dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/service/impl/TestRecordSampleDataServiceImpl.java b/dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/service/impl/TestRecordSampleDataServiceImpl.java index 92dceda..407371f 100644 --- a/dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/service/impl/TestRecordSampleDataServiceImpl.java +++ b/dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/service/impl/TestRecordSampleDataServiceImpl.java @@ -1998,12 +1998,13 @@ public class TestRecordSampleDataServiceImpl extends ServiceImpl