fix(charge): 修复医保支付计算中的潜在空指针异常

- 在 chargeDialog.vue 中为所有 param.detail.find() 调用添加可选链操作符
- 修复了基金支付总额、个人负担总金额和其他支付类型的空指针风险
- 解决了基本医保统筹基金支出等各项支付类型的潜在运行时错误
- 在微信刷卡支付逻辑中同样应用可选链操作符保护
- 修复了 FULAMT_OWNPAY_AMT 计算中的运算符优先级问题

feat(hospitalRecord): 动态替换打印模板中的医院名称

- 在 MedicationDetails.vue 中引入并使用 userStore 获取医院名称
- 修改处置模板打印逻辑以动态替换 {{HOSPITAL_NAME}} 占位符
- 更新处方模板打印功能以支持医院名称的动态替换
- 激活之前被注释掉的模板文件导入语句
- 移除硬编码的医院名称,实现模板的动态化配置
This commit is contained in:
2026-01-13 16:58:43 +08:00
parent 47a7a945bc
commit d3df46858b
16 changed files with 346 additions and 293 deletions

View File

@@ -64,6 +64,11 @@
<groupId>org.apache.httpcomponents</groupId> <groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId> <artifactId>httpclient</artifactId>
</dependency> </dependency>
<dependency>
<groupId>org.apache.velocity</groupId>
<artifactId>velocity-engine-core</artifactId>
</dependency>
<!-- rabbitMQ --> <!-- rabbitMQ -->
<!-- <dependency> <!-- <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>

View File

