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();