From b609d9c71ab4de469c7de35e09b8c7c60e08bf30 Mon Sep 17 00:00:00 2001 From: chen <2710907404@qq.com> Date: Fri, 18 Apr 2025 09:45:15 +0800 Subject: [PATCH] =?UTF-8?q?20250417=20=E6=9B=B4=E6=96=B0=201.=E8=A7=A3?= =?UTF-8?q?=E5=86=B3=E6=9B=B4=E6=96=B0=E5=90=8E=E7=9A=84=E8=AE=A1=E7=AE=97?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../TestRecordSampleDataExpandController.java | 9 ----- .../TestSampleDataExpandConverter.java | 2 +- .../dto/TestSampleDataExpandDTO.java | 14 ++++++- .../TestRecordSampledataExpandService.java | 5 ++- .../impl/TestRecordSampleDataServiceImpl.java | 2 +- ...TestRecordSampledataExpandServiceImpl.java | 39 ++++++++++++------- .../vo/TestRecordSampleDataExpandVO.java | 2 +- .../inspection/vo/TestRecordSampleDataVO.java | 3 ++ 8 files changed, 46 insertions(+), 30 deletions(-) diff --git a/dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/controller/TestRecordSampleDataExpandController.java b/dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/controller/TestRecordSampleDataExpandController.java index 6c4b056..56322e7 100644 --- a/dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/controller/TestRecordSampleDataExpandController.java +++ b/dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/controller/TestRecordSampleDataExpandController.java @@ -37,13 +37,4 @@ public class TestRecordSampleDataExpandController { ); } - @ApiOperation("更新扩展数据") - @PutMapping("/update") - public R update(@RequestBody TestSampleDataExpandDTO updateDTO) { - if (StrUtil.isBlank(updateDTO.getId())) { - return R.failed("扩展数据id不能为空!"); - } - return R.ok(testRecordSampledataExpandService.updateBatchByDTO(Collections.singletonList(updateDTO), null)); - } - } diff --git a/dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/convert/TestSampleDataExpandConverter.java b/dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/convert/TestSampleDataExpandConverter.java index 3439a89..4d1eca1 100644 --- a/dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/convert/TestSampleDataExpandConverter.java +++ b/dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/convert/TestSampleDataExpandConverter.java @@ -25,7 +25,7 @@ public class TestSampleDataExpandConverter { testRecordSampleDataExpand.setTestDataId(dto.getTestDataId()); testRecordSampleDataExpand.setPeakArea(dto.getPeakArea()); testRecordSampleDataExpand.setFragmentRetTime(dto.getFragmentRetTime()); - testRecordSampleDataExpand.setQualitativeIonPair(dto.getQualitativeIonPair()); + testRecordSampleDataExpand.setIonAbundanceRatio(dto.getIonAbundanceRatio()); return testRecordSampleDataExpand; } diff --git a/dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/dto/TestSampleDataExpandDTO.java b/dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/dto/TestSampleDataExpandDTO.java index 477ed83..2eed94b 100644 --- a/dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/dto/TestSampleDataExpandDTO.java +++ b/dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/dto/TestSampleDataExpandDTO.java @@ -1,5 +1,6 @@ package digital.laboratory.platform.inspection.dto; +import digital.laboratory.platform.inspection.constant.TestRecordSampleDataConstant; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @@ -26,6 +27,15 @@ public class TestSampleDataExpandDTO { @ApiModelProperty(value = "碎片保留时间(仅对 NPS 实验有用),求具体样本保留时间 = 碎片保留时间的平均值", example = "3.75") private BigDecimal fragmentRetTime; - @ApiModelProperty(value = "定性离子对,生物案件使用", example = "m/z 100 > 50") - private String qualitativeIonPair; + @ApiModelProperty(value = "离子丰度比,常规毒品案件使用", example = "50") + private BigDecimal ionAbundanceRatio; + + /************************************* 自定义setter *******************************************/ + public void setIonAbundanceRatio(String ionAbundanceRatio) { + if (ionAbundanceRatio == null || ionAbundanceRatio.equals(TestRecordSampleDataConstant.INVALID_VALUE_STR)) { + this.ionAbundanceRatio = null; + } else { + this.ionAbundanceRatio = new BigDecimal(ionAbundanceRatio); + } + } } diff --git a/dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/service/TestRecordSampledataExpandService.java b/dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/service/TestRecordSampledataExpandService.java index 42a4666..73d78a1 100644 --- a/dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/service/TestRecordSampledataExpandService.java +++ b/dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/service/TestRecordSampledataExpandService.java @@ -47,8 +47,9 @@ public interface TestRecordSampledataExpandService extends IService dtoList, String testId); + Boolean updateBatchByDTO(List dtoList, String testId, String businessType); } 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 5991ab2..6a24277 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 @@ -413,7 +413,7 @@ public class TestRecordSampleDataServiceImpl extends ServiceImpl dto.getExpandList().stream()).collect(Collectors.toList()), testRecord.getId()); + return testRecordSampledataExpandService.updateBatchByDTO(dtoList.stream().flatMap(dto -> dto.getExpandList().stream()).collect(Collectors.toList()), testRecord.getId(), testRecord.getBusinessType()); } return false; } diff --git a/dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/service/impl/TestRecordSampledataExpandServiceImpl.java b/dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/service/impl/TestRecordSampledataExpandServiceImpl.java index fda04f1..8215dc4 100644 --- a/dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/service/impl/TestRecordSampledataExpandServiceImpl.java +++ b/dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/service/impl/TestRecordSampledataExpandServiceImpl.java @@ -149,17 +149,24 @@ public class TestRecordSampledataExpandServiceImpl extends ServiceImpl dtoList, String testId) { + public Boolean updateBatchByDTO(List dtoList, String testId, String businessType) { List expandList = TestSampleDataExpandConverter.dtoToEntityList(dtoList); if (super.updateBatchById(expandList)) { // CompletableFuture.runAsync(() -> { + boolean isNPSCase = businessType.equals(BusinessType.NPS_CASE.getBusinessType()); // 是否是常规毒品案件 List newExpandDatList = super.list(Wrappers.lambdaQuery() .in(TestRecordSampleDataExpand::getId, expandList.stream().map(TestRecordSampleDataExpand::getId).collect(Collectors.toList())) - .isNotNull(TestRecordSampleDataExpand::getPeakArea) + .and(wrapper -> + wrapper + .isNotNull(isNPSCase ? TestRecordSampleDataExpand::getIonAbundanceRatio : TestRecordSampleDataExpand::getPeakArea) + .or() + .eq(TestRecordSampleDataExpand::getBasePeak, true) + ) ); Map> expandDataGroupByDataId = getexpandDataGroup(testId, newExpandDatList); @@ -173,7 +180,6 @@ public class TestRecordSampledataExpandServiceImpl extends ServiceImpl stdDataExpandList = null; if (!isSTDSample) { TestRecordSampleData stdTestSampleData = testRecordSampleDataService.getOne(Wrappers.lambdaQuery().eq(TestRecordSampleData::getTestId, testRecordSampleData.getTestId()).eq(TestRecordSampleData::getCompoundName, testRecordSampleData.getCompoundName()).eq(TestRecordSampleData::getSampleType, TestRecordSampleDataConstant.SAMPLE_TYPE_STD)); @@ -181,7 +187,6 @@ public class TestRecordSampledataExpandServiceImpl extends ServiceImpl finalStdDataExpandList = stdDataExpandList; testRecordSampleData.setIsDetected(1); // 默认检出 - boolean isNPSCase = testRecord.getBusinessType().equals(BusinessType.NPS_CASE.getBusinessType()); // 是否是常规毒品案件 value.forEach(sampleDataExpand -> { if (isNPSCase) { calculateIonAbundanceRatioNormal(finalStdDataExpandList, sampleDataExpand); @@ -192,20 +197,25 @@ public class TestRecordSampledataExpandServiceImpl extends ServiceImpl> getexpandDataGroup(String testId, List newExpandDatList) { List stdTestDataIds = null; if (StrUtil.isNotBlank(testId)) { - List stdSampleDataList = testRecordSampleDataService.list(Wrappers.lambdaQuery().eq(TestRecordSampleData::getTestId, testId).eq(TestRecordSampleData::getSampleType, TestRecordSampleDataConstant.SAMPLE_TYPE_STD)); + List stdSampleDataList = testRecordSampleDataService.list(Wrappers.lambdaQuery() + .eq(TestRecordSampleData::getTestId, testId).eq(TestRecordSampleData::getSampleType, TestRecordSampleDataConstant.SAMPLE_TYPE_STD)); stdTestDataIds = stdSampleDataList.stream().map(TestRecordSampleData::getId).collect(Collectors.toList()); } Map> expandDataGroupByDataId = newExpandDatList.stream().collect(Collectors.groupingBy(TestRecordSampleDataExpand::getTestDataId, LinkedHashMap::new, Collectors.toList())); diff --git a/dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/vo/TestRecordSampleDataExpandVO.java b/dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/vo/TestRecordSampleDataExpandVO.java index 7e5007e..922eb18 100644 --- a/dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/vo/TestRecordSampleDataExpandVO.java +++ b/dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/vo/TestRecordSampleDataExpandVO.java @@ -79,7 +79,7 @@ public class TestRecordSampleDataExpandVO { if (getBasePeak()) { return TestRecordSampleDataConstant.INVALID_VALUE_STR; } - return "±" + maxAllowedIonRatioDeviation; + return maxAllowedIonRatioDeviation == null ? null : "±" + maxAllowedIonRatioDeviation; } } diff --git a/dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/vo/TestRecordSampleDataVO.java b/dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/vo/TestRecordSampleDataVO.java index 263e556..7888900 100644 --- a/dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/vo/TestRecordSampleDataVO.java +++ b/dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/vo/TestRecordSampleDataVO.java @@ -102,6 +102,9 @@ public class TestRecordSampleDataVO { * @return */ public String getIonAbundanceRatioError() { + if (sampleType.equals(TestRecordSampleDataConstant.SAMPLE_TYPE_STD)) { + return TestRecordSampleDataConstant.INVALID_VALUE_STR; + } return expandList != null && expandList.size() > 1 ? expandList.get(1).getIonAbundanceRatioError() : null; }