From 97834ce60827831a864ebe37e585f8a921352669 Mon Sep 17 00:00:00 2001
From: liusheng <337615773@qq.com>
Date: 星期四, 13 十一月 2025 19:11:06 +0800
Subject: [PATCH] 文件名修改
---
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/freemark/TemplateCreateController.java | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/freemark/TemplateCreateController.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/freemark/TemplateCreateController.java
index a56b309..dcda1c7 100644
--- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/freemark/TemplateCreateController.java
+++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/freemark/TemplateCreateController.java
@@ -44,7 +44,8 @@
log.info("鐭ユ儏鍚屾剰杩愬姩璇曢獙锛歿}", id);
try {
Map dataMap = new HashMap();
- getData(dataMap, id);
+ AppointmentDO appointment = appointmentService.getAppointment(id);
+ getData(dataMap, appointment);
String filePath = getClass().getResource("/template/").getPath();
System.out.println(filePath);
//璁剧疆妯℃湰瑁呯疆鏂规硶鍜岃矾寰�,FreeMarker鏀寔澶氱妯℃澘瑁呰浇鏂规硶銆傚彲浠ラ噸servlet锛宑lasspath锛屾暟鎹簱鏁欑▼瑁呰浇锛�
@@ -54,16 +55,16 @@
t = configuration.getTemplate("鐭ユ儏鍚屾剰杩愬姩璇曢獙.ftl");
String year = String.valueOf(Calendar.getInstance().get(Calendar.YEAR));
- String name = "鐭ユ儏鍚屾剰杩愬姩璇曢獙" + year;
+ String name = "鐭ユ儏鍚屾剰杩愬姩璇曢獙-" + appointment.getPatName() + "-" + year;
//杈撳嚭鏂囨。璺緞鍙婂悕绉�
- File outFile = new File("D:/download/" + name + ".doc");
+ File outFile = new File("D:/" + name + ".doc");
Writer out = null;
out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(outFile), "utf-8"));
t.process(dataMap, out);
Map<String, Object> map = new HashMap<>();
- map.put("downloadUrl", "D:/download/" + name + ".doc");
+ map.put("downloadUrl", "D:/" + name + ".doc");
map.put("downloadName", name + ".doc");
return map;
} catch (Exception e) {
@@ -72,8 +73,7 @@
return null;
}
- private void getData(Map dataMap, Long id) {
- AppointmentDO appointment = appointmentService.getAppointment(id);
+ private void getData(Map dataMap, AppointmentDO appointment) {
dataMap.put("name", StringUtils.isEmpty(appointment.getPatName()) ? "" : appointment.getPatName());
dataMap.put("sex", appointment.getPatGender() == null ? "" : appointment.getPatGender() == 1 ? "鐢�" : "濂�");
--
Gitblit v1.9.3