| | |
| | | //当前登录的人工号 |
| | | String userId = SecurityUtils.getLoginUser().getUsername(); |
| | | //二进制转pdf 存储在临时文件夹中 |
| | | PDFBinaryUtil.base64StringToPDF(template, FileUtil.mkdir(value).getPath() + "\\" + userId + "体检报告封面模板.pdf"); |
| | | PDFBinaryUtil.base64StringToPDF(template, FileUtil.mkdir(value).getPath() + File.separator + userId + "体检报告封面模板.pdf"); |
| | | |
| | | // 模板文件路径 |
| | | String inputFileName = value + "\\" + userId + "体检报告封面模板.pdf"; |
| | | String inputFileName = value + File.separator + userId + "体检报告封面模板.pdf"; |
| | | // 生成的文件路径 |
| | | String outputFileName = value + "\\" + userId + "体检报告封面页.pdf"; |
| | | String outputFileName = value + File.separator + userId + "体检报告封面页.pdf"; |
| | | OutputStream os = null; |
| | | PdfStamper ps = null; |
| | | PdfReader reader = null; |
| | |
| | | //设置文档的页边距就是距离页面边上的距离,分别为:左边距,右边距,上边距,下边距 |
| | | document.setMargins(70, 70, 40, 40); |
| | | //这个是生成pdf的位置以及名称 |
| | | String fileName = value + "\\" + userId + "体检报告项目详情页.pdf"; |
| | | String fileName = value + File.separator + userId + "体检报告项目详情页.pdf"; |
| | | OutputStream outputStream = Files.newOutputStream(Paths.get(fileName)); |
| | | PdfWriter pdfWriter = PdfWriter.getInstance(document, outputStream); |
| | | |
| | |
| | | outputStream.close(); |
| | | |
| | | //=============================== 第三部分 合并体检报告封面页和体检报告项目详情页 |
| | | String[] files1 = {value + "\\" + userId + "体检报告封面页.pdf", value + "\\" + userId + "体检报告项目详情页.pdf"}; |
| | | String outputPath1 = value + "\\"; |
| | | String[] files1 = {value + File.separator + userId + "体检报告封面页.pdf", value + File.separator + userId + "体检报告项目详情页.pdf"}; |
| | | String outputPath1 = value + File.separator; |
| | | String outputFileName1 = tjNumber + "体检报告.pdf"; |
| | | |
| | | File file1 = new File(outputPath1 + outputFileName1); |
| | |
| | | |
| | | //将临时文件夹中的四个文件删除 |
| | | //FileUtil.del(value+"\\"+tjNumber + "体检报告.pdf"); |
| | | FileUtil.del(value + "\\" + userId + "体检报告封面模板.pdf"); |
| | | FileUtil.del(value + "\\" + userId + "体检报告项目详情页.pdf"); |
| | | FileUtil.del(value + "\\" + userId + "体检报告封面页.pdf"); |
| | | FileUtil.del(value + File.separator + userId + "体检报告封面模板.pdf"); |
| | | FileUtil.del(value + File.separator + userId + "体检报告项目详情页.pdf"); |
| | | FileUtil.del(value + File.separator + userId + "体检报告封面页.pdf"); |
| | | |
| | | //修改order表中的打印报告时间为当前时间 |
| | | LambdaUpdateWrapper<TjOrder> updateWrapper = new LambdaUpdateWrapper<>(); |