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 bfc2997..869eb0b 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 @@ -423,6 +423,10 @@ public class TestRecordSampleDataServiceImpl extends ServiceImpl dtoList) { List testRecordSampleDataList = TestRecordSampleDataConverter.dtoToEntityList(dtoList); if (super.updateBatchById(testRecordSampleDataList)) { + TestRecord testRecord = testRecordService.getById(dtoList.get(0).getTestId()); + if (testRecord.getStatus().compareTo(2) < 0) { + testRecordService.update(Wrappers.lambdaUpdate().eq(TestRecord::getId, dtoList.get(0).getTestId()).set(TestRecord::getStatus, 2)); + } // 开启异步执行 CompletableFuture.runAsync(() -> { testRecordSampleDataList.forEach(item -> calculateInspectData(item.getId())); 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 new file mode 100644 index 0000000..956d20e --- /dev/null +++ b/dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/vo/TestRecordSampleDataExpandVO.java @@ -0,0 +1,61 @@ +package digital.laboratory.platform.inspection.vo; + +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.math.BigDecimal; +import java.math.RoundingMode; + +/** + * 样本检验数据的扩展信息 + * @TableName b_test_record_sampledata_expand + */ +@Data +@TableName(autoResultMap = true) +@ApiModel(value = "TestRecordSampleDataExpandVO", description = "样本检验数据的扩展信息 VO类") // 定义模型描述 +public class TestRecordSampleDataExpandVO { + + @ApiModelProperty(value = "主键标识", example = "123456") + private String id; + + @ApiModelProperty(value = "关联的实验数据id", example = "testData_001") + private String testDataId; + + @ApiModelProperty(value = "峰面积", example = "12345.67") + private BigDecimal peakArea; + + @ApiModelProperty(value = "是否是基峰, 1 是 | 0 不是", example = "true") + private Boolean basePeak; + + @ApiModelProperty(value = "离子丰度比", example = "0.85") + private BigDecimal ionAbundanceRatio; + + @ApiModelProperty(value = "离子丰度比相对偏差(%)", + example = "5.2", notes = "计算公式:(目标物离子丰度比 - 标准物离子丰度比) / 标准物质离子丰度比 * 100") + private BigDecimal ionAbundanceRatioError; + + @ApiModelProperty(value = "离子丰度比偏差是否在误差范围内", example = "是") + private String ionAbundanceRatioWithinError; + + @ApiModelProperty(value = "碎片保留时间,仅对nps实验有用", example = "2.34") + private BigDecimal fragmentRetTime; + + @ApiModelProperty(value = "质荷比(m/z),nps案件", example = "150.2") + private BigDecimal massToChargeRatio; + + @ApiModelProperty(value = "定性离子对,生物案件使用", example = "C6H12O6") + private String qualitativeIonPair; + + /************************ 处理需要特定格式返回的字段 **************************/ + + public BigDecimal getIonAbundanceRatio() { + return ionAbundanceRatio != null ? ionAbundanceRatio.setScale(2, RoundingMode.HALF_UP) : null; + } + + public BigDecimal getIonAbundanceRatioError() { + return ionAbundanceRatioError != null ? ionAbundanceRatioError.setScale(2, RoundingMode.HALF_UP) : null; + } +} + 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 42cb248..5c88d0e 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 @@ -6,6 +6,8 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; +import java.math.BigDecimal; +import java.math.RoundingMode; import java.util.List; /** @@ -41,7 +43,7 @@ public class TestRecordSampleDataVO { private String rtTimeWithinError; @ApiModelProperty(value = "保留时间相对误差(%)", example = "1.2") - private Double rtTimeError; + private BigDecimal rtTimeError; @ApiModelProperty(value = "检材保留时间(min)", example = "2.5") private Double targetRtTime; @@ -71,12 +73,24 @@ public class TestRecordSampleDataVO { private String whetherCheckOut; @ApiModelProperty("样本检验扩展数据列表") - private List expandList; - + private List expandList; + + /********************************* 对于返回到前端的数据进行处理 *****************************************/ + /** + * 获取检测状态。 + * + * @return 如果检测状态为已检测,则返回TestRecordSampleDataConstant.IS; + * 如果检测状态为未检测,则返回TestRecordSampleDataConstant.NO; + * 如果检测状态为空,则返回null。 + */ public String getIsDetected() { if (isDetected == null) { return null; } return isDetected.equals(1) ? TestRecordSampleDataConstant.IS : TestRecordSampleDataConstant.NO; } + + public BigDecimal getRtTimeError() { + return rtTimeError != null ? rtTimeError.setScale(3, RoundingMode.HALF_UP) : null; + } } diff --git a/dlp-drugtesting-biz/src/main/resources/mapper/TestRecordSampleDataExpandMapper.xml b/dlp-drugtesting-biz/src/main/resources/mapper/TestRecordSampleDataExpandMapper.xml index 2721ac7..483e220 100644 --- a/dlp-drugtesting-biz/src/main/resources/mapper/TestRecordSampleDataExpandMapper.xml +++ b/dlp-drugtesting-biz/src/main/resources/mapper/TestRecordSampleDataExpandMapper.xml @@ -21,6 +21,19 @@ + + + + + + + + + + + + + exp.exp_id, exp.test_data_id, @@ -45,7 +58,7 @@ LEFT JOIN b_test_record_sampledata test ON exp.test_data_id = test.id - SELECT FROM b_test_record_sampledata_expand exp WHERE exp.test_data_id = #{testDataId} diff --git a/dlp-drugtesting-biz/src/main/resources/mapper/TestRecordSampleDataMapper.xml b/dlp-drugtesting-biz/src/main/resources/mapper/TestRecordSampleDataMapper.xml index 7810066..11090c7 100644 --- a/dlp-drugtesting-biz/src/main/resources/mapper/TestRecordSampleDataMapper.xml +++ b/dlp-drugtesting-biz/src/main/resources/mapper/TestRecordSampleDataMapper.xml @@ -49,7 +49,7 @@