中西结合数据同步

master
宇宙皮皮娃 1 year ago
parent db612e8e4e
commit 5ccc921b80

@ -95,7 +95,7 @@ public class ZxjhBusinessServiceImpl implements ZxjhBusinessService {
List<FileDto> fileDtos = getFileDtos(result); List<FileDto> fileDtos = getFileDtos(result);
log.info("同步病案主键:{}jzh:{},文件数量:{}",patientId,jzh,fileDtos.size()); log.info("同步病案主键:{}jzh:{},文件数量:{}",patientId,jzh,fileDtos.size());
if(Func.isEmpty(fileDtos)){ if(Func.isEmpty(fileDtos)){
return; continue;
} }
String downPath=config.getDownPath()+File.separator+patientId; String downPath=config.getDownPath()+File.separator+patientId;
List<TScanAssort> tScanAssorts=new ArrayList<TScanAssort>(); List<TScanAssort> tScanAssorts=new ArrayList<TScanAssort>();
@ -325,18 +325,17 @@ public class ZxjhBusinessServiceImpl implements ZxjhBusinessService {
} }
String path = uri.getPath(); String path = uri.getPath();
FTPClient ftpClient = new FTPClient(); FTPClient ftpClient = new FTPClient();
OutputStream outputStream=null;
try { try {
ftpClient.connect(host, port); ftpClient.connect(host, port);
ftpClient.login(username, password); ftpClient.login(username, password);
ftpClient.enterLocalPassiveMode(); ftpClient.enterLocalPassiveMode();
File localFile = new File(localFilePath); File localFile = new File(localFilePath);
OutputStream outputStream = new FileOutputStream(localFile); outputStream = new FileOutputStream(localFile);
ftpClient.retrieveFile(path, outputStream); ftpClient.retrieveFile(path, outputStream);
outputStream.close();
int numberOfPages=0; int numberOfPages=0;
// 判断文件类型并获取页数 // 判断文件类型并获取页数
if (isPdf(localFilePath)) { if (isPdf(localFilePath)) {
@ -361,6 +360,9 @@ public class ZxjhBusinessServiceImpl implements ZxjhBusinessService {
log.error(ex.getMessage(),ex); log.error(ex.getMessage(),ex);
} }
} }
if ( outputStream!=null){
outputStream.close();
}
} }
} }
@ -379,8 +381,8 @@ public class ZxjhBusinessServiceImpl implements ZxjhBusinessService {
PdfReader reader = new PdfReader(filePath); PdfReader reader = new PdfReader(filePath);
return reader.getNumberOfPages(); return reader.getNumberOfPages();
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); log.info(e.getMessage(),e);
return 0; throw new BaseException("获取文件页码出错");
} }
} }
} }

Loading…
Cancel
Save