| | |
| | | return shengchengbgmoban(tjNumber, tjOrder, tjCustomer, reportTemplate,zongJianYiShiQianMing); |
| | | } catch (Exception e) { |
| | | // TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | log.error("生成报告失败:"+e.getMessage(),String.valueOf(e)); |
| | | log.error("生成报告失败:",e); |
| | | tjOrder.setReportTime(null); |
| | | tjOrder.setCheckTime(null); |
| | | tjOrder.setCheckStatus(0); |
| | |
| | | |
| | | ajaxResult = hisPDFUtil.hisPDFNew2(tjOrder, tjCustomer, reportTemplate,zongJianYiShiQianMing); |
| | | } catch (Exception e) { |
| | | // e.printStackTrace(); |
| | | // log.error(String.valueOf(e)); |
| | | e.printStackTrace(); |
| | | log.error(String.valueOf(e)); |
| | | throw new Exception(e); |
| | | } |
| | | if (!ajaxResult.get("code").toString().equals("200")) { |
| | |
| | | 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 value = configService.selectConfigByKey("path_filePath"); |
| | | String filePath = value + File.separator + tjCustomer.getCusId() + tjNumber + tjCustomer.getCusName() + "_报告.pdf"; |
| | | File f = new File(filePath); |
| | |
| | | while ((len = br.read(bs)) > 0) { |
| | | out.write(bs, 0, len); |
| | | } |
| | | // if(null !=tjOrder.getHeshouTime() && tjOrder.getHeshouStatus()==1){ |
| | | // TjReportPrint print=new TjReportPrint(); |
| | | // print.setTjNumber(tjNumber); |
| | | // print.setPrintBy(SecurityUtils.getLoginUser().getUser().getNickName()); |
| | | // print.setPrintTime(date); |
| | | // print.setPrintStatus("已打印"); |
| | | // if (printService.save(print)) { |
| | | // tjOrder.setPrintLastTime(date); |
| | | // tjOrderService.updateById(tjOrder); |
| | | // } |
| | | // } |
| | | |
| | | out.flush(); |
| | | out.close(); |
| | | br.close(); |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | // @GetMapping("/previewBase64/{flag}/{TjNumber}") |
| | | // @ApiOperation(value = "下载体检报告Base64") |
| | | public String previewBase64( @PathVariable("TjNumber") String tjNumber) { |
| | | try { |
| | | TjOrder tjOrder = tjOrderService.getOrderByTjNum(tjNumber); |
| | | TjCustomer tjCustomer = tjCustomerService.getById( tjOrder.getUserId()); |
| | | String value = configService.selectConfigByKey("path_filePath"); |
| | | String filePath = value + File.separator + tjCustomer.getCusId() + tjNumber + tjCustomer.getCusName() + "_报告.pdf"; |
| | | File f = new File(filePath); |
| | | // System.out.println("Base64: " + base64); |
| | | return fileToBase64(f); |
| | | } catch (IOException e) { |
| | | log.error(e.toString()); |
| | | throw new RuntimeException(e); |
| | | } |
| | | } |
| | | |
| | | public static String fileToBase64(File file) throws IOException { |
| | | try (FileInputStream fileInputStream = new FileInputStream(file)) { |
| | | byte[] fileBytes = new byte[(int) file.length()]; |
| | | fileInputStream.read(fileBytes); |
| | | return Base64.getEncoder().encodeToString(fileBytes); |
| | | } |
| | | } |
| | | |
| | | |
| | | @GetMapping("/previewprint/{flag}/{TjNumber}/{sfdy}") |
| | | @ApiOperation(value = "下载体检报告") |
| | | public void previewprint(HttpServletResponse response, @PathVariable("flag") boolean flag, @PathVariable("TjNumber") String tjNumber,@PathVariable("sfdy") String sfdy) { |