| | |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.io.File; |
| | | import java.text.ParseException; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | |
| | | } catch (ParseException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | String docFileName = Constants.FILE_PATH + "\\" + Constants.FILE_NAME + ".doc"; |
| | | String docFileName = Constants.FILE_PATH + File.separator + Constants.FILE_NAME + ".doc"; |
| | | |
| | | // 3、调用工具类生成文件 |
| | | tableToWordUtil.toWord(tables, docFileName, Constants.FILE_NAME); |
| | |
| | | final String substring = uuid.toString().substring(0, 5); |
| | | |
| | | // String userId = SecurityUtils.getLoginUser().getUsername(); |
| | | PDFBinaryUtil.base64StringToPDF(one.getReport(), FileUtil.mkdir(value).getPath() + "\\" + substring + tjNumber + tjCustomer.getCusName() + "_体检报告.pdf"); |
| | | PDFBinaryUtil.base64StringToPDF(one.getReport(), FileUtil.mkdir(value).getPath() + File.separator + substring + tjNumber + tjCustomer.getCusName() + "_体检报告.pdf"); |
| | | //String filePath = one.getPath(); |
| | | String filePath = value + "\\" + substring + tjNumber + tjCustomer.getCusName() + "_体检报告.pdf"; |
| | | String filePath = value + File.separator + substring + tjNumber + tjCustomer.getCusName() + "_体检报告.pdf"; |
| | | File f = new File(filePath); |
| | | if (filePath.isEmpty()) { |
| | | System.out.println("文件不存在!"); |
| | |
| | | import java.lang.reflect.InvocationTargetException; |
| | | import java.lang.reflect.Method; |
| | | import java.math.BigDecimal; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | import java.util.List; |
| | | |
| | |
| | | elements.setSpacingAfter(10f); |
| | | elements.setAlignment(Element.ALIGN_RIGHT); |
| | | Phrase phrase = new Phrase(); |
| | | Font doctorFonts = PdfUtils.setFont(9); |
| | | Font doctorFonts = PdfUtils.setFont(11); |
| | | for (LtkjGetexamreportinfo getexamreportinfo : list) { |
| | | String xm = getexamreportinfo.getHzxm(); |
| | | String xb = getexamreportinfo.getHzxb().equals("2") ? "女" : "男"; |
| | |
| | | private void savePDFFile(String outputFileName1, TjOrder tjOrder, TjCustomer customer, ByteArrayOutputStream finalOutPut) throws IOException { |
| | | // 文件配置 |
| | | // String outputPath1 = "/Users/chacca/开发相关/代码/"; |
| | | String outputPath1 = value + "\\"; |
| | | String outputPath1 = value + File.separator; |
| | | File file = new File(outputPath1 + outputFileName1); |
| | | BufferedOutputStream outputStream = null; |
| | | outputStream = new BufferedOutputStream(new FileOutputStream(file)); |
| | |
| | | ArrayList<List<String>> lists = (ArrayList<List<String>>) entryValue.get("data"); |
| | | addJianYanTable(document1, titleName, titles, titlesWidth, lists); |
| | | if (!jyys.isEmpty()) { |
| | | Font doctorFonts = PdfUtils.setFont(9); |
| | | Font doctorFonts = PdfUtils.setFont(11); |
| | | String doctors = ""; |
| | | Paragraph elements = new Paragraph(); |
| | | elements.setLeading(5f); |
| | |
| | | LambdaQueryWrapper<LtkjHysqd> ltkjHysqdLambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | | ltkjHysqdLambdaQueryWrapper.eq(LtkjHysqd::getTjh, tjOrder.getCardId()); |
| | | List<LtkjHysqd> list = ltkjHysqdService.list(ltkjHysqdLambdaQueryWrapper); |
| | | // List<LtkjHysqd> list = ltkjHysqdService.list(); |
| | | HashMap<String, Object> data = new HashMap<>(); |
| | | for (LtkjHysqd hysqd : list) { |
| | | LambdaQueryWrapper<LtkjHybgd> ltkjHybgdLambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | |
| | | } |
| | | //异常项目 |
| | | data.put("yichang", str.toString()); |
| | | data.put("zjrq",new SimpleDateFormat("yyyy-MM-dd").format(tjOrder.getCheckTime())); |
| | | // 遍历data 给pdf表单表格赋值 |
| | | for (String key : data.keySet()) { |
| | | acroFields.setField(key, data.get(key).toString()); |
| | |
| | | */ |
| | | @RestController |
| | | @RequestMapping ("/check") |
| | | @Api (tags = "总检医师相关接口") |
| | | @Api (tags = "AAAAAAAAAAAA总检医师相关接口") |
| | | @Slf4j |
| | | public class TjCheckController { |
| | | @Resource |
| | |
| | | } |
| | | return AjaxResult.success("同步成功"); |
| | | } |
| | | else if(null !=sfkqdshitulianjie && sfkqdshitulianjie.equals("Y")){ |
| | | else if(null !=sfkqdshitulianjie && sfkqdshitulianjie.equalsIgnoreCase("Y")){ |
| | | List<LtkjHysqd> hysqdList = testMapper.getCcXZxYyLtkjHysqdByLisVi(order.getTjNumber()); |
| | | if(null != hysqdList && !hysqdList.isEmpty()){ |
| | | for (LtkjHysqd hysqd : hysqdList) { |
| | |
| | | @ApiParam (value = "总检建议") @RequestParam (required = false) String advice, |
| | | @ApiParam (value = "审核状态0待审核1已审核") @RequestParam Integer checkStatus) { |
| | | |
| | | int num = orderRemarkService.getTjYqOrderRemarkByTjNum(tjNumber); |
| | | if (num > 0) return AjaxResult.error("有延期项目暂不能生成报告!!!"); |
| | | String config = configService.selectConfigByKey("sfjcwjhyqxm"); |
| | | if(null != config && config.equalsIgnoreCase("Y")){ |
| | | int num = orderRemarkService.getTjYqOrderRemarkByTjNum(tjNumber); |
| | | if (num > 0) return AjaxResult.error("存在未检或延期项目暂不能生成报告!!!"); |
| | | } |
| | | |
| | | if (null != tjNumber) { |
| | | Long userId = Long.valueOf(SecurityUtils.getLoginUser().getUserId()); |
| | | SysUser sysUser = userService.getById(userId); |
| | |
| | | TjReport tjReport = new TjReport(); |
| | | tjReport.setTjNumber(String.valueOf(tjNumber)); |
| | | tjReport.setPath(urlValue + outputFileName1); |
| | | String outputPath1 = value + "\\"; |
| | | String outputPath1 = value + File.separator; |
| | | String pdfBinary = getPDFBinary(outputPath1 + outputFileName1); |
| | | tjReport.setReport(pdfBinary); |
| | | tjReport.setType("体检报告"); |
| | |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/system/report") |
| | | @Api(tags = "体检报告") |
| | | @Api(tags = "AAAA_体检报告") |
| | | @Transactional |
| | | public class TjReportController extends BaseController { |
| | | @Resource |
| | |
| | | public AjaxResult savePdf() { |
| | | //从文件地址读入PDF文件 仅存储一次 |
| | | String base64String = PDFBinaryUtil.getPDFBinary(configService.selectConfigByKey("default_pdf5Template")); |
| | | reportTemplateService.remove(new LambdaQueryWrapper<TjReportTemplate>().eq(TjReportTemplate::getName,"体检报告模板5")); |
| | | TjReportTemplate tem = new TjReportTemplate(); |
| | | tem.setName("体检报告模板5"); |
| | | tem.setRemark("体检报告模板5"); |
| | | tem.setTemplate(base64String); |
| | | tem.setFlag("1"); |
| | | tem.setOpen("0"); |
| | | tem.setCreateTime(DateUtil.date()); |
| | | final boolean save = reportTemplateService.save(tem); |
| | | if (save) { |
| | | return AjaxResult.success("保存成功"); |
| | |
| | | } else { |
| | | one.setStatus(TjConstants.TJ_CONFIRM); |
| | | } |
| | | one.setReportTime(null); |
| | | //将状态改为未审核 |
| | | // UpdateWrapper updateWrapper=new UpdateWrapper(); |
| | | // updateWrapper.eq("tj_number",tjNumber); |
| | |
| | | return; |
| | | } |
| | | String userId = SecurityUtils.getLoginUser().getUsername(); |
| | | PDFBinaryUtil.base64StringToPDF(one.getTemplate(), FileUtil.mkdir(value).getPath() + "\\" + userId + reportTemId + "_模板预览.pdf"); |
| | | String filePath = value + "\\" + userId + reportTemId + "_模板预览.pdf"; |
| | | PDFBinaryUtil.base64StringToPDF(one.getTemplate(), FileUtil.mkdir(value).getPath() + File.separator + userId + reportTemId + "_模板预览.pdf"); |
| | | String filePath = value + File.separator + userId + reportTemId + "_模板预览.pdf"; |
| | | File f = new File(filePath); |
| | | if (filePath.isEmpty()) { |
| | | System.out.println("文件不存在!"); |
| | |
| | | return; |
| | | } |
| | | String userId = SecurityUtils.getLoginUser().getUsername(); |
| | | PDFBinaryUtil.base64StringToPDF(one.getTemplate(), FileUtil.mkdir(value).getPath() + "\\" + userId + "_职业健康体检个人信息表.pdf"); |
| | | String filePath = value + "\\" + userId + "_职业健康体检个人信息表.pdf"; |
| | | PDFBinaryUtil.base64StringToPDF(one.getTemplate(), FileUtil.mkdir(value).getPath() + File.separator + userId + "_职业健康体检个人信息表.pdf"); |
| | | String filePath = value + File.separator + userId + "_职业健康体检个人信息表.pdf"; |
| | | File f = new File(filePath); |
| | | if (filePath.isEmpty()) { |
| | | System.out.println("文件不存在!"); |
| | |
| | | " a.JCMC jcxmmc,\n" + |
| | | " a.JCMCID jcxmid,\n" + |
| | | " a.JCBW bw,\n" + |
| | | " a.JCJL jgzt,\n" + |
| | | " a.JCSJ jgbx\n" + |
| | | " TRIM(a.JCJL) jgzt,\n" + |
| | | " TRIM(a.JCSJ) jgbx\n" + |
| | | " \n" + |
| | | "FROM\n" + |
| | | " ris.V_TJ_JCBGXX_NEWTJ a WHERE a.HIS_ID=#{tjNum}") |
| | |
| | | " a.JCMC xmmc,\n" + |
| | | " NULL bg_mig,\n" + |
| | | " NULL bg_url,\n" + |
| | | " a.JCSJ bg_nr,\n" + |
| | | " TRIM(a.JCSJ) bg_nr,\n" + |
| | | " a.SHYS shysdm,\n" + |
| | | " a.SHYS shysxm,\n" + |
| | | " a.JCJL yxbx,\n" + |
| | | " TRIM(a.JCJL) yxbx,\n" + |
| | | " a.BGSJ zdsj,\n" + |
| | | " a.SQRJ sqsj,\n" + |
| | | " a.JCBW jcbw\n" + |
| | |
| | | //当前登录的人工号 |
| | | 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<>(); |