修改一版
parent
80bc602503
commit
a76cc7a6d6
|
@ -396,6 +396,33 @@ namespace IRaCIS.Core.API.Controllers
|
|||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 上传临床数据
|
||||
/// </summary>
|
||||
/// <param name="clinicalDataId"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("ClinicalData/UploadClinicalData/{trialId:guid}/{clinicalDataId:guid}")]
|
||||
[DisableRequestSizeLimit]
|
||||
public async Task<IResponseOutput> UploadClinicalData(Guid clinicalDataId)
|
||||
{
|
||||
|
||||
var sv = _repository.Where<ClinicalData>(t => t.Id == clinicalDataId).Select(t => new { t.TrialId, t.SubjectId }).FirstOrDefault().IfNullThrowException();
|
||||
await FileUploadAsync(async (fileName) =>
|
||||
{
|
||||
var (serverFilePath, relativePath, fileRealName) = FileStoreHelper.GetClinicalDataPath(_hostEnvironment, fileName, sv.TrialId.Value, sv.SubjectId.Value, clinicalDataId);
|
||||
|
||||
//插入临床pdf 路径
|
||||
await _repository.AddAsync(new PreviousPDF() { SubjectVisitId = clinicalDataId, Path = relativePath, FileName = fileRealName });
|
||||
|
||||
return serverFilePath;
|
||||
});
|
||||
|
||||
await _repository.SaveChangesAsync();
|
||||
|
||||
return ResponseOutput.Ok();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 上传非Dicom 文件 支持压缩包 多文件上传
|
||||
|
|
|
@ -230,6 +230,27 @@ public static class FileStoreHelper
|
|||
|
||||
}
|
||||
|
||||
|
||||
public static (string PhysicalPath, string RelativePath, string FileRealName) GetClinicalDataPath(IWebHostEnvironment _hostEnvironment, string fileName, Guid trialId , Guid subjectId, Guid clinicalDataId)
|
||||
{
|
||||
var rootPath = FileStoreHelper.GetIRaCISRootDataFolder(_hostEnvironment);
|
||||
|
||||
string uploadFolderPath = Path.Combine(rootPath, StaticData.Folder.TrialDataFolder, trialId.ToString(), subjectId.ToString(), clinicalDataId.ToString(), StaticData.Folder.TreatmenthistoryFolder);
|
||||
|
||||
if (!Directory.Exists(uploadFolderPath)) Directory.CreateDirectory(uploadFolderPath);
|
||||
|
||||
var (trustedFileNameForFileStorage, fileRealName) = FileStoreHelper.GetStoreFileName(fileName);
|
||||
|
||||
|
||||
var relativePath = $"/{StaticData.Folder.IRaCISDataFolder}/{StaticData.Folder.TrialDataFolder}/{trialId}/{subjectId}/{clinicalDataId}/{StaticData.Folder.TreatmenthistoryFolder}/{trustedFileNameForFileStorage}";
|
||||
|
||||
var serverFilePath = Path.Combine(uploadFolderPath, trustedFileNameForFileStorage);
|
||||
|
||||
return (serverFilePath, relativePath, fileRealName);
|
||||
|
||||
}
|
||||
|
||||
|
||||
//获取非dicom文件存放路径
|
||||
public static (string PhysicalPath, string RelativePath, string FileRealName) GetNoneDicomFilePath(IWebHostEnvironment _hostEnvironment, string fileName, Guid trialId, Guid siteId, Guid subjectId, Guid subjectVisitId)
|
||||
{
|
||||
|
|
|
@ -46,8 +46,13 @@ namespace IRaCIS.Core.Domain.Models
|
|||
/// </summary>
|
||||
[Required]
|
||||
public Guid CreateUserId { get; set; }
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 临床数据ID
|
||||
/// </summary>
|
||||
public Guid? ClinicalDataId { get; set; }
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue