|
|
|
@ -1,21 +1,32 @@
|
|
|
|
|
package com.docus.server.service.impl;
|
|
|
|
|
|
|
|
|
|
import cn.hutool.json.JSONUtil;
|
|
|
|
|
import com.docus.infrastructure.redis.service.IdService;
|
|
|
|
|
import com.docus.infrastructure.web.request.SearchDTO;
|
|
|
|
|
import com.docus.infrastructure.web.response.PageResult;
|
|
|
|
|
import com.docus.server.convert.OcrFileInfoConvert;
|
|
|
|
|
import com.docus.server.dto.segmentation.FileDTO;
|
|
|
|
|
import com.docus.server.dto.segmentation.UploadBatchFileRequest;
|
|
|
|
|
import com.docus.server.dto.segmentation.UploadPlatformDto;
|
|
|
|
|
import com.docus.server.dto.segmentation.ocrfileinfo.AddOcrFileInfoDTO;
|
|
|
|
|
import com.docus.server.dto.segmentation.ocrfileinfo.DeleteOcrFileInfoDTO;
|
|
|
|
|
import com.docus.server.dto.segmentation.ocrfileinfo.EditOcrFileInfoDTO;
|
|
|
|
|
import com.docus.server.entity.segmentation.OcrBasic;
|
|
|
|
|
import com.docus.server.entity.segmentation.OcrFileInfo;
|
|
|
|
|
import com.docus.server.infrastructure.dao.IOcrBasicDao;
|
|
|
|
|
import com.docus.server.infrastructure.dao.IOcrFileInfoDao;
|
|
|
|
|
import com.docus.server.service.IOcrFileInfoService;
|
|
|
|
|
import com.docus.server.vo.segmentation.ocrfileinfo.OcrFileInfoVO;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
import java.io.File;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* ocr文件信息 服务实现类
|
|
|
|
@ -29,7 +40,12 @@ public class OcrFileInfoServiceImpl implements IOcrFileInfoService {
|
|
|
|
|
private IOcrFileInfoDao iOcrFileInfoDao;
|
|
|
|
|
@Resource
|
|
|
|
|
private IdService idService;
|
|
|
|
|
|
|
|
|
|
@Value("${ocr.defaultSuffix}")
|
|
|
|
|
private String defaultSuffix;
|
|
|
|
|
@Resource
|
|
|
|
|
private IOcrBasicDao iOcrBasicDao;
|
|
|
|
|
@Resource
|
|
|
|
|
private PlatformServiceImpl platformService;
|
|
|
|
|
/**
|
|
|
|
|
* 按主键查询
|
|
|
|
|
*
|
|
|
|
@ -89,6 +105,53 @@ public class OcrFileInfoServiceImpl implements IOcrFileInfoService {
|
|
|
|
|
iOcrFileInfoDao.saveBatch(ocrFileInfos, 500);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void uploadPlatform(UploadPlatformDto uploadPlatformDto) {
|
|
|
|
|
|
|
|
|
|
Map<String, List<OcrFileInfo>> collect = iOcrFileInfoDao.getUploadInfo(uploadPlatformDto).stream().collect(Collectors.groupingBy(OcrFileInfo::getPatientId));
|
|
|
|
|
|
|
|
|
|
collect.forEach((k,v)->{
|
|
|
|
|
|
|
|
|
|
String patientId = k;
|
|
|
|
|
List<OcrFileInfo> uploadInfo = v;
|
|
|
|
|
List<OcrBasic> ocrBasicList = iOcrBasicDao.findBy("patientId", patientId);
|
|
|
|
|
|
|
|
|
|
for (OcrFileInfo item:uploadInfo) {
|
|
|
|
|
List<FileDTO> fileDTOList = new ArrayList<>(uploadInfo.size());
|
|
|
|
|
List<File> files = new ArrayList<>(uploadInfo.size());
|
|
|
|
|
File file = new File(item.getPicUrl());
|
|
|
|
|
files.add(file);
|
|
|
|
|
|
|
|
|
|
FileDTO fileDTO = new FileDTO();
|
|
|
|
|
fileDTO.setAssortId(item.getAssortId());
|
|
|
|
|
fileDTO.setSort(item.getSort());
|
|
|
|
|
fileDTO.setFileType(2);
|
|
|
|
|
fileDTO.setFileTitle(item.getAssortName()+this.defaultSuffix);
|
|
|
|
|
fileDTO.setUploadFileName(item.getPicName());
|
|
|
|
|
fileDTO.setSerialNumber(item.getSerialNumber());
|
|
|
|
|
|
|
|
|
|
fileDTOList.add(fileDTO);
|
|
|
|
|
|
|
|
|
|
//数据上传到3.0
|
|
|
|
|
OcrBasic ocrBasic = ocrBasicList.get(0);
|
|
|
|
|
|
|
|
|
|
UploadBatchFileRequest request = new UploadBatchFileRequest();
|
|
|
|
|
request.setCollectorId("-1");
|
|
|
|
|
request.setInpatientNo(ocrBasic.getInpatientNo());
|
|
|
|
|
request.setTestData(0);
|
|
|
|
|
request.setPatientId(patientId);
|
|
|
|
|
request.setName(ocrBasic.getName());
|
|
|
|
|
request.setFileInfo(JSONUtil.toJsonStr(fileDTOList));
|
|
|
|
|
|
|
|
|
|
platformService.uploadPlatform(files, request);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 新增
|
|
|
|
|
*
|
|
|
|
@ -148,8 +211,8 @@ public class OcrFileInfoServiceImpl implements IOcrFileInfoService {
|
|
|
|
|
* @return 成功或失败
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public int delete(DeleteOcrFileInfoDTO deleteOcrFileInfoDTO) {
|
|
|
|
|
return iOcrFileInfoDao.delete(deleteOcrFileInfoDTO.getIds());
|
|
|
|
|
public int delete(String pid) {
|
|
|
|
|
return iOcrFileInfoDao.delete(pid);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|