diff --git a/IRaCIS.Core.API/Controllers/UploadDownLoadController.cs b/IRaCIS.Core.API/Controllers/UploadDownLoadController.cs index 647ac3f01..bbd9b57d3 100644 --- a/IRaCIS.Core.API/Controllers/UploadDownLoadController.cs +++ b/IRaCIS.Core.API/Controllers/UploadDownLoadController.cs @@ -460,6 +460,32 @@ namespace IRaCIS.Core.API.Controllers } + /// + /// 上传裁判任务的图像 + /// + /// + /// + /// + [HttpPost("VisitTask/UploadMedicalReviewImage/{trialId:guid}/{visitTaskId:guid}")] + [TypeFilter(typeof(TrialResourceFilter))] + public async Task> UploadJudgeTaskImage(Guid trialId, Guid visitTaskId) + { + + FileDto fileDto = new FileDto(); + await FileUploadAsync(async (fileName) => + { + var (serverFilePath, relativePath, fileRealName) = FileStoreHelper.GetFilePath(_hostEnvironment, fileName, trialId, visitTaskId, StaticData.Folder.JudgeTask); + fileDto.Path = relativePath; + fileDto.FileName = fileName; + return serverFilePath; + }); + + await _repository.SaveChangesAsync(); + return ResponseOutput.Ok(fileDto); + } + + + /// /// 上传医学审核图片 /// diff --git a/IRaCIS.Core.Application/Helper/FileStoreHelper.cs b/IRaCIS.Core.Application/Helper/FileStoreHelper.cs index 1a37c63d6..43819b93f 100644 --- a/IRaCIS.Core.Application/Helper/FileStoreHelper.cs +++ b/IRaCIS.Core.Application/Helper/FileStoreHelper.cs @@ -345,6 +345,33 @@ public static class FileStoreHelper } + /// + /// 通用获取文件路径 + /// + /// + /// + /// + /// + /// + /// + public static (string PhysicalPath, string RelativePath, string FileRealName) GetFilePath(IWebHostEnvironment _hostEnvironment, string fileName, Guid trialId, Guid id,string type) + { + var rootPath = FileStoreHelper.GetIRaCISRootDataFolder(_hostEnvironment); + + string uploadFolderPath = Path.Combine(rootPath, StaticData.Folder.TrialDataFolder, trialId.ToString(), id.ToString(), type); + + if (!Directory.Exists(uploadFolderPath)) Directory.CreateDirectory(uploadFolderPath); + + var (trustedFileNameForFileStorage, fileRealName) = FileStoreHelper.GetStoreFileName(fileName); + + + var relativePath = $"/{StaticData.Folder.IRaCISDataFolder}/{StaticData.Folder.TrialDataFolder}/{trialId}/{id}/{type}/{trustedFileNameForFileStorage}"; + + var serverFilePath = Path.Combine(uploadFolderPath, trustedFileNameForFileStorage); + + return (serverFilePath, relativePath, fileRealName); + } + public static (string PhysicalPath, string RelativePath, string FileRealName) GetMedicalReviewImage(IWebHostEnvironment _hostEnvironment, string fileName, Guid trialId, Guid taskMedicalReviewId) { var rootPath = FileStoreHelper.GetIRaCISRootDataFolder(_hostEnvironment); diff --git a/IRaCIS.Core.Application/Service/Reading/Dto/ReadingImageTaskViewModel.cs b/IRaCIS.Core.Application/Service/Reading/Dto/ReadingImageTaskViewModel.cs index 97659e204..2e4b3df09 100644 --- a/IRaCIS.Core.Application/Service/Reading/Dto/ReadingImageTaskViewModel.cs +++ b/IRaCIS.Core.Application/Service/Reading/Dto/ReadingImageTaskViewModel.cs @@ -153,6 +153,9 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto /// 裁判结果的备注 /// public string JudgeResultRemark { get; set; } + + + public string JudgeResultImagePath { get; set; } = string.Empty; } public class GetReadingPastResultListOutDto @@ -182,6 +185,8 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto public Guid JudgeResultTaskId { get; set; } public string JudgeResultRemark { get; set; } = string.Empty; + + public string JudgeResultImagePath { get; set; } = string.Empty; } public class GetJudgeReadingInfo diff --git a/IRaCIS.Core.Application/Service/Reading/ReadingImageTaskService.cs b/IRaCIS.Core.Application/Service/Reading/ReadingImageTaskService.cs index 2897c7953..4fd148094 100644 --- a/IRaCIS.Core.Application/Service/Reading/ReadingImageTaskService.cs +++ b/IRaCIS.Core.Application/Service/Reading/ReadingImageTaskService.cs @@ -372,12 +372,14 @@ namespace IRaCIS.Application.Services x.ReadingTaskState, x.JudgeResultTaskId, x.JudgeResultRemark, + x.JudgeResultImagePath, }).FirstOrDefaultAsync(); GetJudgeReadingInfoOutDto judgeInfo = new GetJudgeReadingInfoOutDto() { ReadingTaskState = visitTask.ReadingTaskState, JudgeResultTaskId = visitTask.JudgeResultTaskId, JudgeResultRemark=visitTask.JudgeResultRemark, + JudgeResultImagePath= JudgeResultImagePath, VisitTaskInfoList = new List() }; var visitIds = await _visitTaskRepository.Where(x => x.JudgeVisitTaskId == inDto.VisitTaskId).Select(x => new @@ -415,6 +417,7 @@ namespace IRaCIS.Application.Services { JudgeResultTaskId = inDto.JudgeResultTaskId, JudgeResultRemark = inDto.JudgeResultRemark, + }); var result=await _visitTaskRepository.SaveChangesAsync(); return ResponseOutput.Ok(result); @@ -434,6 +437,7 @@ namespace IRaCIS.Application.Services ReadingTaskState = ReadingTaskState.HaveSigned, JudgeResultRemark = inDto.JudgeResultRemark, SignTime = DateTime.Now, + JudgeResultImagePath=inDto.JudgeResultImagePath, }); var result = await _visitTaskRepository.SaveChangesAsync(); return ResponseOutput.Ok(result); diff --git a/IRaCIS.Core.Domain/Allocation/VisitTask.cs b/IRaCIS.Core.Domain/Allocation/VisitTask.cs index d6b4dc7be..9bff95cb7 100644 --- a/IRaCIS.Core.Domain/Allocation/VisitTask.cs +++ b/IRaCIS.Core.Domain/Allocation/VisitTask.cs @@ -152,6 +152,12 @@ namespace IRaCIS.Core.Domain.Models /// public bool? IsGlobalHaveUpdate { get; set; } + + /// + /// 裁判结果的图片路径 + /// + public string JudgeResultImagePath { get; set; } = string.Empty; + #region 一致性分析的任务特有数据 /// diff --git a/IRaCIS.Core.Domain/_Config/_StaticData.cs b/IRaCIS.Core.Domain/_Config/_StaticData.cs index 971f32327..ce7140dd0 100644 --- a/IRaCIS.Core.Domain/_Config/_StaticData.cs +++ b/IRaCIS.Core.Domain/_Config/_StaticData.cs @@ -40,6 +40,8 @@ public static class StaticData public static readonly string MedicalReview = "MedicalReview"; + public static readonly string JudgeTask = "JudgeTask"; + public static readonly string UploadEDCData = "UploadEDCData"; public static readonly string UploadFileFolder = "UploadFile";