diff --git a/IRaCIS.Core.API/Controllers/UploadDownLoadController.cs b/IRaCIS.Core.API/Controllers/UploadDownLoadController.cs
index 41d76019..170aae99 100644
--- a/IRaCIS.Core.API/Controllers/UploadDownLoadController.cs
+++ b/IRaCIS.Core.API/Controllers/UploadDownLoadController.cs
@@ -402,22 +402,40 @@ namespace IRaCIS.Core.API.Controllers
///
///
///
- [HttpPost("ClinicalData/UploadClinicalData/{trialId:guid}/{subjectId:guid}")]
+ [HttpPost("ClinicalData/UploadClinicalData/{id:guid}/{isVisit:bool}")]
[DisableRequestSizeLimit]
- public async Task UploadClinicalData(Guid trialId,Guid subjectId)
+ public async Task UploadClinicalData(Guid id, bool isVisit)
{
-
-
var filerelativePath = string.Empty;
- await FileUploadAsync(async (fileName) =>
+ if (isVisit)
{
- var (serverFilePath, relativePath, fileRealName) = FileStoreHelper.GetClinicalDataPath(_hostEnvironment, fileName, trialId, subjectId);
- filerelativePath = relativePath;
-
- return relativePath;
- });
-
- await _repository.SaveChangesAsync();
+ var sv = _repository.Where(t => t.Id == id).Select(t => new { t.TrialId, t.SiteId, t.SubjectId }).FirstOrDefault().IfNullThrowException();
+ await FileUploadAsync(async (fileName) =>
+ {
+ var (serverFilePath, relativePath, fileRealName) = FileStoreHelper.GetClinicalDataPath(_hostEnvironment, fileName, sv.TrialId, sv.SiteId, sv.SubjectId, id);
+ //插入临床pdf 路径
+ filerelativePath = relativePath;
+ return serverFilePath;
+ });
+ }
+ else
+ {
+ var subjectId = await _repository.Where(x => x.Id == id).Select(x =>
+ x.SubjectId
+ ).FirstOrDefaultAsync();
+ var subject = await _repository.Where(x => x.Id == subjectId).Select(x => new
+ {
+ x.TrialId,
+ x.SiteId,
+ }).FirstOrDefaultAsync();
+ await FileUploadAsync(async (fileName) =>
+ {
+ var (serverFilePath, relativePath, fileRealName) = FileStoreHelper.GetClinicalDataPath(_hostEnvironment, fileName, subject.TrialId, subject.SiteId, subjectId.Value, id);
+ //插入临床pdf 路径
+ filerelativePath = relativePath;
+ return serverFilePath;
+ });
+ }
return ResponseOutput.Ok(filerelativePath);
}
diff --git a/IRaCIS.Core.API/IRaCIS.Core.API.xml b/IRaCIS.Core.API/IRaCIS.Core.API.xml
index 6bdc70cc..d0ea724e 100644
--- a/IRaCIS.Core.API/IRaCIS.Core.API.xml
+++ b/IRaCIS.Core.API/IRaCIS.Core.API.xml
@@ -171,7 +171,7 @@
-
+
上传临床数据