20250318 更新
1.存入保留时间相对偏差是否在范围内
This commit is contained in:
@@ -1,6 +1,5 @@
|
|||||||
package digital.laboratory.platform.inspection.dto;
|
package digital.laboratory.platform.inspection.dto;
|
||||||
|
|
||||||
import digital.laboratory.platform.inspection.utils.datafile.nps.NPSTestDetailDataStruct;
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@@ -22,7 +21,7 @@ public class NPSCaseTestSampleData {
|
|||||||
private String area;//峰面积
|
private String area;//峰面积
|
||||||
private String stdRetTime;
|
private String stdRetTime;
|
||||||
private String sn;
|
private String sn;
|
||||||
private String abundanceRatio;//丰度比,如果是基峰,我们设置为1,丰度比的公式为自己的峰面积/基峰峰面积
|
private String abundanceRatio;//丰度比,如果是基峰,我们设置为1,丰度比的公式为自己的峰面积/基峰峰面积
|
||||||
private String abundanceRatio_std;// 标准物质的丰度比
|
private String abundanceRatio_std;// 标准物质的丰度比
|
||||||
private String abundanceRatioError;//丰度比偏差,如果是基峰不需要比,公式是 (自己的丰度比-标准品的MZ对应丰度比)/标准品的MZ对应丰度比
|
private String abundanceRatioError;//丰度比偏差,如果是基峰不需要比,公式是 (自己的丰度比-标准品的MZ对应丰度比)/标准品的MZ对应丰度比
|
||||||
private String errorRange;//误差范围
|
private String errorRange;//误差范围
|
||||||
|
|||||||
@@ -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.getIonAbundanceRatio(), hairSewageDataDtoStd.getIonAbundanceRatio());
|
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 ionAbundanceRatio 目标物的离子丰度比
|
|
||||||
* @param stdIonAbundanceRatio 标准物质的离子丰度比
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
private double getHairCaseIonAbundanceRatioWithinError(double ionAbundanceRatio, double stdIonAbundanceRatio) {
|
|
||||||
return (ionAbundanceRatio - stdIonAbundanceRatio) / stdIonAbundanceRatio * 100;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据计算出来的离子丰度比误差来判断是否检出
|
* 根据计算出来的离子丰度比误差来判断是否检出
|
||||||
*
|
*
|
||||||
@@ -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;
|
||||||
|
|||||||
Reference in New Issue
Block a user