| | |
| | | import java.net.URL; |
| | | import java.nio.charset.StandardCharsets; |
| | | import java.nio.file.Files; |
| | | import java.nio.file.Path; |
| | | import java.nio.file.Paths; |
| | | import java.util.*; |
| | | |
| | |
| | | String content =""; |
| | | Template t = null; |
| | | try { |
| | | content = Files.readString(Paths.get(filePath+"遗体器官获取伦理审查表首页.xml"), StandardCharsets.UTF_8); |
| | | // content = Files.readString(Paths.get(filePath+"遗体器官获取伦理审查表首页.xml"), StandardCharsets.UTF_8); |
| | | Path path = Paths.get(filePath + "遗体器官获取伦理审查表首页.xml"); |
| | | byte[] bytes = Files.readAllBytes(path); |
| | | content = new String(bytes, StandardCharsets.UTF_8); |
| | | String name=list.get(0).getName()+"(住院号:"+list.get(0).getInpatientno()+")"; |
| | | content=content.replace("$name",name);//项目名称 |
| | | |
| | |
| | | if (!folderPath.exists()) { |
| | | folderPath.mkdirs(); |
| | | } |
| | | |
| | | /* |
| | | try { |
| | | Files.writeString(Paths.get(filePathData+ "/" + name + ".doc"),content); |
| | | } catch (Exception e1) { |
| | | e1.printStackTrace(); |
| | | } |
| | | */ |
| | | try { |
| | | Path path = Paths.get(filePathData + "/" + name + ".doc"); |
| | | Files.write(path, content.getBytes(StandardCharsets.UTF_8)); |
| | | } catch (Exception e1) { |
| | | e1.printStackTrace(); |
| | | } |
| | | |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("downloadUrl", "/download/wordtemplate/" + name + ".doc"); |