| | |
| | | import com.ltkj.system.service.ISysUserService; |
| | | import com.ltkj.web.config.pdfutils.PdfUtils; |
| | | import com.ltkj.web.controller.system.SysDeptController; |
| | | import jodd.util.StringUtil; |
| | | import lombok.SneakyThrows; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | import java.lang.reflect.InvocationTargetException; |
| | | import java.lang.reflect.Method; |
| | | import java.math.BigDecimal; |
| | | import java.nio.file.Files; |
| | | import java.nio.file.Path; |
| | | import java.nio.file.Paths; |
| | | import java.text.Collator; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | |
| | | private LtkjHysqdService ltkjHysqdService; |
| | | @Autowired |
| | | private LtkjGetexamreportinfoService ltkjGetexamreportinfoService; |
| | | @Value("${path.filePath}") |
| | | private String value; |
| | | // @Value("${path.filePath}") |
| | | // private String value; |
| | | @Value("${path.reportServer}") |
| | | private String urlValue; |
| | | @Autowired |
| | |
| | | private ITjProAdvicerulesService tjProAdvicerulesService; |
| | | @Autowired |
| | | private TjOrderYcxmService ycxmService; |
| | | @Resource |
| | | private TjXdtgmdjgService xdtgmdjgService; |
| | | @Autowired |
| | | private TjReportSpecialProjectService tjReportSpecialProjectService; |
| | | |
| | | private Integer pdfPage = 0; |
| | | |
| | |
| | | String s2 = sysConfigService.selectConfigByKey("tjreport_font_size_second_page_title"); |
| | | String s3 = sysConfigService.selectConfigByKey("tjreport_font_size_result_title"); |
| | | String s4 = sysConfigService.selectConfigByKey("tjreport_font_size_zongjian"); |
| | | String value = sysConfigService.selectConfigByKey("path_filePath"); |
| | | // String hospName = sysDeptController.getdangqiandengluyuanqu().get("msg").toString(); |
| | | if (StrUtil.isNotBlank(s1) && Integer.parseInt(s1) > 10) DEFAULT_FONT_SIZE = Integer.parseInt(s1); |
| | | else DEFAULT_FONT_SIZE = 10; |
| | |
| | | // List<Map<String, Object>> jiancha = new ArrayList<>(); |
| | | |
| | | |
| | | paragraph = PdfUtils.setParagraph(defaultTitleFont, "检查综述:"); |
| | | paragraph.setSpacingBefore(3f); |
| | | paragraph.setSpacingAfter(2f); |
| | | document2.add(paragraph); |
| | | |
| | | int xmXh = 1; |
| | | |
| | | Map<Long, List<TjOrderDetail>> collect = orderDetails.stream().collect(Collectors.groupingBy(TjOrderDetail::getProId)); |
| | | for (Map.Entry<String, List<CsProVo>> deptEntry : listMap.entrySet()) { |
| | | List<CsProVo> proVos = deptEntry.getValue(); |
| | | if (proVos.size() > 1) { |
| | | proVos = proVos.stream() |
| | | .sorted(Comparator.comparingLong(CsProVo::getProId)) |
| | | .collect(Collectors.toList()); |
| | | } |
| | | // 已经遍历过的 |
| | | ArrayList<String> jianYanYiDa = new ArrayList<>(); |
| | | for (CsProVo proVo : proVos) { |
| | | LambdaQueryWrapper<TjOrderYcxm> wq = new LambdaQueryWrapper<>(); |
| | | wq.eq(TjOrderYcxm::getTjh, tjOrder.getTjNumber()); |
| | | List<TjOrderYcxm> ycxms = ycxmService.list(wq); |
| | | boolean isBr = false; |
| | | if (null != ycxms && !ycxms.isEmpty()) { |
| | | |
| | | // 检查 |
| | | for (Map.Entry<Long, List<TjOrderDetail>> entry : collect.entrySet()) { |
| | | if (!entry.getKey().equals(proVo.getProId())) continue; |
| | | List<TjOrderDetail> details = entry.getValue(); |
| | | String xmmc = details.get(0).getProName(); |
| | | boolean isXmWrite = false; |
| | | for (TjOrderDetail detail : details) { |
| | | if (!isXmWrite) { |
| | | paragraph = new Paragraph(xmXh + ". " + xmmc, defaultFont); |
| | | paragraph.setAlignment(Element.ALIGN_LEFT); |
| | | document2.add(paragraph); |
| | | isXmWrite = true; |
| | | } |
| | | String result = detail.getProResult(); |
| | | if (StrUtil.isNotBlank(result)) { |
| | | int index = 1; |
| | | result = result.replaceAll("本报告仅对本次检查负责,临床医生依据病情如有疑问,请及时复查或进一步检查", ""); |
| | | // result = result.replaceAll("", ""); |
| | | String[] split = result.split("\n"); |
| | | StringBuilder builder = new StringBuilder(); |
| | | for (String s : split) { |
| | | if (StrUtil.isBlank(s.replaceAll("\n", "").trim())) continue; |
| | | builder.append(" (").append(index).append(")").append(s).append("\n"); |
| | | index++; |
| | | } |
| | | result = builder.toString(); |
| | | } |
| | | paragraph = new Paragraph(result, defaultFont); |
| | | paragraph = PdfUtils.setParagraph(defaultTitleFont, "检查综述:"); |
| | | paragraph.setSpacingBefore(3f); |
| | | paragraph.setSpacingAfter(2f); |
| | | document2.add(paragraph); |
| | | isBr = true; |
| | | |
| | | Map<String, List<TjOrderYcxm>> stringListMap = ycxms.stream().collect(Collectors.groupingBy(TjOrderYcxm::getParentName)); |
| | | |
| | | for (Map.Entry<String, List<TjOrderYcxm>> entry : stringListMap.entrySet()) { |
| | | List<TjOrderYcxm> details = entry.getValue(); |
| | | String xmmc = entry.getKey(); |
| | | // String xmmc = details.get(0).getProName(); |
| | | boolean isXmWrite = false; |
| | | int index = 1; |
| | | for (TjOrderYcxm detail : details) { |
| | | // if (!entry.getKey().equals(detail.getProId())) continue; |
| | | if (!isXmWrite) { |
| | | paragraph = new Paragraph(xmXh + ". " + xmmc, defaultFont); |
| | | paragraph.setAlignment(Element.ALIGN_LEFT); |
| | | document2.add(paragraph); |
| | | isXmWrite = true; |
| | | } |
| | | if (isXmWrite) { |
| | | paragraph = PdfUtils.setParagraph(defaultFont, ""); |
| | | paragraph.setLeading(0f); |
| | | paragraph.setSpacingBefore(0f); |
| | | paragraph.setSpacingAfter(5f); |
| | | document2.add(paragraph); |
| | | xmXh++; |
| | | } |
| | | } |
| | | String result = detail.getJcjg(); |
| | | if (StrUtil.isNotBlank(result)) { |
| | | result = result.replaceAll("本报告仅对本次检查负责,临床医生依据病情如有疑问,请及时复查或进一步检查", ""); |
| | | StringBuilder builder = new StringBuilder(); |
| | | if (StrUtil.isBlank(result.replaceAll("\n", "").trim())) continue; |
| | | builder.append(" (").append(index).append(")").append(detail.getJcxm()).append(": ").append(result).append("\n"); |
| | | index++; |
| | | |
| | | // 检验 |
| | | for (Map.Entry<String, Object> item : map.entrySet()) { |
| | | String xmmc = item.getKey(); |
| | | HashMap<String, Object> entryValue = (HashMap<String, Object>) item.getValue(); |
| | | ArrayList<List<String>> lists = (ArrayList<List<String>>) entryValue.get("data"); |
| | | boolean isXmWrite = false; |
| | | int index = 1; |
| | | for (List<String> i : lists) { |
| | | if (!i.get(6).contains(String.valueOf(proVo.getProId()))) continue; |
| | | if (i.contains("↓") || i.contains("↑")) { |
| | | if (jianYanYiDa.contains(i.get(5))) continue; |
| | | jianYanYiDa.add(i.get(5)); |
| | | if (!isXmWrite) { |
| | | paragraph = new Paragraph(xmXh + ". " + xmmc, defaultFont); |
| | | paragraph.setAlignment(Element.ALIGN_LEFT); |
| | | document2.add(paragraph); |
| | | isXmWrite = true; |
| | | } |
| | | String content = " (" + index + ") " + i.get(0) + ":" + i.get(1) + " " + i.get(3) + " " + i.get(4) + " " + i.get(2); |
| | | paragraph = new Paragraph(content, defaultFont); |
| | | paragraph.setAlignment(Element.ALIGN_LEFT); |
| | | document2.add(paragraph); |
| | | index++; |
| | | } |
| | | result = builder.toString(); |
| | | } |
| | | if (isXmWrite) { |
| | | paragraph = PdfUtils.setParagraph(defaultFont, ""); |
| | | paragraph.setSpacingBefore(0f); |
| | | paragraph.setSpacingAfter(5f); |
| | | document2.add(paragraph); |
| | | xmXh++; |
| | | } |
| | | paragraph = new Paragraph(result, defaultFont); |
| | | paragraph.setAlignment(Element.ALIGN_LEFT); |
| | | document2.add(paragraph); |
| | | } |
| | | if (isXmWrite) { |
| | | paragraph = PdfUtils.setParagraph(defaultFont, ""); |
| | | paragraph.setLeading(0f); |
| | | paragraph.setSpacingBefore(0f); |
| | | paragraph.setSpacingAfter(5f); |
| | | document2.add(paragraph); |
| | | xmXh++; |
| | | } |
| | | } |
| | | } |
| | | |
| | | paragraph = PdfUtils.setParagraph(defaultFont, ""); |
| | | paragraph.setLeading(0f); |
| | | paragraph.setSpacingBefore(10f); |
| | | paragraph.setSpacingAfter(10f); |
| | | document2.add(paragraph); |
| | | paragraph = PdfUtils.setParagraph(defaultTitleFont, "医生建议:"); |
| | | paragraph.setSpacingBefore(3f); |
| | | paragraph.setSpacingAfter(2f); |
| | | document2.add(paragraph); |
| | | if(isBr) { |
| | | paragraph = PdfUtils.setParagraph(defaultFont, ""); |
| | | paragraph.setLeading(0f); |
| | | paragraph.setSpacingBefore(10f); |
| | | paragraph.setSpacingAfter(10f); |
| | | document2.add(paragraph); |
| | | } |
| | | |
| | | |
| | | xmXh = 0; |
| | | LambdaQueryWrapper<TjOrderYcxm> wq = new LambdaQueryWrapper<>(); |
| | | wq.eq(TjOrderYcxm::getTjh, tjOrder.getTjNumber()); |
| | | List<TjOrderYcxm> ycxms = ycxmService.list(wq); |
| | | // LambdaQueryWrapper<TjOrderYcxm> wq = new LambdaQueryWrapper<>(); |
| | | // wq.eq(TjOrderYcxm::getTjh, tjOrder.getTjNumber()); |
| | | // List<TjOrderYcxm> ycxms = ycxmService.list(wq); |
| | | if (null != ycxms && !ycxms.isEmpty()) { |
| | | for (Map.Entry<String, List<CsProVo>> deptEntry : listMap.entrySet()) { |
| | | List<CsProVo> proVos = deptEntry.getValue(); |
| | | if (proVos.size() > 1) { |
| | | proVos = proVos.stream() |
| | | .sorted(Comparator.comparingLong(CsProVo::getProId)) |
| | | |
| | | paragraph = PdfUtils.setParagraph(defaultTitleFont, "医生建议:"); |
| | | paragraph.setSpacingBefore(3f); |
| | | paragraph.setSpacingAfter(2f); |
| | | document2.add(paragraph); |
| | | |
| | | Map<String, List<TjOrderYcxm>> stringListMap = ycxms.stream().collect(Collectors.groupingBy(TjOrderYcxm::getParentName)); |
| | | |
| | | for (Map.Entry<String, List<TjOrderYcxm>> entry : stringListMap.entrySet()) { |
| | | List<TjOrderYcxm> details = entry.getValue(); |
| | | if(null !=details && !details.isEmpty()){ |
| | | details= details.stream() |
| | | .sorted(Comparator.comparing(TjOrderYcxm::getJcxm)) |
| | | .collect(Collectors.toList()); |
| | | } |
| | | ArrayList<String> jianYanYiDa = new ArrayList<>(); |
| | | for (CsProVo proVo : proVos) { |
| | | // 检查 |
| | | for (Map.Entry<Long, List<TjOrderDetail>> entry : collect.entrySet()) { |
| | | if (!entry.getKey().equals(proVo.getProId())) continue; |
| | | List<TjOrderDetail> details = entry.getValue(); |
| | | if(null !=details && !details.isEmpty()){ |
| | | details= details.stream() |
| | | .sorted(Comparator.comparing(TjOrderDetail::getProName)) |
| | | .collect(Collectors.toList()); |
| | | boolean isXmWrite = false; |
| | | int index = 1; |
| | | int index1 = 1; |
| | | for (TjOrderDetail detail : details) { |
| | | String xmmc = detail.getProName(); |
| | | if (!isXmWrite) { |
| | | xmXh++; |
| | | paragraph = new Paragraph("【" + xmXh + "." + xmmc + "】", defaultFont); |
| | | paragraph.setAlignment(Element.ALIGN_LEFT); |
| | | document2.add(paragraph); |
| | | isXmWrite = true; |
| | | } |
| | | String result = detail.getProResult(); |
| | | if (StrUtil.isNotBlank(result)) { |
| | | String[] split = result.split("\n"); |
| | | StringBuilder builder = new StringBuilder(); |
| | | for (String s : split) { |
| | | if (StrUtil.isBlank(s.replaceAll("\n", "").trim())) continue; |
| | | builder.append(" (").append(index1).append(")").append(s).append("\n"); |
| | | index1++; |
| | | } |
| | | result = builder.toString(); |
| | | } |
| | | if (StrUtil.isNotBlank(result)) { |
| | | paragraph = new Paragraph(result, defaultFont); |
| | | paragraph.setAlignment(Element.ALIGN_LEFT); |
| | | document2.add(paragraph); |
| | | } else { |
| | | paragraph = new Paragraph("建议定期复查", defaultFont); |
| | | paragraph.setAlignment(Element.ALIGN_LEFT); |
| | | document2.add(paragraph); |
| | | } |
| | | String str = " "; |
| | | List<Map<String, Object>> maps = new ArrayList<>(); |
| | | |
| | | LambdaQueryWrapper<TjOrderYcxm> ycwq=new LambdaQueryWrapper<>(); |
| | | ycwq.eq(TjOrderYcxm::getTjh,tjOrder.getTjNumber()); |
| | | ycwq.eq(TjOrderYcxm::getJcxm,xmmc); |
| | | TjOrderYcxm ycxm = ycxmService.getOne(ycwq); |
| | | if(null !=ycxm){ |
| | | String jynr = ycxm.getJynr(); |
| | | JSONArray array = JSONUtil.parseArray(jynr); |
| | | for (Object object : array) { |
| | | Map<String,Object> objectMap=new HashMap<>(); |
| | | JSONObject jsonObject = (JSONObject) object; |
| | | String bt = jsonObject.getStr("bt"); |
| | | String nr = jsonObject.getStr("nr"); |
| | | objectMap.put("bt",bt); |
| | | objectMap.put("nr",nr); |
| | | if(null !=bt || null !=nr) maps.add(objectMap); |
| | | } |
| | | List<Map<String, Object>> collect1 = maps.stream().distinct().collect(Collectors.toList()); |
| | | for (Map<String, Object> objectMap : collect1) { |
| | | String content = str + objectMap.get("bt").toString() + objectMap.get("nr").toString(); |
| | | if (StrUtil.isBlank(content)) content = " "; |
| | | paragraph = new Paragraph(content, defaultFont); |
| | | paragraph.setAlignment(Element.ALIGN_LEFT); |
| | | document2.add(paragraph); |
| | | } |
| | | } |
| | | index++; |
| | | paragraph = PdfUtils.setParagraph(defaultFont, ""); |
| | | paragraph.setLeading(0f); |
| | | paragraph.setSpacingBefore(0f); |
| | | paragraph.setSpacingAfter(5f); |
| | | document2.add(paragraph); |
| | | } |
| | | boolean isXmWrite = false; |
| | | int index = 1; |
| | | int index1 = 1; |
| | | for (TjOrderYcxm detail : details) { |
| | | String xmmc = entry.getKey().toString(); |
| | | if (!isXmWrite) { |
| | | xmXh++; |
| | | paragraph = new Paragraph("【" + xmXh + "." + xmmc + "】", defaultFont); |
| | | paragraph.setAlignment(Element.ALIGN_LEFT); |
| | | document2.add(paragraph); |
| | | isXmWrite = true; |
| | | } |
| | | } |
| | | // 检验 |
| | | for (Map.Entry<String, Object> item : map.entrySet()) { |
| | | String xmmc = item.getKey(); |
| | | HashMap<String, Object> entryValue = (HashMap<String, Object>) item.getValue(); |
| | | ArrayList<List<String>> lists = (ArrayList<List<String>>) entryValue.get("data"); |
| | | boolean isXmWrite = false; |
| | | int index = 1; |
| | | for (List<String> i : lists) { |
| | | if (!i.get(6).contains(String.valueOf(proVo.getProId()))) continue; |
| | | if (i.contains("↓") || i.contains("↑")) { |
| | | if (jianYanYiDa.contains(i.get(5))) continue; |
| | | jianYanYiDa.add(i.get(5)); |
| | | if (!isXmWrite) { |
| | | xmXh++; |
| | | paragraph = new Paragraph("【" + xmXh + "." + xmmc + "】", defaultFont); |
| | | paragraph.setAlignment(Element.ALIGN_LEFT); |
| | | document2.add(paragraph); |
| | | isXmWrite = true; |
| | | } |
| | | String content = " (" + index + ")" + i.get(0) + ":" + i.get(1) + " " + i.get(3) + " " + i.get(4) + " " + i.get(2); |
| | | paragraph = new Paragraph(content, defaultFont); |
| | | paragraph.setAlignment(Element.ALIGN_LEFT); |
| | | document2.add(paragraph); |
| | | String str = " "; |
| | | String result = detail.getJcjg(); |
| | | if (StrUtil.isNotBlank(result)) { |
| | | StringBuilder builder = new StringBuilder(); |
| | | if (StrUtil.isBlank(result.replaceAll("\n", "").trim())) continue; |
| | | builder.append(" (").append(index1).append(")").append(detail.getJcxm()).append(": ").append(result).append("\n"); |
| | | index1++; |
| | | |
| | | LambdaQueryWrapper<TjOrderYcxm> ycwq=new LambdaQueryWrapper<>(); |
| | | ycwq.eq(TjOrderYcxm::getTjh,tjOrder.getTjNumber()); |
| | | ycwq.eq(TjOrderYcxm::getJcxm,i.get(0)); |
| | | TjOrderYcxm ycxm = ycxmService.getOne(ycwq); |
| | | if(null !=ycxm){ |
| | | String jynr = ycxm.getJynr(); |
| | | JSONArray array = JSONUtil.parseArray(jynr); |
| | | for (Object object : array) { |
| | | JSONObject jsonObject = (JSONObject) object; |
| | | String bt = jsonObject.getStr("bt"); |
| | | String nr = jsonObject.getStr("nr"); |
| | | if(null !=bt || null !=nr) { |
| | | String content1 = str + bt + nr; |
| | | if (StrUtil.isBlank(content)) content1 = " "; |
| | | paragraph = new Paragraph(content1, defaultFont); |
| | | } |
| | | paragraph.setAlignment(Element.ALIGN_LEFT); |
| | | document2.add(paragraph); |
| | | } |
| | | paragraph = PdfUtils.setParagraph(defaultFont, ""); |
| | | paragraph.setSpacingBefore(2f); |
| | | paragraph.setSpacingAfter(5f); |
| | | document2.add(paragraph); |
| | | index++; |
| | | } |
| | | } |
| | | result = builder.toString(); |
| | | } |
| | | if (isXmWrite) { |
| | | paragraph = PdfUtils.setParagraph(defaultFont, ""); |
| | | paragraph.setSpacingBefore(0f); |
| | | paragraph.setSpacingAfter(5f); |
| | | if (StrUtil.isNotBlank(result)) { |
| | | paragraph = new Paragraph(result, defaultFont); |
| | | paragraph.setAlignment(Element.ALIGN_LEFT); |
| | | document2.add(paragraph); |
| | | } else { |
| | | paragraph = new Paragraph("建议定期复查", defaultFont); |
| | | paragraph.setAlignment(Element.ALIGN_LEFT); |
| | | document2.add(paragraph); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } else { |
| | | for (Map.Entry<String, List<CsProVo>> deptEntry : listMap.entrySet()) { |
| | | List<CsProVo> proVos = deptEntry.getValue(); |
| | | if (proVos.size() > 1) { |
| | | proVos = proVos.stream() |
| | | .sorted(Comparator.comparingLong(CsProVo::getProId)) |
| | | .collect(Collectors.toList()); |
| | | } |
| | | ArrayList<String> jianYanYiDa = new ArrayList<>(); |
| | | for (CsProVo proVo : proVos) { |
| | | // 检查 |
| | | for (Map.Entry<Long, List<TjOrderDetail>> entry : collect.entrySet()) { |
| | | if (!entry.getKey().equals(proVo.getProId())) continue; |
| | | List<TjOrderDetail> details = entry.getValue(); |
| | | String xmmc = details.get(0).getProName(); |
| | | boolean isXmWrite = false; |
| | | int index = 1; |
| | | for (TjOrderDetail detail : details) { |
| | | if (!isXmWrite) { |
| | | xmXh++; |
| | | paragraph = new Paragraph("【" + xmXh + "." + xmmc + "】", defaultFont); |
| | | paragraph.setAlignment(Element.ALIGN_LEFT); |
| | | document2.add(paragraph); |
| | | isXmWrite = true; |
| | | } |
| | | String result = detail.getProResult(); |
| | | if (StrUtil.isNotBlank(result)) { |
| | | // result = result.replaceAll(" ","").replaceAll("\t",""); |
| | | // result = result.replaceAll("\n本报告仅对本次检查负责,临床医生依据病情如有疑问,请及时复查或进一步检查", ""); |
| | | // result = "\n " + result.replaceAll("\n", "\n "); |
| | | int index1 = 1; |
| | | String[] split = result.split("\n"); |
| | | // boolean contains = result.contains("本报告仅对本次检查负责,临床医生依据病情如有疑问,请及时复查或进一步检查"); |
| | | boolean contains = result.contains(" "); |
| | | StringBuilder builder = new StringBuilder(); |
| | | for (String s : split) { |
| | | if (StrUtil.isBlank(s.replaceAll("\n", "").trim())) continue; |
| | | builder.append(" (").append(index1).append(")").append(s).append("\n"); |
| | | index1++; |
| | | } |
| | | // if (!contains) builder.append(" (").append(index1).append(")").append("本报告仅对本次检查负责,临床医生依据病情如有疑问,请及时复查或进一步检查"); |
| | | // if (!contains) builder.append(" (").append(index1).append(")").append(" "); |
| | | // else builder.substring(0,builder.length() - 1); |
| | | result = builder.toString(); |
| | | } |
| | | // String content = " (" + index + ") " + detail.getProName() + ":" + result; |
| | | // content = content.replaceAll("[\\n\\r]+$", ""); |
| | | // content = content.replaceAll("\\s+$", ""); |
| | | // paragraph = new Paragraph(content, defaultFont); |
| | | if (StrUtil.isNotBlank(result)) { |
| | | paragraph = new Paragraph(result, defaultFont); |
| | | paragraph.setAlignment(Element.ALIGN_LEFT); |
| | | document2.add(paragraph); |
| | | } else { |
| | | paragraph = new Paragraph("建议定期复查", defaultFont); |
| | | paragraph.setAlignment(Element.ALIGN_LEFT); |
| | | document2.add(paragraph); |
| | | } |
| | | String str = " "; |
| | | // List<Map<String, Object>> maps = tjRulesService.getyichangxiangmujianyiguize(entry.getKey().toString(),"", |
| | | // detail.getYcbz(),tjOrder.getTjNumber(),detail.getProName().replaceAll("[((][^))]*[))]", "") |
| | | // .replaceAll("[ 测定检测]",""),detail.getProResult()); |
| | | List<Map<String, Object>> maps = new ArrayList<>(); |
| | | if (detail.getDeptId().equals("2")) { |
| | | String[] split = result.split("。|,|,"); |
| | | for (String s : split) { |
| | | s = s.replaceAll("\n", "").replaceAll("[((][^))]*[))]", ""); |
| | | // Map<String,Object> mapss= tjRulesService.getyichangxiangmujianyiguizeJianCha(s); |
| | | Map<String, Object> mapss = tjProAdvicerulesService.getyichangxiangmujianyiguizeJianCha(detail.getKs(), s, "0"); |
| | | if (null != mapss) { |
| | | Object bt = mapss.get("bt"); |
| | | Object nr = mapss.get("nr"); |
| | | if (null != bt && null != nr) maps.add(mapss); |
| | | } |
| | | } |
| | | String str = " "; |
| | | List<Map<String, Object>> maps = new ArrayList<>(); |
| | | |
| | | String jynr = detail.getJynr(); |
| | | JSONArray array = JSONUtil.parseArray(jynr); |
| | | for (Object object : array) { |
| | | Map<String,Object> objectMap=new HashMap<>(); |
| | | JSONObject jsonObject = (JSONObject) object; |
| | | String bt = jsonObject.getStr("bt"); |
| | | String nr = jsonObject.getStr("nr"); |
| | | objectMap.put("bt",bt); |
| | | objectMap.put("nr",nr); |
| | | if(null !=bt || null !=nr) maps.add(objectMap); |
| | | } |
| | | List<Map<String, Object>> collect1 = maps.stream().distinct().collect(Collectors.toList()); |
| | | |
| | | for (Map<String, Object> objectMap : collect1) { |
| | | String content = str + objectMap.get("bt").toString() + objectMap.get("nr").toString(); |
| | | // if (StrUtil.isBlank(content)) content = " 本报告仅对本次检查负责,临床医生依据病情如有疑问,请及时复查或进一步检查"; |
| | | if (StrUtil.isBlank(content)) content = " "; |
| | | paragraph = new Paragraph(content, defaultFont); |
| | | paragraph.setAlignment(Element.ALIGN_LEFT); |
| | | document2.add(paragraph); |
| | | } |
| | | index++; |
| | | paragraph = PdfUtils.setParagraph(defaultFont, ""); |
| | | paragraph.setLeading(0f); |
| | | paragraph.setSpacingBefore(0f); |
| | | paragraph.setSpacingAfter(5f); |
| | | document2.add(paragraph); |
| | | } |
| | | } |
| | | // 检验 |
| | | for (Map.Entry<String, Object> item : map.entrySet()) { |
| | | String xmmc = item.getKey(); |
| | | HashMap<String, Object> entryValue = (HashMap<String, Object>) item.getValue(); |
| | | ArrayList<List<String>> lists = (ArrayList<List<String>>) entryValue.get("data"); |
| | | boolean isXmWrite = false; |
| | | int index = 1; |
| | | for (List<String> i : lists) { |
| | | if (!i.get(6).contains(String.valueOf(proVo.getProId()))) continue; |
| | | if (i.contains("↓") || i.contains("↑")) { |
| | | if (jianYanYiDa.contains(i.get(5))) continue; |
| | | jianYanYiDa.add(i.get(5)); |
| | | if (!isXmWrite) { |
| | | xmXh++; |
| | | paragraph = new Paragraph("【" + xmXh + "." + xmmc + "】", defaultFont); |
| | | paragraph.setAlignment(Element.ALIGN_LEFT); |
| | | document2.add(paragraph); |
| | | isXmWrite = true; |
| | | } |
| | | String content = " (" + index + ")" + i.get(0) + ":" + i.get(1) + " " + i.get(3) + " " + i.get(4) + " " + i.get(2); |
| | | paragraph = new Paragraph(content, defaultFont); |
| | | paragraph.setAlignment(Element.ALIGN_LEFT); |
| | | document2.add(paragraph); |
| | | // 第六位是lis项目id |
| | | // LambdaQueryWrapper<TjProject> wrapper = new LambdaQueryWrapper<>(); |
| | | // wrapper.eq(TjProject::getLisXmbm,i.get(5)); |
| | | // TjProject project = projectService.getOne(wrapper); |
| | | // if (project != null) { |
| | | // LambdaQueryWrapper<TjRules> queryWrapper = new LambdaQueryWrapper<>(); |
| | | // queryWrapper.eq(TjRules::getProId,project.getProId()); |
| | | // List<TjRules> rules = tjRulesService.list(queryWrapper); |
| | | // if (!rules.isEmpty()){ |
| | | // |
| | | // } |
| | | String str = " "; |
| | | List<Map<String, Object>> maps = tjRulesService.getyichangxiangmujianyiguize(i.get(5), "", |
| | | i.get(2), tjOrder.getTjNumber(), i.get(0).replaceAll("[((][^))]*[))]", "") |
| | | .replaceAll("[ 测定检测]", ""), i.get(1)); |
| | | if (!maps.isEmpty()) { |
| | | for (Map<String, Object> objectMap : maps) { |
| | | // paragraph = new Paragraph(str+"建议标题",defaultFont); |
| | | // paragraph.setAlignment(Element.ALIGN_LEFT); |
| | | // document2.add(paragraph); |
| | | // |
| | | // paragraph = new Paragraph(str+objectMap.get("bt").toString(),defaultFont); |
| | | // paragraph.setAlignment(Element.ALIGN_LEFT); |
| | | // document2.add(paragraph); |
| | | // |
| | | // paragraph = new Paragraph(str+"建议内容",defaultFont); |
| | | // paragraph.setAlignment(Element.ALIGN_LEFT); |
| | | // document2.add(paragraph); |
| | | // |
| | | // paragraph = new Paragraph(str+objectMap.get("nr").toString(),defaultFont); |
| | | // paragraph.setAlignment(Element.ALIGN_LEFT); |
| | | // document2.add(paragraph); |
| | | Object bt = objectMap.get("bt"); |
| | | Object nr = objectMap.get("nr"); |
| | | if (null != bt && null != nr) { |
| | | String content1 = str + bt.toString() + nr.toString().trim(); |
| | | if (StrUtil.isBlank(content)) content1 = " "; |
| | | paragraph = new Paragraph(content1, defaultFont); |
| | | } |
| | | // if (StrUtil.isBlank(content)) content1 = " 本报告仅对本次检查负责,临床医生依据病情如有疑问,请及时复查或进一步检查"; |
| | | paragraph.setAlignment(Element.ALIGN_LEFT); |
| | | document2.add(paragraph); |
| | | } |
| | | paragraph = PdfUtils.setParagraph(defaultFont, ""); |
| | | paragraph.setSpacingBefore(2f); |
| | | paragraph.setSpacingAfter(5f); |
| | | document2.add(paragraph); |
| | | } |
| | | // } |
| | | index++; |
| | | } |
| | | } |
| | | if (isXmWrite) { |
| | | paragraph = PdfUtils.setParagraph(defaultFont, ""); |
| | | paragraph.setSpacingBefore(0f); |
| | | paragraph.setSpacingAfter(5f); |
| | | document2.add(paragraph); |
| | | } |
| | | index++; |
| | | paragraph = PdfUtils.setParagraph(defaultFont, ""); |
| | | paragraph.setLeading(0f); |
| | | paragraph.setSpacingBefore(0f); |
| | | paragraph.setSpacingAfter(5f); |
| | | document2.add(paragraph); |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | for (int i = 0; i < 1; i++) { |
| | | paragraph = PdfUtils.setParagraph(defaultFont, ""); |
| | |
| | | log.error(String.valueOf(e)); |
| | | return AjaxResult.error(); |
| | | } |
| | | |
| | | |
| | | String isPdfFujianPro = sysConfigService.selectConfigByKey("is_pdf_fujian_pro"); |
| | | List<TjXdtgmdjg> xdtgmdjgList; |
| | | if (StrUtil.isNotBlank(isPdfFujianPro) && isPdfFujianPro.equalsIgnoreCase("Y")){ |
| | | xdtgmdjgList = xdtgmdjgService.xdtGlAttProByTjNum(tjOrder.getTjNumber()); |
| | | }else { |
| | | LambdaQueryWrapper<TjXdtgmdjg> wqq=new LambdaQueryWrapper<>(); |
| | | wqq.eq(TjXdtgmdjg::getTjh,tjOrder.getTjNumber()); |
| | | wqq.isNotNull(TjXdtgmdjg::getUrl); |
| | | xdtgmdjgList = xdtgmdjgService.list(wqq); |
| | | } |
| | | |
| | | int index=1; |
| | | for (TjXdtgmdjg xdtgmdjg : xdtgmdjgList) { |
| | | document.newPage(); |
| | | cell = new PdfPCell(); |
| | | PdfPTable tablefj = new PdfPTable(new float[]{100f}); |
| | | tablefj.setTotalWidth(PageSize.A4.getWidth() - 100); |
| | | tablefj.setLockedWidth(true); |
| | | tablefj.setHorizontalAlignment(Element.ALIGN_LEFT); |
| | | tablefj.getDefaultCell().setBorder(0); |
| | | tablefj.getDefaultCell().setHorizontalAlignment(Element.ALIGN_RIGHT); |
| | | |
| | | cell.setBorder(Rectangle.NO_BORDER); |
| | | cell.setVerticalAlignment(Element.ALIGN_MIDDLE); |
| | | cell.setHorizontalAlignment(Element.ALIGN_CENTER); |
| | | cell.setPaddingTop(10); |
| | | cell.setPaddingBottom(10); |
| | | cell.setPhrase(new Phrase("附件"+index+": "+ xdtgmdjg.getProName(), zongJianFont)); |
| | | Path path = Paths.get(xdtgmdjg.getUrl()); |
| | | byte[] bytesfj = null; |
| | | try { |
| | | bytesfj = Files.readAllBytes(path); |
| | | } catch (IOException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | Image image = Image.getInstance(bytesfj); |
| | | image.scaleToFit(500, 2500); |
| | | tablefj.addCell(cell); |
| | | cell = new PdfPCell(); |
| | | cell.addElement(image); |
| | | tablefj.addCell(cell); |
| | | document.add(tablefj); |
| | | index++; |
| | | } |
| | | |
| | | document.close(); |
| | | |
| | | |
| | |
| | | */ |
| | | private void savePDFFile(String outputFileName1, TjOrder tjOrder, TjCustomer customer, ByteArrayOutputStream finalOutPut) throws IOException, DocumentException, InterruptedException { |
| | | // 第一步:生成文件并保存 |
| | | String value = sysConfigService.selectConfigByKey("path_filePath"); |
| | | String outputPath1 = value + File.separator; |
| | | File file = new File(outputPath1 + outputFileName1); |
| | | BufferedOutputStream outputStream = null; |
| | |
| | | * @throws DocumentException |
| | | */ |
| | | private void notHuaYanTable(Document document1, Map<TjOrderRemark, List<TjPdfVO>> printReport, DictHosp dictHosp, String colorStr, boolean isPacs) throws DocumentException { |
| | | List<TjReportSpecialProject> tjReportSpecialProjects = tjReportSpecialProjectService.list(); |
| | | for (Map.Entry<TjOrderRemark, List<TjPdfVO>> entry : printReport.entrySet()) { |
| | | LambdaQueryWrapper<TjProject> wqqq = new LambdaQueryWrapper<>(); |
| | | wqqq.eq(TjProject::getProId, entry.getKey().getProId()); |
| | |
| | | // if (dictHosp.getHospName().equals("澄合矿务局中心医院") && !value.isEmpty()){ |
| | | if (!value.isEmpty()) { |
| | | if (value.size() > 1) { |
| | | if (value.get(0).getPid().equals("1862852701533012001")) { |
| | | Font remarkFonts = PdfUtils.setFont(DEFAULT_FONT_SIZE); |
| | | Paragraph ppp = new Paragraph("阳性参考值:", remarkFonts); |
| | | paragraph.setAlignment(Element.ALIGN_LEFT); |
| | | paragraph.setLeading(5f); |
| | | document1.add(ppp); |
| | | |
| | | ppp = new Paragraph("DOB值: ≥ 4.0 HP-阳性", remarkFonts); |
| | | paragraph.setAlignment(Element.ALIGN_LEFT); |
| | | paragraph.setLeading(5f); |
| | | document1.add(ppp); |
| | | |
| | | ppp = new Paragraph(" < 4.0 正常", remarkFonts); |
| | | paragraph.setAlignment(Element.ALIGN_LEFT); |
| | | paragraph.setLeading(5f); |
| | | document1.add(ppp); |
| | | |
| | | |
| | | ppp = new Paragraph("检测结果: DOB=" + value.get(0).getProResult(), remarkFonts); |
| | | paragraph.setAlignment(Element.ALIGN_LEFT); |
| | | paragraph.setLeading(5f); |
| | | document1.add(ppp); |
| | | |
| | | ppp = new Paragraph("", remarkFonts); |
| | | paragraph.setAlignment(Element.ALIGN_LEFT); |
| | | paragraph.setLeading(5f); |
| | | document1.add(ppp); |
| | | ppp = new Paragraph("", remarkFonts); |
| | | paragraph.setAlignment(Element.ALIGN_LEFT); |
| | | paragraph.setLeading(5f); |
| | | document1.add(ppp); |
| | | if (StrUtil.isNotBlank(entry.getKey().getRemark())) { |
| | | ppp = new Paragraph("结论:" + entry.getKey().getRemark(), remarkFonts); |
| | | paragraph.setAlignment(Element.ALIGN_LEFT); |
| | | paragraph.setLeading(5f); |
| | | document1.add(ppp); |
| | | } |
| | | Long pid = Long.valueOf(value.get(0).getPid()); |
| | | Optional<TjReportSpecialProject> match = tjReportSpecialProjects.stream() |
| | | .filter(item -> item.getProId().equals(pid)) |
| | | .findFirst(); |
| | | if (match.isPresent()) { |
| | | reportSpecialProject(document1, entry, paragraph, value,match.get()); |
| | | } else { |
| | | String[] titles = {"体检项目", "体检结果", "单位"}; |
| | | Font headFont = PdfUtils.setFont(DEFAULT_FONT_SIZE); |
| | |
| | | Font remarkFonts = PdfUtils.setFont(DEFAULT_FONT_SIZE); |
| | | |
| | | if (isPacs) { |
| | | Paragraph pp = PdfUtils.setParagraph(remarkFonts, "检查所见:"); |
| | | Paragraph pp; |
| | | Paragraph ppp; |
| | | if (StrUtil.isNotBlank(value.get(0).getSj())) { |
| | | pp = PdfUtils.setParagraph(remarkFonts, "检查所见:"); |
| | | document1.add(pp); |
| | | ppp = new Paragraph(value.get(0).getSj(), remarkFonts); |
| | | paragraph.setAlignment(Element.ALIGN_LEFT); |
| | | paragraph.setLeading(5f); |
| | | document1.add(ppp); |
| | | } |
| | | pp = PdfUtils.setParagraph(remarkFonts, "检查提示:"+value.get(0).getTs()); |
| | | document1.add(pp); |
| | | Paragraph ppp = new Paragraph(value.get(0).getSj(), remarkFonts); |
| | | paragraph.setAlignment(Element.ALIGN_LEFT); |
| | | paragraph.setLeading(5f); |
| | | document1.add(ppp); |
| | | pp = PdfUtils.setParagraph(remarkFonts, "结论:"); |
| | | document1.add(pp); |
| | | ppp = new Paragraph(value.get(0).getTs(), remarkFonts); |
| | | paragraph.setAlignment(Element.ALIGN_LEFT); |
| | | paragraph.setLeading(5f); |
| | | document1.add(ppp); |
| | | // ppp = new Paragraph(value.get(0).getTs(), remarkFonts); |
| | | // paragraph.setAlignment(Element.ALIGN_LEFT); |
| | | // paragraph.setLeading(5f); |
| | | // document1.add(ppp); |
| | | } else { |
| | | if (value.get(0).getPid().equals("1862852701533012001")) { |
| | | remarkFonts = PdfUtils.setFont(DEFAULT_FONT_SIZE); |
| | | Paragraph ppp = new Paragraph("阳性参考值:", remarkFonts); |
| | | paragraph.setAlignment(Element.ALIGN_LEFT); |
| | | paragraph.setLeading(5f); |
| | | document1.add(ppp); |
| | | |
| | | ppp = new Paragraph("DOB值: ≥ 4.0 HP-阳性", remarkFonts); |
| | | paragraph.setAlignment(Element.ALIGN_LEFT); |
| | | paragraph.setLeading(5f); |
| | | document1.add(ppp); |
| | | |
| | | ppp = new Paragraph(" < 4.0 正常", remarkFonts); |
| | | paragraph.setAlignment(Element.ALIGN_LEFT); |
| | | paragraph.setLeading(5f); |
| | | document1.add(ppp); |
| | | |
| | | |
| | | ppp = new Paragraph("检测结果: DOB=" + value.get(0).getProResult(), remarkFonts); |
| | | paragraph.setAlignment(Element.ALIGN_LEFT); |
| | | paragraph.setLeading(5f); |
| | | document1.add(ppp); |
| | | |
| | | ppp = new Paragraph("", remarkFonts); |
| | | paragraph.setAlignment(Element.ALIGN_LEFT); |
| | | paragraph.setLeading(5f); |
| | | document1.add(ppp); |
| | | ppp = new Paragraph("", remarkFonts); |
| | | paragraph.setAlignment(Element.ALIGN_LEFT); |
| | | paragraph.setLeading(5f); |
| | | document1.add(ppp); |
| | | if (StrUtil.isNotBlank(entry.getKey().getRemark())) { |
| | | ppp = new Paragraph("结论:" + entry.getKey().getRemark(), remarkFonts); |
| | | paragraph.setAlignment(Element.ALIGN_LEFT); |
| | | paragraph.setLeading(5f); |
| | | document1.add(ppp); |
| | | } |
| | | Long pid = Long.valueOf(value.get(0).getPid()); |
| | | Optional<TjReportSpecialProject> match = tjReportSpecialProjects.stream() |
| | | .filter(item -> item.getProId().equals(pid)) |
| | | .findFirst(); |
| | | if (match.isPresent()) { |
| | | reportSpecialProject(document1, entry, paragraph, value,match.get()); |
| | | } else { |
| | | String[] titles = {"体检项目", "体检结果"}; |
| | | Font headFont = PdfUtils.setFont(DEFAULT_FONT_SIZE); |
| | |
| | | // if (dictHosp.getHospName().equals("澄合矿务局中心医院") && !value.isEmpty()){ |
| | | if (!value.isEmpty()) { |
| | | if (value.size() > 1) { |
| | | if (value.get(0).getPid().equals("1862852701533012001")) { |
| | | Font remarkFonts = PdfUtils.setFont(DEFAULT_FONT_SIZE); |
| | | Paragraph ppp = new Paragraph("阳性参考值:", remarkFonts); |
| | | paragraph.setAlignment(Element.ALIGN_LEFT); |
| | | paragraph.setLeading(5f); |
| | | document1.add(ppp); |
| | | |
| | | ppp = new Paragraph("DOB值: ≥ 4.0 HP-阳性", remarkFonts); |
| | | paragraph.setAlignment(Element.ALIGN_LEFT); |
| | | paragraph.setLeading(5f); |
| | | document1.add(ppp); |
| | | |
| | | ppp = new Paragraph(" < 4.0 正常", remarkFonts); |
| | | paragraph.setAlignment(Element.ALIGN_LEFT); |
| | | paragraph.setLeading(5f); |
| | | document1.add(ppp); |
| | | |
| | | |
| | | ppp = new Paragraph("检测结果: DOB=" + value.get(0).getProResult(), remarkFonts); |
| | | paragraph.setAlignment(Element.ALIGN_LEFT); |
| | | paragraph.setLeading(5f); |
| | | document1.add(ppp); |
| | | |
| | | ppp = new Paragraph("", remarkFonts); |
| | | paragraph.setAlignment(Element.ALIGN_LEFT); |
| | | paragraph.setLeading(5f); |
| | | document1.add(ppp); |
| | | ppp = new Paragraph("", remarkFonts); |
| | | paragraph.setAlignment(Element.ALIGN_LEFT); |
| | | paragraph.setLeading(5f); |
| | | document1.add(ppp); |
| | | if (StrUtil.isNotBlank(entry.getKey().getRemark())) { |
| | | ppp = new Paragraph("结论:" + entry.getKey().getRemark(), remarkFonts); |
| | | paragraph.setAlignment(Element.ALIGN_LEFT); |
| | | paragraph.setLeading(5f); |
| | | document1.add(ppp); |
| | | } |
| | | Long pid = Long.valueOf(value.get(0).getPid()); |
| | | Optional<TjReportSpecialProject> match = tjReportSpecialProjects.stream() |
| | | .filter(item -> item.getProId().equals(pid)) |
| | | .findFirst(); |
| | | if (match.isPresent()) { |
| | | reportSpecialProject(document1, entry, paragraph, value,match.get()); |
| | | } else { |
| | | String[] titles = {"体检项目", "体检结果", "单位"}; |
| | | Font headFont = PdfUtils.setFont(DEFAULT_FONT_SIZE); |
| | |
| | | Font remarkFonts = PdfUtils.setFont(DEFAULT_FONT_SIZE); |
| | | |
| | | if (isPacs) { |
| | | Paragraph pp = PdfUtils.setParagraph(remarkFonts, "检查所见:"); |
| | | Paragraph pp; |
| | | Paragraph ppp; |
| | | // String key = sysConfigService.selectConfigByKey("makepdfuseorderdetailproresult"); |
| | | // if (StrUtil.isNotBlank(key) && !key.equals("Y")){ |
| | | // if (StrUtil.isNotBlank(value.get(0).getSj())) { |
| | | // pp = PdfUtils.setParagraph(remarkFonts, "检查所见:"); |
| | | // document1.add(pp); |
| | | // ppp = new Paragraph(value.get(0).getSj(), remarkFonts); |
| | | // paragraph.setAlignment(Element.ALIGN_LEFT); |
| | | // paragraph.setLeading(5f); |
| | | // document1.add(ppp); |
| | | // } |
| | | // }else { |
| | | // if (StrUtil.isNotBlank(value.get(0).getSj()) || StrUtil.isNotBlank(value.get(0).getProResult())) { |
| | | // pp = PdfUtils.setParagraph(remarkFonts, "检查所见:"); |
| | | // document1.add(pp); |
| | | // ppp = new Paragraph(value.get(0).getSj() != null ? value.get(0).getSj() : value.get(0).getProResult(), remarkFonts); |
| | | // paragraph.setAlignment(Element.ALIGN_LEFT); |
| | | // paragraph.setLeading(5f); |
| | | // document1.add(ppp); |
| | | // } |
| | | // } |
| | | |
| | | if (StrUtil.isNotBlank(value.get(0).getSj()) || StrUtil.isNotBlank(value.get(0).getProResult())) { |
| | | pp = PdfUtils.setParagraph(remarkFonts, "检查所见:"); |
| | | document1.add(pp); |
| | | ppp = new Paragraph(value.get(0).getSj() != null ? value.get(0).getSj() : value.get(0).getProResult(), remarkFonts); |
| | | paragraph.setAlignment(Element.ALIGN_LEFT); |
| | | paragraph.setLeading(5f); |
| | | document1.add(ppp); |
| | | } |
| | | |
| | | pp = PdfUtils.setParagraph(remarkFonts, "检查提示:"); |
| | | document1.add(pp); |
| | | Paragraph ppp = new Paragraph(value.get(0).getSj() != null ? value.get(0).getSj() : value.get(0).getProResult(), remarkFonts); |
| | | ppp = new Paragraph((value.get(0).getTs() != null ? value.get(0).getTs() : value.get(0).getProResult()), remarkFonts); |
| | | paragraph.setAlignment(Element.ALIGN_LEFT); |
| | | paragraph.setLeading(5f); |
| | | document1.add(ppp); |
| | | pp = PdfUtils.setParagraph(remarkFonts, "结论:"); |
| | | document1.add(pp); |
| | | ppp = new Paragraph(value.get(0).getTs() != null ? value.get(0).getTs() : value.get(0).getProResult(), remarkFonts); |
| | | paragraph.setAlignment(Element.ALIGN_LEFT); |
| | | paragraph.setLeading(5f); |
| | | document1.add(ppp); |
| | | // ppp = new Paragraph(value.get(0).getTs() != null ? value.get(0).getTs() : value.get(0).getProResult(), remarkFonts); |
| | | // paragraph.setAlignment(Element.ALIGN_LEFT); |
| | | // paragraph.setLeading(5f); |
| | | // document1.add(ppp); |
| | | } else { |
| | | if (value.get(0).getPid().equals("1862852701533012001")) { |
| | | remarkFonts = PdfUtils.setFont(DEFAULT_FONT_SIZE); |
| | | Paragraph ppp = new Paragraph("阳性参考值:", remarkFonts); |
| | | paragraph.setAlignment(Element.ALIGN_LEFT); |
| | | paragraph.setLeading(5f); |
| | | document1.add(ppp); |
| | | |
| | | ppp = new Paragraph("DOB值: ≥ 4.0 HP-阳性", remarkFonts); |
| | | paragraph.setAlignment(Element.ALIGN_LEFT); |
| | | paragraph.setLeading(5f); |
| | | document1.add(ppp); |
| | | |
| | | ppp = new Paragraph(" < 4.0 正常", remarkFonts); |
| | | paragraph.setAlignment(Element.ALIGN_LEFT); |
| | | paragraph.setLeading(5f); |
| | | document1.add(ppp); |
| | | |
| | | |
| | | ppp = new Paragraph("检测结果: DOB=" + value.get(0).getProResult(), remarkFonts); |
| | | paragraph.setAlignment(Element.ALIGN_LEFT); |
| | | paragraph.setLeading(5f); |
| | | document1.add(ppp); |
| | | |
| | | ppp = new Paragraph("", remarkFonts); |
| | | paragraph.setAlignment(Element.ALIGN_LEFT); |
| | | paragraph.setLeading(5f); |
| | | document1.add(ppp); |
| | | ppp = new Paragraph("", remarkFonts); |
| | | paragraph.setAlignment(Element.ALIGN_LEFT); |
| | | paragraph.setLeading(5f); |
| | | document1.add(ppp); |
| | | if (StrUtil.isNotBlank(entry.getKey().getRemark())) { |
| | | ppp = new Paragraph("结论:" + entry.getKey().getRemark(), remarkFonts); |
| | | paragraph.setAlignment(Element.ALIGN_LEFT); |
| | | paragraph.setLeading(5f); |
| | | document1.add(ppp); |
| | | } |
| | | Long pid = Long.valueOf(value.get(0).getPid()); |
| | | Optional<TjReportSpecialProject> match = tjReportSpecialProjects.stream() |
| | | .filter(item -> item.getProId().equals(pid)) |
| | | .findFirst(); |
| | | if (match.isPresent()) { |
| | | reportSpecialProject(document1, entry, paragraph, value,match.get()); |
| | | } else { |
| | | String[] titles = {"体检项目", "体检结果"}; |
| | | Font headFont = PdfUtils.setFont(DEFAULT_FONT_SIZE); |
| | |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 目前写死 只有碳13、14 模板都是一样的只不过参考值不同 |
| | | * 凌云:{"dy":"4.0","xy":"4.0","title":"阳性参考值:","dystr":"DOB值: ≥ ${dy} HP-阳性","xystr":" < ${xy} 正常","en":"DOB"} |
| | | * 泾川县医院:{"dy":"100","xy":"100","title":"参考值(DPM):","dystr":"DPM值: ≥ ${dy} 阳性","xystr":" < ${xy} 阴性","en":"DPM"} |
| | | * @param document1 |
| | | * @param entry |
| | | * @param paragraph |
| | | * @param value |
| | | * @param tjReportSpecialProject |
| | | * @throws DocumentException |
| | | */ |
| | | private static void reportSpecialProject(Document document1, Map.Entry<TjOrderRemark, List<TjPdfVO>> entry, Paragraph paragraph, List<TjPdfVO> value,TjReportSpecialProject tjReportSpecialProject) throws DocumentException { |
| | | JSONObject entries = JSONUtil.parseObj(tjReportSpecialProject.getParams()); |
| | | Font remarkFonts = PdfUtils.setFont(DEFAULT_FONT_SIZE); |
| | | Paragraph ppp = new Paragraph(entries.getStr("title"), remarkFonts); |
| | | paragraph.setAlignment(Element.ALIGN_LEFT); |
| | | paragraph.setLeading(5f); |
| | | document1.add(ppp); |
| | | |
| | | ppp = new Paragraph(entries.getStr("dystr").replace("${dy}",entries.getStr("dy")), remarkFonts); |
| | | paragraph.setAlignment(Element.ALIGN_LEFT); |
| | | paragraph.setLeading(5f); |
| | | document1.add(ppp); |
| | | |
| | | ppp = new Paragraph(entries.getStr("xystr").replace("${xy}",entries.getStr("xy")), remarkFonts); |
| | | paragraph.setAlignment(Element.ALIGN_LEFT); |
| | | paragraph.setLeading(5f); |
| | | document1.add(ppp); |
| | | |
| | | |
| | | ppp = new Paragraph("检测结果: "+entries.getStr("en")+"=" + value.get(0).getProResult(), remarkFonts); |
| | | paragraph.setAlignment(Element.ALIGN_LEFT); |
| | | paragraph.setLeading(5f); |
| | | document1.add(ppp); |
| | | |
| | | ppp = new Paragraph("", remarkFonts); |
| | | paragraph.setAlignment(Element.ALIGN_LEFT); |
| | | paragraph.setLeading(5f); |
| | | document1.add(ppp); |
| | | ppp = new Paragraph("", remarkFonts); |
| | | paragraph.setAlignment(Element.ALIGN_LEFT); |
| | | paragraph.setLeading(5f); |
| | | document1.add(ppp); |
| | | if (StrUtil.isNotBlank(entry.getKey().getRemark())) { |
| | | ppp = new Paragraph("结论:" + entry.getKey().getRemark().replaceAll("null",""), remarkFonts); |
| | | paragraph.setAlignment(Element.ALIGN_LEFT); |
| | | paragraph.setLeading(5f); |
| | | document1.add(ppp); |
| | | } |
| | | } |
| | | |
| | |
| | | List<LtkjHysqd> list = ltkjHysqdService.list(ltkjHysqdLambdaQueryWrapper); |
| | | HashMap<String, Object> data = new HashMap<>(); |
| | | for (LtkjHysqd hysqd : list) { |
| | | LambdaQueryWrapper<LtkjHybgd> ltkjHybgdLambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | | ltkjHybgdLambdaQueryWrapper.eq(LtkjHybgd::getTmh, hysqd.getTmh()); |
| | | List<LtkjHybgd> hybgds = ltkjHybgdService.list(ltkjHybgdLambdaQueryWrapper); |
| | | // LambdaQueryWrapper<LtkjHybgd> ltkjHybgdLambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | | // ltkjHybgdLambdaQueryWrapper.eq(LtkjHybgd::getTmh, hysqd.getTmh()); |
| | | // List<LtkjHybgd> hybgds = ltkjHybgdService.list(ltkjHybgdLambdaQueryWrapper); |
| | | List<LtkjHybgd> hybgds = ltkjHybgdService.getReportJianYanBaoGaoDanList(hysqd.getTmh()); |
| | | if(null !=hybgds && !hybgds.isEmpty()){ |
| | | |
| | | hybgds = new ArrayList<>(hybgds.stream() |
| | | .collect(Collectors.toMap(LtkjHybgd::getJcxm, p -> p, (existing, replacement) -> existing)) |
| | | .values()); |
| | | |
| | | // hybgds=hybgds.stream().sorted(Comparator.comparing(LtkjHybgd::getJcxm, Collator.getInstance(Locale.CHINA))).collect(Collectors.toList()); |
| | | // hybgds = hybgds.stream() |
| | | // .sorted(Comparator.comparingInt( |
| | |
| | | // List<TjOrderRemark> tjOrderRemarks = tjOrderRemarkService.list(wqq); |
| | | List<TjOrderRemark> tjOrderRemarks = tjOrderRemarkService.notHuaYanData(tjNumber); |
| | | for (TjOrderRemark tjOrderRemark : tjOrderRemarks) { |
| | | printReport.put(tjOrderRemark, null); |
| | | printReport.put(tjOrderRemark,null); |
| | | } |
| | | for (Map.Entry<TjOrderRemark, List<TjPdfVO>> entry : printReport.entrySet()) { |
| | | List<TjPdfVO> tjPdfVOS = new ArrayList<>(); |
| | |
| | | } |
| | | } |
| | | } |
| | | // if(!tjPdfVOS.isEmpty()){ |
| | | // tjPdfVOS=tjPdfVOS.stream().sorted(Comparator.comparing(TjPdfVO::getProName, Collator.getInstance(Locale.CHINA))).collect(Collectors.toList()); |
| | | // tjPdfVOS = tjPdfVOS.stream() |
| | | // .sorted(Comparator.comparingInt( |
| | | // tjPdfVO -> tjPdfVO.getProName().length() // 根据名字的长度排序 |
| | | // )) |
| | | // .collect(Collectors.toList()); |
| | | // } |
| | | if(!tjPdfVOS.isEmpty()){ |
| | | tjPdfVOS=tjPdfVOS.stream().sorted(Comparator.comparing(TjPdfVO::getProName, Collator.getInstance(Locale.CHINA))).collect(Collectors.toList()); |
| | | tjPdfVOS = tjPdfVOS.stream() |
| | | .sorted(Comparator.comparingInt( |
| | | tjPdfVO -> tjPdfVO.getProName().length() // 根据名字的长度排序 |
| | | )) |
| | | .collect(Collectors.toList()); |
| | | } |
| | | printReport.put(entry.getKey(), tjPdfVOS); |
| | | } |
| | | } |
| | |
| | | if (tjOrderDetail.getProject().getProParentId().equals(entry.getKey().getProId()) |
| | | && entry.getKey().getType() == 1 |
| | | && !ids.contains(String.valueOf(tjOrderDetail.getProject().getProParentId()))) { |
| | | |
| | | TjProject tjProjectq = projectService.getById(tjOrderDetail.getProject().getProParentId()); |
| | | TjPdfVO tjPdfVO = new TjPdfVO(); |
| | | tjPdfVO.setProName(tjOrderDetail.getProject().getProName()); |
| | | tjPdfVO.setProResult(tjOrderDetail.getProResult()); |
| | |
| | | tjPdfVO.setCompany("/"); |
| | | } |
| | | tjPdfVO.setProId(String.valueOf(tjOrderDetail.getProject().getProId())); |
| | | // LambdaQueryWrapper<LtkjExamJcbgd> wrapper = new LambdaQueryWrapper<>(); |
| | | // wrapper.eq(LtkjExamJcbgd::getTjh, one.getCardId()); |
| | | // wrapper.like(LtkjExamJcbgd::getXmdm, String.valueOf(tjOrderDetail.getProject().getProParentId())) |
| | | // .or().eq(LtkjExamJcbgd::getXmdm, String.valueOf(tjProjectq.getHisXmbm())); |
| | | // wrapper.orderByDesc(LtkjExamJcbgd::getZdsj); |
| | | LambdaQueryWrapper<LtkjExamJcbgd> wrapper = new LambdaQueryWrapper<>(); |
| | | wrapper.eq(LtkjExamJcbgd::getTjh, tjNumber); |
| | | wrapper.like(LtkjExamJcbgd::getXmdm, String.valueOf(tjOrderDetail.getProject().getProParentId())); |
| | | wrapper.orderByDesc(LtkjExamJcbgd::getZdsj); |
| | | wrapper.eq(LtkjExamJcbgd::getTjh, one.getCardId()) |
| | | .and(w -> w.like(LtkjExamJcbgd::getXmdm, String.valueOf(tjOrderDetail.getProject().getProParentId())) |
| | | .or() |
| | | .eq(LtkjExamJcbgd::getXmdm, String.valueOf(tjProjectq.getHisXmbm()))).orderByDesc(LtkjExamJcbgd::getZdsj); |
| | | |
| | | List<LtkjExamJcbgd> list = jcbgdService.list(wrapper); |
| | | if (null != list && !list.isEmpty()) { |
| | | LtkjExamJcbgd jcbgd = list.get(0); |
| | | if (jcbgd != null) { |
| | | tjPdfVO.setTs(jcbgd.getYxbx()); |
| | | tjPdfVO.setSj(jcbgd.getBgNr()); |
| | | String yxbx = jcbgd.getYxbx(); |
| | | String bgNr = jcbgd.getBgNr(); |
| | | // 正则表达式:匹配数字后跟 '.' 或 '、' |
| | | String regex = "\\d+[\\.,、]"; |
| | | // 使用正则替换,匹配的数字后添加换行符 |
| | | if(StringUtil.isNotBlank(yxbx)) yxbx = yxbx.replaceAll(regex, "\n$0"); |
| | | if(StringUtil.isBlank(bgNr)) bgNr = ""; |
| | | if(StringUtil.isBlank(yxbx)) yxbx = ""; |
| | | tjPdfVO.setTs(yxbx); |
| | | tjPdfVO.setSj(bgNr); |
| | | tjPdfVO.setShys(jcbgd.getShysxm()); |
| | | tjPdfVO.setProName(jcbgd.getXmmc()); |
| | | ids += "|" + jcbgd.getXmdm(); |
| | |
| | | } |
| | | } |
| | | } |
| | | // if(!tjPdfVOS.isEmpty()){ |
| | | // tjPdfVOS=tjPdfVOS.stream().sorted(Comparator.comparing(TjPdfVO::getProName, Collator.getInstance(Locale.CHINA))).collect(Collectors.toList()); |
| | | // tjPdfVOS = tjPdfVOS.stream() |
| | | // .sorted(Comparator.comparingInt( |
| | | // tjPdfVO -> tjPdfVO.getProName().length() // 根据名字的长度排序 |
| | | // )) |
| | | // .collect(Collectors.toList()); |
| | | // } |
| | | printReport.put(entry.getKey(), tjPdfVOS); |
| | | } |
| | | } |