From ed721d3c77517ce4e3bcc52cad9b7f52aa865c51 Mon Sep 17 00:00:00 2001 From: zhaowenxuan <chacca165@163.com> Date: 星期五, 01 八月 2025 17:57:49 +0800 Subject: [PATCH] pdf医师图片 --- ltkj-admin/src/main/java/com/ltkj/web/controller/his/HisPDFUtil.java | 72 ++++++++++++++++++++++------------- 1 files changed, 45 insertions(+), 27 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 21aac68..7fdab25 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 @@ -1446,10 +1446,10 @@ PdfPCell cell; String pdfQzgzpailie = sysConfigService.selectConfigByKey("pdf_qzgzpailie"); if (StrUtil.isNotBlank(pdfQzgzpailie) && pdfQzgzpailie.equalsIgnoreCase("h")){ - zongJianFont = PdfUtils.setFont(DEFAULT_ZONGJIAN_FONT_SIZE - 2); - zongJianTitleFont = PdfUtils.setFont(DEFAULT_ZONGJIAN_FONT_SIZE - 2); + zongJianFont = PdfUtils.setFont(DEFAULT_ZONGJIAN_FONT_SIZE - 6); + zongJianTitleFont = PdfUtils.setFont(DEFAULT_ZONGJIAN_FONT_SIZE -4); zongJianTitleFont.setStyle(Font.BOLD); - PdfPTable tableQz = new PdfPTable(new float[]{90f, 90f, 60f, 60f, 60f, 60f}); + PdfPTable tableQz = new PdfPTable(new float[]{80f, 80f, 60f, 40f,40f, 60f, 55f}); tableQz.setTotalWidth(PageSize.A4.getWidth() - 100); tableQz.setLockedWidth(true); tableQz.setHorizontalAlignment(Element.ALIGN_LEFT); @@ -1467,8 +1467,8 @@ cell = new PdfPCell(); cell.setBorder(Rectangle.NO_BORDER); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); - cell.setHorizontalAlignment(Element.ALIGN_CENTER); - cell.setPadding(10); + cell.setHorizontalAlignment(Element.ALIGN_LEFT); +// cell.setPadding(10); if (!file.exists()) { cell.setPhrase(new Phrase("", zongJianFont)); } else { @@ -1492,9 +1492,10 @@ cell = new PdfPCell(); cell.setBorder(Rectangle.NO_BORDER); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); - cell.setHorizontalAlignment(Element.ALIGN_CENTER); - cell.setPadding(10); +// cell.setHorizontalAlignment(Element.ALIGN_CENTER); +// cell.setPadding(10); + cell.setHorizontalAlignment(Element.ALIGN_LEFT); String zongjianysname = sysConfigService.selectConfigByKey("pdf_report_zongjianysname"); if (zongJianYiShiQianMing == null && StrUtil.isNotBlank(zongjianysname) && !zongjianysname.equals("鏃�")) { cell.setPhrase(new Phrase(zongjianysname, zongJianFont)); @@ -1504,9 +1505,10 @@ } else { byte[] bytes = Base64.getDecoder().decode(zongJianYiShiQianMing.getTemplate()); Image image = Image.getInstance(bytes); - image.scaleToFit(60, 60); + image.scaleToFit(20, 20); +// image.scaleAbsolute(20,20); // cell.addElement(image); - + cell.setPaddingLeft(-10); // cell.setPaddingTop(5); // cell.setPaddingBottom(15); String pdfSfsgqz = sysConfigService.selectConfigByKey("pdf_sfsgqz"); @@ -1515,6 +1517,13 @@ } cell.setImage(image); } + tableQz.addCell(cell); + + cell = new PdfPCell(new Phrase("", zongJianTitleFont)); + cell.setBorder(Rectangle.NO_BORDER); + cell.setVerticalAlignment(Element.ALIGN_MIDDLE); + cell.setHorizontalAlignment(Element.ALIGN_RIGHT); + cell.setPadding(0); tableQz.addCell(cell); cell = new PdfPCell(new Phrase("鎬绘鏃ユ湡:", zongJianTitleFont)); @@ -1527,8 +1536,10 @@ cell = new PdfPCell(new Phrase(new SimpleDateFormat("yyyy-MM-dd").format(tjOrder.getCheckTime()), zongJianFont)); cell.setBorder(Rectangle.NO_BORDER); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); - cell.setHorizontalAlignment(Element.ALIGN_CENTER); - cell.setPadding(10); +// cell.setHorizontalAlignment(Element.ALIGN_CENTER); +// cell.setPadding(10); + + cell.setHorizontalAlignment(Element.ALIGN_LEFT); tableQz.addCell(cell); document2.add(tableQz); } else { @@ -2484,7 +2495,10 @@ doctorNameDefault = entry.getValue().get(0).getShys(); } Font doctorFonts = PdfUtils.setFont(9); - if (key.equals("Y")) { + if (entry.getValue().get(0).getIsShowYiShi() == null){ + entry.getValue().get(0).setIsShowYiShi(true); + } + if (key.equals("Y") && entry.getValue().get(0).getIsShowYiShi()) { String qmImg = dictUserInfoMapper.selectQmImgInnerJoinUserByUserId(String.valueOf(sysUser.getUserId())); if (null != qmImg && StrUtil.isNotBlank(qmImg)) { Paragraph elements = new Paragraph(); @@ -2522,7 +2536,7 @@ df.setAlignment(Element.ALIGN_RIGHT); document1.add(df); } - } else { + } else if (entry.getValue().get(0).getIsShowYiShi()) { String doctorName = "涓绘鍖诲笀锛�" + doctorNameDefault; if (createTime != null) doctorName = "妫�鏌ユ椂闂达細" + new SimpleDateFormat("yyyy-MM-dd").format(createTime) + " 涓绘鍖诲笀锛�" + doctorNameDefault; @@ -2554,9 +2568,9 @@ 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 = new ArrayList<>(hybgds.stream() +// .collect(Collectors.toMap(LtkjHybgd::getJcxm, p -> p, (existing, replacement) -> existing)) +// .values()); Map<String, List<LtkjHybgd>> listMap = hybgds.stream().collect(Collectors.groupingBy(LtkjHybgd::getJyjg)); @@ -2567,7 +2581,7 @@ LambdaQueryWrapper<SysDictData> wrapper = new LambdaQueryWrapper<>(); wrapper.eq(SysDictData::getDictType,"qj_type"); wrapper.eq(SysDictData::getDictLabel,firstKey); - List<SysDictData> dictList = sysDictDataService.list(); + List<SysDictData> dictList = sysDictDataService.list(wrapper); if (!dictList.isEmpty()) { isGroupOnce = true; groupOnceProResult = firstKey; @@ -2681,12 +2695,13 @@ } catch (Exception ignored) { } } - String key = sysConfigService.selectConfigByKey("is_report_pdf_use_ysqm"); - if (null != shys && null != shysmc && key.equals("Y")) { - hashSet.add(shysmc + "|" + shys); - } else { - if (null != shysmc) hashSet.add(shysmc); - } + // 缁撴灉寮冩閲嶅鍘婚櫎鍖诲笀鎵撳嵃 +// String key = sysConfigService.selectConfigByKey("is_report_pdf_use_ysqm"); +// if (null != shys && null != shysmc && key.equals("Y")) { +// hashSet.add(shysmc + "|" + shys); +// } else { +// if (null != shysmc) hashSet.add(shysmc); +// } ArrayList<String> strings = new ArrayList<>(); strings.add(xmmc); strings.add(groupOnceProResult); @@ -2699,10 +2714,11 @@ HashMap<String, Object> map = new HashMap<>(); map.put("data", lists); map.put("jyys", hashSet); - if (StrUtil.isNotBlank(shsj)) { - shsj = shsj.split(" ")[0]; - } - map.put("shsj", shsj); +// if (StrUtil.isNotBlank(shsj)) { +// shsj = shsj.split(" ")[0]; +// } +// map.put("shsj", shsj); + map.put("shsj",""); data.put(xmmc, map); } } @@ -2945,6 +2961,7 @@ // LambdaQueryWrapper<LtkjExamJcbgd> wrapper = new LambdaQueryWrapper<>(); // wrapper.eq(LtkjExamJcbgd::getTjh, tjNumber); // wrapper.eq(LtkjExamJcbgd::getXmdm, String.valueOf(tjOrderDetail.getProject().getProParentId())); + tjPdfVO.setIsShowYiShi(true); tjPdfVOS.add(tjPdfVO); } } @@ -2961,6 +2978,7 @@ tjPdfVO.setProId(String.valueOf(orderRemark.getProId())); tjPdfVO.setPid(String.valueOf(orderRemark.getProId())); tjPdfVO.setXh(1); + tjPdfVO.setIsShowYiShi(false); tjPdfVOS.add(tjPdfVO); } } -- Gitblit v1.8.0