修改一版
This commit is contained in:
@@ -11,6 +11,7 @@ using IRaCIS.Core.Application.Filter;
|
||||
using IRaCIS.Core.Application.Helper;
|
||||
using IRaCIS.Core.Application.MediatR.CommandAndQueries;
|
||||
using IRaCIS.Core.Application.Service;
|
||||
using IRaCIS.Core.Application.Service.Reading.Dto;
|
||||
using IRaCIS.Core.Domain.Models;
|
||||
using IRaCIS.Core.Domain.Share;
|
||||
using IRaCIS.Core.Domain.Share.Reading;
|
||||
@@ -95,13 +96,9 @@ namespace IRaCIS.Core.API.Controllers
|
||||
while (section != null)
|
||||
{
|
||||
var hasContentDispositionHeader = ContentDispositionHeaderValue.TryParse(section.ContentDisposition, out var contentDisposition);
|
||||
|
||||
if (hasContentDispositionHeader)
|
||||
{
|
||||
|
||||
var fileName = contentDisposition.FileName.Value;
|
||||
|
||||
|
||||
//处理压缩文件
|
||||
if (fileName.Contains(".Zip", StringComparison.OrdinalIgnoreCase) || fileName.Contains(".rar", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
@@ -111,9 +108,7 @@ namespace IRaCIS.Core.API.Controllers
|
||||
{
|
||||
if (!entry.IsDirectory)
|
||||
{
|
||||
|
||||
var serverFilePath = await filePathFunc(entry.Key);
|
||||
|
||||
entry.WriteToFile(serverFilePath);
|
||||
|
||||
}
|
||||
@@ -125,11 +120,8 @@ namespace IRaCIS.Core.API.Controllers
|
||||
var serverFilePath = await filePathFunc(fileName);
|
||||
|
||||
await FileStoreHelper.WriteFileAsync(section.Body, serverFilePath);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
section = await reader.ReadNextSectionAsync();
|
||||
}
|
||||
@@ -236,6 +228,7 @@ namespace IRaCIS.Core.API.Controllers
|
||||
[FromServices] ILogger<UploadDownLoadController> _logger,
|
||||
[FromServices] IEasyCachingProvider _provider,
|
||||
[FromServices] IStudyService _studyService,
|
||||
|
||||
[FromServices] IDicomArchiveService _dicomArchiveService,
|
||||
[FromServices] IRepository _repository
|
||||
)
|
||||
@@ -362,6 +355,10 @@ namespace IRaCIS.Core.API.Controllers
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 上传临床数据 多文件
|
||||
/// </summary>
|
||||
@@ -403,22 +400,34 @@ namespace IRaCIS.Core.API.Controllers
|
||||
/// <returns></returns>
|
||||
[HttpPost("ClinicalData/UploadClinicalData/{trialId:guid}/{subjectId:guid}/{readingId:guid}")]
|
||||
[DisableRequestSizeLimit]
|
||||
public async Task<IResponseOutput> UploadReadClinicalData(Guid trialId, Guid subjectId, Guid readingId)
|
||||
public async Task<List<FileDto>> UploadReadClinicalData(Guid trialId,Guid subjectId,Guid readingId)
|
||||
{
|
||||
var filerelativePath = string.Empty;
|
||||
List<FileDto> fileDtos = new List<FileDto>();
|
||||
|
||||
var siteid = await _repository.Where<Subject>(x => x.Id == subjectId).Select(x => x.SiteId).FirstOrDefaultAsync();
|
||||
|
||||
// 写法一致 使用 _repository
|
||||
|
||||
var siteid =await _repository.Where<Subject>(x => x.Id == subjectId).Select(x => x.SiteId).FirstOrDefaultAsync();
|
||||
await FileUploadAsync(async (fileName) =>
|
||||
{
|
||||
var (serverFilePath, relativePath, fileRealName) = FileStoreHelper.GetReadClinicalDataPath(_hostEnvironment, fileName, trialId, siteid, subjectId, readingId);
|
||||
//插入临床pdf 路径
|
||||
filerelativePath = relativePath;
|
||||
return serverFilePath;
|
||||
});
|
||||
{
|
||||
var (serverFilePath, relativePath, fileRealName) = FileStoreHelper.GetReadClinicalDataPath(_hostEnvironment, fileName, trialId, siteid, subjectId, readingId);
|
||||
//插入临床pdf 路径
|
||||
filerelativePath = relativePath;
|
||||
|
||||
fileDtos.Add(new FileDto()
|
||||
{
|
||||
FileName = fileName,
|
||||
Path = serverFilePath
|
||||
|
||||
}); ;
|
||||
return fileName;
|
||||
});
|
||||
|
||||
return ResponseOutput.Ok(filerelativePath);
|
||||
return fileDtos;
|
||||
// indto.AddFileList = fileDtos;
|
||||
|
||||
//await _iReadingClinicalDataService.AddOrUpdateReadingClinicalData(indto);
|
||||
|
||||
//return ResponseOutput.Ok(filerelativePath);
|
||||
}
|
||||
/// <summary>
|
||||
/// 上传非Dicom 文件 支持压缩包 多文件上传
|
||||
|
||||
Reference in New Issue
Block a user