20250318 更新

1.存入保留时间相对偏差是否在范围内
master
陈江保 2 weeks ago
parent 31eebdf728
commit 00ab259f35
  1. 1
      dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/dto/NPSCaseTestSampleData.java
  2. 107
      dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/service/impl/TestRecordSampleDataServiceImpl.java

@ -1,6 +1,5 @@
package digital.laboratory.platform.inspection.dto;
import digital.laboratory.platform.inspection.utils.datafile.nps.NPSTestDetailDataStruct;
import lombok.Data;
@Data

@ -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();
}
// 之前生成定性结果的代码
// 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) {
if (hairSewageDataDto.getIonAbundanceRatio() != -999) {
double ionAbundanceRatioWithinError = getHairCaseIonAbundanceRatioWithinError(hairSewageDataDto.getIonAbundanceRatio(), hairSewageDataDtoStd.getIonAbundanceRatio());
double ionAbundanceRatioWithinError = getAbundanceRatioErrorValue(hairSewageDataDto.getIonAbundanceRatio(), hairSewageDataDtoStd.getIonAbundanceRatio());
hairSewageDataDto.setIonAbundanceRatioWithinError(ionAbundanceRatioWithinError);
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 {
dataJsonStr = JSON.toJSONString(item.getTestSampleDataList());
} catch (Exception e) {
log.error("错误位置详细信息 ============== {}", item.getTestSampleDataList());
e.printStackTrace();
}
try {
dataResultJsonStr = JSON.toJSONString(item);
} catch (Exception e) {
log.error("错误位置详细信息 ============== {}", item);
e.printStackTrace();
}
testRecordSampleData.setDataJson(dataJsonStr);
@ -1622,15 +1546,15 @@ public class TestRecordSampleDataServiceImpl extends ServiceImpl<TestRecordSampl
}
/**
* 计算丰度比偏差
* 计算离子丰度比偏差
*
* @param sampleAbundanceRatio
* @param sampleAbundanceRatio_std
* @param sampleIonAbundanceRatio 目标物的离子丰度比
* @param stdIonAbundanceRatio 标准物质的离子丰度比
* @return
*/
private double getAbundanceRatioErrorValue(double sampleAbundanceRatio, double sampleAbundanceRatio_std) {
double diffValue = sampleAbundanceRatio - sampleAbundanceRatio_std;
double abundanceRatioErrorValue = Math.abs(diffValue) / sampleAbundanceRatio_std * 100;
private double getAbundanceRatioErrorValue(double sampleIonAbundanceRatio, double stdIonAbundanceRatio) {
double diffValue = sampleIonAbundanceRatio - stdIonAbundanceRatio;
double abundanceRatioErrorValue = Math.abs(diffValue) / stdIonAbundanceRatio * 100;
return abundanceRatioErrorValue;
}
@ -2004,6 +1928,21 @@ public class TestRecordSampleDataServiceImpl extends ServiceImpl<TestRecordSampl
std.getMainArea() != null &&
std.getMinorArea() != 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");
}
return this.updateById(data) ? data : null;

Loading…
Cancel
Save