|
|
@ -11,6 +11,8 @@ import io.swagger.annotations.Api;
|
|
|
|
import io.swagger.annotations.ApiImplicitParam;
|
|
|
|
import io.swagger.annotations.ApiImplicitParam;
|
|
|
|
import io.swagger.annotations.ApiImplicitParams;
|
|
|
|
import io.swagger.annotations.ApiImplicitParams;
|
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
|
|
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
|
|
|
|
|
import org.springframework.util.FileCopyUtils;
|
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
|
@ -20,7 +22,11 @@ import org.springframework.web.bind.annotation.RestController;
|
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
|
|
|
import java.io.File;
|
|
|
|
|
|
|
|
import java.io.FileInputStream;
|
|
|
|
|
|
|
|
import java.io.OutputStream;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
@ -53,13 +59,36 @@ public class FileController {
|
|
|
|
@ApiImplicitParams({
|
|
|
|
@ApiImplicitParams({
|
|
|
|
@ApiImplicitParam(name = "files", value = "文件", required = true, dataTypeClass = MultipartFile.class)
|
|
|
|
@ApiImplicitParam(name = "files", value = "文件", required = true, dataTypeClass = MultipartFile.class)
|
|
|
|
})
|
|
|
|
})
|
|
|
|
public void uploadFile(@RequestPart("files") MultipartFile[] files, @Validated UploadBatchFileRequest request) throws Exception {
|
|
|
|
public Object uploadFile(@RequestPart("files") MultipartFile[] files, @Validated UploadBatchFileRequest request) throws Exception {
|
|
|
|
List<UploadFileVO> segmentation = iFileUploadService.uploadFile(files, "segmentation");
|
|
|
|
List<UploadFileVO> segmentation = iFileUploadService.uploadFile(files, "segmentation");
|
|
|
|
|
|
|
|
|
|
|
|
//将基础信息存到库表里面,后面自动分段后,需要上传到归档系统
|
|
|
|
//将基础信息存到库表里面,后面自动分段后,需要上传到归档系统
|
|
|
|
commonService.add(segmentation, request);
|
|
|
|
Object result = commonService.add(segmentation, request);
|
|
|
|
|
|
|
|
|
|
|
|
iPublishEventService.publishEvent(request.getPatientId(), FlowEvent.FlowTypeEnum.START_SEGMENT);
|
|
|
|
iPublishEventService.publishEvent(request.getPatientId(), FlowEvent.FlowTypeEnum.START_SEGMENT);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 获取图片
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
@ApiOperation("获取图片")
|
|
|
|
|
|
|
|
@GetMapping(value = "/getImage")
|
|
|
|
|
|
|
|
public void getImage(String path, HttpServletRequest request, HttpServletResponse response) {
|
|
|
|
|
|
|
|
if (StringUtils.isNotBlank(path)) {
|
|
|
|
|
|
|
|
File image = new File(path);
|
|
|
|
|
|
|
|
if (image.exists()) {
|
|
|
|
|
|
|
|
response.setContentType("image/png");
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
FileInputStream in = new FileInputStream(image);
|
|
|
|
|
|
|
|
OutputStream out = response.getOutputStream();
|
|
|
|
|
|
|
|
FileCopyUtils.copy(in, out);
|
|
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
|
|
System.out.println(e.getMessage());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|