| | |
| | | return AjaxResult.error(); |
| | | } |
| | | String outputFileName1 = customer.getCusId() + tjOrder.getTjNumber() + customer.getCusName() + "_报告.pdf"; |
| | | try { |
| | | PdfReader pdfReader = new PdfReader(finalOutPut.toByteArray()); |
| | | int pages = pdfReader.getNumberOfPages(); |
| | | ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); |
| | | PdfStamper pdfStamper = new PdfStamper(pdfReader, outputStream); |
| | | PdfContentByte contentByte; |
| | | BaseFont baseFont = PdfUtils.createBaseFont(null); |
| | | for (int i = 2; i <= pages; i++) { |
| | | contentByte = pdfStamper.getOverContent(i); |
| | | contentByte.beginText(); |
| | | contentByte.setFontAndSize(baseFont,11); |
| | | float x = contentByte.getPdfDocument().getPageSize().getWidth() / 2; |
| | | float y = 20; |
| | | contentByte.showTextAligned(PdfContentByte.ALIGN_CENTER,String.valueOf(i-1),x,y,0); |
| | | contentByte.endText(); |
| | | } |
| | | pdfStamper.close(); |
| | | pdfReader.close(); |
| | | finalOutPut = outputStream; |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | savePDFFile(outputFileName1, tjOrder, customer, finalOutPut); |
| | | TjReport tjReport = new TjReport(); |
| | | String tjNumber = tjOrder.getTjNumber(); |
| | |
| | | Font doctorFonts = PdfUtils.setFont(9); |
| | | String doctors = ""; |
| | | for (String s : jyys) { |
| | | doctors += s + "、"; |
| | | doctors += s.trim() + "、"; |
| | | } |
| | | String substring = doctors.substring(0, doctors.length() - 1); |
| | | String substring = doctors.substring(0, doctors.length() - 1).trim(); |
| | | Paragraph df = PdfUtils.setParagraph(doctorFonts, "检验医师:" + substring); |
| | | df.setAlignment(Element.ALIGN_RIGHT); |
| | | document1.add(df); |
| | |
| | | String titleName = null; |
| | | if (null != one11 && "1".equals(one11.getResultType())) { |
| | | titleName = one11.getProName(); |
| | | // TODO 单位 |
| | | // 设置标题字体样式 |
| | | Font titleFonts = PdfUtils.setFont(9); |
| | | Paragraph paragraph = PdfUtils.setParagraph(titleFonts, titleName); |
| | |
| | | } |
| | | |
| | | public HashMap<String, Object> makeHisJianYan(TjOrder tjOrder, TjCustomer customer) { |
| | | // TODO 这里先使用查全部测试 |
| | | LambdaQueryWrapper<LtkjHysqd> ltkjHysqdLambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | | ltkjHysqdLambdaQueryWrapper.eq(LtkjHysqd::getTjh, tjOrder.getCardId()); |
| | | List<LtkjHysqd> list = ltkjHysqdService.list(ltkjHysqdLambdaQueryWrapper); |
| | |
| | | String titleName = null; |
| | | if (null != one11 && "1".equals(one11.getResultType())) { |
| | | titleName = one11.getProName(); |
| | | // TODO 单位 |
| | | // 设置标题字体样式 |
| | | Font titleFonts = PdfUtils.setFont(9); |
| | | Paragraph paragraph = PdfUtils.setParagraph(titleFonts, titleName); |
| | |
| | | footer.getDefaultCell().setBorder(Rectangle.NO_BORDER); |
| | | footer.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER); |
| | | footer.addCell(new Phrase(footerText, footerFont)); |
| | | |
| | | footer.writeSelectedRows(0, -1, 36, 36, writer.getDirectContent()); |
| | | footer.writeSelectedRows(0, -1, 36, 50, writer.getDirectContent()); |
| | | } |
| | | } |
| | | } |