修改一版
parent
d3d79637bf
commit
60efc75f44
|
@ -11,6 +11,7 @@ using IRaCIS.Core.Application.Filter;
|
||||||
using IRaCIS.Core.Application.Helper;
|
using IRaCIS.Core.Application.Helper;
|
||||||
using IRaCIS.Core.Application.MediatR.CommandAndQueries;
|
using IRaCIS.Core.Application.MediatR.CommandAndQueries;
|
||||||
using IRaCIS.Core.Application.Service;
|
using IRaCIS.Core.Application.Service;
|
||||||
|
using IRaCIS.Core.Application.Service.Reading.Dto;
|
||||||
using IRaCIS.Core.Domain.Models;
|
using IRaCIS.Core.Domain.Models;
|
||||||
using IRaCIS.Core.Domain.Share;
|
using IRaCIS.Core.Domain.Share;
|
||||||
using IRaCIS.Core.Domain.Share.Reading;
|
using IRaCIS.Core.Domain.Share.Reading;
|
||||||
|
@ -95,13 +96,9 @@ namespace IRaCIS.Core.API.Controllers
|
||||||
while (section != null)
|
while (section != null)
|
||||||
{
|
{
|
||||||
var hasContentDispositionHeader = ContentDispositionHeaderValue.TryParse(section.ContentDisposition, out var contentDisposition);
|
var hasContentDispositionHeader = ContentDispositionHeaderValue.TryParse(section.ContentDisposition, out var contentDisposition);
|
||||||
|
|
||||||
if (hasContentDispositionHeader)
|
if (hasContentDispositionHeader)
|
||||||
{
|
{
|
||||||
|
|
||||||
var fileName = contentDisposition.FileName.Value;
|
var fileName = contentDisposition.FileName.Value;
|
||||||
|
|
||||||
|
|
||||||
//处理压缩文件
|
//处理压缩文件
|
||||||
if (fileName.Contains(".Zip", StringComparison.OrdinalIgnoreCase) || fileName.Contains(".rar", StringComparison.OrdinalIgnoreCase))
|
if (fileName.Contains(".Zip", StringComparison.OrdinalIgnoreCase) || fileName.Contains(".rar", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
|
@ -111,9 +108,7 @@ namespace IRaCIS.Core.API.Controllers
|
||||||
{
|
{
|
||||||
if (!entry.IsDirectory)
|
if (!entry.IsDirectory)
|
||||||
{
|
{
|
||||||
|
|
||||||
var serverFilePath = await filePathFunc(entry.Key);
|
var serverFilePath = await filePathFunc(entry.Key);
|
||||||
|
|
||||||
entry.WriteToFile(serverFilePath);
|
entry.WriteToFile(serverFilePath);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -125,11 +120,8 @@ namespace IRaCIS.Core.API.Controllers
|
||||||
var serverFilePath = await filePathFunc(fileName);
|
var serverFilePath = await filePathFunc(fileName);
|
||||||
|
|
||||||
await FileStoreHelper.WriteFileAsync(section.Body, serverFilePath);
|
await FileStoreHelper.WriteFileAsync(section.Body, serverFilePath);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
section = await reader.ReadNextSectionAsync();
|
section = await reader.ReadNextSectionAsync();
|
||||||
}
|
}
|
||||||
|
@ -236,6 +228,7 @@ namespace IRaCIS.Core.API.Controllers
|
||||||
[FromServices] ILogger<UploadDownLoadController> _logger,
|
[FromServices] ILogger<UploadDownLoadController> _logger,
|
||||||
[FromServices] IEasyCachingProvider _provider,
|
[FromServices] IEasyCachingProvider _provider,
|
||||||
[FromServices] IStudyService _studyService,
|
[FromServices] IStudyService _studyService,
|
||||||
|
|
||||||
[FromServices] IDicomArchiveService _dicomArchiveService,
|
[FromServices] IDicomArchiveService _dicomArchiveService,
|
||||||
[FromServices] IRepository _repository
|
[FromServices] IRepository _repository
|
||||||
)
|
)
|
||||||
|
@ -362,6 +355,10 @@ namespace IRaCIS.Core.API.Controllers
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 上传临床数据 多文件
|
/// 上传临床数据 多文件
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -403,22 +400,34 @@ namespace IRaCIS.Core.API.Controllers
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpPost("ClinicalData/UploadClinicalData/{trialId:guid}/{subjectId:guid}/{readingId:guid}")]
|
[HttpPost("ClinicalData/UploadClinicalData/{trialId:guid}/{subjectId:guid}/{readingId:guid}")]
|
||||||
[DisableRequestSizeLimit]
|
[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;
|
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) =>
|
await FileUploadAsync(async (fileName) =>
|
||||||
{
|
{
|
||||||
var (serverFilePath, relativePath, fileRealName) = FileStoreHelper.GetReadClinicalDataPath(_hostEnvironment, fileName, trialId, siteid, subjectId, readingId);
|
var (serverFilePath, relativePath, fileRealName) = FileStoreHelper.GetReadClinicalDataPath(_hostEnvironment, fileName, trialId, siteid, subjectId, readingId);
|
||||||
//插入临床pdf 路径
|
//插入临床pdf 路径
|
||||||
filerelativePath = relativePath;
|
filerelativePath = relativePath;
|
||||||
return serverFilePath;
|
|
||||||
});
|
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>
|
/// <summary>
|
||||||
/// 上传非Dicom 文件 支持压缩包 多文件上传
|
/// 上传非Dicom 文件 支持压缩包 多文件上传
|
||||||
|
|
|
@ -970,9 +970,9 @@
|
||||||
临床数据类型Id
|
临床数据类型Id
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.AddOrUpdateReadingClinicalDataDto.FileList">
|
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.AddOrUpdateReadingClinicalDataDto.DeleteFileIds">
|
||||||
<summary>
|
<summary>
|
||||||
文件列表
|
要删除的对象
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.FileDto.FileName">
|
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.FileDto.FileName">
|
||||||
|
|
|
@ -39,9 +39,13 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
||||||
public bool IsVisit { get; set; }
|
public bool IsVisit { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 文件列表
|
/// 要删除的对象
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public List<FileDto> FileList { get; set; }
|
|
||||||
|
public List<Guid> DeleteFileIds { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
public List<FileDto> AddFileList { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class FileDto
|
public class FileDto
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
//--------------------------------------------------------------------
|
||||||
|
// 此代码由T4模板自动生成 byzhouhang 20210918
|
||||||
|
// 生成时间 2021-12-23 13:20:59
|
||||||
|
// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。
|
||||||
|
//--------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
using IRaCIS.Core.Application.Service.Reading.Dto;
|
||||||
|
using IRaCIS.Core.Domain.Share.Reading;
|
||||||
|
|
||||||
|
namespace IRaCIS.Core.Application.Contracts
|
||||||
|
{
|
||||||
|
public interface IReadingClinicalDataService
|
||||||
|
{
|
||||||
|
Task<IResponseOutput> AddOrUpdateReadingClinicalData(AddOrUpdateReadingClinicalDataDto indto);
|
||||||
|
}
|
||||||
|
}
|
|
@ -12,6 +12,7 @@ using MassTransit;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using IRaCIS.Core.Infra.EFCore.Common;
|
using IRaCIS.Core.Infra.EFCore.Common;
|
||||||
|
using IRaCIS.Core.Application.Contracts;
|
||||||
|
|
||||||
namespace IRaCIS.Application.Services
|
namespace IRaCIS.Application.Services
|
||||||
{
|
{
|
||||||
|
@ -19,7 +20,7 @@ namespace IRaCIS.Application.Services
|
||||||
/// 阅片临床数据配置
|
/// 阅片临床数据配置
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[ApiExplorerSettings(GroupName = "Reading")]
|
[ApiExplorerSettings(GroupName = "Reading")]
|
||||||
public class ReadingClinicalDataService : BaseService
|
public class ReadingClinicalDataService : BaseService, IReadingClinicalDataService
|
||||||
{
|
{
|
||||||
private readonly IRepository<ReadingClinicalData> _readingClinicalDataRepository;
|
private readonly IRepository<ReadingClinicalData> _readingClinicalDataRepository;
|
||||||
private readonly IRepository<ClinicalDataTrialSet> _clinicalDataTrialSetRepository;
|
private readonly IRepository<ClinicalDataTrialSet> _clinicalDataTrialSetRepository;
|
||||||
|
@ -45,12 +46,10 @@ namespace IRaCIS.Application.Services
|
||||||
public async Task<IResponseOutput> AddOrUpdateReadingClinicalData(AddOrUpdateReadingClinicalDataDto indto)
|
public async Task<IResponseOutput> AddOrUpdateReadingClinicalData(AddOrUpdateReadingClinicalDataDto indto)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (indto.Id == null)
|
if (indto.Id == null)
|
||||||
{
|
{
|
||||||
var entity = _mapper.Map<ReadingClinicalData>(indto);
|
var entity = _mapper.Map<ReadingClinicalData>(indto);
|
||||||
entity.ReadingClinicalDataPDFList = indto.FileList.Select(x => new ReadingClinicalDataPDF()
|
entity.ReadingClinicalDataPDFList = indto.AddFileList.Select(x => new ReadingClinicalDataPDF()
|
||||||
{
|
{
|
||||||
|
|
||||||
TrialId = entity.TrialId,
|
TrialId = entity.TrialId,
|
||||||
|
@ -67,10 +66,12 @@ namespace IRaCIS.Application.Services
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var entity = (await _readingClinicalDataRepository.Where(t => t.Id == indto.Id, true).Include(t => t.ReadingClinicalDataPDFList).FirstOrDefaultAsync()).IfNullThrowException();
|
var entity = (await _readingClinicalDataRepository.Where(t => t.Id == indto.Id, true).FirstOrDefaultAsync()).IfNullThrowException();
|
||||||
_mapper.Map(indto, entity);
|
_mapper.Map(indto, entity);
|
||||||
|
|
||||||
entity.ReadingClinicalDataPDFList = indto.FileList.Select(x => new ReadingClinicalDataPDF()
|
await _readingClinicalDataPDFRepository.DeleteFromQueryAsync(x => indto.DeleteFileIds.Contains(x.Id));
|
||||||
|
|
||||||
|
var addFileList = indto.AddFileList.Select(x => new ReadingClinicalDataPDF()
|
||||||
{
|
{
|
||||||
|
|
||||||
TrialId = entity.TrialId,
|
TrialId = entity.TrialId,
|
||||||
|
@ -80,6 +81,7 @@ namespace IRaCIS.Application.Services
|
||||||
IsVisit = indto.IsVisit,
|
IsVisit = indto.IsVisit,
|
||||||
ReadingId = indto.ReadingId
|
ReadingId = indto.ReadingId
|
||||||
}).ToList();
|
}).ToList();
|
||||||
|
await _readingClinicalDataPDFRepository.AddRangeAsync(addFileList);
|
||||||
|
|
||||||
var success = await _readingClinicalDataRepository.SaveChangesAsync();
|
var success = await _readingClinicalDataRepository.SaveChangesAsync();
|
||||||
return ResponseOutput.Ok(entity.Id);
|
return ResponseOutput.Ok(entity.Id);
|
||||||
|
|
Loading…
Reference in New Issue