|
@ -1456,7 +1456,9 @@ public class DoorOrderService {
|
|
|
*/
|
|
|
public String handleData(Document doc, String orderId) {
|
|
|
WlyyDoorServiceOrderDO orderDO = doorServiceOrderDao.findOne(orderId);
|
|
|
System.out.println("orderDO value -------------------");
|
|
|
WlyyDoorConclusionDO conclusionDO = doorConclusionDao.findByOrderId(orderId);//808080f66e5efb24016e62838d77000a
|
|
|
System.out.println("conclusionDO value -------------------");
|
|
|
String html = doc.toString();
|
|
|
//对各个字段赋值
|
|
|
html = html.replace("${name}", orderDO.getPatientName());
|
|
@ -1482,6 +1484,9 @@ public class DoorOrderService {
|
|
|
html = html.replace("${diagnosticrecord}", conclusionDO.getDiagnosticRecord() == null ? "" : conclusionDO.getDiagnosticRecord());
|
|
|
html = html.replace("${examresult}",conclusionDO.getExamResult() == null ? "" : conclusionDO.getExamResult());
|
|
|
String imgsString = "";
|
|
|
|
|
|
System.out.println("赋值完成 value -------------------");
|
|
|
|
|
|
if(StringUtils.isNotBlank(conclusionDO.getImgs())) {
|
|
|
String imgs = conclusionDO.getImgs();
|
|
|
String[] imgsArray;
|
|
@ -1588,6 +1593,16 @@ public class DoorOrderService {
|
|
|
long time = System.currentTimeMillis();
|
|
|
String exportConclusionList = time+"exportList";
|
|
|
String path = this.getClass().getResource("/").getPath() + exportConclusionList;
|
|
|
|
|
|
System.out.println("path :" +path);
|
|
|
|
|
|
// String path1 = this.getClass().getResource("/").getPath() + exportConclusionList;
|
|
|
// String c2=path1.substring(0,path1.indexOf("!"));// !前面的
|
|
|
// String c1=path1.substring(path1.lastIndexOf("!")+1);// !後面的
|
|
|
// String cc = c2+c1;
|
|
|
// String path = cc.replace("svr-door-service.jar/","");
|
|
|
// System.out.println(path);
|
|
|
|
|
|
File file = new File(path);
|
|
|
// 删除文件夹、文件
|
|
|
if (file.exists()) {
|
|
@ -1613,28 +1628,45 @@ public class DoorOrderService {
|
|
|
j = j + 1;
|
|
|
fileName = java.net.URLEncoder.encode(fileName,"UTF-8");
|
|
|
fileName = java.net.URLDecoder.decode(fileName,"UTF-8");
|
|
|
System.out.println("fileName === "+ fileName);
|
|
|
response.setHeader("Content-Disposition", "attachment; filename=" + fileName);
|
|
|
// String pathName = this.getClass().getResource("/").getPath() + "conclusion.mht";
|
|
|
// System.out.println("路径pathName:" + pathName);
|
|
|
// Document doc = Jsoup.parse(new File(pathName), "UTF-8");
|
|
|
Document doc = Jsoup.parse(StreamUtil.readResources());
|
|
|
|
|
|
String html = this.handleData(doc, orderId.get(i));//16
|
|
|
|
|
|
System.out.println("bw value -------------------:"+path+"/"+fileName);
|
|
|
|
|
|
BufferedWriter bw = new BufferedWriter(new FileWriter(path+"/"+fileName));//创建的文件
|
|
|
|
|
|
System.out.println("创建的文件-----------success");
|
|
|
|
|
|
bw.write(html);
|
|
|
bw.close();
|
|
|
File zipFile = new File(path.replace(exportConclusionList, "") + zipFileName + ".zip");
|
|
|
if (zipFile.exists()) {
|
|
|
zipFile.delete();
|
|
|
}
|
|
|
System.out.println("----------------- 第"+j+"个服务小结 -------------------");
|
|
|
}
|
|
|
// 打包文件夹
|
|
|
if (fileToZip(path, path.replace(exportConclusionList, ""), zipFileName)) {
|
|
|
System.out.println("============= 開始打包 =============");
|
|
|
return new File(path.replace(exportConclusionList, "") + zipFileName + ".zip");
|
|
|
} else {
|
|
|
return null;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
public static void main(String[] args) {
|
|
|
String str = "file:/data/wlyy2.0/svr-door-service/svr-door-service.jar!/BOOT-INF/classes!/1609894996524exportList/";
|
|
|
String c2=str.substring(0,str.indexOf("!"));// !前面的
|
|
|
String c1=str.substring(str.lastIndexOf("!")+1);// !後面的
|
|
|
String cc = c2 + c1 ;
|
|
|
System.out.println(cc.replace("svr-door-service.jar/",""));
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 打包文件夹
|
|
|
*
|