diff --git a/src/main/java/com/dpkj/common/utils/TemplateUtils.java b/src/main/java/com/dpkj/common/utils/TemplateUtils.java index da7ab76..7e90a6e 100644 --- a/src/main/java/com/dpkj/common/utils/TemplateUtils.java +++ b/src/main/java/com/dpkj/common/utils/TemplateUtils.java @@ -77,7 +77,7 @@ public class TemplateUtils { resolver.setTemplateMode("HTML"); // 设置模板引擎使用这个自定义的模板解析器 templateEngine.setTemplateResolver(resolver); - }else { + } else { SpringResourceTemplateResolver resolver = new SpringResourceTemplateResolver(); resolver.setPrefix("classpath:/templates/"); resolver.setSuffix(".html"); @@ -111,9 +111,10 @@ public class TemplateUtils { /** * 生成图片 + * * @param html html内容 */ - private BufferedImage generate(String html, int width, int height){ + private BufferedImage generate(String html, int width, int height) { try { // 转换为xhtml String xhtml = this.htmlToXhtml(html); @@ -132,13 +133,14 @@ public class TemplateUtils { /** * 通过JsonObject进行context内容填充 + * * @param data jsonObject * @return context */ private Context getContext(JSONObject data) { // 创建Thymeleaf上下文 Context context = new Context(); - if ( data != null) { + if (data != null) { Set keys = data.keySet(); for (String key : keys) { // 判单是否有图片生成,统一后面采用的是_2base64Type @@ -168,8 +170,9 @@ public class TemplateUtils { Map hints = new HashMap<>(); hints.put(EncodeHintType.CHARACTER_SET, "UTF-8"); // 设置字符编码为 UTF-8 hints.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.L); // 设置纠错级别 - // 设置外边距为 0 以去除白边 - hints.put(EncodeHintType.MARGIN, 0); + // 设置外边距为1 + hints.put(EncodeHintType.MARGIN, 1); + if (type == 1) { QRCodeWriter qrCodeWriter = new QRCodeWriter(); @@ -182,7 +185,7 @@ public class TemplateUtils { qrImage = MatrixToImageWriter.toBufferedImage(bitMatrix); } - if ( qrImage == null ){ + if (qrImage == null) { throw new RRException("图片渲染失败"); } @@ -212,6 +215,7 @@ public class TemplateUtils { /** * xhtml 转换为 Document + * * @param xhtml xhtml * @return document * @throws Exception e @@ -232,6 +236,7 @@ public class TemplateUtils { /** * 转换,将html转换为xhtml + * * @param html html内容 * @return xhtml */ @@ -259,9 +264,10 @@ public class TemplateUtils { /** * 通过document转换为图片 + * * @param document doc - * @param width 图片的宽度 - * @param height 图片的高度 + * @param width 图片的宽度 + * @param height 图片的高度 * @return bufferedImage */ private BufferedImage createImageToDocument(Document document, int width, int height) { @@ -309,15 +315,16 @@ public class TemplateUtils { /** * 校验这个模板内容是不是html字符串,而非模板名称 + * * @param template template * @return 是否是html字符串 */ - private boolean checkIsHtml(String template){ + private boolean checkIsHtml(String template) { try { String pattern = "<(\"[^\"]*\"|'[^']*'|[^'\">])*>"; Pattern r = Pattern.compile(pattern); return r.matcher(template).find(); - }catch (Exception e) { + } catch (Exception e) { return false; } } @@ -325,6 +332,7 @@ public class TemplateUtils { /** * 将document对象转换为字符串 + * * @param doc document * @return document转换为的字符串 */ diff --git a/src/main/java/com/dpkj/modules/print/enums/ReceiptTemplateEnum.java b/src/main/java/com/dpkj/modules/print/enums/ReceiptTemplateEnum.java index 85f71ba..8c0233d 100644 --- a/src/main/java/com/dpkj/modules/print/enums/ReceiptTemplateEnum.java +++ b/src/main/java/com/dpkj/modules/print/enums/ReceiptTemplateEnum.java @@ -8,7 +8,7 @@ import lombok.Getter; public enum ReceiptTemplateEnum { /** - * 自足挂号模板 + * 自助挂号模板 */ REGISTER("1", "register", "自助挂号的"), @@ -25,9 +25,7 @@ public enum ReceiptTemplateEnum { /** * 门诊缴费的模板 */ - OUTPATIENT_T2("4", "department", "门诊缴费的小票-T2"), - - ; + OUTPATIENT_T2("4", "department", "门诊缴费的小票-T2"); private final String code; @@ -36,7 +34,7 @@ public enum ReceiptTemplateEnum { private final String desc; - ReceiptTemplateEnum(String code, String templateName, String desc){ + ReceiptTemplateEnum(String code, String templateName, String desc) { this.code = code; this.templateName = templateName; this.desc = desc; @@ -44,10 +42,11 @@ public enum ReceiptTemplateEnum { /** * 通过code获取模板名称 + * * @param code code/也有可能直接是一个名称 * @return 模板的名称 */ - public static String getTemplateName(String code){ + public static String getTemplateName(String code) { if (code == null || "".equals(code)) { throw new RRException("模板名称不能为空"); } @@ -55,7 +54,7 @@ public enum ReceiptTemplateEnum { String name = null; for (ReceiptTemplateEnum enumEntity : ReceiptTemplateEnum.values()) { String enumCode = enumEntity.getCode(); - if ( enumCode.equals(code)){ + if (enumCode.equals(code)) { name = enumEntity.getTemplateName(); break; } diff --git a/src/main/resources/templates/department.html b/src/main/resources/templates/department.html index 38ce560..33c31d5 100644 --- a/src/main/resources/templates/department.html +++ b/src/main/resources/templates/department.html @@ -2,18 +2,19 @@ - 门诊缴费凭证 + 门诊缴费凭证T2 -
-
-
************
-
-
-
-
- ----------------------------------------------------------------------------- +
+
+
+
+
******** +
+
+
+
@@ -39,12 +40,12 @@ 费用总额: 个人支付:
-
实收金额:
+
+ 实收金额:
实收金额:
-
- ----------------------------------------------------------------------------- -
+
@@ -61,17 +62,11 @@
-
- ----------------------------------------------------------------------------- -
-
-
终端编号:
-
打印时间:
-
-
- 温馨提示
- 1.请取走全部凭条、并妥善保管
- 2.如果对缴费结算存在疑问,请到人工窗口咨询 +
+
终端编号:
+
打印时间:
+
+ 温馨提示:请取走缴费凭证,并妥善保管。
如果对缴费存在疑问,请到人工窗口咨询!
diff --git a/src/main/resources/templates/department2.html b/src/main/resources/templates/department2.html deleted file mode 100644 index 82526a0..0000000 --- a/src/main/resources/templates/department2.html +++ /dev/null @@ -1,188 +0,0 @@ - - - - - 门诊缴费凭证 - - - -
-
-
************
-
-
-
-
- ----------------------------------------------------------------------------- -
-
-
-
姓名:
-
性别:
-
年龄:
-
-
-
门诊号:
-
就诊医生:
-
-
就诊科室:
-
-
- ----------------------------------------------------------------------------- -
-
-
-
费用总额:
-
个人支付:
-
-
实收金额:
-
实收金额:
-
-
- ----------------------------------------------------------------------------- -
-
- - - - - - - - - - - - - -
项目名称数量单价小计
-
-
- ----------------------------------------------------------------------------- -
-
-
终端编号:
-
打印时间:
-
-
- 温馨提示
- 1.请取走全部凭条、并妥善保管
- 2.如果对缴费结算存在疑问,请到人工窗口咨询 -
-
- - diff --git a/src/main/resources/templates/hospitalPayment.html b/src/main/resources/templates/hospitalPayment.html index 22fede4..9e0a6c2 100644 --- a/src/main/resources/templates/hospitalPayment.html +++ b/src/main/resources/templates/hospitalPayment.html @@ -4,15 +4,18 @@ 挂号单 -
-
-
-
********
-
-----------------------------------------------------------------------------
-
-
-----------------------------------------------------------------------------
+
+
+
+
+
******** +
+
+
+
-
+
姓  名:
性  别:
年  龄:
@@ -21,13 +24,14 @@
入院科室:
总 费 用: 元
支付方式:
-
交易流水:
+
交易流水: +
-
- -
备注:缴费凭证,请妥善保管!
-
终 端 号:
-
打印时间:
+
+
终端编号:
+
打印时间:
+
+ 温馨提示:请取走缴费凭证,并妥善保管。
如果对缴费存在疑问,请到人工窗口咨询!
diff --git a/src/main/resources/templates/outpatientPayment.html b/src/main/resources/templates/outpatientPayment.html index 48cb8e3..92726f4 100644 --- a/src/main/resources/templates/outpatientPayment.html +++ b/src/main/resources/templates/outpatientPayment.html @@ -1,16 +1,19 @@ - 门诊缴费 + 门诊缴费凭证T1 -
-
-
-
********
-
-----------------------------------------------------------------------------
-
-
-----------------------------------------------------------------------------
+
+
+
+
+
******** +
+
+
+
姓  名:
@@ -19,13 +22,14 @@
出生日期:
总 费 用: 元
支付方式:
-
交易流水:
+
交易流水: +
-
- -
备注:缴费凭证,请妥善保管!
-
终 端 号:
-
打印时间:
+
+
终端编号:
+
打印时间:
+
+ 温馨提示:请取走缴费凭证,并妥善保管。
如果对缴费存在疑问,请到人工窗口咨询!
diff --git a/src/main/resources/templates/register.html b/src/main/resources/templates/register.html index 45d674e..ef12e3f 100644 --- a/src/main/resources/templates/register.html +++ b/src/main/resources/templates/register.html @@ -3,38 +3,23 @@ 挂号单 - -
-
-
-
********
-
-----------------------------------------------------------------------------
-
-
-----------------------------------------------------------------------------
+
+
+
+
+
******** +
+
+
+
-
+
姓  名:
性  别:
年  龄:
出生日期:
-
门 诊 号:
就诊科室:
出诊级别:
@@ -43,20 +28,18 @@
挂号日期:
总 费 用: 元
支付方式:
-
交易流水:
-
- QR Code +
+ #
-
-
-----------------------------------------------------------------------------
-
备注:凭此条退费,请妥善保管!
-
终 端 号:
-
打印时间:
+
+
终端编号:
+
打印时间:
+
+ 温馨提示:请取走挂号凭证,并妥善保管。
如果对缴费存在疑问,请到人工窗口咨询!