| | |
| | | tjReport.setTjNumber(String.valueOf(tjNumber)); |
| | | tjReport.setPath(urlValue + outputFileName1); |
| | | String outputPath1 = value + File.separator; |
| | | String pdfBinary = getPDFBinary(outputPath1 + outputFileName1); |
| | | tjReport.setReport(pdfBinary); |
| | | // String pdfBinary = getPDFBinary(outputPath1 + outputFileName1); |
| | | // tjReport.setReport(pdfBinary); |
| | | tjReport.setType("体检报告"); |
| | | tjReport.setPrint("pdf"); |
| | | tjReportService.save(tjReport); |
| | |
| | | public void preview(HttpServletResponse response, @PathVariable("flag") boolean flag, @PathVariable("TjNumber") String tjNumber) { |
| | | TjOrder tjOrder = tjOrderService.getOrderByTjNum(tjNumber); |
| | | TjCustomer tjCustomer = tjCustomerService.getById( tjOrder.getUserId()); |
| | | LambdaQueryWrapper<TjReport> we = new LambdaQueryWrapper<>(); |
| | | we.eq(TjReport::getTjNumber, tjNumber); |
| | | we.eq(TjReport::getType, "体检报告"); |
| | | TjReport one = tjReportService.getOne(we); |
| | | if (one == null) { |
| | | return; |
| | | } |
| | | String userId = SecurityUtils.getLoginUser().getUsername(); |
| | | PDFBinaryUtil.base64StringToPDF(one.getReport(), FileUtil.mkdir(value).getPath() + File.separator + userId + tjNumber + tjCustomer.getCusName() + "_体检报告.pdf"); |
| | | String filePath = value + File.separator + userId + tjNumber + tjCustomer.getCusName() + "_体检报告.pdf"; |
| | | // LambdaQueryWrapper<TjReport> we = new LambdaQueryWrapper<>(); |
| | | // we.eq(TjReport::getTjNumber, tjNumber); |
| | | // we.eq(TjReport::getType, "体检报告"); |
| | | // TjReport one = tjReportService.getOne(we); |
| | | // if (one == null) { |
| | | // return; |
| | | // } |
| | | // String userId = SecurityUtils.getLoginUser().getUsername(); |
| | | // PDFBinaryUtil.base64StringToPDF(one.getReport(), FileUtil.mkdir(value).getPath() + File.separator + userId + tjNumber + tjCustomer.getCusName() + "_体检报告.pdf"); |
| | | String filePath = value + File.separator + tjCustomer.getCusId() + tjNumber + tjCustomer.getCusName() + "_报告.pdf"; |
| | | File f = new File(filePath); |
| | | if (filePath.isEmpty()) { |
| | | System.out.println("文件不存在!"); |
| | | return; |
| | | } |
| | | BufferedInputStream br = null; |
| | | OutputStream out = null; |
| | | FileInputStream fileInputStream = null; |
| | |
| | | String contentType = u.openConnection().getContentType(); |
| | | response.setContentType(contentType); |
| | | response.setHeader("Content-Disposition", "inline;filename=" |
| | | + userId + tjNumber + ".pdf"); |
| | | + tjCustomer.getCusId() + tjNumber + ".pdf"); |
| | | } else { |
| | | // 纯下载方式 |
| | | response.setContentType("application/x-msdownload"); |
| | | response.setContentType("application/pdf;charset=utf-8"); |
| | | response.setHeader("Content-Disposition", "attachment;filename=" |
| | | + userId + tjNumber + ".pdf"); |
| | | + tjCustomer.getCusId() + tjNumber + ".pdf"); |
| | | } |
| | | out = response.getOutputStream(); |
| | | while ((len = br.read(bs)) > 0) { |
| | |
| | | } else { |
| | | return makeReport(tjNumbers); |
| | | } |
| | | } |
| | | |
| | | |
| | | @GetMapping("/xiugaidayinzhuangtai") |
| | | @ApiOperation(value = "修改打印状态接口") |
| | | @Transactional |
| | | public AjaxResult xiugaidayinzhuangtai(@RequestParam String tjNumber) { |
| | | TjOrder order = tjOrderService.getOrderByTjNum(tjNumber); |
| | | if(null !=order){ |
| | | Date date=new Date(); |
| | | TjReportPrint print=new TjReportPrint(); |
| | | print.setTjNumber(tjNumber); |
| | | print.setPrintBy(SecurityUtils.getLoginUser().getUser().getNickName()); |
| | | print.setPrintTime(date); |
| | | print.setPrintStatus("已打印"); |
| | | if (printService.save(print)) { |
| | | order.setPrintLastTime(date); |
| | | order.setStatus(TjConstants.TJ_END); |
| | | tjOrderService.updateById(order); |
| | | } |
| | | return AjaxResult.success(); |
| | | } |
| | | return AjaxResult.error(); |
| | | } |
| | | |
| | | /** |
| | |
| | | |
| | | @GetMapping("/revocationReport/{TjNumber}") |
| | | @ApiOperation(value = "撤销生成体检报告") |
| | | @Transactional |
| | | public AjaxResult revocationReport(@PathVariable("TjNumber") String tjNumber) { |
| | | //逻辑删除数据库里的报告 |
| | | QueryWrapper<TjReport> wq1 = new QueryWrapper<>(); |
| | | wq1.select("re_id"); |
| | | wq1.eq("tj_number", tjNumber); |
| | | wq1.eq("type", "体检报告"); |
| | | TjReport tjReport = tjReportService.getOne(wq1); |
| | | if (null != tjReport) { |
| | | // 不在使用逻辑删除 逻辑删除导致打印报告生成 查询sql缓慢 |
| | | int i = tjReportService.deleteTjReportByReId(tjReport.getReId()); |
| | | if (i == 0) { |
| | | return AjaxResult.error("暂无体检报告,请撤回到总检未审核页面,需总检医生重新审核并生成报告!"); |
| | | } |
| | | } |
| | | |
| | | TjOrder one = tjOrderService.getOrderByTjNum(tjNumber); |
| | | if(null !=one){ |
| | |
| | | one.setPrintLastTime(null); |
| | | one.setDownloadLastTime(null); |
| | | if (tjOrderService.updateById(one)) { |
| | | |
| | | //逻辑删除数据库里的报告 |
| | | QueryWrapper<TjReport> wq1 = new QueryWrapper<>(); |
| | | wq1.select("re_id"); |
| | | wq1.eq("tj_number", tjNumber); |
| | | wq1.eq("type", "体检报告"); |
| | | TjReport tjReport = tjReportService.getOne(wq1); |
| | | if (null != tjReport) { |
| | | // 不在使用逻辑删除 逻辑删除导致打印报告生成 查询sql缓慢 |
| | | int i = tjReportService.deleteTjReportByReId(tjReport.getReId()); |
| | | if (i == 0) { |
| | | return AjaxResult.error("暂无体检报告,请撤回到总检未审核页面,需总检医生重新审核并生成报告!"); |
| | | } |
| | | } |
| | | |
| | | return AjaxResult.success("撤回成功!"); |
| | | } |
| | | } |