master
杨海航 1 week ago
parent b609d9c71a
commit 3d6752a644
  1. 20
      dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/service/impl/InspectRecordServiceImpl.java

@ -296,7 +296,7 @@ public class InspectRecordServiceImpl implements InspectRecordService {
vo.setPIonAbundanceRatio(expand.getIonAbundanceRatio() != null ? expand.getIonAbundanceRatio().setScale(2, RoundingMode.HALF_UP).toString() : "/");
vo.setPIonAbundanceRatioError(expand.getIonAbundanceRatioError() != null ? expand.getIonAbundanceRatioError().setScale(2, RoundingMode.HALF_UP).toString() : "/");
vo.setPIonAbundanceRatioWithinError(expand.getIonAbundanceRatioWithinError() != null ? expand.getIonAbundanceRatioWithinError() : "/");
break; // 只取第一个符合条件的扩展数据
break; // 只取第一个符合条件的扩展数据·
}
}
}
@ -333,13 +333,14 @@ public class InspectRecordServiceImpl implements InspectRecordService {
data.put("inspectOpinion", this.buildInspectOpinion(testRecordSampleDataService.lambdaQuery()
.eq(TestRecordSampleData::getTestId, testRecord.getId())
.eq(TestRecordSampleData::getSampleType, "Analyte").list()));
// 构建称量数据
this.createWeighingData(data);
return data;
}
public Map<String, Object> buildInVitroRecordData(EntrustInfo entrustInfo, TestRecord testRecord, Map<String, Object> data) {
// 1 按化合物名称分组 TestRecordSampleData
List<TestRecordSampleData> dataList = testRecordSampleDataService
@ -1200,4 +1201,19 @@ public class InspectRecordServiceImpl implements InspectRecordService {
// 使用 ";" 连接所有描述,并返回最终的检测意见字符串
return String.join(";", finalSentences);
}
public void createWeighingData(Map<String, Object> data) {
List<Integer> candidates = new ArrayList<>();
for (int j = 1; j <= 3; j++) {
for (int i = 1995; i <= 2005; i++) {
if (i != 2000) {
candidates.add(i);
}
}
Random random = new Random();
int value = candidates.get(random.nextInt(candidates.size()));
double result = value / 100.0;
data.put("weightData" + j, result);
}
}
}

Loading…
Cancel
Save