From cd25c94b0785c1d1acf70d410e6134cd44f26f7e Mon Sep 17 00:00:00 2001 From: chen <2710907404@qq.com> Date: Wed, 26 Mar 2025 17:57:43 +0800 Subject: [PATCH] =?UTF-8?q?20250326=20=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../TestRecordSampleDataController.java | 5 ++- .../mapper/TestRecordSampleDataMapper.java | 7 ++++ .../service/TestRecordSampleDataService.java | 3 +- .../impl/TestRecordSampleDataServiceImpl.java | 40 ++++++++++--------- ...TestRecordSampledataExpandServiceImpl.java | 8 +++- .../inspection/vo/TestRecordSampleDataVO.java | 5 +++ .../mapper/TestRecordSampleDataMapper.xml | 7 ++++ 7 files changed, 52 insertions(+), 23 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 96f692e..79aa337 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 @@ -17,6 +17,7 @@ import digital.laboratory.platform.inspection.service.TestRecordSampleDataServic import digital.laboratory.platform.inspection.utils.TestDataFileUtil; import digital.laboratory.platform.inspection.utils.datafile.hair.HairSewageCompoundData; import digital.laboratory.platform.inspection.utils.datafile.nps.NPSDataFileStruct; +import digital.laboratory.platform.inspection.vo.TestRecordSampleDataVO; import digital.laboratory.platform.inspection.vo.TestResultBusinessVO; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; @@ -186,8 +187,8 @@ public class TestRecordSampleDataController { @PostMapping("/getAnalysisTestResultPage") @ApiOperation(value = "分页查询-获取实验结果", notes = "分页查询-获取实验结果") - public R> getAnalysisTestResultPage(@RequestBody @Valid AnalysisTestResultPageQuery query) { - Page page = null; + public R> getAnalysisTestResultPage(@RequestBody @Valid AnalysisTestResultPageQuery query) { + IPage page = null; try { page = testRecordSampleDataService.getSampleTestDataByTestIdPage(query); } catch (Exception e) { diff --git a/dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/mapper/TestRecordSampleDataMapper.java b/dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/mapper/TestRecordSampleDataMapper.java index ae49aa3..3b8b335 100644 --- a/dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/mapper/TestRecordSampleDataMapper.java +++ b/dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/mapper/TestRecordSampleDataMapper.java @@ -34,6 +34,13 @@ public interface TestRecordSampleDataMapper extends BaseMapper queryTestRecordSampleDataVOList(@Param(Constants.WRAPPER) Wrapper wrapper); + /** + * 查询检验数据vo类,会携带扩展数据的list属性 + * @param wrapper + * @return + */ + IPage queryTestRecordSampleDataVOPage(Page page, @Param(Constants.WRAPPER) Wrapper wrapper); + /** * 通过业务id查询委托表、筛查表、任务表 * @param qw 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 a54ab42..a58102a 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.query.AnalysisTestResultPageQuery; import digital.laboratory.platform.inspection.query.QueryTestResultPageQuery; import digital.laboratory.platform.inspection.utils.datafile.hair.HairSewageCompoundData; import digital.laboratory.platform.inspection.utils.datafile.nps.NPSDataFileStruct; +import digital.laboratory.platform.inspection.vo.TestRecordSampleDataVO; import digital.laboratory.platform.inspection.vo.TestResultBusinessVO; import javax.servlet.http.HttpServletRequest; @@ -63,7 +64,7 @@ public interface TestRecordSampleDataService extends IService getSampleTestDataByTestIdPage(AnalysisTestResultPageQuery pageDTO); + IPage getSampleTestDataByTestIdPage(AnalysisTestResultPageQuery pageDTO); /** * 分页查询 获取审核的任务检验数据, header 是自定义头 data 是分页对象 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 3e8cb2f..bfc2997 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 @@ -270,25 +270,25 @@ public class TestRecordSampleDataServiceImpl extends ServiceImpl getSampleTestDataByTestIdPage(AnalysisTestResultPageQuery pageDTO) { - Page page = this.page(new Page<>(pageDTO.getCurrent(), pageDTO.getSize()), Wrappers.lambdaQuery() + public IPage getSampleTestDataByTestIdPage(AnalysisTestResultPageQuery pageDTO) { + IPage page = baseMapper.queryTestRecordSampleDataVOPage(new Page<>(pageDTO.getCurrent(), pageDTO.getSize()), Wrappers.lambdaQuery() .eq(TestRecordSampleData::getTestId, pageDTO.getTestId()) .orderByDesc(TestRecordSampleData::getCompoundName) .orderByDesc(TestRecordSampleData::getSampleNo)); - List retList = new ArrayList<>(); - switch (BusinessType.getBusinessTypeByType(pageDTO.getType())) { - case NPS_CASE: - // NPS的数据分析 - extractedSampleTestData(page.getRecords(), retList, NPSCaseTestDataDto.class); - case BOINT_CASE: - extractedSampleTestData(page.getRecords(), retList, HairSewageDataDto.class); - } - Page resultPage = new Page<>(); - BeanUtils.copyProperties(page, resultPage, "records"); - // z最后转换类型 -// TypeCasting(retList); - resultPage.setRecords(retList); - return resultPage; +// List retList = new ArrayList<>(); +// switch (BusinessType.getBusinessTypeByType(pageDTO.getType())) { +// case NPS_CASE: +// // NPS的数据分析 +// extractedSampleTestData(page.getRecords(), retList, NPSCaseTestDataDto.class); +// case BOINT_CASE: +// extractedSampleTestData(page.getRecords(), retList, HairSewageDataDto.class); +// } +// Page resultPage = new Page<>(); +// BeanUtils.copyProperties(page, resultPage, "records"); +// // z最后转换类型 +//// TypeCasting(retList); +// resultPage.setRecords(retList); + return page; } /** @@ -424,9 +424,13 @@ public class TestRecordSampleDataServiceImpl extends ServiceImpl testRecordSampleDataList = TestRecordSampleDataConverter.dtoToEntityList(dtoList); if (super.updateBatchById(testRecordSampleDataList)) { // 开启异步执行 -// CompletableFuture.runAsync(() -> { + CompletableFuture.runAsync(() -> { testRecordSampleDataList.forEach(item -> calculateInspectData(item.getId())); -// }); + }).exceptionally(e -> { + log.error("计算保留时间以及相对误差出错!"); + e.printStackTrace(); + return null; + }); return testRecordSampledataExpandService.updateBatchByDTO(dtoList.stream().flatMap(dto -> dto.getExpandList().stream()).collect(Collectors.toList())); } 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 9070a3c..9bc6aa0 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 @@ -160,7 +160,7 @@ public class TestRecordSampledataExpandServiceImpl extends ServiceImpl dtoList) { List expandList = TestSampleDataExpandConverter.dtoToEntityList(dtoList); if (super.updateBatchById(expandList)) { -// CompletableFuture.runAsync(() -> { + CompletableFuture.runAsync(() -> { List newExpandDatList = super.list(Wrappers.lambdaQuery() .in(TestRecordSampleDataExpand::getId, expandList.stream().map(TestRecordSampleDataExpand::getId).collect(Collectors.toList())) .isNotNull(TestRecordSampleDataExpand::getPeakArea) @@ -202,7 +202,11 @@ public class TestRecordSampledataExpandServiceImpl extends ServiceImpl { + log.error("离子丰度比相关计算出错!"); + e.printStackTrace(); + return null; + }); return Boolean.TRUE; } return Boolean.FALSE; 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 2e7e752..3e804e5 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 @@ -1,5 +1,6 @@ package digital.laboratory.platform.inspection.vo; +import digital.laboratory.platform.inspection.constant.TestRecordSampleDataConstant; import digital.laboratory.platform.inspection.entity.TestRecordSampleDataExpand; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; @@ -71,4 +72,8 @@ public class TestRecordSampleDataVO { @ApiModelProperty("样本检验扩展数据列表") private List expandList; + + public String getIsDetected() { + return isDetected.equals(1) ? TestRecordSampleDataConstant.IS : TestRecordSampleDataConstant.NO; + } } diff --git a/dlp-drugtesting-biz/src/main/resources/mapper/TestRecordSampleDataMapper.xml b/dlp-drugtesting-biz/src/main/resources/mapper/TestRecordSampleDataMapper.xml index a2aea17..7810066 100644 --- a/dlp-drugtesting-biz/src/main/resources/mapper/TestRecordSampleDataMapper.xml +++ b/dlp-drugtesting-biz/src/main/resources/mapper/TestRecordSampleDataMapper.xml @@ -87,6 +87,13 @@ ${ew.customSqlSegment} + + SELECT T.id,