zhaowenxuan
昨天 dedacd79c93f8ef95e0cb986f5e7fbd27ddbd907
ltkj-admin/src/main/java/com/ltkj/web/controller/system/TjReportController.java
@@ -439,8 +439,8 @@
            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")) {
@@ -1813,6 +1813,33 @@
        }
    }
//    @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) {