From 6a4e3a5c4c34fdef0accc93d8a077ab016d15250 Mon Sep 17 00:00:00 2001
From: zhaowenxuan <chacca165@163.com>
Date: 星期二, 15 七月 2025 18:01:23 +0800
Subject: [PATCH] pdf以及登记身份证人像处理

---
 ltkj-admin/src/main/java/com/ltkj/web/controller/his/HisPDFUtil.java |   38 ++++++++++++++++++++++++++++++++++++++
 1 files changed, 38 insertions(+), 0 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 2b95727..bb465d7 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
@@ -1847,6 +1847,44 @@
             acroFields.setField(key, hashMap.get(key));
         }
         pdfStamper.setFormFlattening(true);
+
+        String isOpenSfzImg = sysConfigService.selectConfigByKey("pdf_isOpenSfzImg");
+        String pathSfzfilePath = sysConfigService.selectConfigByKey("path_sfzfilePath");
+        if (StrUtil.isNotBlank(isOpenSfzImg) && isOpenSfzImg.equalsIgnoreCase("y")){
+            if (StrUtil.isNotBlank(pathSfzfilePath)){
+                String key = DataSourceContextHolder.getDataSourceKey();
+                key = key.replace("ltkjpeis10_","");
+                if (new File(pathSfzfilePath + File.separator + key + File.separator+customer.getCusId()+".png").exists()) {
+                    String pdfSfzimgwidth = sysConfigService.selectConfigByKey("pdf_sfzimgwidth");
+                    String pdfSfzimgheight = sysConfigService.selectConfigByKey("pdf_sfzimgheight");
+                    String pdfSfzimgy = sysConfigService.selectConfigByKey("pdf_sfzimgy");
+                    String pdfSfzimgx = sysConfigService.selectConfigByKey("pdf_sfzimgx");
+                    int width = 100,height = 100,x = 90,y = 180;
+                    if (StrUtil.isNotBlank(pdfSfzimgwidth)) {
+                        width = Integer.parseInt(pdfSfzimgwidth);
+                    }
+                    if (StrUtil.isNotBlank(pdfSfzimgheight)) {
+                        height = Integer.parseInt(pdfSfzimgheight);
+                    }
+                    if (StrUtil.isNotBlank(pdfSfzimgy)) {
+                        y = Integer.parseInt(pdfSfzimgy);
+                    }
+                    if (StrUtil.isNotBlank(pdfSfzimgx)) {
+                        x = Integer.parseInt(pdfSfzimgx);
+                    }
+                    Image image = Image.getInstance(pathSfzfilePath + File.separator + key + File.separator+customer.getCusId()+".png");
+                    // 璁剧疆鍥剧墖浣嶇疆鍜屽ぇ灏�
+                    // image.setAbsolutePosition(90, 190); // 琛ㄥ崟宸﹁竟
+                    // image.setAbsolutePosition(495, 742); // 鍙充笂瑙�
+                    // image.setAbsolutePosition(250, 50); // 涓笅
+                    image.setAbsolutePosition(x, y);
+                    image.scaleAbsolute(width, height); // 璁剧疆鍥剧墖瀹藉害鍜岄珮搴�
+                    PdfContentByte content = pdfStamper.getOverContent(1);
+                    content.addImage(image);
+                }
+            }
+        }
+
         pdfStamper.close();
         reader4.close();
         // 灏嗕慨鏀瑰悗鐨凱DF鍐呭鍐欏叆

--
Gitblit v1.8.0