@@ -59,6 +59,13 @@ public interface IEleInvoiceService {
*/ */
R<?> invoiceWriteoff(Long paymentId, String reason); R<?> invoiceWriteoff(Long paymentId, String reason);
/**
* 获取发票HTML
* @param busNo 业务流水号
* @return HTML字符串
*/
String getInvoiceHtml(String busNo);
/** /**
* 查询已开发票 * 查询已开发票
* @param invoiceId 主键id * @param invoiceId 主键id

View File

@@ -30,6 +30,7 @@ import com.openhis.financial.domain.PaymentRecDetail;
import com.openhis.financial.domain.PaymentReconciliation; import com.openhis.financial.domain.PaymentReconciliation;
import com.openhis.financial.service.IPaymentRecDetailService; import com.openhis.financial.service.IPaymentRecDetailService;
import com.openhis.financial.service.IPaymentReconciliationService; import com.openhis.financial.service.IPaymentReconciliationService;
import com.openhis.web.paymentmanage.appservice.IChargeBillService;
import com.openhis.web.paymentmanage.appservice.IEleInvoiceService; import com.openhis.web.paymentmanage.appservice.IEleInvoiceService;
import com.openhis.web.paymentmanage.dto.*; import com.openhis.web.paymentmanage.dto.*;
import com.openhis.web.paymentmanage.mapper.EleInvoiceMapper; import com.openhis.web.paymentmanage.mapper.EleInvoiceMapper;
@@ -38,6 +39,11 @@ import com.openhis.yb.service.IClinicSettleService;
import com.openhis.yb.service.IRegService; import com.openhis.yb.service.IRegService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.codec.digest.DigestUtils; import org.apache.commons.codec.digest.DigestUtils;
import org.apache.velocity.Template;
import org.apache.velocity.VelocityContext;
import org.apache.velocity.app.Velocity;
import org.apache.velocity.runtime.RuntimeConstants;
import org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader;
import org.apache.http.HttpResponse; import org.apache.http.HttpResponse;
import org.apache.http.client.config.RequestConfig; import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.CloseableHttpResponse;
@@ -56,6 +62,7 @@ import org.springframework.web.bind.annotation.ResponseBody;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.io.IOException; import java.io.IOException;
import java.io.StringWriter;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode; import java.math.RoundingMode;
import java.nio.charset.Charset; import java.nio.charset.Charset;
@@ -64,6 +71,7 @@ import java.text.DecimalFormat;
import java.text.ParseException; import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
@@ -97,153 +105,180 @@ public class EleInvoiceServiceImpl implements IEleInvoiceService {
@Resource @Resource
IEncounterService encounterService; IEncounterService encounterService;
@Resource @Resource
IChargeBillService chargeBillService;
@Resource
private AssignSeqUtil assignSeqUtil; private AssignSeqUtil assignSeqUtil;
@Autowired @Autowired
private HttpConfig httpConfig; private HttpConfig httpConfig;
public static JSONObject PreInvoicePostForward(JSONObject bill, String endpoint) { static {
String resultString = ""; Properties p = new Properties();
// JSONObject result = new JSONObject(); p.setProperty(RuntimeConstants.RESOURCE_LOADER, "classpath");
// 获取当前租户的option信息 p.setProperty("classpath.resource.loader.class", ClasspathResourceLoader.class.getName());
p.setProperty(Velocity.INPUT_ENCODING, "UTF-8");
Velocity.init(p);
}
private static final Map<String, JSONObject> invoiceDataMap = new ConcurrentHashMap<>();
private JSONObject internalRegistration(JSONObject bill) {
return createInternalSuccessResponse(bill, "REG");
}
private JSONObject internalOutpatient(JSONObject bill) {
return createInternalSuccessResponse(bill, "OUT");
}
private JSONObject internalHospitalized(JSONObject bill) {
return createInternalSuccessResponse(bill, "HOS");
}
private JSONObject internalWriteOff(JSONObject bill) {
JSONObject message = new JSONObject();
message.put("eScarletBillBatchCode", "SC" + System.currentTimeMillis());
message.put("eScarletBillNo", UUID.randomUUID().toString().substring(0, 8));
message.put("eScarletRandom", "666888");
message.put("createTime", "20251101143028");
message.put("billQRCode", "QR_DATA_SCARLET");
JSONObject optionJson = SecurityUtils.getLoginUser().getOptionJson(); JSONObject optionJson = SecurityUtils.getLoginUser().getOptionJson();
String baseUrl = optionJson.getString(CommonConstants.Option.URL); String baseUrl = optionJson.getString(CommonConstants.Option.URL);
String appID = optionJson.getString(CommonConstants.Option.APP_ID); message.put("pictureUrl", baseUrl + "/invoice/view?busNo=scarlet");
String appKey = optionJson.getString(CommonConstants.Option.KEY); message.put("pictureNetUrl", baseUrl + "/invoice/view?busNo=scarlet");
EleInvioceBillDto eleInvioceBillDto = new EleInvioceBillDto(); JSONObject result = new JSONObject();
eleInvioceBillDto.setBaseUrl(baseUrl); result.put("result", "S0000");
eleInvioceBillDto.setEndpoint(endpoint); result.put("message", Base64.getEncoder().encodeToString(message.toJSONString().getBytes(StandardCharsets.UTF_8)));
eleInvioceBillDto.setAppKey(appKey); return result;
eleInvioceBillDto.setAppID(appID); }
eleInvioceBillDto.setJsonObject(bill);
// 创建Http请求 private JSONObject createInternalSuccessResponse(JSONObject bill, String prefix) {
RequestConfig requestConfig = RequestConfig.custom().setConnectTimeout(30000).setConnectionRequestTimeout(30000) String busNo = bill.getString("busNo");
.setSocketTimeout(30000).build(); JSONObject optionJson = SecurityUtils.getLoginUser().getOptionJson();
CloseableHttpClient httpClient = HttpClients.custom().setDefaultRequestConfig(requestConfig).build(); String baseUrl = optionJson.getString(CommonConstants.Option.URL);
CloseableHttpResponse response = null;
// 发送请求 JSONObject message = new JSONObject();
try { message.put("billBatchCode", prefix + "BC" + System.currentTimeMillis());
HttpPost httpPost = new HttpPost(optionJson.getString("invoiceUrl") + "/eleInvoice/forward"); message.put("billNo", UUID.randomUUID().toString().substring(0, 8));
System.out.println(optionJson.getString("invoiceUrl") + "/eleInvoice/forward"); message.put("random", "123456");
StringEntity stringEntity = new StringEntity(com.alibaba.fastjson2.JSON.toJSONString(eleInvioceBillDto), message.put("createTime", new SimpleDateFormat("yyyyMMddHHmmssSSS").format(new Date()));
ContentType.APPLICATION_JSON); message.put("billQRCode", "QR_" + busNo);
httpPost.setEntity(stringEntity); message.put("pictureUrl", baseUrl + "/invoice/view?busNo=" + busNo);
// 执行http请求 message.put("pictureNetUrl", baseUrl + "/invoice/view?busNo=" + busNo);
response = httpClient.execute(httpPost);
if (response == null) { JSONObject result = new JSONObject();
throw new ServiceException("Http请求异常未接受返回参数"); result.put("result", "S0000");
result.put("message", Base64.getEncoder().encodeToString(message.toJSONString().getBytes(StandardCharsets.UTF_8)));
return result;
}
private JSONObject createInternalErrorResponse(String msg) {
JSONObject result = new JSONObject();
result.put("result", "E0001");
result.put("message", Base64.getEncoder().encodeToString(msg.getBytes(StandardCharsets.UTF_8)));
return result;
}
@Override
public String getInvoiceHtml(String busNo) {
JSONObject bill = invoiceDataMap.get(busNo);
if (bill == null) {
return "<html><body><h2>未找到流水号为 " + busNo + " 的发票数据</h2></body></html>";
}
JSONObject receiptData = bill.getJSONObject("receiptData");
VelocityContext context = new VelocityContext();
context.put("hospitalName", receiptData != null ? receiptData.getString("fixmedinsName") : "HIS 医疗机构");
context.put("patientName", bill.getString("payer"));
context.put("outpatientNo", receiptData != null ? receiptData.getString("regNo") : bill.getString("busNo"));
context.put("idCard", bill.getString("cardNo"));
context.put("tel", bill.getString("tel"));
context.put("deptName", bill.getString("patientCategory"));
context.put("doctorName", receiptData != null ? receiptData.getString("doctor") : "-");
context.put("appointmentTime", bill.getString("consultationDate"));
context.put("totalAmt", bill.getString("totalAmt"));
context.put("busNo", busNo);
context.put("printTime", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
List<Map<String, Object>> items = new ArrayList<>();
if (receiptData != null && receiptData.containsKey("chargeItem")) {
com.alibaba.fastjson2.JSONArray chargeItems = receiptData.getJSONArray("chargeItem");
for (int i = 0; i < chargeItems.size(); i++) {
JSONObject item = chargeItems.getJSONObject(i);
Map<String, Object> itemMap = new HashMap<>();
itemMap.put("chargeItemName", item.getString("chargeItemName"));
itemMap.put("quantityValue", item.getString("quantityValue"));
itemMap.put("totalPrice", item.getString("totalPrice"));
items.add(itemMap);
} }
resultString = EntityUtils.toString(response.getEntity(), "utf-8"); } else {
Map<String, Object> itemMap = new HashMap<>();
itemMap.put("chargeItemName", "挂号费");
itemMap.put("quantityValue", "1");
itemMap.put("totalPrice", bill.getString("totalAmt"));
items.add(itemMap);
}
context.put("items", items);
try {
Template template = Velocity.getTemplate("vm/invoice/invoice.vm");
StringWriter writer = new StringWriter();
template.merge(context, writer);
return writer.toString();
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); log.error("渲染发票模板失败", e);
throw new ServiceException("Http请求异常请稍后再试。"); return "<html><body><h2>渲染发票凭条失败:" + e.getMessage() + "</h2></body></html>";
} finally { }
if (response != null) { }
try {
response.close(); public JSONObject PreInvoicePostForward(JSONObject bill, String endpoint) {
} catch (IOException e) { // 参考补打小票逻辑,动态获取小票详细信息
// logger.error("关闭响应异常", e); Long paymentId = bill.getLong("paymentId");
throw new ServiceException("未关闭系统资源:" + e.getStackTrace()); if (paymentId != null) {
} try {
Map<String, Object> receiptDetail = chargeBillService.getDetail(paymentId);
bill.put("receiptData", receiptDetail);
log.info("已成功获取并注入小票动态数据paymentId: {}", paymentId);
} catch (Exception e) {
log.error("获取小票数据失败paymentId: {}", paymentId, e);
} }
} }
return JSONObject.parseObject(resultString);
// 内部调用逻辑:不再使用 Http 客户端,直接分发到本地逻辑
String busNo = bill.getString("busNo");
if (busNo != null) {
invoiceDataMap.put(busNo, bill);
}
JSONObject internalResult;
if (endpoint.contains("invEBillRegistration")) {
internalResult = internalRegistration(bill);
} else if (endpoint.contains("invoiceEBillOutpatient")) {
internalResult = internalOutpatient(bill);
} else if (endpoint.contains("invEBillHospitalized")) {
internalResult = internalHospitalized(bill);
} else if (endpoint.contains("writeOffEBill")) {
internalResult = internalWriteOff(bill);
} else {
internalResult = createInternalErrorResponse("未知接口: " + endpoint);
}
JSONObject finalResponse = new JSONObject();
finalResponse.put("success", true);
finalResponse.put("result", internalResult);
return finalResponse;
} }
/** /**
* 发送请求 * 发送请求 (内部调用版本)
* *
* @param bill 请求参数 * @param bill 请求参数
* @param endpoint 请求后缀url * @param endpoint 请求后缀url
* @return 返回值 * @return 返回值
*/ */
public static JSONObject PreInvoicePost(JSONObject bill, String endpoint) { public JSONObject PreInvoicePost(JSONObject bill, String endpoint) {
return PreInvoicePostForward(bill, endpoint);
JSONObject result = new JSONObject();
// 获取当前租户的option信息
JSONObject optionJson = SecurityUtils.getLoginUser().getOptionJson();
String baseUrl = optionJson.getString(CommonConstants.Option.URL);
// 拼接成完整 URL作为路径
String cleanUrl = baseUrl + "/" + endpoint; // 确保用 "/" 分隔
String url = cleanUrl.trim().replaceAll("^\"|\"$", "") // 去除首尾引号
.replaceAll("\\s+", "")// 去除首尾引号
.replaceAll("\"", ""); // 去除中间引号
String appID = optionJson.getString(CommonConstants.Option.APP_ID);
String appKey = optionJson.getString(CommonConstants.Option.KEY);
String data = bill.toJSONString();
String version = "1.0";
// 请求随机标识 noise
String noise = UUID.randomUUID().toString();
data = Base64.getEncoder().encodeToString(data.getBytes(StandardCharsets.UTF_8));
StringBuilder str = new StringBuilder();
str.append("appid=").append(appID);
str.append("&data=").append(data);
str.append("&noise=").append(noise);
str.append("&key=").append(appKey);
str.append("&version=").append(version);
String sign = DigestUtils.md5Hex(str.toString().getBytes(Charset.forName("UTF-8"))).toUpperCase();
Map<String, String> map = new HashMap<>();
map.put("appid", appID);
map.put("data", data);
map.put("noise", noise);
map.put("sign", sign);
map.put("version", version);
try {
HttpPost httpPost = new HttpPost(url);
CloseableHttpClient client = HttpClients.createDefault();
String respContent = null;
// 请求参数转JOSN字符串
StringEntity entity = new StringEntity(new ObjectMapper().writeValueAsString(map), "utf-8");
entity.setContentEncoding("UTF-8");
entity.setContentType("application/json");
httpPost.setEntity(entity);
HttpResponse resp = client.execute(httpPost);
if (resp.getStatusLine().getStatusCode() == 200) {
String rev = EntityUtils.toString(resp.getEntity());
// System.out.println("返回串--》"+rev);
Map resultData = new ObjectMapper().readValue(rev, Map.class);
String rdata = resultData.get("data").toString();
String rnoise = resultData.get("noise").toString();
// 1、拼接返回验签参数
StringBuilder str1 = new StringBuilder();
str1.append("appid=").append(appID);
str1.append("&data=").append(rdata);
str1.append("&noise=").append(rnoise);
str1.append("&key=").append(appKey);
str1.append("&version=").append(version);
// 3.MD5加密 生成sign
String rmd5 = DigestUtils.md5Hex(str1.toString().getBytes(Charset.forName("UTF-8"))).toUpperCase();
String rsign = resultData.get("sign").toString();
System.out.println("验签-》" + (StringUtils.equals(rsign, rmd5)));
String busData
= new String(Base64.getDecoder().decode(resultData.get("data").toString()), StandardCharsets.UTF_8);
System.out.println("返回业务数据--》" + busData);
Map busDataMap = new ObjectMapper().readValue(busData, Map.class);
System.out
.println("业务信息解密--》" + new String(Base64.getDecoder().decode(busDataMap.get("message").toString()),
StandardCharsets.UTF_8));
JSONObject resobj = JSONObject.parseObject(busData);
result.put("success", true);
result.put("result", resobj);
} else {
result.put("msg", "web响应失败!");
result.put("success", false);
}
} catch (Exception e) {
result.put("msg", e.getMessage());
result.put("success", false);
}
return result;
} }
/** /**
@@ -339,6 +374,7 @@ public class EleInvoiceServiceImpl implements IEleInvoiceService {
// --------------------请求业务参数 data--------------------START // --------------------请求业务参数 data--------------------START
JSONObject bill = commomSet(patientInfo, paymentInfo, clinicSettle); JSONObject bill = commomSet(patientInfo, paymentInfo, clinicSettle);
bill.put("paymentId", paymentId);
// ------票据信息------ // ------票据信息------
// busType 业务标识 String 20 是 06标识挂号 // busType 业务标识 String 20 是 06标识挂号
@@ -580,6 +616,7 @@ public class EleInvoiceServiceImpl implements IEleInvoiceService {
// --------------------请求业务参数 data--------------------START // --------------------请求业务参数 data--------------------START
JSONObject bill = commomSet(patientInfo, paymentInfo, clinicSettle); JSONObject bill = commomSet(patientInfo, paymentInfo, clinicSettle);
bill.put("paymentId", paymentId);
// ------票据信息------ // ------票据信息------
// busType 业务标识 String 20 是 直接填写业务系统内部编码值由医疗平台配置对照例如附录5 业务标识列表 // busType 业务标识 String 20 是 直接填写业务系统内部编码值由医疗平台配置对照例如附录5 业务标识列表
@@ -890,6 +927,7 @@ public class EleInvoiceServiceImpl implements IEleInvoiceService {
// --------------------请求业务参数 data--------------------START // --------------------请求业务参数 data--------------------START
JSONObject bill = commomSet(patientInfo, paymentInfo, clinicSettle); JSONObject bill = commomSet(patientInfo, paymentInfo, clinicSettle);
bill.put("paymentId", paymentId);
// ------票据信息------ // ------票据信息------
// busType 业务标识 String 20 是 直接填写业务系统内部编码值由医疗平台配置对照例如附录5 业务标识列表 // busType 业务标识 String 20 是 直接填写业务系统内部编码值由医疗平台配置对照例如附录5 业务标识列表

View File

@@ -41,22 +41,23 @@ public class EleInvoiceController {
public R<?> invoiceReissue(@RequestBody MakeInvoiceDto makeInvoiceDto) { public R<?> invoiceReissue(@RequestBody MakeInvoiceDto makeInvoiceDto) {
// 付款成功后,开具发票 // 付款成功后,开具发票
R<?> result = eleInvoiceService.invoiceReissue(makeInvoiceDto.getPaymentId(), makeInvoiceDto.getEncounterId()); R<?> result = eleInvoiceService.invoiceReissue(makeInvoiceDto.getPaymentId(), makeInvoiceDto.getEncounterId());
R<?> eleResult = null;
if (result.getCode() == 200) { if (result.getCode() == 200) {
if (result.getData() == YbEncounterClass.REG.getValue()) { if (result.getData() == YbEncounterClass.REG.getValue()) {
// 付款成功后,开具发票 // 付款成功后,开具发票
R<?> eleResult = eleInvoiceService.invoiceRegMake(makeInvoiceDto.getPaymentId(), makeInvoiceDto.getEncounterId()); eleResult = eleInvoiceService.invoiceRegMake(makeInvoiceDto.getPaymentId(), makeInvoiceDto.getEncounterId());
if (eleResult.getCode() != 200) { if (eleResult.getCode() != 200) {
return R.ok(" 挂号电子发票开具失败 :" + eleResult.getMsg()); return R.ok(" 挂号电子发票开具失败 :" + eleResult.getMsg());
} }
} else if (result.getData() == YbEncounterClass.AMB.getValue()) { } else if (result.getData() == YbEncounterClass.AMB.getValue()) {
// 付款成功后,开具发票 // 付款成功后,开具发票
R<?> eleResult = eleInvoiceService.invoiceMZMake(makeInvoiceDto.getPaymentId(), makeInvoiceDto.getEncounterId()); eleResult = eleInvoiceService.invoiceMZMake(makeInvoiceDto.getPaymentId(), makeInvoiceDto.getEncounterId());
if (eleResult.getCode() != 200) { if (eleResult.getCode() != 200) {
return R.ok(" 门诊电子发票开具失败 :" + eleResult.getMsg()); return R.ok(" 门诊电子发票开具失败 :" + eleResult.getMsg());
} }
} else if (result.getData() == YbEncounterClass.IMP.getValue()) { } else if (result.getData() == YbEncounterClass.IMP.getValue()) {
// 付款成功后,开具发票 // 付款成功后,开具发票
R<?> eleResult = eleInvoiceService.invoiceZYMake(makeInvoiceDto.getPaymentId(), makeInvoiceDto.getEncounterId()); eleResult = eleInvoiceService.invoiceZYMake(makeInvoiceDto.getPaymentId(), makeInvoiceDto.getEncounterId());
if (eleResult.getCode() != 200) { if (eleResult.getCode() != 200) {
return R.ok(" 住院电子发票开具失败 :" + eleResult.getMsg()); return R.ok(" 住院电子发票开具失败 :" + eleResult.getMsg());
} }
@@ -64,7 +65,11 @@ public class EleInvoiceController {
return R.ok("电子发票类型不明确!"); return R.ok("电子发票类型不明确!");
} }
} }
Map detail = iChargeBillService.getDetail(makeInvoiceDto.getPaymentId()); Map<String, Object> detail = iChargeBillService.getDetail(makeInvoiceDto.getPaymentId());
if (eleResult != null && eleResult.getCode() == 200 && eleResult.getData() instanceof Invoice) {
Invoice invoice = (Invoice) eleResult.getData();
detail.put("pictureUrl", invoice.getPictureUrl());
}
return R.ok(detail); return R.ok(detail);
} }
@@ -95,10 +100,18 @@ public class EleInvoiceController {
public R<?> invoiceOpen(@RequestParam("invoiceId") String invoiceId) { public R<?> invoiceOpen(@RequestParam("invoiceId") String invoiceId) {
// 退款成功后,开具发票 // 退款成功后,开具发票
Invoice invoice = eleInvoiceService.getInvoiceById(Long.parseLong(invoiceId)); Invoice invoice = eleInvoiceService.getInvoiceById(Long.parseLong(invoiceId));
if(invoice ==null){ if (invoice == null) {
throw new ServiceException("未查询到发票信息"); throw new ServiceException("未查询到发票信息");
} }
return R.ok(invoice.getPictureUrl()); return R.ok(invoice.getPictureUrl());
} }
/**
* 获取发票HTML凭条预览
*/
@GetMapping(value = "/view", produces = "text/html;charset=UTF-8")
@ResponseBody
public String viewInvoice(@RequestParam("busNo") String busNo) {
return eleInvoiceService.getInvoiceHtml(busNo);
}
} }

