/**
 * Copyright (C), 2015-2019
 * Author:   HJL
 * Date:     2019/12/13 12:30
 * Description:
 */
package com.emr.util;

import com.emr.entity.Archive_Detail;
import org.aspectj.weaver.patterns.TypePatternQuestions;
import org.junit.Test;

import java.io.*;
import java.util.ArrayList;
import java.util.List;

public class ExportTxtPaper {



    /**
     * 产生单选模板
     *
     * @param
     */
    public static void exportTxtPaper(String path,String fileName,List<Archive_Detail> list) {
        File outFile = new File(path);
        //如果文件夹不存在则创建
        if (!outFile.exists() && !outFile.isDirectory()) {
            outFile.mkdirs();
        }
        outFile = new File(path+ fileName);
        Writer out;
        try {
            out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(outFile, true), "utf-8"), 10240);
            for (int i = 0; i < list.size(); i++) {
                out.write("[损坏PDF路径]" + list.get(i).getPdfPath()+ "\r\n" + "\r\n" );
                //out.write("\r\n");
            }
            out.flush();
            out.close();
        } catch (Exception e1) {
            // TODO Auto-generated catch block
            e1.printStackTrace();
        }
    }


    /**
     * 测试产生模板
     */
    @Test
    public void test1() {

        List<Archive_Detail> list = new ArrayList<Archive_Detail>();
        Archive_Detail vo=new Archive_Detail();
        vo.setPdfPath("sssss");
        list.add(vo);
        list.add(vo);
        String path= "C:\\Users\\Administrator\\Desktop\\测试\\aa\\";
        ExportTxtPaper.exportTxtPaper( path,"损坏PDF文件列表.txt",list);
    }
}
 

