From cbae1e8d5e1d5d1d09b726cbc39d793ba732bd07 Mon Sep 17 00:00:00 2001 From: he <10978375@qq.com> Date: Thu, 9 Mar 2023 15:21:12 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=80=E7=89=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/UploadDownLoadController.cs | 28 +++++++++++++++++ .../Helper/FileStoreHelper.cs | 30 +++++++++++++++++++ 2 files changed, 58 insertions(+) diff --git a/IRaCIS.Core.API/Controllers/UploadDownLoadController.cs b/IRaCIS.Core.API/Controllers/UploadDownLoadController.cs index be513d29c..c7ef073f1 100644 --- a/IRaCIS.Core.API/Controllers/UploadDownLoadController.cs +++ b/IRaCIS.Core.API/Controllers/UploadDownLoadController.cs @@ -542,6 +542,34 @@ namespace IRaCIS.Core.API.Controllers } + + /// + /// 上传截图 + /// + /// + /// + [HttpPost("Printscreen/UploadPrintscreen/{subjectId:guid}")] + [TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })] + public async Task> UploadPrintscreen(Guid subjectId) + { + + var subjectInfo = await this._repository.Where(x => x.Id == subjectId).FirstNotNullAsync(); + + FileDto fileDto = new FileDto(); + await FileUploadAsync(async (fileName) => + { + var (serverFilePath, relativePath, fileRealName) = FileStoreHelper.GetUploadPrintscreenFilePath(_hostEnvironment, fileName, subjectInfo.TrialId, subjectInfo.SiteId, subjectInfo.Id); + fileDto.Path = relativePath; + fileDto.FileName = fileName; + await Task.CompletedTask; + return serverFilePath; + }); + + + return ResponseOutput.Ok(fileDto); + } + + /// /// 上传Reading问题的图像 /// diff --git a/IRaCIS.Core.Application/Helper/FileStoreHelper.cs b/IRaCIS.Core.Application/Helper/FileStoreHelper.cs index a34b57971..e8da8a52b 100644 --- a/IRaCIS.Core.Application/Helper/FileStoreHelper.cs +++ b/IRaCIS.Core.Application/Helper/FileStoreHelper.cs @@ -365,6 +365,36 @@ public static class FileStoreHelper } + + /// + /// 上传截图 + /// + /// + /// + /// + /// + /// + /// + /// + public static (string PhysicalPath, string RelativePath, string FileRealName) GetUploadPrintscreenFilePath(IWebHostEnvironment _hostEnvironment, string fileName, Guid trialId, Guid siteid, Guid subjectId) + { + var rootPath = FileStoreHelper.GetIRaCISRootDataFolder(_hostEnvironment); + + string uploadFolderPath = Path.Combine(rootPath, StaticData.Folder.TrialDataFolder, trialId.ToString(), siteid.ToString(), subjectId.ToString()); + + if (!Directory.Exists(uploadFolderPath)) Directory.CreateDirectory(uploadFolderPath); + + var (trustedFileNameForFileStorage, fileRealName) = FileStoreHelper.GetStoreFileName(fileName); + + + var relativePath = $"/{StaticData.Folder.IRaCISDataFolder}/{StaticData.Folder.TrialDataFolder}/{trialId}/{siteid}/{subjectId}/{trustedFileNameForFileStorage}"; + + var serverFilePath = Path.Combine(uploadFolderPath, trustedFileNameForFileStorage); + + return (serverFilePath, relativePath, fileRealName); + } + + /// /// 通用获取文件路径 /// From 1c16dcf961a006abff4101f0f87f103f3a34d828 Mon Sep 17 00:00:00 2001 From: he <10978375@qq.com> Date: Thu, 9 Mar 2023 15:54:11 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- IRaCIS.Core.Application/Service/Visit/SubjectVisitService.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/IRaCIS.Core.Application/Service/Visit/SubjectVisitService.cs b/IRaCIS.Core.Application/Service/Visit/SubjectVisitService.cs index ed983e0c2..f1e9dfd6d 100644 --- a/IRaCIS.Core.Application/Service/Visit/SubjectVisitService.cs +++ b/IRaCIS.Core.Application/Service/Visit/SubjectVisitService.cs @@ -530,6 +530,7 @@ namespace IRaCIS.Core.Application.Services }); result.AddRange(studyList); + result = result.Where(x => x.SeriesCount > 0).ToList(); return result; //return ResponseOutput.Ok(studyList.Where(t => t.SeriesList.Count > 0).ToList());