|
|
|
@ -61,32 +61,40 @@ public class BatchExportServiceImpl implements BatchExportService {
|
|
|
|
|
return "没有任务";
|
|
|
|
|
}
|
|
|
|
|
for (ExportTaskDetailsVo list : taskList) {
|
|
|
|
|
//根据住院号出院日期查询需要导出病历路径
|
|
|
|
|
List<String> masterIds = exportTaskDetailsMapper.getMasterId(list.getInpNo(), list.getDischargeDateTime());
|
|
|
|
|
if (CollectionUtils.isEmpty(masterIds)) {
|
|
|
|
|
logger.log("病案号为:" + list.getInpNo() + "出院时间为:" + list.getDischargeDateTime() + "的病历找不到。");
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
for (String masterId : masterIds) {
|
|
|
|
|
List<ExportPdfVo> pdfPathList = exportZdAssortMapper.getPdfPath(masterId);
|
|
|
|
|
if (CollectionUtils.isEmpty(pdfPathList)){
|
|
|
|
|
logger.log("病案号为:" + list.getInpNo() + "出院时间为:" + list.getDischargeDateTime() + "的病历查询不到影像");
|
|
|
|
|
try {
|
|
|
|
|
//根据住院号出院日期查询需要导出病历路径
|
|
|
|
|
List<String> masterIds = exportTaskDetailsMapper.getMasterId(list.getInpNo(), list.getDischargeDateTime());
|
|
|
|
|
if (CollectionUtils.isEmpty(masterIds)) {
|
|
|
|
|
logger.log("病案号为:" + list.getInpNo() + "出院时间为:" + list.getDischargeDateTime() + "的病历找不到。");
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
try {
|
|
|
|
|
//组织导出文件名
|
|
|
|
|
fileName = exportFlieName(list);
|
|
|
|
|
} catch (ParseException e) {
|
|
|
|
|
throw new RuntimeException(e);
|
|
|
|
|
}
|
|
|
|
|
// downPdfResponse(fileName,response);
|
|
|
|
|
Boolean aBoolean = exportPdf(pdfPathList,fileName);
|
|
|
|
|
//为true时修改任务状态1完成2失败
|
|
|
|
|
if (aBoolean){
|
|
|
|
|
exportTaskDetailsMapper.upStatc(1,list.getId());
|
|
|
|
|
}else {
|
|
|
|
|
exportTaskDetailsMapper.upStatc(2,list.getId());
|
|
|
|
|
for (String masterId : masterIds) {
|
|
|
|
|
List<ExportPdfVo> pdfPathList = exportZdAssortMapper.getPdfPath(masterId);
|
|
|
|
|
if (CollectionUtils.isEmpty(pdfPathList)){
|
|
|
|
|
logger.log("病案号为:" + list.getInpNo() + "出院时间为:" + list.getDischargeDateTime() + "的病历查询不到影像");
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
try {
|
|
|
|
|
//组织导出文件名
|
|
|
|
|
fileName = exportFlieName(list);
|
|
|
|
|
} catch (ParseException e) {
|
|
|
|
|
logger.log("保存失败!异常处理" + e.getMessage());
|
|
|
|
|
exportTaskDetailsMapper.upStatc(2,list.getId());
|
|
|
|
|
}
|
|
|
|
|
// downPdfResponse(fileName,response);
|
|
|
|
|
Boolean aBoolean = exportPdf(pdfPathList,fileName);
|
|
|
|
|
//为true时修改任务状态1完成2失败
|
|
|
|
|
if (aBoolean){
|
|
|
|
|
logger.log(list.getId()+"这个id导出失败");
|
|
|
|
|
exportTaskDetailsMapper.upStatc(1,list.getId());
|
|
|
|
|
}else {
|
|
|
|
|
exportTaskDetailsMapper.upStatc(2,list.getId());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
logger.log(list.getId()+"这个id导出失败");
|
|
|
|
|
logger.log("保存失败!异常处理" + e.getMessage());
|
|
|
|
|
exportTaskDetailsMapper.upStatc(2,list.getId());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return "下载完成";
|
|
|
|
@ -157,17 +165,24 @@ public class BatchExportServiceImpl implements BatchExportService {
|
|
|
|
|
}
|
|
|
|
|
pageNum =pageNum+getPageNum(pdfPathList.get(i));
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
//报错删除错误文件
|
|
|
|
|
File file = new File("D://export//"+fileName+".pdf");
|
|
|
|
|
try {
|
|
|
|
|
file.delete(); // 删除照片
|
|
|
|
|
} catch (Exception c) {
|
|
|
|
|
c.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
logger.log(e.getMessage());
|
|
|
|
|
} finally {
|
|
|
|
|
if (document != null) {
|
|
|
|
|
document.close();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
document.close();
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|