feat:新增住院缴费、门诊缴费小票模板
This commit is contained in:
parent
d931ad2bdf
commit
0b9d16befc
|
@ -3,6 +3,7 @@ package com.dpkj.modules.autoReplyPrint.controller;
|
|||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.dpkj.common.exception.RRException;
|
||||
import com.dpkj.common.vo.Result;
|
||||
import com.dpkj.modules.autoReplyPrint.enums.ReceiptTemplateEnum;
|
||||
import com.dpkj.modules.autoReplyPrint.request.ReceiptPrintRequest;
|
||||
import com.dpkj.modules.autoReplyPrint.service.ImagePrintService;
|
||||
import com.dpkj.modules.autoReplyPrint.service.impl.TemplateService;
|
||||
|
@ -38,6 +39,7 @@ public class ReceiptPrintController {
|
|||
@PostMapping("/print")
|
||||
private Result<Void> print(@Validated @RequestBody ReceiptPrintRequest request) throws UnsupportedEncodingException {
|
||||
String devName = "VID:0x0FE6,PID:0x811E"; // 采用默认的devName,不进行入参传值了
|
||||
String templateName = ReceiptTemplateEnum.getTemplateName(request.getTemplateName());
|
||||
// 进行模板填充
|
||||
// String testData = "{\"hospitalName\":\"澜沧县中医医院\",\"registeTerminalName\":\"中国农业银行自助终端\",\"registeType\":\"自助挂号\",\"name\":\"刘博雅\",\"gender\":\"男\",\"age\":28,\"birthDate\":\"1996-06-31\",\"cardNumber\":\"6221**********0731\",\"outpatientNumber\":\"2501150038\",\"department\":\"普外科门诊\",\"visitLevel\":\"普通号\",\"doctor\":\"普通门诊\",\"sequence\":\"1\",\"registerDate\":\"2025-01-15\",\"totalFee\":4.00,\"paymentMethod\":\"微信扫码支付\",\"orderNumber\":\"\",\"transactionNumber\":\"2025011513090412092794szztzzj\",\"qrCodeBase64_2base64Type_1_250_250\":\"maby this is a Base64 code data if has\",\"terminalNumber\":\"12092794\",\"printTime\":\"2025-01-15 13:10:08\"}";
|
||||
StringBuilder filePath = new StringBuilder(request.getFileDir());
|
||||
|
@ -45,7 +47,7 @@ public class ReceiptPrintController {
|
|||
if ( !StringUtils.isEmpty(request.getTemplateName()) && !StringUtils.isEmpty(request.getFileDir())){
|
||||
byte[] image = templateService.generateReceiptImage(
|
||||
JSONObject.parseObject(URLDecoder.decode(request.getTemplateFillData(), "UTF-8")),
|
||||
request.getTemplateName(),
|
||||
templateName,
|
||||
request.getWidth(),
|
||||
request.getHeight(),
|
||||
filePath);
|
||||
|
|
|
@ -0,0 +1,63 @@
|
|||
package com.dpkj.modules.autoReplyPrint.enums;
|
||||
|
||||
|
||||
import com.dpkj.common.exception.RRException;
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
public enum ReceiptTemplateEnum {
|
||||
|
||||
/**
|
||||
* 自足挂号模板
|
||||
*/
|
||||
REGISTER("1", "register", "自助挂号的"),
|
||||
|
||||
/**
|
||||
* 住院缴费的模板
|
||||
*/
|
||||
HOSPITAL_PAYMENT("2", "hospitalPayment", "住院缴费的小票"),
|
||||
|
||||
/**
|
||||
* 门诊缴费的模板
|
||||
*/
|
||||
OUTPATIENT_PAYMENT("3", "outpatientPayment", "门诊缴费的小票"),
|
||||
|
||||
|
||||
;
|
||||
|
||||
private final String code;
|
||||
|
||||
private final String templateName;
|
||||
|
||||
private final String desc;
|
||||
|
||||
|
||||
ReceiptTemplateEnum(String code, String templateName, String desc){
|
||||
this.code = code;
|
||||
this.templateName = templateName;
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过code获取模板名称
|
||||
* @param code code/也有可能直接是一个名称
|
||||
* @return 模板的名称
|
||||
*/
|
||||
public static String getTemplateName(String code){
|
||||
if (code == null || "".equals(code)) {
|
||||
throw new RRException("模板名称不能为空");
|
||||
}
|
||||
|
||||
String name = null;
|
||||
for (ReceiptTemplateEnum enumEntity : ReceiptTemplateEnum.values()) {
|
||||
String enumCode = enumEntity.getCode();
|
||||
if ( enumCode.equals(code)){
|
||||
name = enumEntity.getTemplateName();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return name == null ? code : name;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
<!DOCTYPE html>
|
||||
<html xmlns:th="http://www.thymeleaf.org">
|
||||
<head>
|
||||
<title>挂号单</title>
|
||||
</head>
|
||||
<body>
|
||||
<div style="font-size: 32px; margin-top: 20px;">
|
||||
<div style="">
|
||||
<div style="text-align: center; font-size: 40px; font-weight: 700;"><span th:text="${hospitalName}"></span></div>
|
||||
<div style="text-align: center; font-weight: 700; font-size: 28px;">****<span th:text="${registeTerminalName}"></span></span>****</div>
|
||||
<div style="text-align: center; font-weight: 700; margin-bottom: -10px; margin-top: -10px;">-----------------------------------------------------------------------------</div>
|
||||
<div style="text-align: center; font-size: 40px; font-weight: 700;"><span th:text="${registeType}"></span></div>
|
||||
<div style="text-align: center; font-weight: 700; margin-top: -15px;">-----------------------------------------------------------------------------</div>
|
||||
</div>
|
||||
<div style="font-weight: 700; font-size: 37px;">
|
||||
<div style="margin-left: 35px;">姓  名:<span th:text="${name}"></span></div>
|
||||
<div style="margin-left: 35px;">性  别:<span th:text="${gender}"></span></div>
|
||||
<div style="margin-left: 35px;">年  龄:<span th:text="${age}"></span></div>
|
||||
<div style="margin-left: 35px;">出生日期:<span th:text="${birthDate}"></span></div>
|
||||
<div style="margin-left: 35px;">门 诊 号:<span th:text="${outpatientNumber}"></span></div>
|
||||
<div style="margin-left: 35px;">入院科室:<span th:text="${department}"></span></div>
|
||||
<div style="margin-left: 35px;">总 费 用:<span th:text="${totalFee}"></span> 元</div>
|
||||
<div style="margin-left: 35px;">支付方式:<span th:text="${paymentMethod}"></span></div>
|
||||
<div style="margin-left: 35px;">交易流水:<span style="font-size: 35px;" th:text="${transactionNumber}"></span></div>
|
||||
</div>
|
||||
<div style="font-weight: 700; margin-top: 8px;">
|
||||
<!-- <div style="margin-top: -40px; text-align: center; ">-----------------------------------------------------------------------------</div>-->
|
||||
<div style="font-size: 36px;margin-left: 35px; ">备注:缴费凭证,请妥善保管!</div>
|
||||
<div style="font-size: 36px;margin-left: 35px;">终 端 号:<span th:text="${terminalNumber}"></span></div>
|
||||
<div style="font-size: 36px;margin-left: 35px;">打印时间:<span th:text="${printTime}"></span></div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,32 @@
|
|||
<!DOCTYPE html>
|
||||
<html xmlns:th="http://www.thymeleaf.org">
|
||||
<head>
|
||||
<title>门诊缴费</title>
|
||||
</head>
|
||||
<body>
|
||||
<div style="font-size: 32px; margin-top: 20px;">
|
||||
<div style="">
|
||||
<div style="text-align: center; font-size: 40px; font-weight: 700;"><span th:text="${hospitalName}"></span></div>
|
||||
<div style="text-align: center; font-weight: 700; font-size: 28px;">****<span th:text="${registeTerminalName}"></span></span>****</div>
|
||||
<div style="text-align: center; font-weight: 700; margin-bottom: -10px; margin-top: -10px;">-----------------------------------------------------------------------------</div>
|
||||
<div style="text-align: center; font-size: 40px; font-weight: 700;"><span th:text="${registeType}"></span></div>
|
||||
<div style="text-align: center; font-weight: 700; margin-top: -15px;">-----------------------------------------------------------------------------</div>
|
||||
</div>
|
||||
<div style="font-weight: 700; font-size: 37px;">
|
||||
<div style="margin-left: 35px;">姓  名:<span th:text="${name}"></span></div>
|
||||
<div style="margin-left: 35px;">性  别:<span th:text="${gender}"></span></div>
|
||||
<div style="margin-left: 35px;">年  龄:<span th:text="${age}"></span></div>
|
||||
<div style="margin-left: 35px;">出生日期:<span th:text="${birthDate}"></span></div>
|
||||
<div style="margin-left: 35px;">总 费 用:<span th:text="${totalFee}"></span> 元</div>
|
||||
<div style="margin-left: 35px;">支付方式:<span th:text="${paymentMethod}"></span></div>
|
||||
<div style="margin-left: 35px;">交易流水:<span style="font-size: 35px;" th:text="${transactionNumber}"></span></div>
|
||||
</div>
|
||||
<div style="font-weight: 700; margin-top: 8px;">
|
||||
<!-- <div style="margin-top: -40px; text-align: center; ">-----------------------------------------------------------------------------</div>-->
|
||||
<div style="font-size: 36px;margin-left: 35px; ">备注:缴费凭证,请妥善保管!</div>
|
||||
<div style="font-size: 36px;margin-left: 35px;">终 端 号:<span th:text="${terminalNumber}"></span></div>
|
||||
<div style="font-size: 36px;margin-left: 35px;">打印时间:<span th:text="${printTime}"></span></div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue