|
@@ -0,0 +1,484 @@
|
|
|
+package thyyxxk.wxservice_server.utils;
|
|
|
+
|
|
|
+import com.alibaba.fastjson.JSONArray;
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.itextpdf.text.*;
|
|
|
+import com.itextpdf.text.pdf.*;
|
|
|
+import com.itextpdf.text.pdf.draw.LineSeparator;
|
|
|
+
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
+import java.io.OutputStream;
|
|
|
+import java.net.URLEncoder;
|
|
|
+import java.util.Map;
|
|
|
+
|
|
|
+public class PhysicalCheckPDFUtil {
|
|
|
+ public static void createPDF(HttpServletResponse response, JSONObject tjIndex, JSONObject tjResult) {
|
|
|
+ try {
|
|
|
+ response.setContentType("application/x-download");
|
|
|
+ response.addHeader("content-disposition", "attachment;filename=" + URLEncoder.encode("长沙泰和医院体检报告.pdf", "UTF-8"));
|
|
|
+ OutputStream outputStream = response.getOutputStream();
|
|
|
+ Document document = getDocument();
|
|
|
+
|
|
|
+ PdfWriter pdfWriter = PdfWriter.getInstance(document, outputStream);
|
|
|
+ document.open();
|
|
|
+
|
|
|
+ document.add(getBarcodeParagraph(pdfWriter, tjIndex.getString("条码号")));
|
|
|
+
|
|
|
+ BaseFont baseFont = BaseFont.createFont("STSong-Light","UniGB-UCS2-H", BaseFont.NOT_EMBEDDED);
|
|
|
+ Font font = new Font(baseFont, 30, Font.BOLD);
|
|
|
+
|
|
|
+ document.add(getTitleParagraph(font));
|
|
|
+ document.add(getBriefContent(font, tjIndex));
|
|
|
+ document.add(getFooter(baseFont));
|
|
|
+
|
|
|
+ pdfWriter.setPageEvent(new PdfPageEventHelper() {
|
|
|
+ @Override
|
|
|
+ public void onStartPage(PdfWriter writer, Document document) {
|
|
|
+ PdfContentByte pdfContentByte = writer.getDirectContent();
|
|
|
+ pdfContentByte.saveState();
|
|
|
+ pdfContentByte.beginText();
|
|
|
+ pdfContentByte.setFontAndSize(baseFont, 10);
|
|
|
+ // header
|
|
|
+ float y = document.top(-20);
|
|
|
+ pdfContentByte.showTextAligned(PdfContentByte.ALIGN_LEFT, "H-Left", document.left(), y, 0);
|
|
|
+ pdfContentByte.showTextAligned(PdfContentByte.ALIGN_CENTER, "第" + writer.getPageNumber() + "页",
|
|
|
+ (document.right() + document.left()) / 2, y, 0);
|
|
|
+ pdfContentByte.showTextAligned(PdfContentByte.ALIGN_RIGHT, "H-Right", document.right(), y, 0);
|
|
|
+ pdfContentByte.endText();
|
|
|
+ LineSeparator line = new LineSeparator(1, 100, BaseColor.BLACK, Element.ALIGN_CENTER, 10);
|
|
|
+ try {
|
|
|
+ document.add(line);
|
|
|
+ } catch (DocumentException e) {
|
|
|
+ throw new RuntimeException(e);
|
|
|
+ }
|
|
|
+ pdfContentByte.restoreState();
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ document.newPage();
|
|
|
+ document.add(getEntryWord(font));
|
|
|
+ document.add(getSummaryTitle(font));
|
|
|
+ document.add(getSummaryContent(font, tjResult.getJSONObject("summary")));
|
|
|
+ document.add(getSummaryFooter(font, tjResult.getJSONObject("summary")));
|
|
|
+
|
|
|
+ document.newPage();
|
|
|
+
|
|
|
+ JSONObject examResults = tjResult.getJSONObject("examResult");
|
|
|
+ JSONArray checkItems = tjResult.getJSONArray("checkItems");
|
|
|
+ if (examResults.size() > 0 && checkItems.size() > 0) {
|
|
|
+ addExamResult(baseFont, document, examResults, checkItems);
|
|
|
+ }
|
|
|
+
|
|
|
+ document.add(getTailPageLogo(baseFont));
|
|
|
+
|
|
|
+ document.close();
|
|
|
+ outputStream.close();
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ throw new RuntimeException(e);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private static Document getDocument() {
|
|
|
+ Document document = new Document(PageSize.A4);
|
|
|
+ document.addAuthor("长沙泰和医院");
|
|
|
+ document.addCreationDate();
|
|
|
+ document.addSubject("体检报告");
|
|
|
+ return document;
|
|
|
+ }
|
|
|
+
|
|
|
+ private static Barcode128 getBarcode(String tjid) {
|
|
|
+ Barcode128 barcode128 = new Barcode128();
|
|
|
+ barcode128.setSize(10);
|
|
|
+ barcode128.setBarHeight(28);
|
|
|
+ barcode128.setBaseline(10);
|
|
|
+ barcode128.setCode(tjid);
|
|
|
+ barcode128.setStartStopText(true);
|
|
|
+ barcode128.setExtended(true);
|
|
|
+ return barcode128;
|
|
|
+ }
|
|
|
+
|
|
|
+ private static Paragraph getBarcodeParagraph(PdfWriter pdfWriter, String tjid) {
|
|
|
+ PdfContentByte pdfContentByte = new PdfContentByte(pdfWriter);
|
|
|
+ Barcode128 barcode128 = getBarcode(tjid);
|
|
|
+ Image barcodeImage = barcode128.createImageWithBarcode(pdfContentByte, null, null);
|
|
|
+ Chunk barcodeChunk = new Chunk(barcodeImage, 420, -20, false);
|
|
|
+ return new Paragraph(barcodeChunk);
|
|
|
+ }
|
|
|
+
|
|
|
+ private static Paragraph getTitleParagraph(Font font) {
|
|
|
+ Paragraph titleParagraph = new Paragraph();
|
|
|
+ Chunk titleChunkLine1 = new Chunk("长 沙 泰 和 医 院");
|
|
|
+ titleChunkLine1.setFont(font);
|
|
|
+ titleChunkLine1.setTextRise(-70);
|
|
|
+ titleParagraph.add(titleChunkLine1);
|
|
|
+ titleParagraph.add(Chunk.NEWLINE);
|
|
|
+
|
|
|
+ Chunk titleChunkLine2 = new Chunk("体 检 报 告");
|
|
|
+ titleChunkLine2.setFont(font);
|
|
|
+ titleChunkLine2.setTextRise(-90);
|
|
|
+ titleParagraph.setAlignment(Element.ALIGN_CENTER);
|
|
|
+ titleParagraph.add(titleChunkLine2);
|
|
|
+ return titleParagraph;
|
|
|
+ }
|
|
|
+
|
|
|
+ private static Paragraph getBriefContent(Font font, JSONObject tjIndex) {
|
|
|
+ font.setSize(12);
|
|
|
+ font.setStyle(Font.NORMAL);
|
|
|
+ Paragraph paragraph = new Paragraph();
|
|
|
+ paragraph.setAlignment(Element.ALIGN_LEFT);
|
|
|
+ paragraph.setSpacingBefore(470);
|
|
|
+
|
|
|
+ paragraph.setIndentationLeft(146);
|
|
|
+
|
|
|
+ String personalFlag = tjIndex.getString("团体or个人");
|
|
|
+ String psntext = personalFlag.equals("0") ? "[ ]个人 [√]团体" : "[√]个人 [ ]团体";
|
|
|
+ Chunk tjidChunk = new Chunk("体检编号:" + tjIndex.getString("条码号") + " " + psntext);
|
|
|
+ tjidChunk.setFont(font);
|
|
|
+ paragraph.add(tjidChunk);
|
|
|
+ paragraph.add(Chunk.NEWLINE);
|
|
|
+
|
|
|
+ String gender = tjIndex.getString("性别").equals("1") ? "男" : "女";
|
|
|
+ String name = tjIndex.getString("姓名");
|
|
|
+ String age = tjIndex.getString("年龄");
|
|
|
+ Chunk psnChunk = new Chunk("姓名:" + (null == name ? "" : name) + " 性别:"
|
|
|
+ + gender + " 年龄:" + (null == age ? "" : age));
|
|
|
+ psnChunk.setFont(font);
|
|
|
+ paragraph.add(psnChunk);
|
|
|
+ paragraph.add(Chunk.NEWLINE);
|
|
|
+
|
|
|
+ String unit = tjIndex.getString("工作单位");
|
|
|
+ Chunk unitChunk = new Chunk("单位:" + (null == unit ? "" : unit));
|
|
|
+ unitChunk.setFont(font);
|
|
|
+ paragraph.add(unitChunk);
|
|
|
+ paragraph.add(Chunk.NEWLINE);
|
|
|
+
|
|
|
+ String department = tjIndex.getString("所在部门");
|
|
|
+ Chunk departmentChunk = new Chunk("部门:" + (null == department ? "" : department));
|
|
|
+ departmentChunk.setFont(font);
|
|
|
+ paragraph.add(departmentChunk);
|
|
|
+ paragraph.add(Chunk.NEWLINE);
|
|
|
+
|
|
|
+ String date = DateUtil.parseTimestamp(tjIndex.getLong("登记日期"), "yyyy-MM-dd");
|
|
|
+ String phone = tjIndex.getString("手机");
|
|
|
+ Chunk dateChunk = new Chunk("体检日期:" + (null == date ? "" : date)
|
|
|
+ + " 电话:" + (null == phone ? "" : phone));
|
|
|
+ dateChunk.setFont(font);
|
|
|
+ paragraph.add(dateChunk);
|
|
|
+
|
|
|
+ return paragraph;
|
|
|
+ }
|
|
|
+
|
|
|
+ private static Paragraph getFooter(BaseFont baseFont) {
|
|
|
+ Font font = new Font(baseFont, 10, Font.NORMAL);
|
|
|
+ Paragraph paragraph = new Paragraph();
|
|
|
+ paragraph.setAlignment(Element.ALIGN_CENTER);
|
|
|
+
|
|
|
+ paragraph.setSpacingBefore(100);
|
|
|
+
|
|
|
+ LineSeparator line = new LineSeparator(1, 100, BaseColor.BLACK, Element.ALIGN_CENTER, 0);
|
|
|
+ paragraph.add(line);
|
|
|
+ paragraph.add(Chunk.NEWLINE);
|
|
|
+
|
|
|
+ Chunk footerLine1 = new Chunk("长沙泰和医院");
|
|
|
+ footerLine1.setFont(font);
|
|
|
+ paragraph.add(footerLine1);
|
|
|
+ paragraph.add(Chunk.NEWLINE);
|
|
|
+
|
|
|
+ Chunk footerLine2 = new Chunk("咨询电话:0731-88518505");
|
|
|
+ footerLine2.setFont(font);
|
|
|
+ paragraph.add(footerLine2);
|
|
|
+ paragraph.add(Chunk.NEWLINE);
|
|
|
+
|
|
|
+ Chunk footerLine3 = new Chunk("本体检报告仅供临床参考,不作为诊断依据,谢谢您的光临!");
|
|
|
+ footerLine3.setFont(new Font(baseFont, 12, Font.NORMAL));
|
|
|
+ paragraph.add(footerLine3);
|
|
|
+
|
|
|
+ return paragraph;
|
|
|
+ }
|
|
|
+
|
|
|
+ private static Paragraph getEntryWord(Font font) {
|
|
|
+ font.setSize(12);
|
|
|
+ Paragraph paragraph = new Paragraph();
|
|
|
+ paragraph.setFont(font);
|
|
|
+ paragraph.add(new Chunk("尊敬的客户:"));
|
|
|
+ paragraph.add(Chunk.NEWLINE);
|
|
|
+ paragraph.add(new Chunk(" 您好!欢迎您莅临长沙泰和医院体检中心。身体健康是学习和工作的基础,注意健康是生活和事业发展的必须。" +
|
|
|
+ "世界卫生组织(WHO)提出:“健康是人的生理、心里和社会的完美状态,而不仅仅是指无疾病或非体弱的状态”。通过健康体检," +
|
|
|
+ "检查和发现影响健康的有关因素,成为促进您身心健康的重要措施和保证。为了您的健康,我们真诚的建议您定期进行健康体检。"));
|
|
|
+ return paragraph;
|
|
|
+ }
|
|
|
+
|
|
|
+ private static PdfPTable getSummaryTitle(Font font) {
|
|
|
+ font.setSize(12);
|
|
|
+ PdfPTable table = new PdfPTable(1);
|
|
|
+ table.setSpacingBefore(20);
|
|
|
+ table.setWidthPercentage(100);
|
|
|
+ PdfPCell cell = new PdfPCell(new Paragraph("一、体检结论及健康建议", font));
|
|
|
+ cell.setPaddingBottom(8);
|
|
|
+ table.addCell(cell);
|
|
|
+ return table;
|
|
|
+ }
|
|
|
+
|
|
|
+ private static PdfPTable getSummaryContent(Font font, JSONObject summary) {
|
|
|
+ font.setSize(12);
|
|
|
+ font.setStyle(Font.NORMAL);
|
|
|
+ PdfPTable table = new PdfPTable(1);
|
|
|
+ table.setWidthPercentage(100);
|
|
|
+ table.setSplitLate(false);
|
|
|
+ PdfPCell cell = new PdfPCell(new Paragraph(summary.getString("汇总建议"), font));
|
|
|
+ cell.disableBorderSide(3);
|
|
|
+ cell.setPaddingLeft(10);
|
|
|
+ cell.setPaddingRight(10);
|
|
|
+ table.addCell(cell);
|
|
|
+ return table;
|
|
|
+ }
|
|
|
+
|
|
|
+ private static PdfPTable getSummaryFooter(Font font, JSONObject summary) {
|
|
|
+ font.setSize(12);
|
|
|
+ PdfPTable table = new PdfPTable(1);
|
|
|
+ table.setWidthPercentage(100);
|
|
|
+ table.setSplitLate(false);
|
|
|
+
|
|
|
+ Paragraph paragraph = new Paragraph();
|
|
|
+ paragraph.setFont(font);
|
|
|
+ paragraph.add(new Chunk("汇总:" + summary.getString("汇总医生")));
|
|
|
+ paragraph.add(Chunk.NEWLINE);
|
|
|
+ paragraph.add(Chunk.NEWLINE);
|
|
|
+ paragraph.add(new Chunk("主检:" + summary.getString("审核医生")));
|
|
|
+
|
|
|
+ PdfPCell cell = new PdfPCell(paragraph);
|
|
|
+ cell.disableBorderSide(1);
|
|
|
+ cell.setHorizontalAlignment(Element.ALIGN_RIGHT);
|
|
|
+ cell.setPaddingRight(30);
|
|
|
+ cell.setPaddingTop(15);
|
|
|
+ cell.setPaddingBottom(15);
|
|
|
+ table.addCell(cell);
|
|
|
+ return table;
|
|
|
+ }
|
|
|
+
|
|
|
+ private static void addExamResult(BaseFont baseFont, Document document, JSONObject itemResults, JSONArray checkItems) throws Exception {
|
|
|
+ int entryIndex = 0;
|
|
|
+ Font font = new Font(baseFont, 12, Font.NORMAL);
|
|
|
+ for (Map.Entry<String, Object> entry : itemResults.entrySet()) {
|
|
|
+ Paragraph paragraph = new Paragraph();
|
|
|
+ font.setColor(BaseColor.BLUE);
|
|
|
+ paragraph.setFont(font);
|
|
|
+ paragraph.setSpacingAfter(8);
|
|
|
+ if (entryIndex > 0) {
|
|
|
+ paragraph.setSpacingBefore(15);
|
|
|
+ }
|
|
|
+ paragraph.add(new Chunk(entry.getKey()));
|
|
|
+ document.add(paragraph);
|
|
|
+
|
|
|
+ font.setColor(BaseColor.BLACK);
|
|
|
+
|
|
|
+ JSONArray results = (JSONArray) entry.getValue();
|
|
|
+ String restype = results.getJSONObject(0).getString("结果类型");
|
|
|
+
|
|
|
+ if (entry.getKey().equals("碳呼气试验") || restype.equals("3")) {
|
|
|
+ restype = "3";
|
|
|
+ for (int i = 0; i < results.size(); i++) {
|
|
|
+ JSONObject item = results.getJSONObject(i);
|
|
|
+ if (StringUtil.notBlank(item.getString("单位")) || StringUtil.notBlank(item.getString("参考范围显示效果"))) {
|
|
|
+ restype = "2";
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ String sumContent = "";
|
|
|
+ String examDoctor = "";
|
|
|
+ String auditDoctor = "";
|
|
|
+ for (int i = 0; i < checkItems.size(); i++) {
|
|
|
+ JSONObject item = checkItems.getJSONObject(i);
|
|
|
+ if (item.getString("name").equals(entry.getKey())) {
|
|
|
+ sumContent = item.getString("诊断内容");
|
|
|
+ examDoctor = item.getString("检查医生签名");
|
|
|
+ auditDoctor = item.getString("审核医生签名");
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (restype.equals("3") || restype.equals("2")) {
|
|
|
+ PdfPTable table = new PdfPTable(4);
|
|
|
+ table.setWidthPercentage(100);
|
|
|
+
|
|
|
+ PdfPCell header1 = new PdfPCell(new Phrase("项目", font));
|
|
|
+ header1.disableBorderSide(8);
|
|
|
+ header1.setPaddingBottom(6);
|
|
|
+ header1.setBackgroundColor(BaseColor.LIGHT_GRAY);
|
|
|
+
|
|
|
+ PdfPCell header2 = new PdfPCell(new Phrase("体检结果", font));
|
|
|
+ header2.disableBorderSide(12);
|
|
|
+ header2.setPaddingBottom(6);
|
|
|
+ header2.setBackgroundColor(BaseColor.LIGHT_GRAY);
|
|
|
+ if (restype.equals("3")) {
|
|
|
+ header2.setColspan(3);
|
|
|
+ }
|
|
|
+
|
|
|
+ table.addCell(header1);
|
|
|
+ table.addCell(header2);
|
|
|
+
|
|
|
+ if (restype.equals("2")) {
|
|
|
+ PdfPCell header3 = new PdfPCell(new Phrase("单位", font));
|
|
|
+ header3.disableBorderSide(12);
|
|
|
+ header3.setPaddingBottom(6);
|
|
|
+ header3.setBackgroundColor(BaseColor.LIGHT_GRAY);
|
|
|
+
|
|
|
+ PdfPCell header4 = new PdfPCell(new Phrase("参考范围", font));
|
|
|
+ header4.disableBorderSide(4);
|
|
|
+ header4.setPaddingBottom(6);
|
|
|
+ header4.setBackgroundColor(BaseColor.LIGHT_GRAY);
|
|
|
+ table.addCell(header3);
|
|
|
+ table.addCell(header4);
|
|
|
+ }
|
|
|
+
|
|
|
+ for (int i = 0; i < results.size(); i++) {
|
|
|
+ JSONObject item = results.getJSONObject(i);
|
|
|
+
|
|
|
+ PdfPCell res1 = new PdfPCell(new Phrase(item.getString("检查项目"), font));
|
|
|
+ res1.disableBorderSide(8);
|
|
|
+ res1.setPaddingBottom(6);
|
|
|
+
|
|
|
+ PdfPCell res2 = new PdfPCell(new Phrase(item.getString("结果"), font));
|
|
|
+ res2.disableBorderSide(12);
|
|
|
+ res2.setPaddingBottom(6);
|
|
|
+ if (restype.equals("3")) {
|
|
|
+ res2.setColspan(3);
|
|
|
+ }
|
|
|
+
|
|
|
+ table.addCell(res1);
|
|
|
+ table.addCell(res2);
|
|
|
+
|
|
|
+ if (restype.equals("2")) {
|
|
|
+ PdfPCell res3 = new PdfPCell(new Phrase(item.getString("单位"), font));
|
|
|
+ res3.disableBorderSide(12);
|
|
|
+ res3.setPaddingBottom(6);
|
|
|
+
|
|
|
+ PdfPCell res4 = new PdfPCell(new Phrase(item.getString("参考范围显示效果"), font));
|
|
|
+ res4.disableBorderSide(4);
|
|
|
+ res4.setPaddingBottom(6);
|
|
|
+ table.addCell(res3);
|
|
|
+ table.addCell(res4);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ PdfPCell sum1 = new PdfPCell(new Phrase("科室小结:", font));
|
|
|
+ sum1.setHorizontalAlignment(Element.ALIGN_CENTER);
|
|
|
+ sum1.setVerticalAlignment(Element.ALIGN_CENTER);
|
|
|
+ sum1.setBackgroundColor(BaseColor.LIGHT_GRAY);
|
|
|
+ sum1.setPaddingTop(20);
|
|
|
+ sum1.setPaddingBottom(20);
|
|
|
+ table.addCell(sum1);
|
|
|
+
|
|
|
+ PdfPCell sum2 = new PdfPCell(new Phrase(sumContent, font));
|
|
|
+ sum2.setColspan(3);
|
|
|
+ table.addCell(sum2);
|
|
|
+
|
|
|
+ if (StringUtil.notBlank(examDoctor)) {
|
|
|
+ examDoctor = "检查医生:" + examDoctor;
|
|
|
+ }
|
|
|
+ if (StringUtil.notBlank(auditDoctor)) {
|
|
|
+ auditDoctor = "审核医生:" + auditDoctor;
|
|
|
+ }
|
|
|
+
|
|
|
+ PdfPCell doctorCell = new PdfPCell(new Phrase(examDoctor + " " + auditDoctor, font));
|
|
|
+ doctorCell.setColspan(4);
|
|
|
+ doctorCell.setHorizontalAlignment(Element.ALIGN_RIGHT);
|
|
|
+ doctorCell.setPaddingRight(30);
|
|
|
+ doctorCell.setPaddingTop(10);
|
|
|
+ doctorCell.disableBorderSide(15);
|
|
|
+ table.addCell(doctorCell);
|
|
|
+
|
|
|
+ table.setSplitLate(false);
|
|
|
+ document.add(table);
|
|
|
+
|
|
|
+ } else {
|
|
|
+ PdfPTable table = new PdfPTable(8);
|
|
|
+ table.setWidthPercentage(100);
|
|
|
+ String[] headers = new String[]{"化验项目", "结果", "单位", "参考值", "化验项目", "结果", "单位", "参考值"};
|
|
|
+ for (String header : headers) {
|
|
|
+ PdfPCell headerCell = new PdfPCell(new Phrase(header, font));
|
|
|
+ headerCell.disableBorderSide(14);
|
|
|
+ table.addCell(headerCell);
|
|
|
+ }
|
|
|
+
|
|
|
+ for (int i = 0; i < results.size(); i++) {
|
|
|
+ font = new Font(baseFont, 10, Font.NORMAL);
|
|
|
+ JSONObject item = results.getJSONObject(i);
|
|
|
+ String resSign = item.getString("阳性标识");
|
|
|
+ if (StringUtil.notBlank(resSign)) {
|
|
|
+ font.setColor(BaseColor.RED);
|
|
|
+ } else {
|
|
|
+ font.setColor(BaseColor.BLACK);
|
|
|
+ }
|
|
|
+
|
|
|
+ PdfPCell nameCell = new PdfPCell(new Phrase(item.getString("检查项目"), font));
|
|
|
+ nameCell.disableBorderSide(15);
|
|
|
+ table.addCell(nameCell);
|
|
|
+
|
|
|
+ PdfPCell resCell = new PdfPCell(new Phrase(item.getString("结果") + resSign, font));
|
|
|
+ resCell.disableBorderSide(15);
|
|
|
+ table.addCell(resCell);
|
|
|
+
|
|
|
+ PdfPCell unitCell = new PdfPCell(new Phrase(item.getString("单位"), font));
|
|
|
+ unitCell.disableBorderSide(15);
|
|
|
+ table.addCell(unitCell);
|
|
|
+
|
|
|
+ PdfPCell rangeCell = new PdfPCell(new Phrase(item.getString("参考范围显示效果"), font));
|
|
|
+ rangeCell.disableBorderSide(i % 2 == 0 ? 7 : 15);
|
|
|
+ table.addCell(rangeCell);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (StringUtil.notBlank(examDoctor)) {
|
|
|
+ examDoctor = "检验:" + examDoctor;
|
|
|
+ }
|
|
|
+ if (StringUtil.notBlank(auditDoctor)) {
|
|
|
+ auditDoctor = "审核:" + auditDoctor;
|
|
|
+ }
|
|
|
+
|
|
|
+ font = new Font(baseFont, 12, Font.NORMAL);
|
|
|
+ font.setColor(BaseColor.BLACK);
|
|
|
+ PdfPCell doctorCell = new PdfPCell(new Phrase(examDoctor + " " + auditDoctor, font));
|
|
|
+ doctorCell.setColspan(8);
|
|
|
+ doctorCell.setHorizontalAlignment(Element.ALIGN_RIGHT);
|
|
|
+ doctorCell.setPaddingRight(30);
|
|
|
+ doctorCell.setPaddingTop(10);
|
|
|
+ doctorCell.disableBorderSide(15);
|
|
|
+ table.addCell(doctorCell);
|
|
|
+
|
|
|
+ PdfPCell tipCell = new PdfPCell(new Phrase("注:此检验报告只对本次标本负责,如有疑问请七日内复查。", font));
|
|
|
+ tipCell.setColspan(8);
|
|
|
+ tipCell.setHorizontalAlignment(Element.ALIGN_LEFT);
|
|
|
+ tipCell.setPaddingTop(10);
|
|
|
+ tipCell.disableBorderSide(15);
|
|
|
+ table.addCell(tipCell);
|
|
|
+
|
|
|
+ table.setSplitLate(false);
|
|
|
+ document.add(table);
|
|
|
+ }
|
|
|
+ entryIndex += 1;
|
|
|
+ }
|
|
|
+ document.newPage();
|
|
|
+ }
|
|
|
+
|
|
|
+ private static Paragraph getTailPageLogo(BaseFont baseFont) throws Exception {
|
|
|
+ Image logo = Image.getInstance("/home/images/thyylogo.png");
|
|
|
+ logo.scaleAbsolute(240, 110);
|
|
|
+ Chunk logoChunk = new Chunk(logo, 0, -260, false);
|
|
|
+ Paragraph paragraph = new Paragraph();
|
|
|
+ paragraph.setAlignment(Element.ALIGN_CENTER);
|
|
|
+ paragraph.add(logoChunk);
|
|
|
+ paragraph.add(Chunk.NEWLINE);
|
|
|
+
|
|
|
+ Font font = new Font(baseFont, 30, Font.NORMAL);
|
|
|
+ Chunk ending = new Chunk("泰和伴您,健康同行!");
|
|
|
+ ending.setFont(font);
|
|
|
+ ending.setTextRise(-330);
|
|
|
+ paragraph.add(ending);
|
|
|
+
|
|
|
+ return paragraph;
|
|
|
+ }
|
|
|
+}
|