From 0abda58f18505b0d42f60fd8ac9eb033e5e4a294 Mon Sep 17 00:00:00 2001 From: hcy <314517173@qq.com> Date: Mon, 20 May 2024 10:33:53 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=AF=BC=E5=87=BApdf?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/batchExport/BatchExportServiceImpl.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/emr/service/batchExport/BatchExportServiceImpl.java b/src/main/java/com/emr/service/batchExport/BatchExportServiceImpl.java index 3101362..400856b 100644 --- a/src/main/java/com/emr/service/batchExport/BatchExportServiceImpl.java +++ b/src/main/java/com/emr/service/batchExport/BatchExportServiceImpl.java @@ -261,7 +261,7 @@ public class BatchExportServiceImpl implements BatchExportService { while ((len = bis.read(buf, 0, buf.length)) != -1) { bos.write(buf, 0, len); } - + bis.close(); // 及时关闭流,避免资源泄露 } else { exportTaskDetailsMapper.upStatc(2, list.getId()); logger.log("病案号为:" + list.getInpNo() + "出院时间为:" + list.getDischargeDateTime() + "的病历保存失败。"); @@ -272,15 +272,18 @@ public class BatchExportServiceImpl implements BatchExportService { e.printStackTrace(); } finally { try { + + if (null != bis) { + bis.close(); + } if (null != bos) { bos.flush(); bos.close(); } - if (null != bis) { - bis.close(); + if (null != out) { + out.flush(); + out.close(); } - out.flush(); - out.close(); if (null != zos) { zos.flush(); zos.close();