From 79f9fbd9f999e26af3f0bca534d825eb687e092c Mon Sep 17 00:00:00 2001 From: zjh <1084500556@qq.com> Date: 星期三, 25 十二月 2024 08:47:24 +0800 Subject: [PATCH] 20241225 --- ltkj-admin/src/main/java/com/ltkj/web/controller/his/HisPDFUtil.java | 72 +++++++++++++++++++++++++----------- 1 files changed, 50 insertions(+), 22 deletions(-) diff --git a/ltkj-admin/src/main/java/com/ltkj/web/controller/his/HisPDFUtil.java b/ltkj-admin/src/main/java/com/ltkj/web/controller/his/HisPDFUtil.java index 4897b53..5cf465f 100644 --- a/ltkj-admin/src/main/java/com/ltkj/web/controller/his/HisPDFUtil.java +++ b/ltkj-admin/src/main/java/com/ltkj/web/controller/his/HisPDFUtil.java @@ -30,6 +30,7 @@ import com.ltkj.system.service.ISysDictDataService; import com.ltkj.system.service.ISysUserService; import com.ltkj.web.config.pdfutils.PdfUtils; +import com.ltkj.web.controller.system.SysDeptController; import lombok.SneakyThrows; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; @@ -109,6 +110,8 @@ private TjOrderRemarkMapper tjOrderRemarkMapper; @Autowired private TjOrderDetailMapper tjOrderDetailMapper; + @Autowired + private SysDeptController sysDeptController; private Integer pdfPage = 0; @@ -116,6 +119,7 @@ private static int DEFAULT_LITTLE_TITLE_FONT_SIZE = 11; private static int DEFAULT_TITLE_FONT_SIZE = 12; private static int DEFAULT_ZONGJIAN_FONT_SIZE = 15; + private static String HOSP_NAME; private List<Map<String, Object>> makePDFInfo(HashMap<String, Object> map, AjaxResult ajaxResult, String key) { List<Map<String, Object>> data = null; @@ -156,7 +160,8 @@ int pageSize = 0; try { pdfWriter = PdfWriter.getInstance(document1, byteArrayOutputStream1); - if (dictHosp.getHospName().equals("婢勫悎鐭垮姟灞�涓績鍖婚櫌")){ +// if (dictHosp.getHospName().equals("婢勫悎鐭垮姟灞�涓績鍖婚櫌")){ + if (true){ String sex = ""; if (customer.getCusSex() != null) { for (SysDictData userSex : sysUserSex) { @@ -166,7 +171,8 @@ } } if (StrUtil.isBlank(sex)) sex = "鏈煡"; - pdfWriter.setPageEvent(new FooterHeaderPageEvent("婢勫悎鐭垮姟灞�涓績鍖婚櫌",customer.getCusName(),tjOrder.getTjNumber(),sex,String.valueOf(DateUtil.ageOfNow(customer.getCusBrithday())),null)); +// pdfWriter.setPageEvent(new FooterHeaderPageEvent("婢勫悎鐭垮姟灞�涓績鍖婚櫌",customer.getCusName(),tjOrder.getTjNumber(),sex,String.valueOf(DateUtil.ageOfNow(customer.getCusBrithday())),null)); + pdfWriter.setPageEvent(new FooterHeaderPageEvent(dictHosp.getHospName(),customer.getCusName(),tjOrder.getTjNumber(),sex,String.valueOf(DateUtil.ageOfNow(customer.getCusBrithday())),null)); pageSize = pdfWriter.getPageNumber(); } } catch (DocumentException e) { @@ -176,7 +182,8 @@ document1.setMargins(70, 70, 40, 40); document1.open(); - if (dictHosp.getHospName().equals("婢勫悎鐭垮姟灞�涓績鍖婚櫌")){ +// if (dictHosp.getHospName().equals("婢勫悎鐭垮姟灞�涓績鍖婚櫌")){ + if (true){ // 缁勮浣撴妫�鏌ラ」鐩姤鍛� Map<TjOrderRemark, List<TjPdfVO>> printReport = new HashMap<>(); notHuaYanData(tjOrder.getTjNumber(), printReport, tjOrder, customer); @@ -224,7 +231,8 @@ copy.addPage(page); } - if (!dictHosp.getHospName().equals("婢勫悎鐭垮姟灞�涓績鍖婚櫌")){ +// if (!dictHosp.getHospName().equals("婢勫悎鐭垮姟灞�涓績鍖婚櫌")){ + if (!true){ List<ByteArrayOutputStream> jianchas = makeHisJianChaTable(tjOrder); // List<ByteArrayOutputStream> jianchas = makeCcgcHisJianChaTable(tjOrder); try { @@ -254,7 +262,8 @@ int pages = pdfReader.getNumberOfPages(); ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); PdfStamper pdfStamper = new PdfStamper(pdfReader, outputStream); - if (!dictHosp.getHospName().equals("婢勫悎鐭垮姟灞�涓績鍖婚櫌")){ +// if (!dictHosp.getHospName().equals("婢勫悎鐭垮姟灞�涓績鍖婚櫌")){ + if (!true){ PdfContentByte contentByte; BaseFont baseFont = PdfUtils.createBaseFont(null); for (int i = 2; i <= pages; i++) { @@ -866,6 +875,7 @@ 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 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; if (StrUtil.isNotBlank(s2) && Integer.parseInt(s2) > 10) DEFAULT_LITTLE_TITLE_FONT_SIZE = Integer.parseInt(s2); @@ -876,6 +886,7 @@ else DEFAULT_ZONGJIAN_FONT_SIZE = 10; pdfPage = 0; DictHosp dictHosp = dictHospService.list().get(0); + HOSP_NAME = dictHosp.getHospName(); String color = sysConfigService.selectConfigByKey("report_title_color"); List<SysDictData> sysUserSex = sysDictDataService.list(new LambdaQueryWrapper<SysDictData>().eq(SysDictData::getDictType, "sys_user_sex")); // 妫�楠屾暟鎹� @@ -1831,7 +1842,8 @@ } } //鍒嗗壊绾� - if (!dictHosp.getHospName().equals("婢勫悎鐭垮姟灞�涓績鍖婚櫌")) { +// if (!dictHosp.getHospName().equals("婢勫悎鐭垮姟灞�涓績鍖婚櫌")) { + if (!true) { LineSeparator objectName = new LineSeparator(); objectName.setOffset(-5); document1.add(objectName); @@ -1867,7 +1879,8 @@ Font titleFonts = PdfUtils.setFont(9); Paragraph paragraph = PdfUtils.setParagraph(titleFonts, titleName); - if (dictHosp.getHospName().equals("婢勫悎鐭垮姟灞�涓績鍖婚櫌")) { +// if (dictHosp.getHospName().equals("婢勫悎鐭垮姟灞�涓績鍖婚櫌")) { + if (true) { Font titleFont = PdfUtils.setFont(DEFAULT_TITLE_FONT_SIZE); titleFont.setStyle(Font.BOLD); PdfPCell cellTitle = new PdfPCell(PdfUtils.setParagraph(titleFont, titleName)); @@ -1891,7 +1904,8 @@ // PdfPTable table = PdfUtils.setTable2(headFont, textFont, titles, value,dictHosp.getHospName().equals("婢勫悎鐭垮姟灞�涓績鍖婚櫌")); // document1.add(table); - if (dictHosp.getHospName().equals("婢勫悎鐭垮姟灞�涓績鍖婚櫌") && !value.isEmpty()){ +// if (dictHosp.getHospName().equals("婢勫悎鐭垮姟灞�涓績鍖婚櫌") && !value.isEmpty()){ + if (true && !value.isEmpty()){ if (value.size()>1){ if (value.get(0).getPid().equals("1862852701533012001")){ Font remarkFonts = PdfUtils.setFont(DEFAULT_FONT_SIZE); @@ -2011,7 +2025,8 @@ if (entry.getKey().getRemark() == null) { entry.getKey().setRemark(""); } - if (!dictHosp.getHospName().equals("婢勫悎鐭垮姟灞�涓績鍖婚櫌")){ +// if (!dictHosp.getHospName().equals("婢勫悎鐭垮姟灞�涓績鍖婚櫌")){ + if (!true){ String remark = "澶囨敞锛�" + entry.getKey().getRemark(); if (entry.getKey().getRemark().length() > 50) { int j = 0; @@ -2037,7 +2052,8 @@ //鍒ゆ柇涓绘鍖诲笀鏄惁涓虹┖ 绌轰笉鑳芥樉绀簄ull zhuJianYiShi(document1, entry,orderRemark.getCreateTime(),dictHosp); //鍒嗗壊绾� - if (!dictHosp.getHospName().equals("婢勫悎鐭垮姟灞�涓績鍖婚櫌")) { +// if (!dictHosp.getHospName().equals("婢勫悎鐭垮姟灞�涓績鍖婚櫌")) { + if (!true) { LineSeparator objectName = new LineSeparator(); document1.add(objectName); } @@ -2053,7 +2069,8 @@ Font titleFonts = PdfUtils.setFont(DEFAULT_FONT_SIZE); Paragraph paragraph = PdfUtils.setParagraph(titleFonts, titleName); - if (dictHosp.getHospName().equals("婢勫悎鐭垮姟灞�涓績鍖婚櫌")) { +// if (dictHosp.getHospName().equals("婢勫悎鐭垮姟灞�涓績鍖婚櫌")) { + if (true) { if (StrUtil.isBlank(value.get(0).getProResult()) && (StrUtil.isBlank(value.get(0).getTs()) && StrUtil.isBlank(value.get(0).getSj()))){ continue; } @@ -2079,7 +2096,8 @@ // PdfPTable table = PdfUtils.setTable(headFont, textFont, titles, value,dictHosp.getHospName().equals("婢勫悎鐭垮姟灞�涓績鍖婚櫌")); // document1.add(table); - if (dictHosp.getHospName().equals("婢勫悎鐭垮姟灞�涓績鍖婚櫌") && !value.isEmpty()){ +// if (dictHosp.getHospName().equals("婢勫悎鐭垮姟灞�涓績鍖婚櫌") && !value.isEmpty()){ + if (true && !value.isEmpty()){ if (value.size()>1){ if (value.get(0).getPid().equals("1862852701533012001")){ Font remarkFonts = PdfUtils.setFont(DEFAULT_FONT_SIZE); @@ -2203,7 +2221,8 @@ if (entry.getKey().getRemark() == null) { entry.getKey().setRemark(""); } - if (!dictHosp.getHospName().equals("婢勫悎鐭垮姟灞�涓績鍖婚櫌")){ +// if (!dictHosp.getHospName().equals("婢勫悎鐭垮姟灞�涓績鍖婚櫌")){ + if (!true){ String remark = "澶囨敞锛�" + entry.getKey().getRemark(); if (entry.getKey().getRemark().length() > 50) { int j = 0; @@ -2228,7 +2247,8 @@ } //鍒ゆ柇涓绘鍖诲笀鏄惁涓虹┖ 绌轰笉鑳芥樉绀簄ull zhuJianYiShi(document1, entry,orderRemark.getCreateTime(),dictHosp); - if (!dictHosp.getHospName().equals("婢勫悎鐭垮姟灞�涓績鍖婚櫌")) { +// if (!dictHosp.getHospName().equals("婢勫悎鐭垮姟灞�涓績鍖婚櫌")) { + if (!true) { //鍒嗗壊绾� LineSeparator objectName = new LineSeparator(); document1.add(objectName); @@ -2245,13 +2265,15 @@ * @throws DocumentException */ private void zhuJianYiShi(Document document1, Map.Entry<TjOrderRemark, List<TjPdfVO>> entry,Date createTime,DictHosp dictHosp) throws DocumentException { - if ((null != entry.getKey().getDoctorName() && null != userService.getById(entry.getKey().getDoctorName())) || dictHosp.getHospName().equals("婢勫悎鐭垮姟灞�涓績鍖婚櫌") ) { +// if ((null != entry.getKey().getDoctorName() && null != userService.getById(entry.getKey().getDoctorName())) || dictHosp.getHospName().equals("婢勫悎鐭垮姟灞�涓績鍖婚櫌") ) { + if ((null != entry.getKey().getDoctorName() && null != userService.getById(entry.getKey().getDoctorName())) || true ) { //涓绘鍖诲笀 String key = sysConfigService.selectConfigByKey("is_report_pdf_use_ysqm"); SysUser sysUser = userService.getById(entry.getKey().getDoctorName()); String doctorNameDefault = "鏃�"; if (sysUser != null)doctorNameDefault = sysUser.getNickName(); - if (!entry.getValue().isEmpty() && StrUtil.isNotBlank(entry.getValue().get(0).getShys()) && dictHosp.getHospName().equals("婢勫悎鐭垮姟灞�涓績鍖婚櫌")){ +// if (!entry.getValue().isEmpty() && StrUtil.isNotBlank(entry.getValue().get(0).getShys()) && dictHosp.getHospName().equals("婢勫悎鐭垮姟灞�涓績鍖婚櫌")){ + if (!entry.getValue().isEmpty() && StrUtil.isNotBlank(entry.getValue().get(0).getShys()) && true){ doctorNameDefault = entry.getValue().get(0).getShys(); } Font doctorFonts = PdfUtils.setFont(9); @@ -2450,7 +2472,8 @@ } //鎷兼帴閲嶅ぇ闃虫�х粨鏋� StringBuffer str = new StringBuffer(); - if (!dictHosp.getHospName().equals("婢勫悎鐭垮姟灞�涓績鍖婚櫌")) { +// if (!dictHosp.getHospName().equals("婢勫悎鐭垮姟灞�涓績鍖婚櫌")) { + if (!true) { str.append("銆愰噸澶ч槼鎬ч」鐩�慭n"); LambdaQueryWrapper<TjBigPositive> bigPositiveLambdaQueryWrapper = new LambdaQueryWrapper<>(); bigPositiveLambdaQueryWrapper.eq(TjBigPositive::getTjNumber, tjNumber); @@ -2465,7 +2488,8 @@ } //鎷兼帴寮傚父椤圭洰 str.append("銆愬紓甯告儏鍐甸」鐩�慭n"); - if (!dictHosp.getHospName().equals("婢勫悎鐭垮姟灞�涓績鍖婚櫌")) { +// if (!dictHosp.getHospName().equals("婢勫悎鐭垮姟灞�涓績鍖婚櫌")) { + if (!true) { if (list.size() > 0) { for (int i = 0; i < list.size(); i++) { if (list.get(i).getExceptionDesc() == 1) { @@ -2799,7 +2823,8 @@ private static void addJianYanTable(Document document, String titleName, String[] titles, float[] titlesWidth, ArrayList<List<String>> lists,DictHosp dictHosp,String colorStr) throws DocumentException { // 澶ч」鏍囬 Font titleFont = PdfUtils.setFont(DEFAULT_TITLE_FONT_SIZE); - if (dictHosp.getHospName().equals("婢勫悎鐭垮姟灞�涓績鍖婚櫌")) { +// if (dictHosp.getHospName().equals("婢勫悎鐭垮姟灞�涓績鍖婚櫌")) { + if (true) { titleFont.setSize(DEFAULT_TITLE_FONT_SIZE); titleFont.setStyle(Font.BOLD); } @@ -2811,7 +2836,8 @@ paragraph.setSpacingBefore(10f); // 璁剧疆娈佃惤涓嬬┖鐧� paragraph.setSpacingAfter(10f); - if (dictHosp.getHospName().equals("婢勫悎鐭垮姟灞�涓績鍖婚櫌")) { +// if (dictHosp.getHospName().equals("婢勫悎鐭垮姟灞�涓績鍖婚櫌")) { + if (true) { // 琛岄棿璺� paragraph.setLeading(7f); // 璁剧疆娈佃惤涓婄┖鐧� @@ -2857,7 +2883,8 @@ for (List<String> list : lists) { boolean isYc = false; textFont = PdfUtils.setFont(DEFAULT_FONT_SIZE); - if (dictHosp.getHospName().equals("婢勫悎鐭垮姟灞�涓績鍖婚櫌")){ +// if (dictHosp.getHospName().equals("婢勫悎鐭垮姟灞�涓績鍖婚櫌")){ + if (true){ if (list.contains("鈫�") || list.contains("鈫�")){ isYc = true; } @@ -2927,7 +2954,8 @@ table1.setSpacingAfter(10f); Font titleFont = PdfUtils.setFont(12); - PdfPCell mergedCell = new PdfPCell(new Phrase("闄曞仴鍖绘緞鍚堢熆鍔″眬涓績鍖婚櫌", titleFont)); +// PdfPCell mergedCell = new PdfPCell(new Phrase("闄曞仴鍖绘緞鍚堢熆鍔″眬涓績鍖婚櫌", titleFont)); + PdfPCell mergedCell = new PdfPCell(new Phrase(HOSP_NAME, titleFont)); mergedCell.setBorder(Rectangle.NO_BORDER); mergedCell.setColspan(10); mergedCell.setHorizontalAlignment(Element.ALIGN_CENTER); -- Gitblit v1.8.0