|
|
@ -19,6 +19,7 @@ import org.springframework.stereotype.Component;
|
|
|
|
import java.io.File;
|
|
|
|
import java.io.File;
|
|
|
|
import java.text.ParsePosition;
|
|
|
|
import java.text.ParsePosition;
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
|
|
|
|
|
import java.time.Duration;
|
|
|
|
import java.time.LocalDateTime;
|
|
|
|
import java.time.LocalDateTime;
|
|
|
|
import java.util.Date;
|
|
|
|
import java.util.Date;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.List;
|
|
|
@ -53,6 +54,8 @@ public class AnalysisService {
|
|
|
|
private ArchiveMasterService archiveMasterService;
|
|
|
|
private ArchiveMasterService archiveMasterService;
|
|
|
|
|
|
|
|
|
|
|
|
public void handleScanningFile(List<ScanningFile> scanningFileList) {
|
|
|
|
public void handleScanningFile(List<ScanningFile> scanningFileList) {
|
|
|
|
|
|
|
|
LocalDateTime beginTime = LocalDateTime.now();
|
|
|
|
|
|
|
|
logger.error("开始时间:"+beginTime);
|
|
|
|
//处理ScanningFile\
|
|
|
|
//处理ScanningFile\
|
|
|
|
for (ScanningFile scanningFile: scanningFileList) {
|
|
|
|
for (ScanningFile scanningFile: scanningFileList) {
|
|
|
|
String remark = null;
|
|
|
|
String remark = null;
|
|
|
@ -72,25 +75,56 @@ public class AnalysisService {
|
|
|
|
scanningFile.setRemark(remark);
|
|
|
|
scanningFile.setRemark(remark);
|
|
|
|
scanningFile.setStatus(status);
|
|
|
|
scanningFile.setStatus(status);
|
|
|
|
scanningFileRepository.save(scanningFile);
|
|
|
|
scanningFileRepository.save(scanningFile);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
LocalDateTime handleTime = LocalDateTime.now();
|
|
|
|
|
|
|
|
logger.error("每一条处理时间:"+handleTime);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
LocalDateTime endTime = LocalDateTime.now();
|
|
|
|
|
|
|
|
logger.error("结束时间:"+endTime);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public String handlePdfFile(ScanningFile scanningFile) throws Exception{
|
|
|
|
public String handlePdfFile(ScanningFile scanningFile) throws Exception{
|
|
|
|
//处理ScanningFile
|
|
|
|
//处理ScanningFile
|
|
|
|
// 判断病案首页数据是否存在
|
|
|
|
// 判断病案首页数据是否存在
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
LocalDateTime now1 = LocalDateTime.now();//删掉
|
|
|
|
CommonTable commonTable = commonTableRepository.findByInpNoAndVisitId(scanningFile.getInpNo(), scanningFile.getVisitId());
|
|
|
|
CommonTable commonTable = commonTableRepository.findByInpNoAndVisitId(scanningFile.getInpNo(), scanningFile.getVisitId());
|
|
|
|
|
|
|
|
LocalDateTime end1 = LocalDateTime.now();//删掉
|
|
|
|
|
|
|
|
logger.error("判断病案首页数据是否存在耗时:"+Duration.between(now1,end1).toMillis());//删掉
|
|
|
|
|
|
|
|
|
|
|
|
if(commonTable == null){
|
|
|
|
if(commonTable == null){
|
|
|
|
String masterId = scanningFile.getApplyId() != null ? scanningFile.getApplyId() : UUID.randomUUID().toString();
|
|
|
|
String masterId = scanningFile.getApplyId() != null ? scanningFile.getApplyId() : UUID.randomUUID().toString();
|
|
|
|
commonTable = new CommonTable(masterId,scanningFile.getPatientId(),scanningFile.getAge(),scanningFile.getSex(),scanningFile.getVisitId(),scanningFile.getName(),
|
|
|
|
commonTable = new CommonTable(masterId,scanningFile.getPatientId(),scanningFile.getAge(),scanningFile.getSex(),scanningFile.getVisitId(),scanningFile.getName(),
|
|
|
|
scanningFile.getAdmissDate(),scanningFile.getDisDate(),scanningFile.getDisDept(),scanningFile.getAttending(),scanningFile.getInpNo(),"扫描系统");
|
|
|
|
scanningFile.getAdmissDate(),scanningFile.getDisDate(),scanningFile.getDisDept(),scanningFile.getAttending(),scanningFile.getInpNo(),"扫描系统");
|
|
|
|
// //保存公共表
|
|
|
|
// //保存公共表
|
|
|
|
|
|
|
|
LocalDateTime now2 = LocalDateTime.now();//删掉
|
|
|
|
commonTableRepository.save(commonTable);
|
|
|
|
commonTableRepository.save(commonTable);
|
|
|
|
|
|
|
|
LocalDateTime end2 = LocalDateTime.now();//删掉
|
|
|
|
|
|
|
|
logger.error("保存公共表耗时:"+Duration.between(now2,end2).toMillis());//删掉
|
|
|
|
//保存公共表1
|
|
|
|
//保存公共表1
|
|
|
|
|
|
|
|
LocalDateTime now3 = LocalDateTime.now();//删掉
|
|
|
|
commonTable1Repository.save( new CommonTable1(commonTable.getMasterId(),scanningFile.getBirthday(),scanningFile.getIdCard(),scanningFile.getAdmissDept(),scanningFile.getAdmissDoctor()));
|
|
|
|
commonTable1Repository.save( new CommonTable1(commonTable.getMasterId(),scanningFile.getBirthday(),scanningFile.getIdCard(),scanningFile.getAdmissDept(),scanningFile.getAdmissDoctor()));
|
|
|
|
|
|
|
|
LocalDateTime end3 = LocalDateTime.now();//删掉
|
|
|
|
|
|
|
|
logger.error("保存公共表1耗时:"+Duration.between(now3,end3).toMillis());//删掉
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Object[] objects = WebServiceUtils.connect(scanningFile.getPath() + "\\" + scanningFile.getFileName());
|
|
|
|
LocalDateTime now4 = LocalDateTime.now();//删掉
|
|
|
|
|
|
|
|
//Object[] objects = WebServiceUtils.connect(scanningFile.getPath() + "\\" + scanningFile.getFileName());
|
|
|
|
|
|
|
|
//Object[] objects = WebServiceUtil.urlConnectionUtil("http://10.6.0.224/cdms/cdmsservice.asmx?wsdl",scanningFile.getPath() + "\\" + scanningFile.getFileName());
|
|
|
|
|
|
|
|
//使用HttpURLConnection方式连接
|
|
|
|
|
|
|
|
String s = WebServiceUtil.urlConnectionUtil("http://10.6.0.224/cdms/cdmsservice.asmx?wsdl", scanningFile.getPath() + "\\" + scanningFile.getFileName());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
LocalDateTime end4 = LocalDateTime.now();//删掉
|
|
|
|
|
|
|
|
logger.error("WebServiceUtils.connect耗时:"+Duration.between(now4,end4).toMillis());//删掉
|
|
|
|
|
|
|
|
//s转Object[]
|
|
|
|
|
|
|
|
String[] strArr = s.split(",");//注意分隔符是需要转译
|
|
|
|
|
|
|
|
Object[] objects = new Object[strArr.length];
|
|
|
|
|
|
|
|
for(int i=0;i<strArr.length;i++) {
|
|
|
|
|
|
|
|
objects[i] = strArr[i];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (objects == null) {
|
|
|
|
if (objects == null) {
|
|
|
|
return "下载图片出错了。。。";
|
|
|
|
return "下载图片出错了。。。";
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -107,14 +141,28 @@ public class AnalysisService {
|
|
|
|
// byte[] bytes = (byte[]) objects[0];
|
|
|
|
// byte[] bytes = (byte[]) objects[0];
|
|
|
|
String applyId = commonTable.getMasterId() + "~" + (number != null ? number : "");
|
|
|
|
String applyId = commonTable.getMasterId() + "~" + (number != null ? number : "");
|
|
|
|
// 给临时图片填充内容
|
|
|
|
// 给临时图片填充内容
|
|
|
|
|
|
|
|
LocalDateTime now5 = LocalDateTime.now();//删掉
|
|
|
|
File imageTempFile = FileUtils.createFile("images", scanningFile.getInpNo(), scanningFile.getVisitId(), applyId);
|
|
|
|
File imageTempFile = FileUtils.createFile("images", scanningFile.getInpNo(), scanningFile.getVisitId(), applyId);
|
|
|
|
|
|
|
|
LocalDateTime end5 = LocalDateTime.now();//删掉
|
|
|
|
|
|
|
|
logger.error("FileUtils.createFile生成images耗时:"+Duration.between(now5,end5).toMillis());//删掉
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
LocalDateTime now6 = LocalDateTime.now();//删掉
|
|
|
|
File imageFile = FileUtils.getImageFileByByteArray(objects, imageTempFile);
|
|
|
|
File imageFile = FileUtils.getImageFileByByteArray(objects, imageTempFile);
|
|
|
|
|
|
|
|
LocalDateTime end6 = LocalDateTime.now();//删掉
|
|
|
|
|
|
|
|
logger.error("FileUtils.getImageFileByByteArray耗时:"+Duration.between(now6,end6).toMillis());//删掉
|
|
|
|
if (imageFile == null) {
|
|
|
|
if (imageFile == null) {
|
|
|
|
return "填充临时图片出错了。。。";
|
|
|
|
return "填充临时图片出错了。。。";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
LocalDateTime now7 = LocalDateTime.now();//删掉
|
|
|
|
File pdfFile = FileUtils.createFile("pdfs", scanningFile.getInpNo(), scanningFile.getVisitId(), applyId);
|
|
|
|
File pdfFile = FileUtils.createFile("pdfs", scanningFile.getInpNo(), scanningFile.getVisitId(), applyId);
|
|
|
|
|
|
|
|
LocalDateTime end7 = LocalDateTime.now();//删掉
|
|
|
|
|
|
|
|
logger.error("FileUtils.createFile生成pdfs耗时:"+Duration.between(now7,end7).toMillis());//删掉
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
LocalDateTime now8 = LocalDateTime.now();//删掉
|
|
|
|
String pdfPath = PdfUtils.imagesToPdf(imageFile, pdfFile);
|
|
|
|
String pdfPath = PdfUtils.imagesToPdf(imageFile, pdfFile);
|
|
|
|
|
|
|
|
LocalDateTime end8 = LocalDateTime.now();//删掉
|
|
|
|
|
|
|
|
logger.error("图片转pdf耗时:"+Duration.between(now8,end8).toMillis());//删掉
|
|
|
|
//存入pdf地址
|
|
|
|
//存入pdf地址
|
|
|
|
if (pdfPath == null) {
|
|
|
|
if (pdfPath == null) {
|
|
|
|
return "image转成pdf出错了。。。";
|
|
|
|
return "image转成pdf出错了。。。";
|
|
|
@ -175,7 +223,10 @@ public class AnalysisService {
|
|
|
|
assortId = "18";
|
|
|
|
assortId = "18";
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
LocalDateTime now9 = LocalDateTime.now();//删掉
|
|
|
|
archiveDetailService.save(new ArchiveDetail(commonTable.getMasterId(), new Date(), assortId, "扫描系统", applyId, pdfPath,Integer.valueOf(number)));
|
|
|
|
archiveDetailService.save(new ArchiveDetail(commonTable.getMasterId(), new Date(), assortId, "扫描系统", applyId, pdfPath,Integer.valueOf(number)));
|
|
|
|
|
|
|
|
LocalDateTime end9 = LocalDateTime.now();//删掉
|
|
|
|
|
|
|
|
logger.error("保存耗时:"+Duration.between(now9,end9).toMillis());//删掉
|
|
|
|
return null;
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|