sinake
5 天以前 353a35956f156b78beca56b08c1877455bb67a74
Merge remote-tracking branch 'origin/master'
已修改2个文件
29 ■■■■■ 文件已修改
ruoyi-admin/pom.xml 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceEthicalreviewopinionsController.java 25 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/pom.xml
@@ -129,8 +129,8 @@
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>11</source>
                    <target>11</target>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>
        </plugins>
ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceEthicalreviewopinionsController.java
@@ -40,6 +40,7 @@
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.*;
@@ -189,24 +190,27 @@
     */
    @ApiOperation("遗体器官获取伦理审查表")
    @GetMapping(value = "/download")
    public Result downloadInfo(String nitiateId) throws IOException {
        if(ObjectUtils.isEmpty(nitiateId)){
    public Result downloadInfo(String initiateId) throws IOException {
        if(ObjectUtils.isEmpty(initiateId)){
            return Result.error("nitiateId伦理审查id不能为空");
        }
        EthicalReviewVO reviewVO =new EthicalReviewVO();
        reviewVO.setNitiateId(nitiateId);
        reviewVO.setNitiateId(initiateId);
        List<EthicalReviewVO> list = serviceEthicalreviewopinionsService.selectVOList(reviewVO);
        if(list.size()==0){
            return Result.error("伦理审查id无相关数据");
        }
        EthicalreviewopinionsStateTotalVO  stateTotalVO=serviceEthicalreviewopinionsService.stateTotalAll(nitiateId);
        EthicalreviewopinionsStateTotalVO  stateTotalVO=serviceEthicalreviewopinionsService.stateTotalAll(initiateId);
        String filePath = getClass().getResource("/template/").getPath();
        if(filePath.substring(0,1).equals("/"))
            filePath=filePath.substring(1);
        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);//项目名称
@@ -311,7 +315,7 @@
            e.printStackTrace();
        }
        String newTime = String.valueOf(Calendar.getInstance().getTimeInMillis());
        String name = "遗体器官获取伦理审查表_"+nitiateId+"_" +  newTime;
        String name = "遗体器官获取伦理审查表_"+initiateId+"_" +  newTime;
        String filePathData =RuoYiConfig.getProfile() + "/download/wordtemplate";
        //创建文件夹
@@ -319,12 +323,19 @@
        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");