fix:优化模板获取以及html模板

This commit is contained in:
石崇礼 2025-01-20 14:16:50 +08:00
parent 44a175aa66
commit a8f13d72b9
3 changed files with 37 additions and 29 deletions

View File

@ -271,6 +271,10 @@ public class TemplateService {
sharedContext.setInteractive(false); sharedContext.setInteractive(false);
sharedContext.setDPI(256f); sharedContext.setDPI(256f);
// 使用系统默认字体假设系统默认字体支持UTF - 8
Font font = new Font(Font.DIALOG, Font.PLAIN, 20);
graphics.setFont(font);
// 使用Dimension对象进行布局 // 使用Dimension对象进行布局
renderer.layout(graphics, dimension); renderer.layout(graphics, dimension);
renderer.render(graphics); renderer.render(graphics);

View File

@ -24,7 +24,11 @@ public class USBImagePrintServiceImpl extends BaseImagePrint implements ImagePri
@Override @Override
public Pointer getHandle(String devName) { public Pointer getHandle(String devName) {
try { try {
return AutoReplyPrint.INSTANCE.CP_Port_OpenUsb(devName, 1); Pointer pointer = AutoReplyPrint.INSTANCE.CP_Port_OpenUsb(devName, 1);
if ( pointer == null ){
throw new RRException();
}
return pointer;
}catch (Exception e){ }catch (Exception e){
e.printStackTrace(); e.printStackTrace();
throw new RRException("获取USB句柄失败"); throw new RRException("获取USB句柄失败");

View File

@ -4,37 +4,37 @@
<title>挂号单</title> <title>挂号单</title>
</head> </head>
<body> <body>
<div class="receipt"> <div style="font-size: 24px;">
<div style="margin-top: 30px;"> <div style="">
<div style="text-align: center; font-size: 20px; font-weight: 700;"><span th:text="${hospitalName}"></span></div> <div style="text-align: center; font-size: 36px; font-weight: 700;"><span th:text="${hospitalName}"></span></div>
<div style="text-align: center">****<span th:text="${registeTerminalName}"></span></span>****</div> <div style="text-align: center; font-weight: 700; font-size: 26px;">****<span th:text="${registeTerminalName}"></span></span>****</div>
<div style="margin-bottom: 5px; text-align: center;">---------------------------------------------------------------------</div> <div style="text-align: center; font-weight: 700; margin-bottom: -5px;">-----------------------------------------------------------------------------</div>
<div style="text-align: center; font-size: 20px; font-weight: 700;"><span th:text="${registeType}"></span></div> <div style="text-align: center; font-size: 36px; font-weight: 700;"><span th:text="${registeType}"></span></div>
<div style="text-align: center;">---------------------------------------------------------------------</div> <div style="text-align: center; font-weight: 700; margin-top: -7px;">-----------------------------------------------------------------------------</div>
</div>
<div style="font-weight: 700;">
<div style="margin-left: 59px;">&emsp;&emsp;名:<span th:text="${name}"></span></div>
<div style="margin-left: 59px;">&emsp;&emsp;别:<span th:text="${gender}"></span></div>
<div style="margin-left: 59px;">&emsp;&emsp;龄:<span th:text="${age}"></span></div>
<div style="margin-left: 59px;">出生日期:<span th:text="${birthDate}"></span></div>
<div style="margin-left: 59px;">&emsp;&emsp;号:<span th:text="${cardNumber}"></span></div>
<div style="margin-left: 59px;">&ensp;&ensp;号:<span th:text="${outpatientNumber}"></span></div>
<div style="margin-left: 59px;">就诊科室:<span th:text="${department}"></span></div>
<div style="margin-left: 59px;">出诊级别:<span th:text="${visitLevel}"></span></div>
<div style="margin-left: 59px;">就诊医生:<span th:text="${doctor}"></span></div>
<div style="margin-left: 59px;">&emsp;&emsp;序:<span th:text="${sequence}"></span></div>
<div style="margin-left: 59px;">挂号日期:<span th:text="${registerDate}"></span></div>
<div style="margin-left: 59px; font-size: 31px; ">总费用:<span th:text="${totalFee}"></span>&thinsp;</div>
<div style="margin-left: 59px;">支付方式:<span th:text="${paymentMethod}"></span></div>
<div style="margin-left: 59px;">&ensp;&ensp;号:<span th:text="${orderNumber}"></span></div>
<div style="margin-left: 59px;">交易流水:<span th:text="${transactionNumber}"></span></div>
<img style="margin-left: 35px; margin-top: -8px; margin-bottom: -8px;" th:src="${qrCodeBase64}" alt="QR Code"/>
</div> </div>
<div> <div>
<div style="margin-left: 21px;">&emsp;&emsp;名:<span th:text="${name}"></span></div> <div style="margin-top: -20px; text-align: center; font-weight: 700;">-----------------------------------------------------------------------------</div>
<div style="margin-left: 21px;">&emsp;&emsp;别:<span th:text="${gender}"></span></div> <div style="margin-left: 59px; font-weight: 700;">备注(REFERENCE):凭此条退费,请妥善保管!</div>
<div style="margin-left: 21px;">&emsp;&emsp;龄:<span th:text="${age}"></span></div> <div style="margin-left: 59px;">&ensp;&ensp;号:<span th:text="${terminalNumber}"></span></div>
<div style="margin-left: 21px;">出生日期:<span th:text="${birthDate}"></span></div> <div style="margin-left: 59px;">打印时间:<span th:text="${printTime}"></span></div>
<div style="margin-left: 21px;">&emsp;&emsp;号:<span th:text="${cardNumber}"></span></div>
<div style="margin-left: 21px;">&ensp;&ensp;号:<span th:text="${outpatientNumber}"></span></div>
<div style="margin-left: 21px;">就诊科室:<span th:text="${department}"></span></div>
<div style="margin-left: 21px;">出诊级别:<span th:text="${visitLevel}"></span></div>
<div style="margin-left: 21px;">就诊医生:<span th:text="${doctor}"></span></div>
<div style="margin-left: 21px;">&emsp;&emsp;序:<span th:text="${sequence}"></span></div>
<div style="margin-left: 21px;">挂号日期:<span th:text="${registerDate}"></span></div>
<div style="margin-left: 21px;">&ensp;&ensp;用:<span th:text="${totalFee}"></span></div>
<div style="margin-left: 21px;">支付方式:<span th:text="${paymentMethod}"></span></div>
<div style="margin-left: 21px;">&ensp;&ensp;号:<span th:text="${orderNumber}"></span></div>
<div style="margin-left: 21px;">交易流水:<span th:text="${transactionNumber}"></span></div>
<img th:src="${qrCodeBase64}" alt="QR Code"/>
</div>
<div>
<div style="margin-top: -20px; text-align: center;">---------------------------------------------------------------------</div>
<div style="margin-left: 21px; font-weight: 700;">备注(REFERENCE):凭此条退费,请妥善保管!</div>
<div style="margin-left: 21px;">&ensp;&ensp;号:<span th:text="${terminalNumber}"></span></div>
<div style="margin-left: 21px;">打印时间:<span th:text="${printTime}"></span></div>
</div> </div>
</div> </div>
</body> </body>