修改一版
This commit is contained in:
@@ -381,30 +381,19 @@ namespace IRaCIS.Core.API.Controllers
|
||||
{
|
||||
await QCCommon.VerifyIsCRCSubmmitAsync(_repository, _userInfo, subjectVisitId);
|
||||
var sv = _repository.Where<SubjectVisit>(t => t.Id == subjectVisitId).Select(t => new { t.TrialId, t.SiteId, t.SubjectId }).FirstOrDefault().IfNullThrowException();
|
||||
|
||||
|
||||
ClinicalData? clinical = await _clinicalDataRepository.Where(x => x.VisitOrReadId == subjectVisitId && x.ClinicalLevel == ClinicalLevel.Subject).FirstOrDefaultAsync();
|
||||
if (clinical == null)
|
||||
{
|
||||
clinical = new ClinicalData()
|
||||
{
|
||||
ClinicalLevel = ClinicalLevel.Subject,
|
||||
SubjectId = sv.SubjectId,
|
||||
DataType = ClinicalDataType.MedicalHistory,
|
||||
TrialId = sv.TrialId,
|
||||
UploadType = ClinicalUploadType.PDF,
|
||||
VisitOrReadId = subjectVisitId,
|
||||
Id= NewId.NextGuid(),
|
||||
};
|
||||
|
||||
await _clinicalDataRepository.AddAsync(clinical);
|
||||
|
||||
}
|
||||
|
||||
await FileUploadAsync(async (fileName) =>
|
||||
{
|
||||
var (serverFilePath, relativePath, fileRealName) = FileStoreHelper.GetClinicalDataPath(_hostEnvironment, fileName, sv.TrialId, sv.SiteId, sv.SubjectId, subjectVisitId);
|
||||
//插入临床pdf 路径
|
||||
await _repository.AddAsync(new PreviousPDF() { ClinicalDataId= clinical.Id, SubjectVisitId = subjectVisitId, Path = relativePath, FileName = fileRealName });
|
||||
await _repository.AddAsync(new PreviousPDF() { SubjectVisitId = subjectVisitId,
|
||||
|
||||
IsVisist=true,
|
||||
DataType= ClinicalDataType.MedicalHistory,
|
||||
UploadType=ClinicalUploadType.PDF,
|
||||
SubjectId= sv.SubjectId,
|
||||
TrialId=sv.TrialId,
|
||||
ClinicalLevel = ClinicalLevel.Subject, Path = relativePath, FileName = fileRealName });
|
||||
return serverFilePath;
|
||||
});
|
||||
await _repository.SaveChangesAsync();
|
||||
@@ -417,25 +406,24 @@ namespace IRaCIS.Core.API.Controllers
|
||||
/// </summary>
|
||||
/// <param name="clinicalDataId"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("ClinicalData/UploadClinicalData/{clinicalDataId:guid}")]
|
||||
[HttpPost("ClinicalData/UploadClinicalData/{trialId:guid}/{subjectId:guid}")]
|
||||
[DisableRequestSizeLimit]
|
||||
public async Task<IResponseOutput> UploadClinicalData(Guid clinicalDataId)
|
||||
public async Task<IResponseOutput> UploadClinicalData(Guid trialId,Guid subjectId)
|
||||
{
|
||||
|
||||
var sv = _repository.Where<ClinicalData>(t => t.Id == clinicalDataId).Select(t => new { t.TrialId, t.SubjectId }).FirstOrDefault().IfNullThrowException();
|
||||
await FileUploadAsync(async (fileName) =>
|
||||
|
||||
var filerelativePath = string.Empty;
|
||||
await FileUploadAsync(async (fileName) =>
|
||||
{
|
||||
var (serverFilePath, relativePath, fileRealName) = FileStoreHelper.GetClinicalDataPath(_hostEnvironment, fileName, sv.TrialId.Value, sv.SubjectId.Value, clinicalDataId);
|
||||
var (serverFilePath, relativePath, fileRealName) = FileStoreHelper.GetClinicalDataPath(_hostEnvironment, fileName, trialId, subjectId);
|
||||
filerelativePath = relativePath;
|
||||
|
||||
//插入临床pdf 路径
|
||||
await _repository.AddAsync(new PreviousPDF() { SubjectVisitId = clinicalDataId, ClinicalDataId= clinicalDataId, Path = relativePath, FileName = fileRealName });
|
||||
|
||||
return serverFilePath;
|
||||
return relativePath;
|
||||
});
|
||||
|
||||
await _repository.SaveChangesAsync();
|
||||
|
||||
return ResponseOutput.Ok();
|
||||
return ResponseOutput.Ok(filerelativePath);
|
||||
}
|
||||
/// <summary>
|
||||
/// 上传非Dicom 文件 支持压缩包 多文件上传
|
||||
|
||||
Reference in New Issue
Block a user