master
杨海航 6 days ago
parent 04ac241630
commit e1c565a2f3
  1. 68
      dlp-drugtesting-biz/src/main/java/digital/laboratory/platform/inspection/service/impl/InspectRecordServiceImpl.java

@ -238,13 +238,13 @@ public class InspectRecordServiceImpl implements InspectRecordService {
for (int i = 0; i < dataDtos.size(); i++) { for (int i = 0; i < dataDtos.size(); i++) {
dataDtos.get(i).setIndexNum(String.valueOf(indexNum++)); dataDtos.get(i).setIndexNum(String.valueOf(indexNum++));
} }
this.buildIonPairAndCE(data, testRecordReagentService // this.buildIonPairAndCE(data, testRecordReagentService
.list(Wrappers.<TestRecordReagent>lambdaQuery() // .list(Wrappers.<TestRecordReagent>lambdaQuery()
.in(TestRecordReagent::getId, testRecord.getReagentConsumablesList()) // .in(TestRecordReagent::getId, testRecord.getReagentConsumablesList())
.eq(TestRecordReagent::getCategory, "标准物质")) // .eq(TestRecordReagent::getCategory, "标准物质"))
.stream() // .stream()
.map(item -> item.getId()) // .map(item -> item.getId())
.collect(Collectors.toList())); // .collect(Collectors.toList()));
// 返回处理后的数据 // 返回处理后的数据
data.put("dataDtos", dataDtos); data.put("dataDtos", dataDtos);
data.put("sampleSize", dataDtos.size()); data.put("sampleSize", dataDtos.size());
@ -252,32 +252,32 @@ public class InspectRecordServiceImpl implements InspectRecordService {
return data; return data;
} }
public void buildIonPairAndCE(Map<String, Object> data, List<String> reagentIdList) { // public void buildIonPairAndCE(Map<String, Object> data, List<String> reagentIdList) {
List<IonPairAndCEVO> ionPairAndCEVOS = new ArrayList<>(); // List<IonPairAndCEVO> ionPairAndCEVOS = new ArrayList<>();
//
// 遍历 reagentIdList // // 遍历 reagentIdList
for (String id : reagentIdList) { // for (String id : reagentIdList) {
TestRecordReagentVO vo = testRecordReagentService.getVOById(id); // TestRecordReagentVO vo = testRecordReagentService.getVOById(id);
if (vo == null) { // if (vo == null) {
continue; // 如果 vo 为空,跳过当前循环 // continue; // 如果 vo 为空,跳过当前循环
} // }
//
Drug drug = vo.getDrug(); // Drug drug = vo.getDrug();
if (drug == null) { // if (drug == null) {
continue; // 如果 drug 为空,跳过当前循环 // continue; // 如果 drug 为空,跳过当前循环
} // }
//
// 添加 ionPairAndCEVO1 和 ionPairAndCEVO2 // // 添加 ionPairAndCEVO1 和 ionPairAndCEVO2
ionPairAndCEVOS.add(createIonPairAndCEVO(drug.getName(), drug.getMainProductIon(), // ionPairAndCEVOS.add(createIonPairAndCEVO(drug.getName(), drug.getMainProductIon(),
drug.getMainDeclusteringPotential(), drug.getMainCollisionEnergy())); // drug.getMainDeclusteringPotential(), drug.getMainCollisionEnergy()));
ionPairAndCEVOS.add(createIonPairAndCEVO(drug.getName(), drug.getMinorProductIon(), // ionPairAndCEVOS.add(createIonPairAndCEVO(drug.getName(), drug.getMinorProductIon(),
drug.getMinorDeclusteringPotential(), drug.getMinorCollisionEnergy())); // drug.getMinorDeclusteringPotential(), drug.getMinorCollisionEnergy()));
} // }
//
// 将结果放入数据 map 中 // // 将结果放入数据 map 中
data.put("ionPairAndCEVOS", ionPairAndCEVOS); // data.put("ionPairAndCEVOS", ionPairAndCEVOS);
data.put("ionPairAndCEVOSize", ionPairAndCEVOS.size() / 2); // data.put("ionPairAndCEVOSize", ionPairAndCEVOS.size() / 2);
} // }
// 创建 IonPairAndCEVO 对象的辅助方法 // 创建 IonPairAndCEVO 对象的辅助方法
private IonPairAndCEVO createIonPairAndCEVO(String compoundName, String productIon, private IonPairAndCEVO createIonPairAndCEVO(String compoundName, String productIon,
@ -365,7 +365,7 @@ public class InspectRecordServiceImpl implements InspectRecordService {
LoopRowTableRenderPolicy policy = new LoopRowTableRenderPolicy(); LoopRowTableRenderPolicy policy = new LoopRowTableRenderPolicy();
Configure config = Configure.builder(). Configure config = Configure.builder().
bind("dataDtos", policy) bind("dataDtos", policy)
.bind("ionPairAndCEVOS", policy).build(); .build();
return buildDocFileAndUploadToOss(entrustId, templatePath, config, docMap); return buildDocFileAndUploadToOss(entrustId, templatePath, config, docMap);
} }

Loading…
Cancel
Save