View File

@@ -92,10 +92,12 @@ public class PaymentReconciliationController {
if (eleResult.getCode() != 200) { if (eleResult.getCode() != 200) {
// 因收费成功前端需要关闭弹窗此处信息仅用于提示所以返回ok // 因收费成功前端需要关闭弹窗此处信息仅用于提示所以返回ok
return R.ok(detail, " 收费成功,电子发票开具失败 :" + eleResult.getMsg()); return R.ok(detail, " 收费成功,电子发票开具失败 :" + eleResult.getMsg());
} else if (eleResult.getData() instanceof Invoice) {
Invoice invoice = (Invoice) eleResult.getData();
detail.put("pictureUrl", invoice.getPictureUrl());
} }
return R.ok(detail);
} }
// Map detail = iChargeBillService.getDetail(paymentRecon.getId());
} }
return result; return result;
} }
@@ -194,7 +196,11 @@ public class PaymentReconciliationController {
if (eleResult.getCode() != 200) { if (eleResult.getCode() != 200) {
// 因收费成功前端需要关闭弹窗此处信息仅用于提示所以返回ok // 因收费成功前端需要关闭弹窗此处信息仅用于提示所以返回ok
return R.ok(detail, " 收费成功,电子发票开具失败 :" + eleResult.getMsg()); return R.ok(detail, " 收费成功,电子发票开具失败 :" + eleResult.getMsg());
} else if (eleResult.getData() instanceof Invoice) {
Invoice invoice = (Invoice) eleResult.getData();
detail.put("pictureUrl", invoice.getPictureUrl());
} }
return R.ok(detail);
} }
} }
return result; return result;
@@ -233,6 +239,9 @@ public class PaymentReconciliationController {
if (eleResult.getCode() != 200) { if (eleResult.getCode() != 200) {
// 因收费成功前端需要关闭弹窗此处信息仅用于提示所以返回ok // 因收费成功前端需要关闭弹窗此处信息仅用于提示所以返回ok
return R.ok(detail, " 收费成功,电子发票开具失败 :" + eleResult.getMsg()); return R.ok(detail, " 收费成功,电子发票开具失败 :" + eleResult.getMsg());
} else if (eleResult.getData() instanceof Invoice) {
Invoice invoice = (Invoice) eleResult.getData();
detail.put("pictureUrl", invoice.getPictureUrl());
} }
return R.ok(detail); return R.ok(detail);
} }
@@ -260,8 +269,9 @@ public class PaymentReconciliationController {
// 因取消付款成功前端需要关闭弹窗此处信息仅用于提示所以返回ok // 因取消付款成功前端需要关闭弹窗此处信息仅用于提示所以返回ok
return R.ok(null, " 取消付款成功,电子发票开具失败 :" + eleResult.getMsg()); return R.ok(null, " 取消付款成功,电子发票开具失败 :" + eleResult.getMsg());
} }
return R.ok("取消结算成功");
} }
return R.ok("取消结算失败,请确认"); return R.fail("取消结算失败,请确认");
} }
/** /**

View File

@@ -0,0 +1,68 @@
<html>
<head>
<style>
body { font-family: 'Microsoft YaHei', sans-serif; width: 350px; margin: 0 auto; padding: 20px; border: 1px solid #ccc; background: #fff; }
.header { text-align: center; }
.hospital-name { font-size: 20px; font-weight: bold; margin-bottom: 5px; }
.title { font-size: 16px; margin-bottom: 10px; }
.time { font-size: 12px; color: #666; margin-bottom: 15px; }
.section { border-top: 1px solid #000; padding-top: 10px; margin-top: 10px; }
.section-title { font-weight: bold; text-decoration: underline; margin-bottom: 10px; font-size: 14px; }
.item { display: flex; font-size: 13px; margin-bottom: 5px; }
.label { width: 90px; color: #333; }
.value { flex: 1; font-weight: 500; }
table { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: 13px; }
th { text-align: left; border-bottom: 1px dashed #ccc; padding-bottom: 5px; color: #666; }
td { padding: 5px 0; }
.total { text-align: right; font-weight: bold; border-top: 1px solid #000; padding-top: 10px; margin-top: 10px; font-size: 15px; }
.footer { margin-top: 20px; font-size: 11px; color: #666; line-height: 1.5; }
.qr-code { text-align: center; margin-top: 15px; }
.serial-no { text-align: left; margin-top: 10px; font-size: 12px; font-weight: bold; border-top: 1px dashed #ccc; padding-top: 10px; }
</style>
</head>
<body>
<div class='header'>
<div class='hospital-name'>$hospitalName</div>
<div class='title'>门诊预约挂号凭条</div>
<div class='time'>打印时间:$printTime</div>
</div>
<div class='section'>
<div class='section-title'>患者基本信息</div>
<div class='item'><div class='label'>患者姓名:</div><div class='value'>$patientName</div></div>
<div class='item'><div class='label'>门诊号:</div><div class='value'>$outpatientNo</div></div>
<div class='item'><div class='label'>身份证号:</div><div class='value'>#if($idCard)$idCard#else-#end</div></div>
<div class='item'><div class='label'>联系电话:</div><div class='value'>#if($tel)$tel#else-#end</div></div>
</div>
<div class='section'>
<div class='section-title'>预约详情</div>
<div class='item'><div class='label'>就诊科室:</div><div class='value'>#if($deptName)$deptName#else-#end</div></div>
<div class='item'><div class='label'>医生姓名:</div><div class='value'>$doctorName</div></div>
<div class='item'><div class='label'>预约时间:</div><div class='value'>#if($appointmentTime)$appointmentTime#else-#end</div></div>
<div class='item'><div class='label'>就诊地点:</div><div class='value'>门诊大楼内</div></div>
<div class='item'><div class='label'>预约状态:</div><div class='value'><span style='color:green;'>☑ 已 预</span></div></div>
</div>
<div class='section'>
<div class='section-title'>费用信息</div>
<table>
<tr><th>项目</th><th>数量</th><th>单价</th><th>金额</th></tr>
#foreach($item in $items)
<tr>
<td>$item.chargeItemName</td>
<td>$item.quantityValue</td>
<td>¥$item.totalPrice</td>
<td>¥$item.totalPrice</td>
</tr>
#end
</table>
<div class='total'>合计:¥$totalAmt</div>
<div class='item' style='margin-top:10px;'><div class='label'>支付方式:</div><div class='value'>线上支付 (已支付)</div></div>
</div>
<div class='footer'>
温馨提示请至少提前30分钟到达取号过时自动取消。服务时间8:00-17:00
</div>
<div class='qr-code'>
<img src='https://api.qrserver.com/v1/create-qr-code/?size=100x100&data=$busNo' width='100' height='100' />
</div>
<div class='serial-no'>流水号:$busNo</div>
</body>
</html>

View File

@@ -1,117 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>openhis-server</artifactId>
<groupId>com.openhis</groupId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>openhis-einvoiceapp</artifactId>
<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
</properties>
<dependencies>
<!-- 领域-->
<!-- <dependency>-->
<!-- <groupId>com.openhis</groupId>-->
<!-- <artifactId>openhis-domain</artifactId>-->
<!-- <version>0.0.1-SNAPSHOT</version>-->
<!-- </dependency>-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>com.alibaba.fastjson2</groupId>
<artifactId>fastjson2</artifactId>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
</dependency>
<!-- 共通-->
<dependency>
<groupId>com.openhis</groupId>
<artifactId>openhis-common</artifactId>
</dependency>
<!-- liteflow-->
<dependency>
<groupId>com.yomahub</groupId>
<artifactId>liteflow-spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk15on</artifactId>
</dependency>
<dependency>
<groupId>com.itextpdf</groupId>
<artifactId>kernel</artifactId>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpmime</artifactId>
</dependency>
<!-- pdf依赖-->
<dependency>
<groupId>com.itextpdf</groupId>
<artifactId>itextpdf</artifactId>
</dependency>
<dependency>
<groupId>com.itextpdf</groupId>
<artifactId>itext-asian</artifactId>
</dependency>
</dependencies>
<!-- <build>-->
<!-- <plugins>-->
<!-- <plugin>-->
<!-- <groupId>org.springframework.boot</groupId>-->
<!-- <artifactId>spring-boot-maven-plugin</artifactId>-->
<!-- <configuration>-->
<!-- <fork>true</fork> &lt;!&ndash; 如果没有该配置devtools不会生效 &ndash;&gt;-->
<!-- </configuration>-->
<!-- <executions>-->
<!-- <execution>-->
<!-- <goals>-->
<!-- <goal>repackage</goal>-->
<!-- </goals>-->
<!-- </execution>-->
<!-- </executions>-->
<!-- </plugin>-->
<!-- <plugin>-->
<!-- <groupId>org.apache.maven.plugins</groupId>-->
<!-- <artifactId>maven-war-plugin</artifactId>-->
<!-- <version>${maven-war-plugin.version}</version>-->
<!-- <configuration>-->
<!-- <failOnMissingWebXml>false</failOnMissingWebXml>-->
<!-- <warName>${project.artifactId}</warName>-->
<!-- </configuration>-->
<!-- </plugin>-->
<!-- </plugins>-->
<!-- <finalName>${project.artifactId}</finalName>-->
<!-- </build>-->
</project>

View File

@@ -214,38 +214,38 @@ async function printReceipt(param) {
{ {
...param, ...param,
// 基础支付类型 // 基础支付类型
YB_FUND_PAY: param.detail.find((t) => t.payEnum === 100000)?.amount ?? 0, // 基金支付总额 YB_FUND_PAY: param.detail?.find((t) => t.payEnum === 100000)?.amount ?? 0, // 基金支付总额
SELF_PAY: param.detail.find((t) => t.payEnum === 200000)?.amount ?? 0, // 个人负担总金额 SELF_PAY: param.detail?.find((t) => t.payEnum === 200000)?.amount ?? 0, // 个人负担总金额
OTHER_PAY: param.detail.find((t) => t.payEnum === 300000)?.amount ?? 0, // 其他(如医院负担金额) OTHER_PAY: param.detail?.find((t) => t.payEnum === 300000)?.amount ?? 0, // 其他(如医院负担金额)
// 基本医保统筹基金支出 // 基本医保统筹基金支出
YB_TC_FUND_AMOUNT: param.detail.find((t) => t.payEnum === 110000)?.amount ?? 0, // 基本医保统筹基金支出 YB_TC_FUND_AMOUNT: param.detail?.find((t) => t.payEnum === 110000)?.amount ?? 0, // 基本医保统筹基金支出
YB_BC_FUND_AMOUNT: param.detail.find((t) => t.payEnum === 120000)?.amount ?? 0, // 补充医疗保险基金支出 YB_BC_FUND_AMOUNT: param.detail?.find((t) => t.payEnum === 120000)?.amount ?? 0, // 补充医疗保险基金支出
YB_JZ_FUND_AMOUNT: param.detail.find((t) => t.payEnum === 130000)?.amount ?? 0, // 医疗救助基金支出 YB_JZ_FUND_AMOUNT: param.detail?.find((t) => t.payEnum === 130000)?.amount ?? 0, // 医疗救助基金支出
YB_OTHER_AMOUNT: param.detail.find((t) => t.payEnum === 140000)?.amount ?? 0, // 其他支出 YB_OTHER_AMOUNT: param.detail?.find((t) => t.payEnum === 140000)?.amount ?? 0, // 其他支出
// 职工基本医疗保险 // 职工基本医疗保险
YB_TC_ZG_FUND_VALUE: param.detail.find((t) => t.payEnum === 110100)?.amount ?? 0, // 职工基本医疗保险 YB_TC_ZG_FUND_VALUE: param.detail?.find((t) => t.payEnum === 110100)?.amount ?? 0, // 职工基本医疗保险
YB_TC_JM_FUND_VALUE: param.detail.find((t) => t.payEnum === 110200)?.amount ?? 0, // 居民基本医疗保险 YB_TC_JM_FUND_VALUE: param.detail?.find((t) => t.payEnum === 110200)?.amount ?? 0, // 居民基本医疗保险
// 补充医疗保险基金支出细分 // 补充医疗保险基金支出细分
YB_BC_JM_DB_VALUE: param.detail.find((t) => t.payEnum === 120100)?.amount ?? 0, // 全体参保人的居民大病保险 YB_BC_JM_DB_VALUE: param.detail?.find((t) => t.payEnum === 120100)?.amount ?? 0, // 全体参保人的居民大病保险
YB_BC_DE_BZ_VALUE: param.detail.find((t) => t.payEnum === 120200)?.amount ?? 0, // 大额医疗费用补助 YB_BC_DE_BZ_VALUE: param.detail?.find((t) => t.payEnum === 120200)?.amount ?? 0, // 大额医疗费用补助
YB_BC_ZG_DE_BZ_VALUE: param.detail.find((t) => t.payEnum === 120300)?.amount ?? 0, // 企业职工大额医疗费用补助 YB_BC_ZG_DE_BZ_VALUE: param.detail?.find((t) => t.payEnum === 120300)?.amount ?? 0, // 企业职工大额医疗费用补助
YB_BC_GWY_BZ_VALUE: param.detail.find((t) => t.payEnum === 120400)?.amount ?? 0, // 公务员医疗补助 YB_BC_GWY_BZ_VALUE: param.detail?.find((t) => t.payEnum === 120400)?.amount ?? 0, // 公务员医疗补助
// 其他支出细分 // 其他支出细分
OTHER_PAY_DD_FUND_VALUE: param.detail.find((t) => t.payEnum === 300001)?.amount ?? 0, // 兜底基金支出 OTHER_PAY_DD_FUND_VALUE: param.detail?.find((t) => t.payEnum === 300001)?.amount ?? 0, // 兜底基金支出
OTHER_PAY_YW_SH_FUND_VALUE: param.detail.find((t) => t.payEnum === 300002)?.amount ?? 0, // 意外伤害基金支出 OTHER_PAY_YW_SH_FUND_VALUE: param.detail?.find((t) => t.payEnum === 300002)?.amount ?? 0, // 意外伤害基金支出
OTHER_PAY_LX_YL_FUND_VALUE: param.detail.find((t) => t.payEnum === 300003)?.amount ?? 0, // 离休人员医疗保障金支出 OTHER_PAY_LX_YL_FUND_VALUE: param.detail?.find((t) => t.payEnum === 300003)?.amount ?? 0, // 离休人员医疗保障金支出
OTHER_PAY_LX_YH_FUND_VALUE: param.detail.find((t) => t.payEnum === 300004)?.amount ?? 0, // 离休人员优惠金支出 OTHER_PAY_LX_YH_FUND_VALUE: param.detail?.find((t) => t.payEnum === 300004)?.amount ?? 0, // 离休人员优惠金支出
OTHER_PAY_CZ_FUND_VALUE: param.detail.find((t) => t.payEnum === 300005)?.amount ?? 0, // 财政基金支出 OTHER_PAY_CZ_FUND_VALUE: param.detail?.find((t) => t.payEnum === 300005)?.amount ?? 0, // 财政基金支出
OTHER_PAY_CZ_YZ_FUND_VALUE: param.detail.find((t) => t.payEnum === 300006)?.amount ?? 0, // 财政预支支出 OTHER_PAY_CZ_YZ_FUND_VALUE: param.detail?.find((t) => t.payEnum === 300006)?.amount ?? 0, // 财政预支支出
OTHER_PAY_ZG_DB_FUND_VALUE: param.detail.find((t) => t.payEnum === 300007)?.amount ?? 0, // 职工大病基金支出 OTHER_PAY_ZG_DB_FUND_VALUE: param.detail?.find((t) => t.payEnum === 300007)?.amount ?? 0, // 职工大病基金支出
OTHER_PAY_EY_FUND_VALUE: param.detail.find((t) => t.payEnum === 300008)?.amount ?? 0, // 二乙基金支出 OTHER_PAY_EY_FUND_VALUE: param.detail?.find((t) => t.payEnum === 300008)?.amount ?? 0, // 二乙基金支出
OTHER_PAY_QX_JZ_FUND_VALUE: param.detail.find((t) => t.payEnum === 300009)?.amount ?? 0, // 倾斜救助支出 OTHER_PAY_QX_JZ_FUND_VALUE: param.detail?.find((t) => t.payEnum === 300009)?.amount ?? 0, // 倾斜救助支出
OTHER_PAY_YL_JZ_FUND_VALUE: param.detail.find((t) => t.payEnum === 300010)?.amount ?? 0, // 医疗救助再救助基金 OTHER_PAY_YL_JZ_FUND_VALUE: param.detail?.find((t) => t.payEnum === 300010)?.amount ?? 0, // 医疗救助再救助基金
HOSP_PART_AMT: param.detail.find((t) => t.payEnum === 300011)?.amount ?? 0, // 医院负担金额 HOSP_PART_AMT: param.detail?.find((t) => t.payEnum === 300011)?.amount ?? 0, // 医院负担金额
// 医保结算返回值 - 修复运算符优先级问题,添加括号确保正确拼接'元' // 医保结算返回值 - 修复运算符优先级问题,添加括号确保正确拼接'元'
FULAMT_OWNPAY_AMT: (param.detail?.find((t) => t.payEnum === 1)?.amount ?? 0) + '元', // 全自费金额 FULAMT_OWNPAY_AMT: (param.detail?.find((t) => t.payEnum === 1)?.amount ?? 0) + '元', // 全自费金额
@@ -347,10 +347,10 @@ async function printReceipt(param) {
: '', // 保健预支基金 : '', // 保健预支基金
//微信刷卡支付 //微信刷卡支付
SELF_CASH_VX_VALUE: (() => { SELF_CASH_VX_VALUE: (() => {
// const cashValue = param.detail.find((t) => t.payEnum === 220400)?.amount ?? 0; // const cashValue = param.detail?.find((t) => t.payEnum === 220400)?.amount ?? 0;
const vxValue = param.detail.find((t) => t.payEnum === 220100)?.amount ?? 0; const vxValue = param.detail?.find((t) => t.payEnum === 220100)?.amount ?? 0;
const unionValue = param.detail.find((t) => t.payEnum === 220300)?.amount ?? 0; const unionValue = param.detail?.find((t) => t.payEnum === 220300)?.amount ?? 0;
const aliValue = param.detail.find((t) => t.payEnum === 220200)?.amount ?? 0; const aliValue = param.detail?.find((t) => t.payEnum === 220200)?.amount ?? 0;
return vxValue + unionValue + aliValue + '元'; return vxValue + unionValue + aliValue + '元';
})(), })(),

View File

@@ -291,10 +291,13 @@ import {advicePrint, getAdjustPriceSwitchState, lotNumberMatch} from '@/api/publ
import {debounce} from 'lodash-es'; import {debounce} from 'lodash-es';
import TraceNoDialog from '@/components/OpenHis/TraceNoDialog/index.vue'; import TraceNoDialog from '@/components/OpenHis/TraceNoDialog/index.vue';
import {hiprint} from 'vue-plugin-hiprint'; import {hiprint} from 'vue-plugin-hiprint';
// import templateJson from './components/templateJson.json'; import templateJson from './components/templateJson.json';
// import disposalTemplate from './components/disposalTemplate.json'; import disposalTemplate from './components/disposalTemplate.json';
import {formatInventory} from '@/utils/his.js'; import {formatInventory} from '@/utils/his.js';
import useUserStore from '@/store/modules/user';
const userStore = useUserStore();
const { proxy } = getCurrentInstance(); const { proxy } = getCurrentInstance();
const showSearch = ref(true); const showSearch = ref(true);
const total = ref(0); const total = ref(0);
@@ -444,7 +447,9 @@ async function printPrescription() {
}).then((res) => { }).then((res) => {
if (projectTypeCode.value == '3') { if (projectTypeCode.value == '3') {
const result = res.data; const result = res.data;
const printElements = disposalTemplate; const printElements = JSON.parse(
JSON.stringify(disposalTemplate).replace(/{{HOSPITAL_NAME}}/g, userStore.hospitalName)
);
var hiprintTemplate = new hiprint.PrintTemplate({ template: printElements }); // 定义模板 var hiprintTemplate = new hiprint.PrintTemplate({ template: printElements }); // 定义模板
hiprintTemplate.print2(result, { hiprintTemplate.print2(result, {
height: 210, height: 210,
@@ -474,7 +479,9 @@ async function printPrescription() {
prescriptionList: item, prescriptionList: item,
}); });
}); });
const printElements = templateJson; const printElements = JSON.parse(
JSON.stringify(templateJson).replace(/{{HOSPITAL_NAME}}/g, userStore.hospitalName)
);
var hiprintTemplate = new hiprint.PrintTemplate({ template: printElements }); // 定义模板 var hiprintTemplate = new hiprint.PrintTemplate({ template: printElements }); // 定义模板
hiprintTemplate.print2(result, { hiprintTemplate.print2(result, {
height: 210, height: 210,

File diff suppressed because one or more lines are too long

View File

@@ -1754,7 +1754,11 @@
</template> </template>
<script setup> <script setup>
import {ref} from 'vue'; import {ref, reactive, getCurrentInstance} from 'vue';
import useUserStore from '@/store/modules/user';
const userStore = useUserStore();
const { proxy } = getCurrentInstance();
import formDataJs from '../../doctorstation/components/store/medicalpage'; import formDataJs from '../../doctorstation/components/store/medicalpage';
import {patientInfo} from '../../inpatientDoctor/home/store/patient'; import {patientInfo} from '../../inpatientDoctor/home/store/patient';

View File

@@ -1046,7 +1046,9 @@ function handlePrint() {
purchaseinventoryList: form.purchaseinventoryList, purchaseinventoryList: form.purchaseinventoryList,
}); });
console.log(result, '345678987654'); console.log(result, '345678987654');
const printElements = templateJson; const printElements = JSON.parse(
JSON.stringify(templateJson).replace(/{{HOSPITAL_NAME}}/g, userStore.hospitalName)
);
var hiprintTemplate = new hiprint.PrintTemplate({ template: printElements }); // 定义模板 var hiprintTemplate = new hiprint.PrintTemplate({ template: printElements }); // 定义模板
hiprintTemplate.print2(result, { hiprintTemplate.print2(result, {
// printer: 'EPSON LQ-80KFII', // printer: 'EPSON LQ-80KFII',

View File

@@ -244,7 +244,9 @@ function handlePrint() {
purposeLocationName: printList[0].purposeLocationName, purposeLocationName: printList[0].purposeLocationName,
purchaseinventoryList: printList, purchaseinventoryList: printList,
}); });
const printElements = templateJson; const printElements = JSON.parse(
JSON.stringify(templateJson).replace(/{{HOSPITAL_NAME}}/g, userStore.hospitalName)
);
var hiprintTemplate = new hiprint.PrintTemplate({ template: printElements }); // 定义模板 var hiprintTemplate = new hiprint.PrintTemplate({ template: printElements }); // 定义模板
hiprintTemplate.print2(result, { hiprintTemplate.print2(result, {
// printer: 'EPSON LQ-80KFII', // printer: 'EPSON LQ-80KFII',

View File

@@ -1436,8 +1436,11 @@ function handlePrintPreview() {
console.log("打印数据:", printData); console.log("打印数据:", printData);
// 创建打印模板实例 // 创建打印模板实例
const printElements = JSON.parse(
JSON.stringify(templateJson).replace(/{{HOSPITAL_NAME}}/g, userUserStore.hospitalName)
);
const hiprintTemplate = new hiprint.PrintTemplate({ const hiprintTemplate = new hiprint.PrintTemplate({
template: templateJson, template: printElements,
}); });
// 打开预览窗口(推荐) // 打开预览窗口(推荐)
@@ -1515,8 +1518,11 @@ function handleDirectPrint() {
console.log("打印数据:", printData); console.log("打印数据:", printData);
// 创建打印模板实例 // 创建打印模板实例
const printElements = JSON.parse(
JSON.stringify(templateJson).replace(/{{HOSPITAL_NAME}}/g, userUserStore.hospitalName)
);
const hiprintTemplate = new hiprint.PrintTemplate({ const hiprintTemplate = new hiprint.PrintTemplate({
template: templateJson, template: printElements,
}); });
// 直接打印到指定打印机 // 直接打印到指定打印机
@@ -1591,8 +1597,11 @@ function handlePrintWithSelectPrinter() {
console.log("打印数据:", printData); console.log("打印数据:", printData);
// 创建打印模板实例 // 创建打印模板实例
const printElements = JSON.parse(
JSON.stringify(templateJson).replace(/{{HOSPITAL_NAME}}/g, userUserStore.hospitalName)
);
const hiprintTemplate = new hiprint.PrintTemplate({ const hiprintTemplate = new hiprint.PrintTemplate({
template: templateJson, template: printElements,
}); });
// 获取打印机列表并选择 // 获取打印机列表并选择

View File

@@ -243,7 +243,9 @@ function handlePrint() {
busNo: printList[0].busNo, busNo: printList[0].busNo,
detailsList: printList, detailsList: printList,
}); });
const printElements = templateJson; const printElements = JSON.parse(
JSON.stringify(templateJson).replace(/{{HOSPITAL_NAME}}/g, userStore.hospitalName)
);
var hiprintTemplate = new hiprint.PrintTemplate({ template: printElements }); // 定义模板 var hiprintTemplate = new hiprint.PrintTemplate({ template: printElements }); // 定义模板
hiprintTemplate.print2(result, { hiprintTemplate.print2(result, {
title: '打印标题', title: '打印标题',

View File

@@ -696,7 +696,10 @@ async function printPrescription() {
console.log('药房result', result); console.log('药房result', result);
// 根据药品分类选择对应的打印模板 // 根据药品分类选择对应的打印模板
const printElements = tcmFlag.value === '1' ? chineseMedicineTemplateJson : templateJson; const template = tcmFlag.value === '1' ? chineseMedicineTemplateJson : templateJson;
const printElements = JSON.parse(
JSON.stringify(template).replace(/{{HOSPITAL_NAME}}/g, proxy.$store.useUserStore().hospitalName)
);
var hiprintTemplate = new hiprint.PrintTemplate({template: printElements}); // 定义模板 var hiprintTemplate = new hiprint.PrintTemplate({template: printElements}); // 定义模板
hiprintTemplate.print2(result, { hiprintTemplate.print2(result, {
height: 210, height: 210,