From a9fd1978e17f8576621a4cef2224980848d07a30 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Tue, 24 Oct 2023 17:05:03 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=8C=BB=E7=94=9F=E7=AE=80?= =?UTF-8?q?=E5=8E=86=E4=B8=8A=E4=BC=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/UploadDownLoadController.cs | 188 +++++++++++++----- IRaCIS.Core.API/IRaCIS.Core.API.xml | 45 +++-- IRaCIS.Core.Application/Helper/OSSService.cs | 24 ++- .../IRaCIS.Core.Application.xml | 7 + .../Service/Common/FileService.cs | 5 +- .../Service/Document/_MapConfig.cs | 2 + .../DTO/UltrasonicDicomViewModel.cs | 2 + .../UltrasonicDicomService.cs | 2 +- IRaCIS.Core.Domain/Dcotor/Attachment.cs | 6 +- 9 files changed, 201 insertions(+), 80 deletions(-) diff --git a/IRaCIS.Core.API/Controllers/UploadDownLoadController.cs b/IRaCIS.Core.API/Controllers/UploadDownLoadController.cs index 5ef44eb2c..b0a275fb5 100644 --- a/IRaCIS.Core.API/Controllers/UploadDownLoadController.cs +++ b/IRaCIS.Core.API/Controllers/UploadDownLoadController.cs @@ -268,7 +268,7 @@ namespace IRaCIS.Core.API.Controllers [DisableFormValueModelBinding] [DisableRequestSizeLimit] [TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })] - public async Task ArchiveStudyNew(/*[FromForm] ArchiveStudyCommand archiveStudyCommand,*/ Guid trialId, Guid subjectVisitId, string studyInstanceUid, Guid? abandonStudyId,Guid studyMonitorId, + public async Task ArchiveStudyNew(/*[FromForm] ArchiveStudyCommand archiveStudyCommand,*/ Guid trialId, Guid subjectVisitId, string studyInstanceUid, Guid? abandonStudyId, Guid studyMonitorId, [FromServices] ILogger _logger, [FromServices] IEasyCachingProvider _provider, [FromServices] IStudyService _studyService, @@ -302,9 +302,9 @@ namespace IRaCIS.Core.API.Controllers { _provider.Set($"StudyUid_{trialId}_{archiveStudyCommand.StudyInstanceUid}", _userInfo.Id, TimeSpan.FromMinutes(30)); } - - - + + + //if (_provider.Exists($"StudyUid_{trialId}_{archiveStudyCommand.StudyInstanceUid}")) //{ // //---当前已有人正在上传和归档该检查! @@ -407,7 +407,7 @@ namespace IRaCIS.Core.API.Controllers studyMonitor.IsSuccess = true; } - + } catch (Exception e) { @@ -424,7 +424,7 @@ namespace IRaCIS.Core.API.Controllers studyMonitor.StudyCode = archiveResult.ArchivedDicomStudies.FirstOrDefault()?.StudyCode; studyMonitor.ArchiveFinishedTime = DateTime.Now; - await _studyMonitorRepository.SaveChangesAsync(); + await _studyMonitorRepository.SaveChangesAsync(); } @@ -528,7 +528,7 @@ namespace IRaCIS.Core.API.Controllers if (!fileName.EndsWith(".xlsx") && !fileName.EndsWith(".csv") && !fileName.EndsWith(".xls")) { - //---支持.xlsx、.xls、.csv格式的文件上传。 + //---支持.xlsx、.xls、.csv格式的文件上传。 throw new BusinessValidationFailedException(StaticData.International("UploadDownLoad_SupportedFormats")); } @@ -686,11 +686,11 @@ namespace IRaCIS.Core.API.Controllers var dt = DateTime.Now; - etcCheckList = etcCheckList.Where(t => !(t.Modality == string.Empty || t.SiteCode == string.Empty || t.SubjectCode == string.Empty || t.VisitName == string.Empty || t.StudyDate == string.Empty ||! DateTime.TryParse(t.StudyDate, out dt))).ToList(); + etcCheckList = etcCheckList.Where(t => !(t.Modality == string.Empty || t.SiteCode == string.Empty || t.SubjectCode == string.Empty || t.VisitName == string.Empty || t.StudyDate == string.Empty || !DateTime.TryParse(t.StudyDate, out dt))).ToList(); if (etcCheckList.Count == 0) { - //---请保证上传数据符合模板文件中的样式,且存在有效数据。 + //---请保证上传数据符合模板文件中的样式,且存在有效数据。 return ResponseOutput.NotOk(StaticData.International("UploadDownLoad_InvalidData")); } @@ -709,6 +709,38 @@ namespace IRaCIS.Core.API.Controllers #region 医生文件上传下载 + + #region DTO + public class DoctorDownloadInfo + { + public Guid Id { get; set; } + public string Name { get; set; } + public string ReviewerCode { get; set; } + + public List FileList { get; set; } + } + public class DownloadFileInfo + { + public string FileName { get; set; } + + public string Path { get; set; } + } + + public class GetDoctorPathCommand + { + public int Language { get; set; } + + public List DoctorIdList { get; set; } + } + + public class GetDoctoreAttachPathCommand + { + public Guid DoctorId { get; set; } + public List AttachmentIdList { get; set; } + } + #endregion + + /// 医生文件上传下载 [ApiExplorerSettings(GroupName = "Common")] [ApiController] @@ -723,55 +755,98 @@ namespace IRaCIS.Core.API.Controllers private readonly IFileService _fileService; - public FileController(IMapper mapper, IUserInfo userInfo, IWebHostEnvironment hostEnvironment, IFileService fileService) { _fileService = fileService; _hostEnvironment = hostEnvironment; - _mapper = mapper; _userInfo = userInfo; } /// - /// 上传文件[FileUpload] + /// New 医生首页 多选 获取多个医生信息+文件路径列表 医生压缩包名称 doctorCode + "_" + doctorName _(时间戳或者随机的Guid) /// - /// 附件类型 - /// 医生Id - /// 返回文件信息 - [HttpPost, Route("file/UploadFile/{attachmentType}/{doctorId}")] - [DisableFormValueModelBinding] - [DisableRequestSizeLimit] - public async Task UploadOrdinaryFile(string attachmentType, Guid doctorId) + /// + [HttpPost, Route("file/GetOfficialResume")] + public async Task>> GetOfficialResume(GetDoctorPathCommand command, + [FromServices] IRepository _attachmentrepository) { - return await SingleFileUploadAsync((fileName) => FileStoreHelper.GetDoctorOrdinaryFilePath(_hostEnvironment, fileName, doctorId, attachmentType)); + var list = await _attachmentrepository.Where(t => command.DoctorIdList.Contains(t.DoctorId) && command.Language==t.Language).GroupBy(t => new { Name = t.Doctor.FirstName + "_" + t.Doctor.LastName, ReviewerCode = t.Doctor.ReviewerCode, t.DoctorId }) + .Select(g => new DoctorDownloadInfo() + { + Id = g.Key.DoctorId, + Name = g.Key.Name, + ReviewerCode = g.Key.ReviewerCode, + FileList = g.Select(t => new DownloadFileInfo() { FileName = t.FileName, Path = t.Path }).ToList() + }).ToListAsync(); + + return ResponseOutput.Ok(list); } - /// - /// 上传文件( 不是医生个人的文件)[FileUpload] - /// 例如:阅片章程等 + /// New 项目入组 获取医生简历 /// - /// 文件类型 + /// + /// + /// /// - - [HttpPost, Route("file/UploadNonDoctorFile/{type}")] - [DisableFormValueModelBinding] - [DisableRequestSizeLimit] - public async Task UploadNonDoctorFile(string type) + [HttpPost,Route("file/GetTrialDoctorOfficialResume")] + public async Task>> GetTrialDoctorOfficialResume(GetDoctorPathCommand command, + [FromServices] IDoctorService _doctorService, + [FromServices] IRepository _attachmentrepository) { - return await SingleFileUploadAsync((fileName) => FileStoreHelper.GetNonDoctorFilePath(_hostEnvironment, fileName, type)); + + var list = await _attachmentrepository.Where(t => command.DoctorIdList.Contains(t.DoctorId) && command.Language == t.Language && t.IsOfficial && t.Type.Equals("Resume")).GroupBy(t => new { Name = t.Doctor.FirstName + "_" + t.Doctor.LastName, ReviewerCode = t.Doctor.ReviewerCode, t.DoctorId }) + .Select(g => new DoctorDownloadInfo() + { + Id = g.Key.DoctorId, + Name = g.Key.Name, + ReviewerCode = g.Key.ReviewerCode, + FileList = g.Select(t => new DownloadFileInfo() { FileName = t.FileName, Path = t.Path }).ToList() + }).ToListAsync(); + + return ResponseOutput.Ok(list); + } + /// + /// new 医生详情 下载指定简历 + /// + /// + /// + /// + /// + [HttpPost, Route("file/GetDoctorAttachment")] + public async Task> GetDoctorAttachment(GetDoctoreAttachPathCommand command, + [FromServices] IDoctorService _doctorService, + [FromServices] IRepository _attachmentrepository) + { + + var find = await _attachmentrepository.Where(t => command.DoctorId==t.DoctorId && command.AttachmentIdList.Contains(t.Id)).GroupBy(t => new { Name = t.Doctor.FirstName + "_" + t.Doctor.LastName, ReviewerCode = t.Doctor.ReviewerCode, t.DoctorId }) + .Select(g => new DoctorDownloadInfo() + { + Id = g.Key.DoctorId, + Name = g.Key.Name, + ReviewerCode = g.Key.ReviewerCode, + FileList = g.Select(t => new DownloadFileInfo() { FileName = t.FileName, Path = t.Path }).ToList() + }).FirstOrDefaultAsync(); + + return ResponseOutput.Ok(find); + + } + + + + #region 废弃 /// /// 下载多个医生的所有附件 /// /// /// - + [Obsolete] [HttpPost, Route("file/downloadDoctorAttachments")] public async Task> DownloadAttachment(Guid[] doctorIds) { @@ -786,24 +861,6 @@ namespace IRaCIS.Core.API.Controllers }); } - /// - /// 下载医生官方简历 - /// - /// - /// - /// - [HttpPost, Route("file/downloadOfficialCV/{language}")] - public async Task> DownloadOfficialResume(int language, Guid[] doctorIds) - { - - var path = await _fileService.CreateDoctorsAllAttachmentZip(doctorIds); - return ResponseOutput.Ok(new UploadFileInfoDTO - { - FilePath = await _fileService.CreateOfficialResumeZip(language, doctorIds), - FullFilePath = path + "?access_token=" + HttpContext.Request.Headers["Authorization"].ToString().Substring(7) - }); - } - /// /// 下载指定医生的指定附件 /// @@ -811,6 +868,7 @@ namespace IRaCIS.Core.API.Controllers /// 要下载的附件Id /// [HttpPost, Route("file/downloadByAttachmentId/{doctorId}")] + [Obsolete] public async Task> DownloadAttachmentById(Guid doctorId, Guid[] attachmentIds) { var path = await _fileService.CreateZipPackageByAttachment(doctorId, attachmentIds); @@ -822,15 +880,47 @@ namespace IRaCIS.Core.API.Controllers } + /// + /// 下载医生官方简历 首页 区分 中文和英文 + /// + /// + /// + /// + [HttpPost, Route("file/downloadOfficialCV/{language}")] + [Obsolete] + public async Task> DownloadOfficialResume(int language, Guid[] doctorIds) + { + + var path = await _fileService.CreateDoctorsAllAttachmentZip(doctorIds); + return ResponseOutput.Ok(new UploadFileInfoDTO + { + FilePath = await _fileService.CreateOfficialResumeZip(language, doctorIds), + FullFilePath = path + "?access_token=" + HttpContext.Request.Headers["Authorization"].ToString().Substring(7) + }); + } + + + + + /// + /// 入组 项目下载简历 + /// + /// + /// + /// + /// [HttpPost, Route("enroll/downloadResume/{trialId:guid}/{language}")] [TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })] [AllowAnonymous] + [Obsolete] public async Task> DownloadResume(int language, Guid trialId, Guid[] doctorIdArray) { var zipPath = await _fileService.CreateOfficialResumeZip(language, doctorIdArray); return ResponseOutput.Ok(zipPath); } + #endregion + } #endregion diff --git a/IRaCIS.Core.API/IRaCIS.Core.API.xml b/IRaCIS.Core.API/IRaCIS.Core.API.xml index 96f6f9d06..5e57621b6 100644 --- a/IRaCIS.Core.API/IRaCIS.Core.API.xml +++ b/IRaCIS.Core.API/IRaCIS.Core.API.xml @@ -285,20 +285,19 @@ 医生文件上传下载 - + - 上传文件[FileUpload] + New 医生首页 多选 获取多个医生信息+文件路径列表 医生压缩包名称 doctorCode + "_" + doctorName _(时间戳或者随机的Guid) - 附件类型 - 医生Id - 返回文件信息 + - + - 上传文件( 不是医生个人的文件)[FileUpload] - 例如:阅片章程等 + New 项目入组 获取医生简历 - 文件类型 + + + @@ -308,14 +307,6 @@ - - - 下载医生官方简历 - - - - - 下载指定医生的指定附件 @@ -324,6 +315,26 @@ 要下载的附件Id + + + 下载医生官方简历 首页 区分 中文和英文 + + + + + + + + 入组 项目下载简历 + + + + + + + + 通用文件下载 + 上传通用文档 比如一致性核查的 比如导出的excel 模板 diff --git a/IRaCIS.Core.Application/Helper/OSSService.cs b/IRaCIS.Core.Application/Helper/OSSService.cs index 1fba59176..ff0a024fa 100644 --- a/IRaCIS.Core.Application/Helper/OSSService.cs +++ b/IRaCIS.Core.Application/Helper/OSSService.cs @@ -51,17 +51,19 @@ namespace IRaCIS.Core.Application.Helper { var ossOptions = options.CurrentValue; - _OSSConfig = new AliyunOssOptions() - { - RegionId = ossOptions.RegionId, - AccessKeyId = ossOptions.AccessKeyId, - AccessKeySecret = ossOptions.AccessKeySecret, - EndPoint = ossOptions.EndPoint, - BucketName = ossOptions.BucketName, - RoleArn = ossOptions.RoleArn, - Region = ossOptions.Region, - ViewEndpoint = ossOptions.ViewEndpoint - }; + _OSSConfig= ossOptions; + + //_OSSConfig = new AliyunOssOptions() + //{ + // RegionId = ossOptions.RegionId, + // AccessKeyId = ossOptions.AccessKeyId, + // AccessKeySecret = ossOptions.AccessKeySecret, + // EndPoint = ossOptions.EndPoint, + // BucketName = ossOptions.BucketName, + // RoleArn = ossOptions.RoleArn, + // Region = ossOptions.Region, + // ViewEndpoint = ossOptions.ViewEndpoint + //}; _ossClient = new OssClient(_OSSConfig.EndPoint, _OSSConfig.AccessKeyId, _OSSConfig.AccessKeySecret); diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml index 26f9eb556..c0fc753c7 100644 --- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml +++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml @@ -1954,6 +1954,13 @@ + + + 骨髓中是否存在局灶性 FDG亲和病灶的证据 + + + + 获取肝脏评估 diff --git a/IRaCIS.Core.Application/Service/Common/FileService.cs b/IRaCIS.Core.Application/Service/Common/FileService.cs index ecbce02cd..01f6323b3 100644 --- a/IRaCIS.Core.Application/Service/Common/FileService.cs +++ b/IRaCIS.Core.Application/Service/Common/FileService.cs @@ -98,7 +98,8 @@ namespace IRaCIS.Application.Services /// public async Task CreateDoctorsAllAttachmentZip(Guid[] doctorIds) { - //准备下载文件的临时路径 + #region 老版本 存储在服务器 + //准备下载文件的临时路径 var guidStr = Guid.NewGuid().ToString(); //string uploadFolderPath = HostingEnvironment.MapPath("/UploadFile/"); string uploadFolderPath = Path.Combine(FileStoreHelper.GetIRaCISRootDataFolder(_hostEnvironment), "UploadFile"); @@ -134,6 +135,8 @@ namespace IRaCIS.Application.Services string targetPath = Path.Combine(uploadFolderPath, target + ".zip"); ZipHelper.CreateZip(tempSavePath, targetPath); return Path.Combine("/IRaCISData/UploadFile/", target + ".zip"); + #endregion + } diff --git a/IRaCIS.Core.Application/Service/Document/_MapConfig.cs b/IRaCIS.Core.Application/Service/Document/_MapConfig.cs index 1116a7bf1..f01322122 100644 --- a/IRaCIS.Core.Application/Service/Document/_MapConfig.cs +++ b/IRaCIS.Core.Application/Service/Document/_MapConfig.cs @@ -52,7 +52,9 @@ namespace IRaCIS.Core.Application.Service CreateMap(); + CreateMap(); + CreateMap() diff --git a/IRaCIS.Core.Application/Service/Third-partyProject/DTO/UltrasonicDicomViewModel.cs b/IRaCIS.Core.Application/Service/Third-partyProject/DTO/UltrasonicDicomViewModel.cs index 3d5b5abea..25bf021ee 100644 --- a/IRaCIS.Core.Application/Service/Third-partyProject/DTO/UltrasonicDicomViewModel.cs +++ b/IRaCIS.Core.Application/Service/Third-partyProject/DTO/UltrasonicDicomViewModel.cs @@ -119,6 +119,8 @@ namespace IRaCIS.Core.Application.Service.Third_partyProject.DTO public class InstancePathDTO { + public string StudyInstanceUid { get; set; } + public string SopInstanceUid { get; set; } public string StudyCode { get; set; } public string InstancePath { get; set; } } diff --git a/IRaCIS.Core.Application/Service/Third-partyProject/UltrasonicDicomService.cs b/IRaCIS.Core.Application/Service/Third-partyProject/UltrasonicDicomService.cs index b030987e2..7e52257fb 100644 --- a/IRaCIS.Core.Application/Service/Third-partyProject/UltrasonicDicomService.cs +++ b/IRaCIS.Core.Application/Service/Third-partyProject/UltrasonicDicomService.cs @@ -194,7 +194,7 @@ namespace IRaCIS.Core.Application.Service.Third_partyProject [HttpPost] public async Task> GetStudyModalityOSSPath(List seriesIdList, [FromServices] IRepository _dicomSeriesRepository) { - return await _dicomSeriesRepository.Where(t => seriesIdList.Contains(t.Id)).SelectMany(t => t.DicomInstanceList).Select(t => new InstancePathDTO() {InstancePath= t.Path,StudyCode=t.DicomStudy.StudyCode } ).ToListAsync(); + return await _dicomSeriesRepository.Where(t => seriesIdList.Contains(t.Id)).SelectMany(t => t.DicomInstanceList).Select(t => new InstancePathDTO() {InstancePath= t.Path,StudyCode=t.DicomStudy.StudyCode , SopInstanceUid = t.SopInstanceUid, StudyInstanceUid = t.StudyInstanceUid} ).ToListAsync(); } diff --git a/IRaCIS.Core.Domain/Dcotor/Attachment.cs b/IRaCIS.Core.Domain/Dcotor/Attachment.cs index bf61dd5ee..1a97bfb64 100644 --- a/IRaCIS.Core.Domain/Dcotor/Attachment.cs +++ b/IRaCIS.Core.Domain/Dcotor/Attachment.cs @@ -16,7 +16,11 @@ namespace IRaCIS.Core.Domain.Models [Table("Attachment")] public partial class Attachment : Entity, IAuditAdd { - public Guid? DoctorId { get; set; } + + [JsonIgnore] + public Doctor Doctor { get; set; } + + public Guid DoctorId { get; set; } public string Type { get; set; } public bool IsOfficial { get; set; } = false; public string Path { get; set; } = string.Empty;