|
|
|
@ -2,12 +2,17 @@ package com.docus.server.service.handler;
|
|
|
|
|
|
|
|
|
|
import cn.hutool.json.JSONUtil;
|
|
|
|
|
import com.docus.core.util.Func;
|
|
|
|
|
import com.docus.infrastructure.core.db.dao.IBaseDao;
|
|
|
|
|
import com.docus.log.annotation.TrackRetryListener;
|
|
|
|
|
import com.docus.server.api.ocr.OcrApi;
|
|
|
|
|
import com.docus.server.common.service.IFileUploadService;
|
|
|
|
|
import com.docus.server.dto.segmentation.FileDTO;
|
|
|
|
|
import com.docus.server.dto.segmentation.UploadBatchFileRequest;
|
|
|
|
|
import com.docus.server.entity.segmentation.*;
|
|
|
|
|
import com.docus.server.entity.segmentation.OcrBasic;
|
|
|
|
|
import com.docus.server.entity.segmentation.OcrFileInfo;
|
|
|
|
|
import com.docus.server.entity.segmentation.OcrRuleResult;
|
|
|
|
|
import com.docus.server.entity.segmentation.OcrSpecialResult;
|
|
|
|
|
import com.docus.server.entity.segmentation.OcrVersion;
|
|
|
|
|
import com.docus.server.enums.OcrStatusEnum;
|
|
|
|
|
import com.docus.server.infrastructure.dao.IOcrBasicDao;
|
|
|
|
|
import com.docus.server.infrastructure.dao.IOcrFileInfoDao;
|
|
|
|
@ -71,8 +76,8 @@ public class StartSegmentHandler {
|
|
|
|
|
List<OcrBasic> ocrBasicList = iOcrBasicDao.findBy("patientId", patientId);
|
|
|
|
|
String url = iOcrUrlConfigDao.findBy("version", version).get(0).getUrl();
|
|
|
|
|
List<OcrFileInfo> fileInfoList = iOcrFileInfoDao.findBy("patientId", patientId)
|
|
|
|
|
.stream().sorted(Comparator.comparing(OcrFileInfo::getPicName))
|
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
.stream().sorted(Comparator.comparing(OcrFileInfo::getPicName))
|
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
OcrCutConfigVO ocrCutConfigVO = iOcrCutConfigService.findByVersion(ocrVersion.getVersion());
|
|
|
|
|
Double height = ocrCutConfigVO.getHeight();
|
|
|
|
|
Double widthStart = ocrCutConfigVO.getWidthStart();
|
|
|
|
@ -84,8 +89,8 @@ public class StartSegmentHandler {
|
|
|
|
|
String assortId = null;
|
|
|
|
|
String assortName = null;
|
|
|
|
|
for (OcrFileInfo fileInfo : fileInfoList) {
|
|
|
|
|
iFileUploadService.compressFile(fileInfo.getPicCompressUrl(),fileInfo.getPicUrl(),height);
|
|
|
|
|
iFileUploadService.cutPic(fileInfo.getPicCutUrl(),fileInfo.getPicCompressUrl(),widthStart,widthEnd);
|
|
|
|
|
iFileUploadService.compressFile(fileInfo.getPicCompressUrl(), fileInfo.getPicUrl(), height);
|
|
|
|
|
iFileUploadService.cutPic(fileInfo.getPicCutUrl(), fileInfo.getPicCompressUrl(), widthStart, widthEnd);
|
|
|
|
|
|
|
|
|
|
boolean assortFlag = false;
|
|
|
|
|
Long ruleId = null;
|
|
|
|
@ -136,9 +141,9 @@ public class StartSegmentHandler {
|
|
|
|
|
hitKey = ocrRuleResult.getHitKey();
|
|
|
|
|
rate = ocrRuleResult.getRate();
|
|
|
|
|
} else {
|
|
|
|
|
if (assortName==null){
|
|
|
|
|
if (assortName == null) {
|
|
|
|
|
assortId = "-1";
|
|
|
|
|
assortName="其他(无关键字)";
|
|
|
|
|
assortName = "其他(无关键字)";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -171,8 +176,8 @@ public class StartSegmentHandler {
|
|
|
|
|
p.setOcrStatue(OcrStatusEnum.COMPLETE);
|
|
|
|
|
}).collect(Collectors.toList());
|
|
|
|
|
|
|
|
|
|
iOcrBasicDao.updateBatchById(collect, iOcrBasicDao.DEFAULT_BATCH_SIZE);
|
|
|
|
|
iOcrFileInfoDao.updateBatchById(fileInfoList, iOcrFileInfoDao.DEFAULT_BATCH_SIZE);
|
|
|
|
|
iOcrBasicDao.updateBatchById(collect, IBaseDao.DEFAULT_BATCH_SIZE);
|
|
|
|
|
iOcrFileInfoDao.updateBatchById(fileInfoList, IBaseDao.DEFAULT_BATCH_SIZE);
|
|
|
|
|
|
|
|
|
|
//数据上传到3.0
|
|
|
|
|
OcrBasic ocrBasic = ocrBasicList.get(0);
|
|
|
|
|