|
|
@ -741,72 +741,9 @@ public class TestRecordSampleDataServiceImpl extends ServiceImpl<TestRecordSampl |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// dataMap.forEach((k, v) -> {
|
|
|
|
|
|
|
|
// Map<String, List<DataSolutionSampleDTO>> groupByCompoundMap = v.stream().collect(Collectors.groupingBy(DataSolutionSampleDTO::getCompoundName));
|
|
|
|
|
|
|
|
// stringBuilder.append("\t").append(index.getAndIncrement()).append("、从").append(v.get(0).getSampleName() + "(" + v.get(0).getSampleNo() + ")");
|
|
|
|
|
|
|
|
// String checkOutResult = "";
|
|
|
|
|
|
|
|
// String notCheckOutResult = "";
|
|
|
|
|
|
|
|
// Set<String> keySet = groupByCompoundMap.keySet();
|
|
|
|
|
|
|
|
// for (String key : keySet) {
|
|
|
|
|
|
|
|
// List<DataSolutionSampleDTO> dtoS1 = groupByCompoundMap.get(key);
|
|
|
|
|
|
|
|
// boolean detected = true;
|
|
|
|
|
|
|
|
// /// 下面先判断是否检出
|
|
|
|
|
|
|
|
// if (dtoS1.size() > 1) {
|
|
|
|
|
|
|
|
// Set<Integer> isDetected = dtoS1.stream().map(DataSolutionSampleDTO::getIsDetected).collect(Collectors.toSet());
|
|
|
|
|
|
|
|
// // 如果set的长度大于1 则证明其中有的检出,有的未检出, 或者其中值有0
|
|
|
|
|
|
|
|
// if (isDetected.size() > 1 || isDetected.contains(0)) {
|
|
|
|
|
|
|
|
// detected = false;
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// } else {
|
|
|
|
|
|
|
|
// // 不等于1 未检出
|
|
|
|
|
|
|
|
// detected = dtoS1.get(0).getIsDetected() == 1;
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// // 拼接结果
|
|
|
|
|
|
|
|
// if (detected) {
|
|
|
|
|
|
|
|
// if (StrUtil.isBlank(checkOutResult)) {
|
|
|
|
|
|
|
|
// checkOutResult = TestRecordSampleDataConstant.CHECK_OUT + key;
|
|
|
|
|
|
|
|
// } else {
|
|
|
|
|
|
|
|
// checkOutResult = checkOutResult + "、" + key;
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// } else {
|
|
|
|
|
|
|
|
// if (StrUtil.isBlank(notCheckOutResult)) {
|
|
|
|
|
|
|
|
// notCheckOutResult = TestRecordSampleDataConstant.NOT_CHECK_OUT + key;
|
|
|
|
|
|
|
|
// } else {
|
|
|
|
|
|
|
|
// notCheckOutResult = notCheckOutResult + "、" + key;
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// if (StrUtil.isNotBlank(checkOutResult) && StrUtil.isNotBlank(notCheckOutResult)) {
|
|
|
|
|
|
|
|
// stringBuilder.append(checkOutResult + ",");
|
|
|
|
|
|
|
|
// stringBuilder.append(notCheckOutResult + "。");
|
|
|
|
|
|
|
|
// } else if (StrUtil.isNotBlank(checkOutResult)) {
|
|
|
|
|
|
|
|
// stringBuilder.append(checkOutResult + "。");
|
|
|
|
|
|
|
|
// } else {
|
|
|
|
|
|
|
|
// stringBuilder.append(notCheckOutResult + "。");
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// stringBuilder.append("\n");
|
|
|
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return stringBuilder.toString(); |
|
|
|
return stringBuilder.toString(); |
|
|
|
} |
|
|
|
} |
|
|
|
// 之前生成定性结果的代码
|
|
|
|
|
|
|
|
// Map<Integer, List<DataSolutionSampleDTO>> isDetectedMap = v.stream().collect(Collectors.groupingBy(DataSolutionSampleDTO::getIsDetected));
|
|
|
|
|
|
|
|
// List<DataSolutionSampleDTO> checkOutList = isDetectedMap.get(1);
|
|
|
|
|
|
|
|
// List<DataSolutionSampleDTO> notCheckOutList = isDetectedMap.get(0);
|
|
|
|
|
|
|
|
//// String result = "从" + v.get(0).getSampleName();
|
|
|
|
|
|
|
|
// stringBuilder.append("\t");
|
|
|
|
|
|
|
|
// stringBuilder.append(index.getAndIncrement() + "、从" + v.get(0).getSampleName());
|
|
|
|
|
|
|
|
// if (CollUtil.isNotEmpty(checkOutList)) {
|
|
|
|
|
|
|
|
// String result = TestRecordSampleDataConstant.CHECK_OUT +
|
|
|
|
|
|
|
|
// StrUtil.join("、", checkOutList.stream().map(DataSolutionSampleDTO::getCompoundName).collect(Collectors.toList())) + ",";
|
|
|
|
|
|
|
|
// stringBuilder.append(result);
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// if (CollUtil.isNotEmpty(notCheckOutList)) {
|
|
|
|
|
|
|
|
// String result = TestRecordSampleDataConstant.NOT_CHECK_OUT +
|
|
|
|
|
|
|
|
// StrUtil.join("、", notCheckOutList.stream().map(DataSolutionSampleDTO::getCompoundName).collect(Collectors.toList())) + "。";
|
|
|
|
|
|
|
|
// stringBuilder.append(result);
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 完成实验 |
|
|
|
* 完成实验 |
|
|
@ -1153,7 +1090,7 @@ public class TestRecordSampleDataServiceImpl extends ServiceImpl<TestRecordSampl |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private void calculateHairCaseIonAbundanceRatioWithinError(HairSewageDataDto hairSewageDataDto, HairSewageDataDto hairSewageDataDtoStd) { |
|
|
|
private void calculateHairCaseIonAbundanceRatioWithinError(HairSewageDataDto hairSewageDataDto, HairSewageDataDto hairSewageDataDtoStd) { |
|
|
|
if (hairSewageDataDto.getIonAbundanceRatio() != -999) { |
|
|
|
if (hairSewageDataDto.getIonAbundanceRatio() != -999) { |
|
|
|
double ionAbundanceRatioWithinError = getHairCaseIonAbundanceRatioWithinError(hairSewageDataDto, hairSewageDataDtoStd); |
|
|
|
double ionAbundanceRatioWithinError = getAbundanceRatioErrorValue(hairSewageDataDto.getIonAbundanceRatio(), hairSewageDataDtoStd.getIonAbundanceRatio()); |
|
|
|
hairSewageDataDto.setIonAbundanceRatioWithinError(ionAbundanceRatioWithinError); |
|
|
|
hairSewageDataDto.setIonAbundanceRatioWithinError(ionAbundanceRatioWithinError); |
|
|
|
double stdIonAbundanceRatio = hairSewageDataDtoStd.getIonAbundanceRatio(); |
|
|
|
double stdIonAbundanceRatio = hairSewageDataDtoStd.getIonAbundanceRatio(); |
|
|
|
// 判断是否在离子丰度比允许的最大偏差范围
|
|
|
|
// 判断是否在离子丰度比允许的最大偏差范围
|
|
|
@ -1191,17 +1128,6 @@ public class TestRecordSampleDataServiceImpl extends ServiceImpl<TestRecordSampl |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 计算离子丰度比相对误差 |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @param hairSewageDataDto |
|
|
|
|
|
|
|
* @param hairSewageDataDtoStd |
|
|
|
|
|
|
|
* @return |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
private double getHairCaseIonAbundanceRatioWithinError(HairSewageDataDto hairSewageDataDto, HairSewageDataDto hairSewageDataDtoStd) { |
|
|
|
|
|
|
|
return (hairSewageDataDto.getIonAbundanceRatio() - hairSewageDataDtoStd.getIonAbundanceRatio()) / hairSewageDataDtoStd.getIonAbundanceRatio() * 100; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 根据计算出来的离子丰度比误差来判断是否检出 |
|
|
|
* 根据计算出来的离子丰度比误差来判断是否检出 |
|
|
|
* |
|
|
|
* |
|
|
@ -1229,10 +1155,10 @@ public class TestRecordSampleDataServiceImpl extends ServiceImpl<TestRecordSampl |
|
|
|
private void calculateHairCaseRtTimeError(HairSewageDataDto hairSewageDataDto, HairSewageDataDto hairSewageDataDtoStd) { |
|
|
|
private void calculateHairCaseRtTimeError(HairSewageDataDto hairSewageDataDto, HairSewageDataDto hairSewageDataDtoStd) { |
|
|
|
if (hairSewageDataDto.getTargetRtTime() != -999) { |
|
|
|
if (hairSewageDataDto.getTargetRtTime() != -999) { |
|
|
|
// 计算保留时间的相对误差
|
|
|
|
// 计算保留时间的相对误差
|
|
|
|
double rtTimeError = getHairCaseRtTimeError(hairSewageDataDto, hairSewageDataDtoStd); |
|
|
|
double rtTimeError = getHairCaseRtTimeError(hairSewageDataDto.getTargetRtTime(), hairSewageDataDtoStd.getStdRtTime()); |
|
|
|
hairSewageDataDto.setRtTimeError(rtTimeError); |
|
|
|
hairSewageDataDto.setRtTimeError(rtTimeError); |
|
|
|
// 判断保留时间相对误差是否符合误差范围
|
|
|
|
// 判断保留时间相对误差是否符合误差范围
|
|
|
|
setHairCaseRtTimeWithinError(hairSewageDataDto); |
|
|
|
hairSewageDataDto.setRtTimeWithinError(setHairCaseRtTimeWithinError(hairSewageDataDto.getRtTimeError())); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
hairSewageDataDto.setRtTimeError(-999); |
|
|
|
hairSewageDataDto.setRtTimeError(-999); |
|
|
|
hairSewageDataDto.setRtTimeWithinError("/"); |
|
|
|
hairSewageDataDto.setRtTimeWithinError("/"); |
|
|
@ -1242,25 +1168,25 @@ public class TestRecordSampleDataServiceImpl extends ServiceImpl<TestRecordSampl |
|
|
|
/** |
|
|
|
/** |
|
|
|
* 计算保留时间的相对误差 |
|
|
|
* 计算保留时间的相对误差 |
|
|
|
* |
|
|
|
* |
|
|
|
* @param hairSewageDataDto 目标物信息 |
|
|
|
* @param targetRtTime 目标物保留时间信息 |
|
|
|
* @param hairSewageDataDtoStd 标准物信息 |
|
|
|
* @param stdRtTime 标准物保留时间信息 |
|
|
|
* @return |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private double getHairCaseRtTimeError(HairSewageDataDto hairSewageDataDto, HairSewageDataDto hairSewageDataDtoStd) { |
|
|
|
private double getHairCaseRtTimeError(double targetRtTime, double stdRtTime) { |
|
|
|
return (hairSewageDataDto.getTargetRtTime() - hairSewageDataDtoStd.getStdRtTime()) / hairSewageDataDtoStd.getStdRtTime() * 100; |
|
|
|
return (targetRtTime - stdRtTime) / stdRtTime * 100; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 判断保留时间相对误差是否符合误差范围 |
|
|
|
* 判断保留时间相对误差是否符合误差范围 |
|
|
|
* |
|
|
|
* |
|
|
|
* @param hairSewageDataDto |
|
|
|
* @param rtTimeError |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private void setHairCaseRtTimeWithinError(HairSewageDataDto hairSewageDataDto) { |
|
|
|
private String setHairCaseRtTimeWithinError(double rtTimeError) { |
|
|
|
if (hairSewageDataDto.getRtTimeError() > TestRecordSampleDataConstant.HAIR_CASE_NEGATIVE_RT_ERROR |
|
|
|
if (rtTimeError > TestRecordSampleDataConstant.HAIR_CASE_NEGATIVE_RT_ERROR |
|
|
|
&& hairSewageDataDto.getRtTimeError() < TestRecordSampleDataConstant.HAIR_CASE_POSITIVE_RT_ERROR) { |
|
|
|
&& rtTimeError < TestRecordSampleDataConstant.HAIR_CASE_POSITIVE_RT_ERROR) { |
|
|
|
hairSewageDataDto.setRtTimeWithinError(TestRecordSampleDataConstant.IS); |
|
|
|
return TestRecordSampleDataConstant.IS; |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
hairSewageDataDto.setRtTimeWithinError(TestRecordSampleDataConstant.NO); |
|
|
|
return TestRecordSampleDataConstant.NO; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -1389,13 +1315,11 @@ public class TestRecordSampleDataServiceImpl extends ServiceImpl<TestRecordSampl |
|
|
|
try { |
|
|
|
try { |
|
|
|
dataJsonStr = JSON.toJSONString(item.getTestSampleDataList()); |
|
|
|
dataJsonStr = JSON.toJSONString(item.getTestSampleDataList()); |
|
|
|
} catch (Exception e) { |
|
|
|
} catch (Exception e) { |
|
|
|
log.error("错误位置详细信息 ============== {}", item.getTestSampleDataList()); |
|
|
|
|
|
|
|
e.printStackTrace(); |
|
|
|
e.printStackTrace(); |
|
|
|
} |
|
|
|
} |
|
|
|
try { |
|
|
|
try { |
|
|
|
dataResultJsonStr = JSON.toJSONString(item); |
|
|
|
dataResultJsonStr = JSON.toJSONString(item); |
|
|
|
} catch (Exception e) { |
|
|
|
} catch (Exception e) { |
|
|
|
log.error("错误位置详细信息 ============== {}", item); |
|
|
|
|
|
|
|
e.printStackTrace(); |
|
|
|
e.printStackTrace(); |
|
|
|
} |
|
|
|
} |
|
|
|
testRecordSampleData.setDataJson(dataJsonStr); |
|
|
|
testRecordSampleData.setDataJson(dataJsonStr); |
|
|
@ -1622,15 +1546,15 @@ public class TestRecordSampleDataServiceImpl extends ServiceImpl<TestRecordSampl |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 计算丰度比偏差 |
|
|
|
* 计算离子丰度比偏差 |
|
|
|
* |
|
|
|
* |
|
|
|
* @param sampleAbundanceRatio |
|
|
|
* @param sampleIonAbundanceRatio 目标物的离子丰度比 |
|
|
|
* @param sampleAbundanceRatio_std |
|
|
|
* @param stdIonAbundanceRatio 标准物质的离子丰度比 |
|
|
|
* @return |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private double getAbundanceRatioErrorValue(double sampleAbundanceRatio, double sampleAbundanceRatio_std) { |
|
|
|
private double getAbundanceRatioErrorValue(double sampleIonAbundanceRatio, double stdIonAbundanceRatio) { |
|
|
|
double diffValue = sampleAbundanceRatio - sampleAbundanceRatio_std; |
|
|
|
double diffValue = sampleIonAbundanceRatio - stdIonAbundanceRatio; |
|
|
|
double abundanceRatioErrorValue = Math.abs(diffValue) / sampleAbundanceRatio_std * 100; |
|
|
|
double abundanceRatioErrorValue = Math.abs(diffValue) / stdIonAbundanceRatio * 100; |
|
|
|
return abundanceRatioErrorValue; |
|
|
|
return abundanceRatioErrorValue; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -2004,6 +1928,21 @@ public class TestRecordSampleDataServiceImpl extends ServiceImpl<TestRecordSampl |
|
|
|
std.getMainArea() != null && |
|
|
|
std.getMainArea() != null && |
|
|
|
std.getMinorArea() != null && |
|
|
|
std.getMinorArea() != null && |
|
|
|
std.getTargetRtTime() != null) { |
|
|
|
std.getTargetRtTime() != null) { |
|
|
|
|
|
|
|
TestRecord testRecord = testRecordService.getById(data.getTestId()); |
|
|
|
|
|
|
|
if (testRecord.getBusinessType().equals(BusinessType.BOINT_CASE.getBusinessType())) { |
|
|
|
|
|
|
|
data.setRtTimeWithinError( |
|
|
|
|
|
|
|
setHairCaseRtTimeWithinError( |
|
|
|
|
|
|
|
getHairCaseRtTimeError(data.getTargetRtTime(), std.getStdRtTime()) |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
data.setRtTimeWithinError( |
|
|
|
|
|
|
|
getRtWithinErrorText( |
|
|
|
|
|
|
|
Math.abs(getHairCaseRtTimeError(data.getTargetRtTime(), std.getStdRtTime())), |
|
|
|
|
|
|
|
1 |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
} |
|
|
|
System.out.println("所有属性都不为 null"); |
|
|
|
System.out.println("所有属性都不为 null"); |
|
|
|
} |
|
|
|
} |
|
|
|
return this.updateById(data) ? data : null; |
|
|
|
return this.updateById(data) ? data : null; |
|
|
|