|
|
@ -150,16 +150,23 @@ public class TestRecordSampledataExpandServiceImpl extends ServiceImpl<TestRecor |
|
|
|
* |
|
|
|
* |
|
|
|
* @param dtoList |
|
|
|
* @param dtoList |
|
|
|
* @param testId 这里实验id之所以需要是因为如果当前更新的也有标准品的,则应该先计算标准品的,避免计算样本检测的空指针异常 |
|
|
|
* @param testId 这里实验id之所以需要是因为如果当前更新的也有标准品的,则应该先计算标准品的,避免计算样本检测的空指针异常 |
|
|
|
|
|
|
|
* @param businessType |
|
|
|
* @return |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public Boolean updateBatchByDTO(List<TestSampleDataExpandDTO> dtoList, String testId) { |
|
|
|
public Boolean updateBatchByDTO(List<TestSampleDataExpandDTO> dtoList, String testId, String businessType) { |
|
|
|
List<TestRecordSampleDataExpand> expandList = TestSampleDataExpandConverter.dtoToEntityList(dtoList); |
|
|
|
List<TestRecordSampleDataExpand> expandList = TestSampleDataExpandConverter.dtoToEntityList(dtoList); |
|
|
|
if (super.updateBatchById(expandList)) { |
|
|
|
if (super.updateBatchById(expandList)) { |
|
|
|
// CompletableFuture.runAsync(() -> {
|
|
|
|
// CompletableFuture.runAsync(() -> {
|
|
|
|
|
|
|
|
boolean isNPSCase = businessType.equals(BusinessType.NPS_CASE.getBusinessType()); // 是否是常规毒品案件
|
|
|
|
List<TestRecordSampleDataExpand> newExpandDatList = super.list(Wrappers.<TestRecordSampleDataExpand>lambdaQuery() |
|
|
|
List<TestRecordSampleDataExpand> newExpandDatList = super.list(Wrappers.<TestRecordSampleDataExpand>lambdaQuery() |
|
|
|
.in(TestRecordSampleDataExpand::getId, expandList.stream().map(TestRecordSampleDataExpand::getId).collect(Collectors.toList())) |
|
|
|
.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<String, List<TestRecordSampleDataExpand>> expandDataGroupByDataId = getexpandDataGroup(testId, newExpandDatList); |
|
|
|
Map<String, List<TestRecordSampleDataExpand>> expandDataGroupByDataId = getexpandDataGroup(testId, newExpandDatList); |
|
|
|
|
|
|
|
|
|
|
@ -173,7 +180,6 @@ public class TestRecordSampledataExpandServiceImpl extends ServiceImpl<TestRecor |
|
|
|
// 获取标准物质的扩展信息,1 先查询对应的实验数据 2 根据实验数据的实验id以及化合物以及类型获取标准物质的实验数据信息 3 根据标准物质实验数据id取对应的扩展数据
|
|
|
|
// 获取标准物质的扩展信息,1 先查询对应的实验数据 2 根据实验数据的实验id以及化合物以及类型获取标准物质的实验数据信息 3 根据标准物质实验数据id取对应的扩展数据
|
|
|
|
TestRecordSampleData testRecordSampleData = testRecordSampleDataService.getById(key); |
|
|
|
TestRecordSampleData testRecordSampleData = testRecordSampleDataService.getById(key); |
|
|
|
boolean isSTDSample = testRecordSampleData.getSampleType().equals(TestRecordSampleDataConstant.SAMPLE_TYPE_STD); |
|
|
|
boolean isSTDSample = testRecordSampleData.getSampleType().equals(TestRecordSampleDataConstant.SAMPLE_TYPE_STD); |
|
|
|
TestRecord testRecord = testRecordService.getById(testRecordSampleData.getTestId()); |
|
|
|
|
|
|
|
List<TestRecordSampleDataExpand> stdDataExpandList = null; |
|
|
|
List<TestRecordSampleDataExpand> stdDataExpandList = null; |
|
|
|
if (!isSTDSample) { |
|
|
|
if (!isSTDSample) { |
|
|
|
TestRecordSampleData stdTestSampleData = testRecordSampleDataService.getOne(Wrappers.<TestRecordSampleData>lambdaQuery().eq(TestRecordSampleData::getTestId, testRecordSampleData.getTestId()).eq(TestRecordSampleData::getCompoundName, testRecordSampleData.getCompoundName()).eq(TestRecordSampleData::getSampleType, TestRecordSampleDataConstant.SAMPLE_TYPE_STD)); |
|
|
|
TestRecordSampleData stdTestSampleData = testRecordSampleDataService.getOne(Wrappers.<TestRecordSampleData>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<TestRecor |
|
|
|
} |
|
|
|
} |
|
|
|
List<TestRecordSampleDataExpand> finalStdDataExpandList = stdDataExpandList; |
|
|
|
List<TestRecordSampleDataExpand> finalStdDataExpandList = stdDataExpandList; |
|
|
|
testRecordSampleData.setIsDetected(1); // 默认检出
|
|
|
|
testRecordSampleData.setIsDetected(1); // 默认检出
|
|
|
|
boolean isNPSCase = testRecord.getBusinessType().equals(BusinessType.NPS_CASE.getBusinessType()); // 是否是常规毒品案件
|
|
|
|
|
|
|
|
value.forEach(sampleDataExpand -> { |
|
|
|
value.forEach(sampleDataExpand -> { |
|
|
|
if (isNPSCase) { |
|
|
|
if (isNPSCase) { |
|
|
|
calculateIonAbundanceRatioNormal(finalStdDataExpandList, sampleDataExpand); |
|
|
|
calculateIonAbundanceRatioNormal(finalStdDataExpandList, sampleDataExpand); |
|
|
@ -192,14 +197,18 @@ public class TestRecordSampledataExpandServiceImpl extends ServiceImpl<TestRecor |
|
|
|
!isSTDSample && |
|
|
|
!isSTDSample && |
|
|
|
testRecordSampleData.getIsDetected().equals(1) && |
|
|
|
testRecordSampleData.getIsDetected().equals(1) && |
|
|
|
( |
|
|
|
( |
|
|
|
testRecordSampleData.getRtTimeWithinError().equals(TestRecordSampleDataConstant.NO) |
|
|
|
Objects.equals(testRecordSampleData.getRtTimeWithinError(), TestRecordSampleDataConstant.NO) |
|
|
|
|| sampleDataExpand.getIonAbundanceRatioWithinError().equals(TestRecordSampleDataConstant.NO) |
|
|
|
|| |
|
|
|
|
|
|
|
Objects.equals(sampleDataExpand.getIonAbundanceRatioWithinError(), TestRecordSampleDataConstant.NO) |
|
|
|
|
|
|
|
|
|
|
|
) |
|
|
|
) |
|
|
|
) { |
|
|
|
) { |
|
|
|
testRecordSampleData.setIsDetected(0); |
|
|
|
testRecordSampleData.setIsDetected(0); |
|
|
|
} |
|
|
|
} |
|
|
|
// calculateAfterResult.add(sampleDataExpand);
|
|
|
|
// calculateAfterResult.add(sampleDataExpand);
|
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
if ((isNPSCase && value.size() == 4) || (!isNPSCase && value.size() == 2)) { |
|
|
|
|
|
|
|
// 只有扩展数据的丰度比和相对偏差填写完成才能判断是否检出, 其他情况不判断更新
|
|
|
|
testRecordSampleData.setWhetherCheckOut( |
|
|
|
testRecordSampleData.setWhetherCheckOut( |
|
|
|
(testRecordSampleData.getIsDetected().equals(1) ? TestRecordSampleDataConstant.CHECK_OUT : TestRecordSampleDataConstant.NOT_CHECK_OUT) |
|
|
|
(testRecordSampleData.getIsDetected().equals(1) ? TestRecordSampleDataConstant.CHECK_OUT : TestRecordSampleDataConstant.NOT_CHECK_OUT) |
|
|
|
+ testRecordSampleData.getCompoundCnName() |
|
|
|
+ testRecordSampleData.getCompoundCnName() |
|
|
@ -207,6 +216,7 @@ public class TestRecordSampledataExpandServiceImpl extends ServiceImpl<TestRecor |
|
|
|
testRecordSampleDataService.updateById(testRecordSampleData); |
|
|
|
testRecordSampleDataService.updateById(testRecordSampleData); |
|
|
|
super.updateBatchById(value); |
|
|
|
super.updateBatchById(value); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
// if (CollUtil.isNotEmpty(calculateAfterResult)) {
|
|
|
|
// if (CollUtil.isNotEmpty(calculateAfterResult)) {
|
|
|
|
// super.updateBatchById(calculateAfterResult);
|
|
|
|
// super.updateBatchById(calculateAfterResult);
|
|
|
@ -231,7 +241,8 @@ public class TestRecordSampledataExpandServiceImpl extends ServiceImpl<TestRecor |
|
|
|
private Map<String, List<TestRecordSampleDataExpand>> getexpandDataGroup(String testId, List<TestRecordSampleDataExpand> newExpandDatList) { |
|
|
|
private Map<String, List<TestRecordSampleDataExpand>> getexpandDataGroup(String testId, List<TestRecordSampleDataExpand> newExpandDatList) { |
|
|
|
List<String> stdTestDataIds = null; |
|
|
|
List<String> stdTestDataIds = null; |
|
|
|
if (StrUtil.isNotBlank(testId)) { |
|
|
|
if (StrUtil.isNotBlank(testId)) { |
|
|
|
List<TestRecordSampleData> stdSampleDataList = testRecordSampleDataService.list(Wrappers.<TestRecordSampleData>lambdaQuery().eq(TestRecordSampleData::getTestId, testId).eq(TestRecordSampleData::getSampleType, TestRecordSampleDataConstant.SAMPLE_TYPE_STD)); |
|
|
|
List<TestRecordSampleData> stdSampleDataList = testRecordSampleDataService.list(Wrappers.<TestRecordSampleData>lambdaQuery() |
|
|
|
|
|
|
|
.eq(TestRecordSampleData::getTestId, testId).eq(TestRecordSampleData::getSampleType, TestRecordSampleDataConstant.SAMPLE_TYPE_STD)); |
|
|
|
stdTestDataIds = stdSampleDataList.stream().map(TestRecordSampleData::getId).collect(Collectors.toList()); |
|
|
|
stdTestDataIds = stdSampleDataList.stream().map(TestRecordSampleData::getId).collect(Collectors.toList()); |
|
|
|
} |
|
|
|
} |
|
|
|
Map<String, List<TestRecordSampleDataExpand>> expandDataGroupByDataId = newExpandDatList.stream().collect(Collectors.groupingBy(TestRecordSampleDataExpand::getTestDataId, LinkedHashMap::new, Collectors.toList())); |
|
|
|
Map<String, List<TestRecordSampleDataExpand>> expandDataGroupByDataId = newExpandDatList.stream().collect(Collectors.groupingBy(TestRecordSampleDataExpand::getTestDataId, LinkedHashMap::new, Collectors.toList())); |
|
|
|