From b529a4498e995ad5b083016951c48c108b120e93 Mon Sep 17 00:00:00 2001 From: "a15234804788@163.com" Date: Fri, 14 Oct 2022 17:55:55 +0800 Subject: [PATCH] Changes --- .../lims/service/impl/EntrustServiceImpl.java | 73 +++++++++++++++++-- 1 file changed, 66 insertions(+), 7 deletions(-) diff --git a/lab-service/lab-lims/src/main/java/org/springblade/lims/service/impl/EntrustServiceImpl.java b/lab-service/lab-lims/src/main/java/org/springblade/lims/service/impl/EntrustServiceImpl.java index 7ce5102..ba6817a 100644 --- a/lab-service/lab-lims/src/main/java/org/springblade/lims/service/impl/EntrustServiceImpl.java +++ b/lab-service/lab-lims/src/main/java/org/springblade/lims/service/impl/EntrustServiceImpl.java @@ -9,7 +9,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import lombok.NoArgsConstructor; import org.apache.commons.lang3.RandomUtils; import org.apache.commons.lang3.StringUtils; -import org.apache.poi.xwpf.usermodel.XWPFDocument; +import org.apache.poi.xwpf.usermodel.*; import org.springblade.common.utils.ZipCompressUtil; import org.springblade.core.tool.api.R; import org.springblade.core.tool.utils.StringUtil; @@ -95,6 +95,7 @@ public class EntrustServiceImpl extends BaseServiceImpl @Autowired private IRepairApplicationService repairApplicationService; + // @Value("${handleUrl}") // private String handleUrl; // @@ -671,6 +672,17 @@ public class EntrustServiceImpl extends BaseServiceImpl resultList.add(resultVo); } } + //给检测结果赋值 start + ItemAndAllList.forEach(item ->{ + if (StringUtils.isNoneBlank(item.get("examineItem").toString()) && StringUtils.equals(examineItem.getName(),item.get("examineItem").toString())){ + //遍历resultList 获取阴阳结果的数量 + long yangNum = resultList.stream().filter(re -> StringUtils.equals("阳性" , re.getResult())).count(); + long yinNum = resultList.stream().filter(re -> StringUtils.equals("阴性" , re.getResult())).count(); + item.put("yangNum",yangNum); + item.put("yinNum", yinNum); + } + }); + //给检验结果赋值 end reportMainBody.put("list", resultList); } } @@ -954,7 +966,7 @@ public class EntrustServiceImpl extends BaseServiceImpl wrapper.eq(TaskBlueprint::getEntrustId, entrust.getId()); TaskBlueprint taskBlueprint = blueprintService.getOne(wrapper); result1.put("acceptanceNum", entrust.getAcceptanceNum()); - result1.put("simpleName", entrust.getSimpleName()); + result1.put("simpleName", StringUtils.remove(entrust.getSimpleName(), "-")); result1.put("takeCompany", entrust.getTakeCompany()); result1.put("takePerson", entrust.getTakePerson()); result1.put("takeCompanyAddress", entrust.getTakeCompanyAddress()); @@ -997,7 +1009,7 @@ public class EntrustServiceImpl extends BaseServiceImpl // 获取该仪器对象 Instrument instrument = instrumentService.getById(s); // 拼接仪器编号及名称 - instrumentName += instrument.getCode() + " " + instrument.getName() + ","; + instrumentName += instrument.getCode() + " " + instrument.getName() + "," + "\\r"; } result1.put("code", instrumentName); result1.put("experieDate", format3.format(taskBlueprint.getCreateTime())); @@ -1132,7 +1144,7 @@ public class EntrustServiceImpl extends BaseServiceImpl String s = getExperieNumPrefix(split[0]); result.put("1", s); result.put("2", examineResult.getDisposal()); - result.put("3", examine.getSimpleName()); + result.put("3", StringUtils.remove(examine.getSimpleName(), "-")); result.put("4", examine.getSimpleCount()); result.put("5", byId.getName()); if (examineBasis != null) { @@ -1221,7 +1233,7 @@ public class EntrustServiceImpl extends BaseServiceImpl if (i == (split2.length - 1)) { instrumentName += s2; } else { - instrumentName += s2 + ","; + instrumentName += s2 + "," + "\\r"; } } result.put("9", instrumentName); @@ -1277,12 +1289,12 @@ public class EntrustServiceImpl extends BaseServiceImpl SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy年MM月dd日"); if (examineResult.getVerificationTime() != null) { String s1 = dateFormat.format(examineResult.getVerificationTime()); - result.put("16", s1); + result.put("17", s1); } // 检测时间 if (examineResult.getInspectionTime() != null) { String s1 = dateFormat.format(examineResult.getInspectionTime()); - result.put("17", s1); + result.put("16", s1); } // 如果是布鲁氏检测 (列排单+式和列排多+式) @@ -1401,6 +1413,31 @@ public class EntrustServiceImpl extends BaseServiceImpl } for (int j = 1; j <= resultMap.size(); j++) { List arrVOList = resultMap.get(String.valueOf(j)); + //按照阴阳性进行分组 start +// Map> collect = arrVOList.stream().collect(Collectors.groupingBy(PCR2Excel::getValue)); +// List listYang = collect.get("阳性"); +// List listYin = collect.get("阴性"); +// List> resultYang = new ArrayList<>(); +// List> resultYin = new ArrayList<>(); +// +// listYang.forEach(yang -> { +// Map map = new HashMap<>(); +// map.put("numYang", yang.getExperieNum()); +// map.put("valueYang", yang.getCtValue()); +// map.put("resultYang", yang.getValue()); +// resultYang.add(map); +// }); +// +// listYin.forEach(yin ->{ +// Map map = new HashMap<>(); +// map.put("numYin", yin.getExperieNum()); +// map.put("valueYin", yin.getCtValue()); +// map.put("resultYin", yin.getValue()); +// resultYin.add(map); +// }); +// result.put("listYang", listYang); +// result.put("listYin", listYin); + //按照阴阳性进行分组 end // 使用每一页的数据 if (arrVOList.size() % 2 == 0) { for (int i = 0; i < arrVOList.size() / 2; i++) { @@ -1493,6 +1530,7 @@ public class EntrustServiceImpl extends BaseServiceImpl } result.put("list1", resultList2); result.put("list", resultList1); + url = DictBizCache.getKey(DictBizEnum.PRINT_URL.getName(), "PCRreportPrint"); } // XN检测 @@ -2901,6 +2939,19 @@ public class EntrustServiceImpl extends BaseServiceImpl // FileOutputStream fos = null; try { doc = WordExportUtil.exportWord07(url, result); + /** ------------------尝试修改对齐方式 start ----------------------------**/ + XWPFTable xwpfTable = doc.getTables().get(1);//获取第几个表格,从0开始 + XWPFTableRow row = xwpfTable.getRow(2);//获取表格的数据行 + XWPFTableCell cell1 = row.getCell(2); + XWPFTableCell cell2 = row.getCell(5); + + XWPFParagraph sourcePara1 = cell1.getParagraphs().get(0);//获取每一行 + sourcePara1.setAlignment(StringUtils.equals("阳性",sourcePara1.getText()) ? ParagraphAlignment.LEFT : ParagraphAlignment.RIGHT ); + + XWPFParagraph sourcePara2 = cell2.getParagraphs().get(0);//获取每一行 + sourcePara2.setAlignment(StringUtils.equals("阳性",sourcePara2.getText()) ? ParagraphAlignment.LEFT : ParagraphAlignment.RIGHT ); + + /** ------------------尝试修改对齐方式 end ------------------------------**/ // fos = new FileOutputStream("C://Users//AAA//Desktop//shuojin//dayin//检测报告2.docx"); // String filename = "测试.docx"; response.setContentType("application/octet-stream"); @@ -3195,6 +3246,14 @@ public class EntrustServiceImpl extends BaseServiceImpl String deptName = sysClient.getDeptName(eTask.getDeptId()).getData(); result.put("deptName", deptName); result.put("acceptanceNum", entrust.getAcceptanceNum()); + + /** *通过主表id到f_entruest_simple子表中获取experie_num的前缀作为检验编号 start **/ + QueryWrapper simpleWrapper = new QueryWrapper<>(); + simpleWrapper.eq("entrustId" ,Long.valueOf(id)); + Simple simple = simpleService.getOne(simpleWrapper); + result.put("experieNo", simple.getExperieNum().split("-")[0]); + /** *通过主表id到f_entruest_simple子表中获取experie_num的前缀作为检验编号 end **/ + if (eTask != null) { // position1 if ("1".equals(eTask.getSimpleType())) {