| | |
| | | } |
| | | } |
| | | |
| | | private void pacsTable(Document document1, Map<TjOrderRemark, List<TjPdfVO>> printReport, DictHosp dictHosp, String colorStr, boolean isPacs)throws DocumentException{ |
| | | try { |
| | | |
| | | for (Map.Entry<TjOrderRemark, List<TjPdfVO>> entry : printReport.entrySet()) { |
| | | |
| | | if (entry.getValue() == null || entry.getValue().isEmpty()) continue; |
| | | //判断该项目是否需要打印报告 |
| | | |
| | | TjOrderRemark orderRemark = entry.getKey(); |
| | | List<TjPdfVO> value = entry.getValue().stream().distinct().collect(Collectors.toList()); |
| | | if (StrUtil.isBlank(value.get(0).getProResult()) && (StrUtil.isBlank(value.get(0).getTs()) && StrUtil.isBlank(value.get(0).getSj()))) { |
| | | continue; |
| | | } |
| | | String titleName = null; |
| | | |
| | | if (entry.getValue().get(0).getProName().contains(";")) |
| | | titleName = entry.getValue().get(0).getProName(); |
| | | else titleName = orderRemark.getProName(); |
| | | // 设置标题字体样式 |
| | | Font titleFonts = PdfUtils.setFont(DEFAULT_FONT_SIZE); |
| | | Paragraph paragraph = PdfUtils.setParagraph(titleFonts, titleName); |
| | | |
| | | if (StrUtil.isBlank(value.get(0).getProResult()) && (StrUtil.isBlank(value.get(0).getTs().replaceAll("\n","")) |
| | | && StrUtil.isBlank(value.get(0).getSj().replaceAll("\n","")))) { |
| | | continue; |
| | | } |
| | | Font titleFont = PdfUtils.setFont(DEFAULT_TITLE_FONT_SIZE); |
| | | titleFont.setStyle(Font.BOLD); |
| | | PdfPCell cellTitle = new PdfPCell(PdfUtils.setParagraph(titleFont, titleName)); |
| | | cellTitle.setBorder(Rectangle.NO_BORDER); |
| | | Color color = Color.decode("#B4CDCD"); |
| | | cellTitle.setBackgroundColor(new BaseColor(color.getRed(), color.getGreen(), color.getBlue())); // 设置背景颜色(十六进制 RGB) |
| | | // 创建表格并添加单元格 |
| | | PdfPTable tableTitle = new PdfPTable(1); |
| | | tableTitle.setWidthPercentage(100); |
| | | tableTitle.addCell(cellTitle); |
| | | // 将表格添加到文档中 |
| | | document1.add(tableTitle); |
| | | |
| | | if (!value.isEmpty()) { |
| | | if (value.size() > 1) { |
| | | Long pid = Long.valueOf(value.get(0).getPid()); |
| | | String[] titles = {"体检项目", "体检结果", "单位"}; |
| | | Font headFont = PdfUtils.setFont(DEFAULT_FONT_SIZE); |
| | | Font textFont = PdfUtils.setFont(DEFAULT_FONT_SIZE); |
| | | PdfPTable table = PdfUtils.setTable2(headFont, textFont, titles, value, isPacs, new float[]{240, 240, 240}); |
| | | document1.add(table); |
| | | |
| | | } else { |
| | | Font remarkFonts = PdfUtils.setFont(DEFAULT_FONT_SIZE); |
| | | |
| | | if (isPacs) { |
| | | Paragraph pp; |
| | | Paragraph 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().replaceAll("\n","") : value.get(0).getProResult().replaceAll("\n",""), 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().replaceAll("\n","") : value.get(0).getProResult().replaceAll("\n","")), remarkFonts); |
| | | paragraph.setAlignment(Element.ALIGN_LEFT); |
| | | paragraph.setLeading(5f); |
| | | document1.add(ppp); |
| | | |
| | | } else { |
| | | Long pid = Long.valueOf(value.get(0).getPid()); |
| | | String[] titles = {"体检项目", "体检结果"}; |
| | | Font headFont = PdfUtils.setFont(DEFAULT_FONT_SIZE); |
| | | Font textFont = PdfUtils.setFont(DEFAULT_FONT_SIZE); |
| | | PdfPTable table = PdfUtils.setTable2(headFont, textFont, titles, value, false, new float[]{240, 300}); |
| | | document1.add(table); |
| | | } |
| | | |
| | | } |
| | | } else { |
| | | String[] titles = {"体检项目", "体检结果", "单位"}; |
| | | Font headFont = PdfUtils.setFont(DEFAULT_FONT_SIZE); |
| | | Font textFont = PdfUtils.setFont(DEFAULT_FONT_SIZE); |
| | | PdfPTable table = PdfUtils.setTable(headFont, textFont, titles, value, isPacs); |
| | | document1.add(table); |
| | | } |
| | | |
| | | |
| | | //判断备注是否为空 空不能显示null |
| | | if (entry.getKey().getRemark() == null) { |
| | | entry.getKey().setRemark(""); |
| | | } |
| | | // if (!dictHosp.getHospName().equals("澄合矿务局中心医院")){ |
| | | if (!true) { |
| | | String remark = "备注:" + entry.getKey().getRemark(); |
| | | if (entry.getKey().getRemark().length() > 50) { |
| | | int j = 0; |
| | | for (int i = 0; i < remark.length() / 50; i++) { |
| | | String substring = remark.substring(j, j + 50); |
| | | Font remarkFonts = PdfUtils.setFont(DEFAULT_FONT_SIZE); |
| | | Paragraph pp = PdfUtils.setParagraph(remarkFonts, substring); |
| | | document1.add(pp); |
| | | j = j + 50; |
| | | } |
| | | if (remark.length() % 50 != 0) { |
| | | String substring = remark.substring((remark.length() / 50) * 50, remark.length() - 1); |
| | | Font remarkFonts = PdfUtils.setFont(DEFAULT_FONT_SIZE); |
| | | Paragraph pp = PdfUtils.setParagraph(remarkFonts, substring); |
| | | document1.add(pp); |
| | | } |
| | | } else { |
| | | Font remarkFonts = PdfUtils.setFont(DEFAULT_FONT_SIZE); |
| | | Paragraph pp = PdfUtils.setParagraph(remarkFonts, remark); |
| | | document1.add(pp); |
| | | } |
| | | } |
| | | //判断主检医师是否为空 空不能显示null |
| | | zhuJianYiShi(document1, entry, orderRemark.getCreateTime(), dictHosp); |
| | | // if (!dictHosp.getHospName().equals("澄合矿务局中心医院")) { |
| | | if (!true) { |
| | | //分割线 |
| | | LineSeparator objectName = new LineSeparator(); |
| | | document1.add(objectName); |
| | | } |
| | | |
| | | |
| | | } |
| | | } catch (NumberFormatException e) { |
| | | throw new RuntimeException(e); |
| | | } catch (DocumentException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 主见医师行显示设置 |
| | | * |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | private void newpacsJianChaData(String tjNumber, Map<TjOrderRemark, List<TjPdfVO>> printReport, TjOrder one, TjCustomer customer) { |
| | | try { |
| | | List<TjOrderRemark> tjOrderRemarks = tjOrderRemarkService.newpacsJianChaData(tjNumber); |
| | | for (TjOrderRemark tjOrderRemark : tjOrderRemarks) { |
| | | List<TjPdfVO> tjPdfVOS = new ArrayList<>(); |
| | | TjPdfVO tjPdfVO = new TjPdfVO(); |
| | | tjPdfVO.setProResult(null); |
| | | tjPdfVO.setExc(0L); |
| | | tjPdfVO.setCompany("/"); |
| | | tjPdfVO.setProId(tjOrderRemark.getProsId()); |
| | | String yxbx = tjOrderRemark.getRemark(); |
| | | String bgNr = tjOrderRemark.getJgbx(); |
| | | // 正则表达式:匹配数字后跟 '.' 或 '、' |
| | | 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(tjOrderRemark.getDoctorName()); |
| | | tjPdfVO.setProName(tjOrderRemark.getProName()); |
| | | tjPdfVOS.add(tjPdfVO); |
| | | printReport.put(tjOrderRemark, tjPdfVOS); |
| | | } |
| | | } catch (Exception e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 设置用户信息 |
| | | * |