From 658f9c7c404d003b1acef48f27eb02bb0d30cd1c Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Tue, 8 Oct 2024 11:38:37 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81=E9=98=85=E7=89=87=E8=B7=9F=E8=B8=AA?= =?UTF-8?q?=E8=A1=A8=202=E3=80=81=E6=8E=A5=E6=94=B6=E8=AE=B0=E5=BD=95?= =?UTF-8?q?=E8=A1=A8=203=E3=80=81=E6=8E=A5=E6=94=B6=E5=BD=B1=E5=83=8F?= =?UTF-8?q?=E6=A3=80=E6=9F=A5=E8=A1=A8=204=E3=80=81=E4=B8=8B=E8=BD=BD?= =?UTF-8?q?=E8=AE=B0=E5=BD=95=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../IRaCIS.Core.Application.xml | 24 +++ .../Service/Common/ExcelExportService.cs | 139 ++++++++++++++++++ .../Service/Common/_MapConfig.cs | 7 + .../Service/QC/DTO/QCListViewModel.cs | 89 +++++++++++ .../Service/Visit/DTO/PatientViewModel.cs | 36 +++++ .../Service/Visit/_MapConfig.cs | 10 +- .../_IRaCIS/_Config/_StaticData.cs | 6 +- 7 files changed, 307 insertions(+), 4 deletions(-) diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml index 6132acfb8..dd706d5f7 100644 --- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml +++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml @@ -712,6 +712,30 @@ + + + 影像下载记录表 + + + + + + + + + + 影像接收记录表 + + + + + + + 影像检查列表-患者为维度组织 + + + + 自身一致性分析(仅做了resist1.1) diff --git a/IRaCIS.Core.Application/Service/Common/ExcelExportService.cs b/IRaCIS.Core.Application/Service/Common/ExcelExportService.cs index 91e2206a8..b1fc7c25b 100644 --- a/IRaCIS.Core.Application/Service/Common/ExcelExportService.cs +++ b/IRaCIS.Core.Application/Service/Common/ExcelExportService.cs @@ -1204,6 +1204,145 @@ namespace IRaCIS.Core.Application.Service.Common } + /// + /// 影像下载记录表 + /// + /// + /// + /// + /// + /// + [HttpPost] + public async Task GetTrialDownloadList_Export(TrialIamgeDownQuery inQuery, + [FromServices] IRepository _trialImageDownloadRepository, + [FromServices] IDictionaryService _dictionaryService, + [FromServices] IRepository _trialRepository) + { + var query = _trialImageDownloadRepository.Where(t => t.TrialId == inQuery.TrialId) + .WhereIf(inQuery.SubjectCode.IsNotNullOrEmpty(), t => t.SubjectCode.Contains(inQuery.SubjectCode)) + .WhereIf(inQuery.IP.IsNotNullOrEmpty(), t => t.IP.Contains(inQuery.IP)) + .WhereIf(inQuery.Name.IsNotNullOrEmpty(), t => t.CreateUser.UserName.Contains(inQuery.Name) || t.CreateUser.FullName.Contains(inQuery.Name)) + .WhereIf(inQuery.ImageType != null, t => t.ImageType == inQuery.ImageType) + .WhereIf(inQuery.UserType != null, t => t.CreateUser.UserTypeEnum == inQuery.UserType) + .WhereIf(inQuery.IsSuccess != null, t => t.IsSuccess == inQuery.IsSuccess) + .WhereIf(inQuery.DownloadStartTime != null, t => t.DownloadStartTime >= inQuery.DownloadStartTime) + .WhereIf(inQuery.DownloadEndTime != null, t => t.DownloadEndTime <= inQuery.DownloadEndTime) + + .ProjectTo(_mapper.ConfigurationProvider); + + var list = query.SortToListAsync(inQuery); + + + var exportInfo = (await _trialRepository.Where(t => t.Id == inQuery.TrialId).IgnoreQueryFilters().ProjectTo(_mapper.ConfigurationProvider).FirstOrDefaultAsync()).IfNullThrowException(); + + exportInfo.List = ExportExcelConverterDate.ConvertToClientTimeInObject(list, _userInfo.TimeZoneId); + exportInfo.CurrentTime = ExportExcelConverterDate.DateTimeInternationalToString(DateTime.Now, _userInfo.TimeZoneId); + + + return await ExcelExportHelper.DataExportAsync(StaticData.Export.TrialImageDownloadList_Export, exportInfo, $"{exportInfo.ResearchProgramNo}", _commonDocumentRepository, _hostEnvironment, _dictionaryService, typeof(TrialImageDownloadExportDto)); + + } + + /// + /// 影像接收记录表 + /// + /// + /// + [HttpPost] + public async Task GetSCPImageUploadList_Export(SCPImageUploadQuery inQuery, + [FromServices] IRepository _scpImageUploadRepository, + [FromServices] IDictionaryService _dictionaryService, + [FromServices] IRepository _trialRepository) + { + var query = _scpImageUploadRepository.Where(t => t.TrialId == inQuery.TrialId) + .WhereIf(!string.IsNullOrWhiteSpace(inQuery.CalledAE), t => t.CalledAE.Contains(inQuery.CalledAE)) + .WhereIf(!string.IsNullOrWhiteSpace(inQuery.CallingAEIP), t => t.CallingAEIP.Contains(inQuery.CallingAEIP)) + .WhereIf(!string.IsNullOrWhiteSpace(inQuery.CallingAE), t => t.CallingAE.Contains(inQuery.CallingAE)) + .WhereIf(inQuery.StartTime != null, t => t.StartTime >= inQuery.StartTime) + .WhereIf(inQuery.EndTime != null, t => t.EndTime <= inQuery.EndTime) + .WhereIf(!string.IsNullOrWhiteSpace(inQuery.TrialSiteKeyInfo), t => t.TrialSite.TrialSiteCode.Contains(inQuery.TrialSiteKeyInfo) + || t.TrialSite.TrialSiteAliasName.Contains(inQuery.TrialSiteKeyInfo) || t.TrialSite.TrialSiteName.Contains(inQuery.TrialSiteKeyInfo)) + .ProjectTo(_mapper.ConfigurationProvider); + + + var list = query.SortToListAsync(inQuery); + + var exportInfo = (await _trialRepository.Where(t => t.Id == inQuery.TrialId).IgnoreQueryFilters().ProjectTo(_mapper.ConfigurationProvider).FirstOrDefaultAsync()).IfNullThrowException(); + + exportInfo.List = ExportExcelConverterDate.ConvertToClientTimeInObject(list, _userInfo.TimeZoneId); + exportInfo.CurrentTime = ExportExcelConverterDate.DateTimeInternationalToString(DateTime.Now, _userInfo.TimeZoneId); + + + return await ExcelExportHelper.DataExportAsync(StaticData.Export.TrialSCPImageUploadList_Export, exportInfo, $"{exportInfo.ResearchProgramNo}", _commonDocumentRepository, _hostEnvironment, _dictionaryService, typeof(SCPImageUploadExportDTO)); + + } + + /// + ///影像检查列表-患者为维度组织 + /// + /// + /// + [HttpPost] + public async Task GetPatientList_Export(PatientTrialQuery inQuery, + [FromServices] IRepository _patientRepository, + [FromServices] IDictionaryService _dictionaryService, + [FromServices] IRepository _trialRepository) + { + + + var query = _patientRepository.Where(t => t.TrialId == inQuery.TrialId) + .WhereIf(!string.IsNullOrWhiteSpace(inQuery.PatientIdStr), t => t.PatientIdStr.Contains(inQuery.PatientIdStr)) + .WhereIf(!string.IsNullOrWhiteSpace(inQuery.PatientName), t => t.PatientName.Contains(inQuery.PatientName)) + .WhereIf(!string.IsNullOrWhiteSpace(inQuery.SubejctCode), t => t.Subject.Code.Contains(inQuery.SubejctCode)) + .WhereIf(!string.IsNullOrWhiteSpace(inQuery.TrialSiteKeyInfo), t => t.TrialSite.TrialSiteCode.Contains(inQuery.TrialSiteKeyInfo) + || t.TrialSite.TrialSiteAliasName.Contains(inQuery.TrialSiteKeyInfo) || t.TrialSite.TrialSiteName.Contains(inQuery.TrialSiteKeyInfo)) + .WhereIf(!string.IsNullOrWhiteSpace(inQuery.CallingAE), t => t.SCPStudyList.Any(t => t.CallingAE == inQuery.CallingAE)) + .WhereIf(!string.IsNullOrWhiteSpace(inQuery.CalledAE), t => t.SCPStudyList.Any(t => t.CalledAE == inQuery.CalledAE)) + .WhereIf(inQuery.BeginPushTime != null, t => t.LatestPushTime >= inQuery.BeginPushTime) + .WhereIf(inQuery.EndPushTime != null, t => t.LatestPushTime <= inQuery.EndPushTime); + + + var resultQuery = from patient in query + + select new SCPPatientSubjectExportDTO() + { + //CreateUserId = patient.CreateUserId, + //UpdateTime = patient.UpdateTime, + //UpdateUserId = patient.UpdateUserId, + //TrialId = patient.TrialId, + //SubejctId = patient.SubjectId, + //CreateTime = patient.CreateTime, + //PatientId = patient.Id, + + PatientBirthDate = patient.PatientBirthDate, + CalledAEList = patient.SCPStudyList.Select(t => t.CalledAE).Distinct().ToList(), + CallingAEList = patient.SCPStudyList.Select(t => t.CallingAE).Distinct().ToList(), + EarliestStudyTime = patient.EarliestStudyTime, + LatestStudyTime = patient.LatestStudyTime, + LatestPushTime = patient.LatestPushTime, + PatientAge = patient.PatientAge, + PatientName = patient.PatientName, + PatientIdStr = patient.PatientIdStr, + PatientSex = patient.PatientSex, + StudyCount = patient.SCPStudyList.Count(), + SubjectCode = patient.Subject.Code, + TrialSiteAliasName = patient.TrialSite.TrialSiteAliasName, + TrialSiteCode = patient.TrialSite.TrialSiteCode, + TrialSiteName = patient.TrialSite.TrialSiteName + + }; + + var list = query.SortToListAsync(inQuery); + + var exportInfo = (await _trialRepository.Where(t => t.Id == inQuery.TrialId).IgnoreQueryFilters().ProjectTo(_mapper.ConfigurationProvider).FirstOrDefaultAsync()).IfNullThrowException(); + + exportInfo.List = ExportExcelConverterDate.ConvertToClientTimeInObject(list, _userInfo.TimeZoneId); + exportInfo.CurrentTime = ExportExcelConverterDate.DateTimeInternationalToString(DateTime.Now, _userInfo.TimeZoneId); + + + return await ExcelExportHelper.DataExportAsync(StaticData.Export.TrialSCPImageUploadPatientList_Export, exportInfo, $"{exportInfo.ResearchProgramNo}", _commonDocumentRepository, _hostEnvironment, _dictionaryService, typeof(SCPPatientSubjectExportDTO)); + + } /// /// 自身一致性分析(仅做了resist1.1) diff --git a/IRaCIS.Core.Application/Service/Common/_MapConfig.cs b/IRaCIS.Core.Application/Service/Common/_MapConfig.cs index 932be43f8..aa3410c8d 100644 --- a/IRaCIS.Core.Application/Service/Common/_MapConfig.cs +++ b/IRaCIS.Core.Application/Service/Common/_MapConfig.cs @@ -82,6 +82,13 @@ namespace IRaCIS.Core.Application.Service CreateMap(); CreateMap().ReverseMap(); + + CreateMap() + .ForMember(d => d.UserFullName, u => u.MapFrom(s => s.CreateUser.FullName)) + .ForMember(d => d.UserTypeEnum, u => u.MapFrom(s => s.CreateUser.UserTypeEnum)) + .ForMember(d => d.UserName, u => u.MapFrom(s => s.CreateUser.UserName)); + + } } diff --git a/IRaCIS.Core.Application/Service/QC/DTO/QCListViewModel.cs b/IRaCIS.Core.Application/Service/QC/DTO/QCListViewModel.cs index c925ecfca..fca4c712c 100644 --- a/IRaCIS.Core.Application/Service/QC/DTO/QCListViewModel.cs +++ b/IRaCIS.Core.Application/Service/QC/DTO/QCListViewModel.cs @@ -871,6 +871,95 @@ namespace IRaCIS.Core.Application.Contracts public bool IsInvalid { get; set; } } + public class TrialImageDownloadExportDto + { + public Guid TrialId { get; set; } + + public string SubjectCode { get; set; } + + public bool IsSuccess { get; set; } + + public DateTime DownloadStartTime { get; set; } + public DateTime? DownloadEndTime { get; set; } + + public string VisitName { get; set; } + + [DictionaryTranslateAttribute("downloadImageType")] + public ImageType ImageType { get; set; } + + public int NoneDicomStudyCount { get; set; } + + public int DicomStudyCount { get; set; } + + public int ImageCount { get; set; } + public long ImageSize { get; set; } + + + public string UserName { get; set; } + + public string UserFullName { get; set; } + public DateTime CreateTime { get; set; } + + public string IP { get; set; } + + [DictionaryTranslateAttribute("UserType")] + public UserTypeEnum UserTypeEnum { get; set; } + + public string ImageSizeStr => (ImageSize / Math.Pow(1024, 2)).ToString("F3") + 'M'; + + public string UploadIntervalStr + { + get + { + var uploadTimeSpan = DownloadEndTime - DownloadStartTime; + + return $" {uploadTimeSpan?.Hours}:{uploadTimeSpan?.Minutes}:{uploadTimeSpan?.Seconds}.{uploadTimeSpan?.Milliseconds}"; + } + } + + } + + public class SCPImageUploadExportDTO + { + public string CallingAE { get; set; } = string.Empty; + + public string CalledAE { get; set; } = string.Empty; + + public string CallingAEIP { get; set; } = string.Empty; + + public DateTime StartTime { get; set; } + + public DateTime EndTime { get; set; } + + public int FileCount { get; set; } + + public long FileSize { get; set; } + + public int StudyCount { get; set; } + + + public Guid TrialId { get; set; } + public Guid TrialSiteId { get; set; } + + + public string TrialSiteCode { get; set; } + + public string TrialSiteName { get; set; } + + public string TrialSiteAliasName { get; set; } + + public string UploadIntervalStr + { + get + { + var uploadTimeSpan = EndTime - StartTime; + + return $" {uploadTimeSpan.Hours}:{uploadTimeSpan.Minutes}:{uploadTimeSpan.Seconds}.{uploadTimeSpan.Milliseconds}"; + } + } + + public string ImageSizeStr => (FileSize / Math.Pow(1024, 2)).ToString("F3") + 'M'; + } public class AnalysisExortCommon { diff --git a/IRaCIS.Core.Application/Service/Visit/DTO/PatientViewModel.cs b/IRaCIS.Core.Application/Service/Visit/DTO/PatientViewModel.cs index f7477c78a..8b8fa455f 100644 --- a/IRaCIS.Core.Application/Service/Visit/DTO/PatientViewModel.cs +++ b/IRaCIS.Core.Application/Service/Visit/DTO/PatientViewModel.cs @@ -256,9 +256,45 @@ namespace IRaCIS.Application.Contracts public string? TrialSiteName { get; set; } public string? TrialSiteAliasName { get; set; } + + + } + public class SCPPatientSubjectExportDTO + { + public int? StudyCount { get; set; } + + public string? SubjectCode { get; set; } + + public string? TrialSiteCode { get; set; } + + public string? TrialSiteName { get; set; } + + public string? TrialSiteAliasName { get; set; } + + public string PatientIdStr { get; set; } = string.Empty; + public string PatientName { get; set; } = string.Empty; + public string PatientAge { get; set; } = string.Empty; + public string PatientSex { get; set; } = string.Empty; + public string PatientBirthDate { get; set; } = string.Empty; + + public DateTime? EarliestStudyTime { get; set; } + + public DateTime? LatestStudyTime { get; set; } + + public DateTime LatestPushTime { get; set; } + + public List CallingAEList { get; set; } = new List(); + + public List CalledAEList { get; set; } = new List(); + + public string CallingAEListStr => string.Join(",", CallingAEList); + + public string CalledAEListStr => string.Join(",", CalledAEList); + } + public class PatientQuery : PageInput { diff --git a/IRaCIS.Core.Application/Service/Visit/_MapConfig.cs b/IRaCIS.Core.Application/Service/Visit/_MapConfig.cs index 7ffd90487..cf927ee17 100644 --- a/IRaCIS.Core.Application/Service/Visit/_MapConfig.cs +++ b/IRaCIS.Core.Application/Service/Visit/_MapConfig.cs @@ -112,9 +112,13 @@ namespace IRaCIS.Core.Application.Service CreateMap() .ForMember(d => d.TrialSiteCode, u => u.MapFrom(s => s.TrialSite.TrialSiteCode)) - .ForMember(d => d.TrialSiteAliasName, u => u.MapFrom(s => s.TrialSite.TrialSiteAliasName)) - .ForMember(d => d.TrialSiteName, u => u.MapFrom(s => s.TrialSite.TrialSiteName)) -; + .ForMember(d => d.TrialSiteAliasName, u => u.MapFrom(s => s.TrialSite.TrialSiteAliasName)) + .ForMember(d => d.TrialSiteName, u => u.MapFrom(s => s.TrialSite.TrialSiteName)); + + CreateMap() + .ForMember(d => d.TrialSiteCode, u => u.MapFrom(s => s.TrialSite.TrialSiteCode)) + .ForMember(d => d.TrialSiteAliasName, u => u.MapFrom(s => s.TrialSite.TrialSiteAliasName)) + .ForMember(d => d.TrialSiteName, u => u.MapFrom(s => s.TrialSite.TrialSiteName)); CreateMap(); diff --git a/IRaCIS.Core.Infrastructure/_IRaCIS/_Config/_StaticData.cs b/IRaCIS.Core.Infrastructure/_IRaCIS/_Config/_StaticData.cs index 0d06b9e5c..cd320ed98 100644 --- a/IRaCIS.Core.Infrastructure/_IRaCIS/_Config/_StaticData.cs +++ b/IRaCIS.Core.Infrastructure/_IRaCIS/_Config/_StaticData.cs @@ -252,7 +252,11 @@ public static class StaticData public const string TrialMedicalReviewList_Export = "TrialMedicalReviewList_Export"; - + public static string TrialImageDownloadList_Export = "TrialImageDownloadList_Export"; + + public static string TrialSCPImageUploadList_Export = "TrialSCPImageUploadList_Export"; + + public static string TrialSCPImageUploadPatientList_Export = "TrialSCPImageUploadPatientList_Export"; //public const string TrialRECIST1Point1SelfAnalysisList_Export = "TrialRECIST1Point1SelfAnalysisList_Export";