diff --git a/IRaCIS.Core.Application/Service/Common/DTO/EmailNoticeConfigViewModel.cs b/IRaCIS.Core.Application/Service/Common/DTO/EmailNoticeConfigViewModel.cs index 47cdbdd6d..6e9e54d1b 100644 --- a/IRaCIS.Core.Application/Service/Common/DTO/EmailNoticeConfigViewModel.cs +++ b/IRaCIS.Core.Application/Service/Common/DTO/EmailNoticeConfigViewModel.cs @@ -3,6 +3,7 @@ // 生成时间 2022-02-15 11:55:57 // 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。 //-------------------------------------------------------------------- +using IRaCIS.Core.Application.Helper; using IRaCIS.Core.Domain.Share; namespace IRaCIS.Core.Application.Contracts { @@ -133,8 +134,41 @@ namespace IRaCIS.Core.Application.Contracts } + public class EmailNoticeConfigExportDto + { + public Guid? Id { get; set; } + public string Code { get; set; } = String.Empty; + [DictionaryTranslate("BusinessScenarioEnum")] + public EmailBusinessScenario BusinessScenarioEnum { get; set; } + + + [DictionaryTranslate("YesOrNo")] + public bool IsDistinguishCriteria { get; set; } + + + [DictionaryTranslate("CriterionType")] + public CriterionType? CriterionTypeEnum { get; set; } + + [DictionaryTranslate("BusinessModuleEnum")] + public int BusinessModuleEnum { get; set; } + + [DictionaryTranslate("BusinessLevelEnum")] + public int BusinessLevelEnum { get; set; } + + [DictionaryTranslate("EmailUrgentEnum")] + public int EmailUrgentEnum { get; set; } + + public string Description { get; set; } = string.Empty; + + + public string EmailTopic { get; set; } = string.Empty; + + public string EmailTopicCN { get; set; } = string.Empty; + + } + } diff --git a/IRaCIS.Core.Application/Service/Common/ExcelExportService.cs b/IRaCIS.Core.Application/Service/Common/ExcelExportService.cs index 22ea9b7da..547cbdfd4 100644 --- a/IRaCIS.Core.Application/Service/Common/ExcelExportService.cs +++ b/IRaCIS.Core.Application/Service/Common/ExcelExportService.cs @@ -13,8 +13,10 @@ using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Mvc; using NPOI.POIFS.Properties; using NPOI.XSSF.UserModel; +using System.ComponentModel.Design; using System.Globalization; using static IRaCIS.Core.Application.Service.ExcelExportHelper; +using IDictionaryService = IRaCIS.Application.Interfaces.IDictionaryService; namespace IRaCIS.Core.Application.Service.Common { @@ -1324,6 +1326,9 @@ namespace IRaCIS.Core.Application.Service.Common ///影像检查列表-患者为维度组织 /// /// + /// + /// + /// /// [HttpPost] public async Task GetPatientList_Export(PatientTrialQuery inQuery, @@ -1387,194 +1392,42 @@ namespace IRaCIS.Core.Application.Service.Common } + /// - /// 自身一致性分析(仅做了resist1.1) + /// 邮件导出 /// /// - /// + /// /// - /// /// [HttpPost] - public async Task GetSelfAnalysisTaskList_Export(VisitTaskQuery inQuery, - [FromServices] IRepository _commonDocumentRepository, - [FromServices] IDictionaryService _dictionaryService, - [FromServices] IRepository _trialRepository) + public async Task GetEmailNoticeConfigList_Export(EmailNoticeConfigQuery inQuery, + [FromServices] IRepository _emailNoticeConfigrepository, + [FromServices] IDictionaryService _dictionaryService) { + var emailNoticeConfigQueryable = _emailNoticeConfigrepository + //.WhereIf(inQuery.SystemLevel == null, t => t.SystemLevel == SysEmailLevel.not_sys) + //.WhereIf(inQuery.SystemLevel != null, t => t.SystemLevel == inQuery.SystemLevel) + //.WhereIf(inQuery.IsDistinguishCriteria != null, t => t.IsDistinguishCriteria == inQuery.IsDistinguishCriteria) + .WhereIf(inQuery.CriterionTypeEnum != null, t => t.CriterionTypeEnum == inQuery.CriterionTypeEnum) + .WhereIf(inQuery.BusinessScenarioEnum != null, t => t.BusinessScenarioEnum == inQuery.BusinessScenarioEnum) + .WhereIf(inQuery.IsReturnRequired != null, t => t.IsReturnRequired == inQuery.IsReturnRequired) + .WhereIf(inQuery.IsEnable != null, t => t.IsEnable == inQuery.IsEnable) + .ProjectTo(_mapper.ConfigurationProvider); - var criterion = await _readingQuestionCriterionTrialRepository.Where(t => t.Id == inQuery.TrialReadingCriterionId).Select(t => new { t.CriterionType, t.CriterionName }).FirstNotNullAsync(); + var list = await emailNoticeConfigQueryable.SortToListAsync(inQuery); - if (criterion.CriterionType != CriterionType.RECIST1Point1) - { - //---当前标准导出还未支持 - throw new Exception(_localizer["ExcelExport_UnsupportedExport"]); - } - //产生一致性分析的Subject + var exportInfo = new ExcelExportInfo(); - var subjectQuerybal = _visitTaskRepository.Where(t => t.TrialId == inQuery.TrialId && t.TaskState == TaskState.Effect && t.IsSelfAnalysis == true).Select(t => t.SubjectId).Distinct(); - - var allList = await _visitTaskRepository.Where(t => t.TrialId == inQuery.TrialId && t.TaskState == TaskState.Effect && subjectQuerybal.Contains(t.SubjectId) && t.ReadingCategory == ReadingCategory.Visit) - .Where(t => (t.IsSelfAnalysis == true || t.IsSelfAnalysis == null) && t.VisitTaskNum > 0) //一致性分析的结果 + 正常任务的结果 + 仅仅访视的结果 +去除基线 - - //.WhereIf(inQuery.SubjectId != null, t => t.SubjectId == inQuery.SubjectId) - //.WhereIf(inQuery.TaskState != null, t => t.TaskState == inQuery.TaskState) - //.WhereIf(inQuery.IsSelfAnalysis != null, t => t.IsSelfAnalysis == inQuery.IsSelfAnalysis) - - .WhereIf(inQuery.TrialReadingCriterionId != null, t => t.TrialReadingCriterionId == inQuery.TrialReadingCriterionId) - .WhereIf(inQuery.TrialSiteId != null, t => t.Subject.TrialSiteId == inQuery.TrialSiteId) - - .WhereIf(inQuery.IsUrgent != null, t => t.IsUrgent == inQuery.IsUrgent) - .WhereIf(inQuery.DoctorUserId != null, t => t.DoctorUserId == inQuery.DoctorUserId) - .WhereIf(inQuery.ReadingCategory != null, t => t.ReadingCategory == inQuery.ReadingCategory) - .WhereIf(inQuery.ReadingTaskState != null, t => t.ReadingTaskState == inQuery.ReadingTaskState) - .WhereIf(inQuery.TaskAllocationState != null, t => t.TaskAllocationState == inQuery.TaskAllocationState) - .WhereIf(inQuery.ArmEnum != null, t => t.ArmEnum == inQuery.ArmEnum) - .WhereIf(!string.IsNullOrEmpty(inQuery.TrialSiteCode), t => (t.BlindTrialSiteCode.Contains(inQuery.TrialSiteCode!) && t.IsAnalysisCreate) || (t.Subject.TrialSite.TrialSiteCode.Contains(inQuery.TrialSiteCode!) && t.IsAnalysisCreate == false)) - .WhereIf(!string.IsNullOrEmpty(inQuery.TaskName), t => t.TaskName.Contains(inQuery.TaskName) || t.TaskBlindName.Contains(inQuery.TaskName)) - .WhereIf(!string.IsNullOrEmpty(inQuery.SubjectCode), t => t.Subject.Code.Contains(inQuery.SubjectCode)) - .WhereIf(inQuery.BeginAllocateDate != null, t => t.AllocateTime > inQuery.BeginAllocateDate) - .WhereIf(inQuery.EndAllocateDate != null, t => t.AllocateTime < inQuery.EndAllocateDate!.Value.AddDays(1)) - .ProjectTo(_mapper.ConfigurationProvider).ToListAsync(); - - - - var list = allList.Where(t => t.IsSelfAnalysis == null).OrderBy(t => t.TrialSiteCode).ThenBy(t => t.SubjectCode).ThenBy(t => t.VisitTaskNum).ToList(); - - //To do 根据任务Id 找对评估结果,这里需要考虑标准 以及对应的翻译 - - //基线和访视的评估结果翻译枚举 分别对应着 - - foreach (var item in list) - { - //找到一致性分析的结果 - var selfAnalysisTask = allList.Where(t => t.IsSelfAnalysis == true && t.SubjectCode == item.SubjectCode && t.VisitTaskNum == item.VisitTaskNum && t.TaskName == t.TaskName && t.UserName == item.UserName).FirstOrDefault(); - - - //因为基线的评估结果是 是否存在疾病 而 其他访视的结果是 整体肿瘤评估结果 是用不同的枚举翻译的 所以这里手动翻译 不把翻译逻辑耦合到通用的翻译代码里面 在此特殊处理 - - item.AgainEvaluateResult = selfAnalysisTask?.EvaluateResult ?? String.Empty; - - //将自身一致性分析的字段 赋值到访视任务这个字段 - item.IsAnalysisDiffToOriginalData = selfAnalysisTask?.IsAnalysisDiffToOriginalData; - - } - - - var exportInfo = (await _trialRepository.Where(t => t.Id == inQuery.TrialId).IgnoreQueryFilters().ProjectTo(_mapper.ConfigurationProvider).FirstOrDefaultAsync()).IfNullThrowException(); - - exportInfo.CriterionName = await _readingQuestionCriterionTrialRepository.Where(u => u.TrialId == inQuery.TrialId && u.IsConfirm && u.Id == inQuery.TrialReadingCriterionId).Select(t => t.CriterionName).FirstOrDefaultAsync(); exportInfo.List = ExportExcelConverterDate.ConvertToClientTimeInObject(list, _userInfo.TimeZoneId); exportInfo.CurrentTime = ExportExcelConverterDate.DateTimeInternationalToString(DateTime.Now, _userInfo.TimeZoneId); - return await ExcelExportHelper.DataExportAsync(StaticData.Export.TrialSelfAnalysisList_Export, exportInfo, $"{exportInfo.ResearchProgramNo}_{exportInfo.CriterionName}", _commonDocumentRepository, _hostEnvironment, _dictionaryService, typeof(SelftAnalysisExport)); - } - - - /// - /// 组件一致性分析(仅做了resist1.1) - /// - /// - /// - /// - /// - /// - [HttpPost] - public async Task GetGroupAnalysisTaskList_Export(VisitTaskQuery inQuery, - [FromServices] IRepository _commonDocumentRepository, - [FromServices] IDictionaryService _dictionaryService, - [FromServices] IRepository _trialRepository) - { - var criterion = await _readingQuestionCriterionTrialRepository.Where(t => t.Id == inQuery.TrialReadingCriterionId).Select(t => new { t.CriterionType, t.CriterionName }).FirstNotNullAsync(); - - if (criterion.CriterionType != CriterionType.RECIST1Point1) - { - //---当前标准导出还未支持 - throw new Exception(_localizer["ExcelExport_UnsupportedExport"]); - } - - //产生组间一致性分析的Subject - - var subjectQuerybal = _visitTaskRepository.Where(t => t.TrialId == inQuery.TrialId && t.TaskState == TaskState.Effect && t.IsSelfAnalysis == false).Select(t => t.SubjectId).Distinct(); - - var allList = await _visitTaskRepository.Where(t => t.TrialId == inQuery.TrialId && t.TaskState == TaskState.Effect && subjectQuerybal.Contains(t.SubjectId) && t.ReadingCategory == ReadingCategory.Visit) - .Where(t => (t.IsSelfAnalysis == false || t.IsSelfAnalysis == null) && t.VisitTaskNum > 0) //一致性分析的结果 + 正常任务的结果 +仅仅访视的结果 - - //.WhereIf(inQuery.SubjectId != null, t => t.SubjectId == inQuery.SubjectId) - //.WhereIf(inQuery.TaskState != null, t => t.TaskState == inQuery.TaskState) - //.WhereIf(inQuery.IsSelfAnalysis != null, t => t.IsSelfAnalysis == inQuery.IsSelfAnalysis) - - .WhereIf(inQuery.TrialReadingCriterionId != null, t => t.TrialReadingCriterionId == inQuery.TrialReadingCriterionId) - .WhereIf(inQuery.TrialSiteId != null, t => t.Subject.TrialSiteId == inQuery.TrialSiteId) - - .WhereIf(inQuery.IsUrgent != null, t => t.IsUrgent == inQuery.IsUrgent) - .WhereIf(inQuery.DoctorUserId != null, t => t.DoctorUserId == inQuery.DoctorUserId) - .WhereIf(inQuery.ReadingCategory != null, t => t.ReadingCategory == inQuery.ReadingCategory) - .WhereIf(inQuery.ReadingTaskState != null, t => t.ReadingTaskState == inQuery.ReadingTaskState) - .WhereIf(inQuery.TaskAllocationState != null, t => t.TaskAllocationState == inQuery.TaskAllocationState) - .WhereIf(inQuery.ArmEnum != null, t => t.ArmEnum == inQuery.ArmEnum) - .WhereIf(!string.IsNullOrEmpty(inQuery.TrialSiteCode), t => (t.BlindTrialSiteCode.Contains(inQuery.TrialSiteCode!) && t.IsAnalysisCreate) || (t.Subject.TrialSite.TrialSiteCode.Contains(inQuery.TrialSiteCode!) && t.IsAnalysisCreate == false)) - .WhereIf(!string.IsNullOrEmpty(inQuery.TaskName), t => t.TaskName.Contains(inQuery.TaskName) || t.TaskBlindName.Contains(inQuery.TaskName)) - .WhereIf(!string.IsNullOrEmpty(inQuery.SubjectCode), t => t.Subject.Code.Contains(inQuery.SubjectCode)) - .WhereIf(inQuery.BeginAllocateDate != null, t => t.AllocateTime > inQuery.BeginAllocateDate) - .WhereIf(inQuery.EndAllocateDate != null, t => t.AllocateTime < inQuery.EndAllocateDate!.Value.AddDays(1)) - .ProjectTo(_mapper.ConfigurationProvider).ToListAsync(); - - - //找到原任务(非组间一致性分析的) - var list = allList.Where(t => t.IsSelfAnalysis == null).OrderBy(t => t.TrialSiteCode).ThenBy(t => t.SubjectCode).ThenBy(t => t.VisitTaskNum).ToList(); - - - var newList = new List(); - - // 每个subject访视进行分组 - - foreach (var group in list.GroupBy(t => new { t.SubjectCode, t.VisitTaskNum, t.TaskName, t.ArmEnum }) - .OrderBy(g => g.Key.SubjectCode) - .ThenBy(g => g.Key.VisitTaskNum) - //.ThenBy(g => g.Key.ArmEnum) - ) - { - var subjectVisitGroupList = group.ToList(); - - - //找到当前访视组间一致性分析的任务结果 - - var groupTaskList = allList.Where(t => t.IsSelfAnalysis == false && t.SubjectCode == group.Key.SubjectCode && t.VisitTaskNum == group.Key.VisitTaskNum && t.TaskName == group.Key.TaskName).ToList(); - - foreach (var subjectVisitTaskArm in subjectVisitGroupList.OrderBy(t => t.ArmEnum)) - { - - foreach (var item in groupTaskList) - { - var cloneObj = subjectVisitTaskArm.Clone(); - - - cloneObj.AgainUserName = item.UserName; - cloneObj.AgainEvaluateResult = item.EvaluateResult; - cloneObj.AgainArmEnum = item.ArmEnum; - - cloneObj.IsGroupAnalysisDiffToOriginalData = cloneObj.ArmEnum == Arm.DoubleReadingArm1 ? item.IsGroupDiffArm1 : item.IsGroupDiffArm2; - - newList.Add(cloneObj); - } - } - - } - - - - - var exportInfo = (await _trialRepository.Where(t => t.Id == inQuery.TrialId).IgnoreQueryFilters().ProjectTo(_mapper.ConfigurationProvider).FirstOrDefaultAsync()).IfNullThrowException(); - exportInfo.CriterionName = await _readingQuestionCriterionTrialRepository.Where(u => u.TrialId == inQuery.TrialId && u.IsConfirm && u.Id == inQuery.TrialReadingCriterionId).Select(t => t.CriterionName).FirstOrDefaultAsync(); - exportInfo.List = ExportExcelConverterDate.ConvertToClientTimeInObject(newList, _userInfo.TimeZoneId); ; - exportInfo.CurrentTime = ExportExcelConverterDate.DateTimeInternationalToString(DateTime.Now, _userInfo.TimeZoneId); - - - return await ExcelExportHelper.DataExportAsync(StaticData.Export.TrialGroupAnalysisList_Export, exportInfo, $"{exportInfo.ResearchProgramNo}_{exportInfo.CriterionName}", _commonDocumentRepository, _hostEnvironment, _dictionaryService, typeof(GroupAnalysisExport)); + return await ExcelExportHelper.DataExportAsync(StaticData.Export.EmailNoticeConfig_Export, exportInfo, $"{exportInfo.ResearchProgramNo}", _commonDocumentRepository, _hostEnvironment, _dictionaryService, typeof(EmailNoticeConfigExportDto)); } + #region 导表公用 public class ExportDocumentDes @@ -1737,7 +1590,7 @@ namespace IRaCIS.Core.Application.Service.Common #region 通用阅片结果导出 /// - /// 一致性分析结果导出 9 10 分别是自身 和组件一致性 + /// 一致性分析结果导出 7 8 分别是自身 和组件一致性 /// /// /// diff --git a/IRaCIS.Core.Application/Service/Common/_MapConfig.cs b/IRaCIS.Core.Application/Service/Common/_MapConfig.cs index 8ff1c86e0..d55d78cb9 100644 --- a/IRaCIS.Core.Application/Service/Common/_MapConfig.cs +++ b/IRaCIS.Core.Application/Service/Common/_MapConfig.cs @@ -28,6 +28,9 @@ namespace IRaCIS.Core.Application.Service CreateMap() .ForMember(t => t.EmailNoticeUserList, u => u.MapFrom(c => c.EmailNoticeUserTypeList)); + CreateMap(); + + CreateMap() .ForMember(t => t.ParentCode, u => u.MapFrom(c => c.Parent.Code)); CreateMap(); diff --git a/IRaCIS.Core.Domain.Share/Management/SystemNotice.cs b/IRaCIS.Core.Domain.Share/Management/SystemNotice.cs index 4a46cc7b5..e8f5f6d5b 100644 --- a/IRaCIS.Core.Domain.Share/Management/SystemNotice.cs +++ b/IRaCIS.Core.Domain.Share/Management/SystemNotice.cs @@ -55,11 +55,9 @@ namespace IRaCIS.Core.Domain.Share { not_sys = 0, - //系统 不配置角色 - sys_not_role = 1, + //系统 + sys = 1 - //系统需要配置角色的 - sys_Config_role = 2 } public enum FrontAudit diff --git a/IRaCIS.Core.Infrastructure/_IRaCIS/_Config/_StaticData.cs b/IRaCIS.Core.Infrastructure/_IRaCIS/_Config/_StaticData.cs index f936d4bfa..3999919a7 100644 --- a/IRaCIS.Core.Infrastructure/_IRaCIS/_Config/_StaticData.cs +++ b/IRaCIS.Core.Infrastructure/_IRaCIS/_Config/_StaticData.cs @@ -242,6 +242,8 @@ public static class StaticData public static string Internationalization_Export = "Internationalization_Export"; + public static string EmailNoticeConfig_Export = "EmailNoticeConfig_Export"; + //public const string TrialRECIST1Point1SelfAnalysisList_Export = "TrialRECIST1Point1SelfAnalysisList_Export"; //public const string TrialRECIST1Point1GroupAnalysisList_Export = "TrialRECIST1Point1GroupAnalysisList_Export";