diff --git a/IRaCIS.Core.Application/Helper/SendEmailHelper.cs b/IRaCIS.Core.Application/Helper/SendEmailHelper.cs index 41ed362a2..d15a5d857 100644 --- a/IRaCIS.Core.Application/Helper/SendEmailHelper.cs +++ b/IRaCIS.Core.Application/Helper/SendEmailHelper.cs @@ -33,6 +33,7 @@ public static class SendEmailHelper await smtp.AuthenticateAsync(_systemEmailConfig.FromEmail, _systemEmailConfig.AuthorizationCode); + await smtp.SendAsync(messageToSend); await smtp.DisconnectAsync(true); @@ -42,13 +43,28 @@ public static class SendEmailHelper catch (Exception ex) { - //---邮件发送失败,您进行的操作未能成功,请检查邮箱或联系维护人员 + //---邮件发送失败,您进行的操作未能成功,请检查邮箱或联系维护人员 throw new Exception(StaticData.International("SendEmail_SendFail")); } } + public static async Task TestEmailConfigAsync(SystemEmailSendConfig _systemEmailConfig) + { + using (var client = new MailKit.Net.Smtp.SmtpClient()) + { + + await client.ConnectAsync(_systemEmailConfig.Host, _systemEmailConfig.Port, SecureSocketOptions.SslOnConnect); + + await client.AuthenticateAsync(_systemEmailConfig.FromEmail, _systemEmailConfig.AuthorizationCode); + + await client.DisconnectAsync(true); + } + + return true; + } + public static async Task SendEmailAsync(SMTPEmailConfig sMTPEmailConfig, EventHandler? messageSentSuccess = null) { var messageToSend = new MimeMessage(); @@ -63,7 +79,7 @@ public static class SendEmailHelper if (sMTPEmailConfig.ToMailAddressList.Count == 0) { - //---没有收件人 + //---没有收件人 throw new ArgumentException(StaticData.International("SendEmail_NoRecipient")); } else diff --git a/IRaCIS.Core.Application/Service/Document/TrialEmailNoticeConfigService.cs b/IRaCIS.Core.Application/Service/Document/TrialEmailNoticeConfigService.cs index 0abc0654d..5289dea1d 100644 --- a/IRaCIS.Core.Application/Service/Document/TrialEmailNoticeConfigService.cs +++ b/IRaCIS.Core.Application/Service/Document/TrialEmailNoticeConfigService.cs @@ -1384,8 +1384,6 @@ namespace IRaCIS.Core.Application.Service return ResponseOutput.Ok(entity.Id.ToString()); - - } else { @@ -1424,10 +1422,7 @@ namespace IRaCIS.Core.Application.Service private async Task TestEmailConfigAsync(TrialEmailNoticeConfigAddOrEdit config) { - var toUserList = await _repository.Where(t => t.TrialId == config.TrialId) - .WhereIf(config.ToUserTypeList != null, t => config.ToUserTypeList.Contains(t.User.UserTypeEnum)) - .Select(t => new { t.User.EMail, t.User.FullName }).ToListAsync(); - + if (!config.FromEmail.Contains("@") || string.IsNullOrEmpty(config.FromEmail)) { @@ -1435,52 +1430,16 @@ namespace IRaCIS.Core.Application.Service throw new BusinessValidationFailedException(_localizer["TrialEmailN_InvalidEmailConfig"]); } - - if (toUserList.Count() == 0 || toUserList.Where(t => t.EMail.Contains("@")).Count() == 0) - { - //---项目没有有效的收件人,无法发送邮件 - throw new BusinessValidationFailedException(_localizer["TrialEmailN_InvalidRecipient"]); - } - - var sendEmailConfig = new SMTPEmailConfig(); - - sendEmailConfig.FromEmailAddress = new MimeKit.MailboxAddress(config.FromName, config.FromEmail); - sendEmailConfig.AuthorizationCode = config.AuthorizationCode; - sendEmailConfig.UserName = config.FromEmail; - - sendEmailConfig.Host = config.SMTPServerAddress; - sendEmailConfig.Port = config.SMTPServerPort; - - - sendEmailConfig.ToMailAddressList.Add(new MimeKit.MailboxAddress(config.FromName, config.FromEmail)); - - - var pathToFile = _hostEnvironment.WebRootPath - + Path.DirectorySeparatorChar.ToString() - + "EmailTemplate" - + Path.DirectorySeparatorChar.ToString() - //+ "EmailConfigTest.html"; - - + (_userInfo.IsEn_Us ? "EmailConfigTest_US.html" : "EmailConfigTest.html"); - - - //---项目邮件测试 - sendEmailConfig.TopicDescription = _localizer["TrialEmailN_EmailTestMessage"]; - - using (StreamReader SourceReader = System.IO.File.OpenText(pathToFile)) - { - var templateInfo = SourceReader.ReadToEnd(); - - - sendEmailConfig.HtmlBodyStr = string.Format(templateInfo, - //--- 收到此邮件,代表邮件配置正确 - _localizer["TrialEmailN_ConfigurationCorrect"] - ); - } - try { - await SendEmailHelper.SendEmailAsync(sendEmailConfig); + await SendEmailHelper.TestEmailConfigAsync(new SystemEmailSendConfig() + { + AuthorizationCode = config.AuthorizationCode, + FromEmail = config.FromEmail, + FromName = config.FromName, + Host = config.SMTPServerAddress, + Port = config.SMTPServerPort + }); } catch (Exception ex) @@ -1490,6 +1449,72 @@ namespace IRaCIS.Core.Application.Service throw new BusinessValidationFailedException(_localizer["TrialEmailN_InvalidSenderEmailConfig"] + ex.Message); } + + + + #region 人员还未加入,可以先配置邮件 历史废弃 + + //var toUserList = await _repository.Where(t => t.TrialId == config.TrialId) + // .WhereIf(config.ToUserTypeList != null, t => config.ToUserTypeList.Contains(t.User.UserTypeEnum)) + // .Select(t => new { t.User.EMail, t.User.FullName }).ToListAsync(); + + + //if (toUserList.Count() == 0 || toUserList.Where(t => t.EMail.Contains("@")).Count() == 0) + //{ + // //---项目没有有效的收件人,无法发送邮件 + // throw new BusinessValidationFailedException(_localizer["TrialEmailN_InvalidRecipient"]); + //} + + //var sendEmailConfig = new SMTPEmailConfig(); + + //sendEmailConfig.FromEmailAddress = new MimeKit.MailboxAddress(config.FromName, config.FromEmail); + //sendEmailConfig.AuthorizationCode = config.AuthorizationCode; + //sendEmailConfig.UserName = config.FromEmail; + + //sendEmailConfig.Host = config.SMTPServerAddress; + //sendEmailConfig.Port = config.SMTPServerPort; + + + //sendEmailConfig.ToMailAddressList.Add(new MimeKit.MailboxAddress(config.FromName, config.FromEmail)); + + + //var pathToFile = _hostEnvironment.WebRootPath + // + Path.DirectorySeparatorChar.ToString() + // + "EmailTemplate" + // + Path.DirectorySeparatorChar.ToString() + // //+ "EmailConfigTest.html"; + + // + (_userInfo.IsEn_Us ? "EmailConfigTest_US.html" : "EmailConfigTest.html"); + + + ////---项目邮件测试 + //sendEmailConfig.TopicDescription = _localizer["TrialEmailN_EmailTestMessage"]; + + //using (StreamReader SourceReader = System.IO.File.OpenText(pathToFile)) + //{ + // var templateInfo = SourceReader.ReadToEnd(); + + + // sendEmailConfig.HtmlBodyStr = string.Format(templateInfo, + // //--- 收到此邮件,代表邮件配置正确 + // _localizer["TrialEmailN_ConfigurationCorrect"] + // ); + //} + + //try + //{ + // await SendEmailHelper.SendEmailAsync(sendEmailConfig); + + //} + //catch (Exception ex) + //{ + + // //---发件人配置错误,请核对服务器地址或者授权码是否填写有误 + // throw new BusinessValidationFailedException(_localizer["TrialEmailN_InvalidSenderEmailConfig"] + ex.Message); + //} + + #endregion + } diff --git a/IRaCIS.Core.Application/Service/Inspection/FrontAuditConfigService.cs b/IRaCIS.Core.Application/Service/Inspection/FrontAuditConfigService.cs index fa7bcb1e9..8daf7cccd 100644 --- a/IRaCIS.Core.Application/Service/Inspection/FrontAuditConfigService.cs +++ b/IRaCIS.Core.Application/Service/Inspection/FrontAuditConfigService.cs @@ -754,7 +754,7 @@ namespace IRaCIS.Core.Application.Service { JArray arrays = (JArray)value; - + //动态配置表翻译 if (item.DataType == "Table") { var tableConfigList = JsonConvert.DeserializeObject>(item.TableConfigJsonStr) ?? new List(); diff --git a/IRaCIS.Core.Application/Service/QC/QCOperationService.cs b/IRaCIS.Core.Application/Service/QC/QCOperationService.cs index c353ce620..d716abeae 100644 --- a/IRaCIS.Core.Application/Service/QC/QCOperationService.cs +++ b/IRaCIS.Core.Application/Service/QC/QCOperationService.cs @@ -716,9 +716,10 @@ namespace IRaCIS.Core.Application.Image.QA study.BodyPartForEdit = updateModalityCommand.BodyPart; - //study.Modalities = updateModalityCommand.Modality; + study.ModalityForEdit = updateModalityCommand.Modality; - await _repository.BatchUpdateAsync(t => t.StudyId == studyId, r => new DicomSeries() { BodyPartForEdit = updateModalityCommand.BodyPart, Modality = updateModalityCommand.Modality }); + + await _repository.BatchUpdateAsync(t => t.StudyId == studyId, r => new DicomSeries() { BodyPartForEdit = updateModalityCommand.BodyPart }); } else if (updateModalityCommand.Type == 2) { diff --git a/IRaCIS.Core.Application/Service/Reading/AdditionalEvaluate/SubjectCriteriaEvaluationService.cs b/IRaCIS.Core.Application/Service/Reading/AdditionalEvaluate/SubjectCriteriaEvaluationService.cs index e7e9a8882..03545bd9a 100644 --- a/IRaCIS.Core.Application/Service/Reading/AdditionalEvaluate/SubjectCriteriaEvaluationService.cs +++ b/IRaCIS.Core.Application/Service/Reading/AdditionalEvaluate/SubjectCriteriaEvaluationService.cs @@ -72,7 +72,7 @@ namespace IRaCIS.Core.Application.Service /// /// [HttpPost] - public async Task<(PageOutput, object)> GetSubjectCriteriaEvaluationList(SubjectCriteriaEvaluationQuery inQuery) + public async Task> > GetSubjectCriteriaEvaluationList(SubjectCriteriaEvaluationQuery inQuery) { var trialReadingCritionList = _trialReadingCriterionRepository.Where(t => t.TrialId == inQuery.TrialId).ToList(); @@ -235,7 +235,7 @@ namespace IRaCIS.Core.Application.Service - return (pageList, addtionalQustionInfoList); + return ResponseOutput.Ok (pageList, addtionalQustionInfoList); } @@ -257,17 +257,24 @@ namespace IRaCIS.Core.Application.Service { var entity = await _subjectCriteriaEvaluationRepository.InsertFromDTOAsync(addOrEditSubjectCriteriaEvaluation); - //找到一致性核查通过的访视 并且没有 自动影像筛选的数据 - var subjectVisitIdList = await _subjectVisitRepository.Where(t => t.SubjectId == addOrEditSubjectCriteriaEvaluation.SubjectId && t.CheckState == CheckStateEnum.CVPassed - && !t.SubjectCriteriaEvaluationVisitFilterList.Any(t => t.TrialReadingCriterionId == addOrEditSubjectCriteriaEvaluation.TrialReadingCriterionId && t.SubjectId == addOrEditSubjectCriteriaEvaluation.SubjectId)).Select(t => t.Id) - .ToListAsync(); - - - foreach (var subjectVisitId in subjectVisitIdList) + if (addOrEditSubjectCriteriaEvaluation.IsJoinEvaluation) { - await AutoSubjectCriteriaEvaluationVisitFilter(addOrEditSubjectCriteriaEvaluation.SubjectId, subjectVisitId, addOrEditSubjectCriteriaEvaluation.TrialReadingCriterionId); + + //找到一致性核查通过的访视 并且没有 自动影像筛选的数据 + var subjectVisitIdList = await _subjectVisitRepository.Where(t => t.SubjectId == addOrEditSubjectCriteriaEvaluation.SubjectId && t.CheckState == CheckStateEnum.CVPassed + && !t.SubjectCriteriaEvaluationVisitFilterList.Any(t => t.TrialReadingCriterionId == addOrEditSubjectCriteriaEvaluation.TrialReadingCriterionId && t.SubjectId == addOrEditSubjectCriteriaEvaluation.SubjectId)).Select(t => t.Id) + .ToListAsync(); + + + foreach (var subjectVisitId in subjectVisitIdList) + { + await AutoSubjectCriteriaEvaluationVisitFilter(addOrEditSubjectCriteriaEvaluation.SubjectId, subjectVisitId, addOrEditSubjectCriteriaEvaluation.TrialReadingCriterionId); + } + } + + } //编辑 diff --git a/IRaCIS.Core.Application/Service/TrialSiteUser/TrialConfigService.cs b/IRaCIS.Core.Application/Service/TrialSiteUser/TrialConfigService.cs index 3b0cbc4cf..64e0c7b64 100644 --- a/IRaCIS.Core.Application/Service/TrialSiteUser/TrialConfigService.cs +++ b/IRaCIS.Core.Application/Service/TrialSiteUser/TrialConfigService.cs @@ -39,8 +39,8 @@ namespace IRaCIS.Core.Application private readonly IOrganInfoService _iOrganInfoService; private readonly IRepository _taskAllocationRuleRepository; private readonly IRepository _readingCriterionDictionaryRepository; - private readonly IRepository _readingTrialCriterionDictionaryRepository; - private readonly IReadingQuestionService iReadingQuestionService; + private readonly IRepository _readingTrialCriterionDictionaryRepository; + private readonly IReadingQuestionService iReadingQuestionService; private readonly IRepository _trialCriterionAdditionalAssessmentTypeRepository; private readonly IRepository _readingTaskQuestionAnswer; @@ -62,8 +62,8 @@ namespace IRaCIS.Core.Application IRepository readingCriterionPageRepository, IRepository taskAllocationRuleRepository, IRepository readingCriterionDictionaryRepository, - IRepository readingTrialCriterionDictionaryRepository, - IReadingQuestionService iReadingQuestionService, + IRepository readingTrialCriterionDictionaryRepository, + IReadingQuestionService iReadingQuestionService, IEasyCachingProvider provider, IOrganInfoService iOrganInfoService, IRepository trialCriterionAdditionalAssessmentTypeRepository, @@ -79,8 +79,8 @@ namespace IRaCIS.Core.Application _trialRepository = trialRepository; _taskAllocationRuleRepository = taskAllocationRuleRepository; this._readingCriterionDictionaryRepository = readingCriterionDictionaryRepository; - this._readingTrialCriterionDictionaryRepository = readingTrialCriterionDictionaryRepository; - this.iReadingQuestionService = iReadingQuestionService; + this._readingTrialCriterionDictionaryRepository = readingTrialCriterionDictionaryRepository; + this.iReadingQuestionService = iReadingQuestionService; this._trialQCQuestionRepository = trialQCQuestionRepository; this._readingQuestionCriterionTrialRepository = readingQuestionCriterionTrialRepository; this._readingQuestionTrialRepository = readingQuestionTrialRepository; @@ -269,15 +269,16 @@ namespace IRaCIS.Core.Application var criterionDictionaryList = await _readingCriterionDictionaryRepository.Where(x => x.CriterionId == trialCriterion.ReadingQuestionCriterionSystemId.Value) - .Select(x=>new ReadingTrialCriterionDictionary() { + .Select(x => new ReadingTrialCriterionDictionary() + { - CriterionId = inDto.TrialReadingCriterionId, - CrterionDictionaryGroup=x.CrterionDictionaryGroup, - IsBaseLineUse=x.IsBaseLineUse, - IsFollowVisitUse=x.IsFollowVisitUse, - DictionaryId=x.DictionaryId, - ParentCode=x.ParentCode, - }) + CriterionId = inDto.TrialReadingCriterionId, + CrterionDictionaryGroup = x.CrterionDictionaryGroup, + IsBaseLineUse = x.IsBaseLineUse, + IsFollowVisitUse = x.IsFollowVisitUse, + DictionaryId = x.DictionaryId, + ParentCode = x.ParentCode, + }) .ToListAsync(); criterionDictionaryList.ForEach(x => @@ -287,7 +288,7 @@ namespace IRaCIS.Core.Application }); - await _readingTrialCriterionDictionaryRepository.AddRangeAsync(criterionDictionaryList); + await _readingTrialCriterionDictionaryRepository.AddRangeAsync(criterionDictionaryList); await _trialCriterionDictionaryCode.AddRangeAsync(criterionDictionaryCodeList); #endregion @@ -624,7 +625,7 @@ namespace IRaCIS.Core.Application if (inDto.TrialCriterionAdditionalAssessmentTypeList.All(t => t.IsSelected != true)) { - //---选择了附加评估,必须勾选附加评估类型 + //---选择了附加评估,必须勾选附加评估类型 throw new BusinessValidationFailedException(_localizer["TrialConfig_AddEvalReq"]); } @@ -641,7 +642,7 @@ namespace IRaCIS.Core.Application AdditionalAssessment additional = new AdditionalAssessment(); var addTypeList = additional.GetSystemDefeaultAdditionalAssessmentList(updateItem.CriterionType, updateItem.AdditionalAssessmentType); - if(!await _readingQuestionTrialRepository.AsQueryable().IgnoreQueryFilters().AnyAsync(t => t.ReadingQuestionCriterionTrialId == updateItem.TrialReadingCriterionId && t.IsAdditional==true)) + if (!await _readingQuestionTrialRepository.AsQueryable().IgnoreQueryFilters().AnyAsync(t => t.ReadingQuestionCriterionTrialId == updateItem.TrialReadingCriterionId && t.IsAdditional == true)) { foreach (var addType in addTypeList) { @@ -653,9 +654,9 @@ namespace IRaCIS.Core.Application await _readingQuestionTrialRepository.AddAsync(question); } } - } + } } - + await _trialCriterionAdditionalAssessmentTypeRepository.UpdatePartialFromQueryAsync(updateItem.Id, t => new TrialCriterionAdditionalAssessmentType() { IsSelected = updateItem.IsSelected }); } } @@ -953,6 +954,47 @@ namespace IRaCIS.Core.Application _mapper.Map(trialConfig, trialInfo); + //不管是否修改,一定要记录稽查 + trialInfo.UpdateTime=DateTime.Now; + + //// 修改临床数据 + + var clinicalDataTrialSetList = await _clinicalDataTrialSetRepository.Where(x => x.TrialId == trialConfig.TrialId, true).ToListAsync(); + + foreach (var item in clinicalDataTrialSetList) + { + + if(trialConfig.ClinicalDataTrialSetIds.Contains(item.Id)) + { + item.IsConfirm = true; + } + else + { + item.IsConfirm = false; + } + } + //// 修改阅片标准 + + var readingQuestionCriterionTrialList = await _readingQuestionCriterionTrialRepository.Where(x => x.TrialId == trialConfig.TrialId, true).ToListAsync(); + + foreach (var item in readingQuestionCriterionTrialList) + { + + if (trialConfig.TrialCriterionIds.Contains(item.Id)) + { + item.IsConfirm = true; + } + else + { + item.IsConfirm = false; + } + } + + #region 废弃 + + + #endregion + //if (trialInfo.IsGlobalReading && (trialInfo.IsArbitrationReading ?? false)) //{ // trialInfo.ArbitrationRule = ArbitrationRule.Reading; @@ -962,40 +1004,40 @@ namespace IRaCIS.Core.Application //{ // trialInfo.ArbitrationRule = ArbitrationRule.Visit; //} - trialInfo.UpdateTime = DateTime.Now; + //trialInfo.UpdateTime = DateTime.Now; - // 修改临床数据 - var noconfirmids = await _clinicalDataTrialSetRepository.Where(x => x.TrialId == trialConfig.TrialId && !trialConfig.ClinicalDataTrialSetIds.Contains(x.Id)).Select(x => x.Id).ToListAsync(); - foreach (var item in trialConfig.ClinicalDataTrialSetIds) - { - await _clinicalDataTrialSetRepository.UpdatePartialFromQueryAsync(item, x => new ClinicalDataTrialSet() - { + //// 修改临床数据 + //var noconfirmids = await _clinicalDataTrialSetRepository.Where(x => x.TrialId == trialConfig.TrialId && !trialConfig.ClinicalDataTrialSetIds.Contains(x.Id)).Select(x => x.Id).ToListAsync(); + //foreach (var item in trialConfig.ClinicalDataTrialSetIds) + //{ + // await _clinicalDataTrialSetRepository.UpdatePartialFromQueryAsync(item, x => new ClinicalDataTrialSet() + // { - IsConfirm = true - }); - } + // IsConfirm = true + // }); + //} - foreach (var item in noconfirmids) - { - await _clinicalDataTrialSetRepository.UpdatePartialFromQueryAsync(item, x => new ClinicalDataTrialSet() - { + //foreach (var item in noconfirmids) + //{ + // await _clinicalDataTrialSetRepository.UpdatePartialFromQueryAsync(item, x => new ClinicalDataTrialSet() + // { - IsConfirm = false - }); - } + // IsConfirm = false + // }); + //} - // 修改阅片标准 - var cancelConfirmCriterionIds = await _readingQuestionCriterionTrialRepository.Where(x => x.TrialId == trialConfig.TrialId && x.IsConfirm && !trialConfig.TrialCriterionIds.Contains(x.Id)).Select(x => x.Id).ToListAsync(); + //// 修改阅片标准 + //var cancelConfirmCriterionIds = await _readingQuestionCriterionTrialRepository.Where(x => x.TrialId == trialConfig.TrialId && x.IsConfirm && !trialConfig.TrialCriterionIds.Contains(x.Id)).Select(x => x.Id).ToListAsync(); - await _readingQuestionCriterionTrialRepository.UpdatePartialFromQueryAsync(x => cancelConfirmCriterionIds.Contains(x.Id), x => new ReadingQuestionCriterionTrial() - { - IsConfirm = false - }); + //await _readingQuestionCriterionTrialRepository.UpdatePartialFromQueryAsync(x => cancelConfirmCriterionIds.Contains(x.Id), x => new ReadingQuestionCriterionTrial() + //{ + // IsConfirm = false + //}); - await _readingQuestionCriterionTrialRepository.UpdatePartialFromQueryAsync(x => trialConfig.TrialCriterionIds.Contains(x.Id), x => new ReadingQuestionCriterionTrial() - { - IsConfirm = true - }); ; + //await _readingQuestionCriterionTrialRepository.UpdatePartialFromQueryAsync(x => trialConfig.TrialCriterionIds.Contains(x.Id), x => new ReadingQuestionCriterionTrial() + //{ + // IsConfirm = true + //}); ; @@ -1159,11 +1201,11 @@ namespace IRaCIS.Core.Application public async Task GetTrialConfigInfo(Guid trialId) { return await _trialRepository.Where(t => t.Id == trialId).ProjectTo(_mapper.ConfigurationProvider, new - { - isEn_Us = _userInfo.IsEn_Us + { + isEn_Us = _userInfo.IsEn_Us - }) - .FirstOrDefaultAsync().IfNullThrowException(); + }) + .FirstOrDefaultAsync().IfNullThrowException(); } diff --git a/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs b/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs index 35527fffa..e5b14d333 100644 --- a/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs +++ b/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs @@ -120,24 +120,14 @@ namespace IRaCIS.Core.Infra.EFCore.Common //阅片标准 var criterionNameList = await _dbContext.ReadingQuestionCriterionTrial.Where(t => t.TrialId == entity.Id && t.IsConfirm).OrderBy(t => t.ShowOrder).Select(t => t.CriterionName).ToListAsync(); + var memoryCriterionNameList = entitys.Where(x => x.Entity.GetType() == typeof(ReadingQuestionCriterionTrial)).Select(t => t.Entity as ReadingQuestionCriterionTrial) + .Where(t => t.TrialId == entity.Id && t.IsConfirm).OrderBy(t => t.ShowOrder).Select(t => t.CriterionName).ToList(); + //临床数据配置 var clinicalDataSetNameList = await _dbContext.ClinicalDataTrialSet.Where(t => t.TrialId == entity.Id && t.IsConfirm).Select(t => t.ClinicalDataSetName).ToListAsync(); - - - - //List trialDics = new List(); - //var dictionaryIds = new List(); - //if (entity.TrialDicList == null || entity.TrialDicList.Count == 0) - //{ - // dictionaryIds = await this._dbContext.TrialDictionary.Where(x => x.TrialId == entity.Id && x.KeyName == "Criterion").Select(x => x.DictionaryId).ToListAsync(); - //} - //else - //{ - // dictionaryIds = entity.TrialDicList.Select(x => x.DictionaryId).ToList(); - //} - //trialDics = await this._dbContext.Dictionary.Where(x => dictionaryIds.Contains(x.Id)).Select(x => x.ValueCN).ToListAsync(); - + var memoryClinicalDataSetNameList = entitys.Where(x => x.Entity.GetType() == typeof(ClinicalDataTrialSet)).Select(t => t.Entity as ClinicalDataTrialSet) + .Where(t => t.TrialId == entity.Id && t.IsConfirm).Select(t => t.ClinicalDataSetName).ToList(); Guid id = entity.Id; @@ -173,9 +163,9 @@ namespace IRaCIS.Core.Infra.EFCore.Common { //TrialDicList = string.Join(",", trialDics) - CriterionNames = criterionNameList.Count() > 0 ? string.Join(",", criterionNameList) : string.Empty, + CriterionNames = string.Join(",", criterionNameList.Union(memoryCriterionNameList).Distinct()) , - ClinicalDataSetNames = clinicalDataSetNameList.Count() > 0 ? string.Join(",", clinicalDataSetNameList) : String.Empty, + ClinicalDataSetNames = string.Join(",", clinicalDataSetNameList.Union(memoryClinicalDataSetNameList).Distinct().OrderBy(t=>t)) , }); ; @@ -286,7 +276,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common }, new { EvaluationResultTypes = dicValueList.Count > 0 ? string.Join(",", dicValueList) : string.Empty, - AdditionalAssessmentTypeList= addtionalAssesementList + AdditionalAssessmentTypeList = addtionalAssesementList }); } @@ -576,7 +566,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common var entity = item.Entity as CriterionNidusSystem; - + await InsertInspection(entity, type, x => new InspectionConvertDTO() { IsDistinctionInterface = false, @@ -770,6 +760,9 @@ namespace IRaCIS.Core.Infra.EFCore.Common #endregion + #region 文档相关 + + // 系统文件签署 父层级未记录稽查(系统文档初始数据) foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(SystemDocConfirmedUser))) @@ -777,11 +770,28 @@ namespace IRaCIS.Core.Infra.EFCore.Common var type = GetEntityAuditOpt(item); var entity = item.Entity as SystemDocConfirmedUser; + + var extraIdentification = string.Empty; + + + if (type == AuditOpt.Update) + { + if (entity.IsDeleted == true) + { + extraIdentification = "/" + 2; + } + else + { + extraIdentification = "/" + 1; + } + } + + var systemDocument = await _dbContext.SystemDocument.Where(x => x.Id == entity.SystemDocumentId).FirstOrDefaultAsync(); await InsertInspection(entity, type, x => new InspectionConvertDTO() { GeneralId = x.Id, - + ExtraIndentification = extraIdentification, ObjectRelationParentId = x.SystemDocumentId }, new @@ -804,12 +814,27 @@ namespace IRaCIS.Core.Infra.EFCore.Common var entity = item.Entity as TrialDocConfirmedUser; + var extraIdentification = string.Empty; + + + if (type == AuditOpt.Update) + { + if (entity.IsDeleted == true) + { + extraIdentification = "/" + 2; + } + else + { + extraIdentification = "/" + 1; + } + } + var trialDoc = await _dbContext.TrialDocument.Where(x => x.Id == entity.TrialDocumentId).FirstOrDefaultAsync(); await InsertInspection(entity as TrialDocConfirmedUser, type, x => new InspectionConvertDTO() { TrialId = trialDoc.TrialId, - + ExtraIndentification = extraIdentification, ObjectRelationParentId = x.TrialDocumentId }, new @@ -824,6 +849,174 @@ namespace IRaCIS.Core.Infra.EFCore.Common } + //系统文件 + foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(SystemDocument))) + { + var type = GetEntityAuditOpt(item); + + var entity = item.Entity as SystemDocument; + + List needConfirmedUserTypeIdList = new List(); + + if (entity.NeedConfirmedUserTypeList == null) + { + needConfirmedUserTypeIdList = await _dbContext.SystemDocNeedConfirmedUserType.Where(x => x.SystemDocumentId == entity.Id).Select(t => t.NeedConfirmUserTypeId).ToListAsync(); + } + else + { + needConfirmedUserTypeIdList = entity.NeedConfirmedUserTypeList.Select(t => t.NeedConfirmUserTypeId).ToList(); + } + + + var userTypeNameList = await _dbContext.UserType.Where(x => needConfirmedUserTypeIdList.Contains(x.Id)).Select(x => x.UserTypeShortName).ToListAsync(); + var userTypeName = string.Join(",", userTypeNameList); + await InsertInspection(entity, type, x => new InspectionConvertDTO() + { + IsDistinctionInterface = false + }, new + { + NeedConfirmedUserType = userTypeName, + }); + } + + // 项目文档 + foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(TrialDocument))) + { + var type = GetEntityAuditOpt(item); + + var entity = item.Entity as TrialDocument; + + List needConfirmedUserTypeIdList = new List(); + + if (entity.NeedConfirmedUserTypeList == null) + { + needConfirmedUserTypeIdList = await _dbContext.TrialDocNeedConfirmedUserType.Where(x => x.TrialDocumentId == entity.Id).Select(t => t.NeedConfirmUserTypeId).ToListAsync(); + } + else + { + needConfirmedUserTypeIdList = entity.NeedConfirmedUserTypeList.Select(t => t.NeedConfirmUserTypeId).ToList(); + } + + var usertypeNames = await _dbContext.UserType.Where(x => needConfirmedUserTypeIdList.Contains(x.Id)).Select(x => x.UserTypeShortName).ToListAsync(); + var usertypeName = string.Join(",", usertypeNames); + await InsertInspection(entity, type, x => new InspectionConvertDTO() + { + IsDistinctionInterface = false, + ObjectRelationParentId = x.TrialId + }, + new + { + NeedConfirmedUserType = usertypeName, + }); + + + } + + //项目标准自动发送邮件配置 + foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(TrialEmailNoticeConfig))) + { + var type = GetEntityAuditOpt(item); + + var extraIdentification = string.Empty; + + var entity = item.Entity as TrialEmailNoticeConfig; + + //找到配置的用户 + var configUserTypeList = entitys.Where(x => x.Entity.GetType() == typeof(TrialEmailNoticeUser)).Select(t => t.Entity as TrialEmailNoticeUser) + .Where(t => t.TrialEmailNoticeConfigId == entity.Id).Select(t => + new { t.TrialEmailNoticeConfigId, t.EmailUserType, t.UserType }).ToList(); + + if (_userInfo.RequestUrl == "TrialEmailNoticeConfig/getTrialEmailNoticeConfigList") + { + extraIdentification = "/Auto"; + } + + await InsertInspection(entity, type, x => new InspectionConvertDTO() + { + IsDistinctionInterface = false, + ObjectRelationParentId = x.TrialReadingCriterionId, + ExtraIndentification = extraIdentification + }, + new + { + ToUserTypes = configUserTypeList.Where(t => t.EmailUserType == EmailUserType.To).Select(t => t.UserType).ToList(), + CopyUserTypes = configUserTypeList.Where(t => t.EmailUserType == EmailUserType.Copy).Select(t => t.UserType).ToList(), + }); + + + } + + #endregion + + #region 附加评估 + + // 是否参与附加评估记录表 + foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(SubjectCriteriaEvaluation))) + { + var type = GetEntityAuditOpt(item); + + //var extraIdentification = string.Empty; + + var entity = item.Entity as SubjectCriteriaEvaluation; + + + await InsertInspection(entity, type, x => new InspectionConvertDTO() + { + IsDistinctionInterface = false, + ObjectRelationParentId = x.SubjectId, + ObjectRelationParentId2 = x.TrialReadingCriterionId, + + TrialReadingCriterionId = x.TrialReadingCriterionId, + }); + + + } + + foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(SubjectCriteriaEvaluationVisitFilter))) + { + var type = GetEntityAuditOpt(item); + + var extraIdentification = string.Empty; + + var entity = item.Entity as SubjectCriteriaEvaluationVisitFilter; + + await InsertInspection(entity, type, x => new InspectionConvertDTO() + { + IsDistinctionInterface = false, + ObjectRelationParentId = x.SubjectVisitId, + ObjectRelationParentId2 = x.TrialReadingCriterionId, + + TrialReadingCriterionId = x.TrialReadingCriterionId, + }); + } + + foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(SubjectCriteriaEvaluationVisitStudyFilter))) + { + var type = GetEntityAuditOpt(item); + + var extraIdentification = string.Empty; + + var entity = item.Entity as SubjectCriteriaEvaluationVisitStudyFilter; + + await InsertInspection(entity, type, x => new InspectionConvertDTO() + { + IsDistinctionInterface = false, + ObjectRelationParentId = x.SeriesId, + ObjectRelationParentId2 = x.StudyId, + ObjectRelationParentId3 = x.TrialReadingCriterionId, + + TrialReadingCriterionId = x.TrialReadingCriterionId, + }); + } + + + + #endregion + + #region 医学审核 + + + //医学审核 问题答案 if (entitys.Any(x => x.Entity.GetType() == typeof(ReadingMedicineQuestionAnswer))) { @@ -921,7 +1114,48 @@ namespace IRaCIS.Core.Infra.EFCore.Common }); } + //系统 医学审核问题 + foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(ReadingMedicineSystemQuestion))) + { + var type = GetEntityAuditOpt(item); + var entity = item.Entity as ReadingMedicineSystemQuestion; + + var parentQuestionName = string.Empty; + if (entity.ParentId != null) + { + parentQuestionName = await _dbContext.ReadingMedicineSystemQuestion.Where(x => x.Id == entity.ParentId).Select(x => x.QuestionName).FirstOrDefaultAsync(); + } + + await InsertInspection(entity, type, x => new InspectionConvertDTO() + { + IsDistinctionInterface = false, + }, new { ParentQuestionName = parentQuestionName }); + } + + //项目医学审核问题 + foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(ReadingMedicineTrialQuestion))) + { + var type = GetEntityAuditOpt(item); + + var entity = item.Entity as ReadingMedicineTrialQuestion; + + var parentQuestionName = string.Empty; + if (entity.ParentId != null) + { + parentQuestionName = await _dbContext.ReadingMedicineTrialQuestion.Where(x => x.Id == entity.ParentId).Select(x => x.QuestionName).FirstOrDefaultAsync(); + } + + await InsertInspection(entity, type, x => new InspectionConvertDTO() + { + IsDistinctionInterface = false, + ObjectRelationParentId = x.TrialId + + }, new { ParentQuestionName = parentQuestionName }); + } + + + #endregion #region QC 质疑 一致性核查 @@ -1073,6 +1307,20 @@ namespace IRaCIS.Core.Infra.EFCore.Common var entity = item.Entity as QCChallengeDialog; + var extraIdentification = string.Empty; + + var reason = string.Empty; + + // 对话消息区分用户类型 + + extraIdentification = "/(" + _userInfo.UserTypeShortName + ")"; + + + if (_userInfo.RequestUrl.ToLower() == "qcoperation/closeqcchallenge") + { + reason = entity.TalkContent.Substring(entity.TalkContent.LastIndexOf(':') + 1); + } + await InsertInspection(entity, type, x => new InspectionConvertDTO() { @@ -1082,8 +1330,8 @@ namespace IRaCIS.Core.Infra.EFCore.Common //byzhouhang ObjectRelationParentId = entity.QCChallengeId, - IsDistinctionInterface = false - + IsDistinctionInterface = false, + ExtraIndentification = extraIdentification, }); } //一致性核查 对话 @@ -1093,6 +1341,18 @@ namespace IRaCIS.Core.Infra.EFCore.Common var entity = item.Entity as CheckChallengeDialog; + var extraIdentification = string.Empty; + + var reason = string.Empty; + + extraIdentification = "/(" + _userInfo.UserTypeShortName + ")"; + + if (_userInfo.RequestUrl.ToLower() == "qcoperation/closecheckchallenge") + { + reason = entity.TalkContent.Substring(entity.TalkContent.LastIndexOf(':') + 1); + } + + await InsertInspection(entity, type, x => new InspectionConvertDTO() { @@ -1101,6 +1361,9 @@ namespace IRaCIS.Core.Infra.EFCore.Common //byzhouhang IsDistinctionInterface = false, + Reason = reason, + + ExtraIndentification=extraIdentification, ObjectRelationParentId = entity.SubjectVisitId, } @@ -1235,73 +1498,6 @@ namespace IRaCIS.Core.Infra.EFCore.Common }); } - - - - - //系统文件 - foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(SystemDocument))) - { - var type = GetEntityAuditOpt(item); - - var entity = item.Entity as SystemDocument; - - List needConfirmedUserTypeIdList = new List(); - - if (entity.NeedConfirmedUserTypeList == null) - { - needConfirmedUserTypeIdList = await _dbContext.SystemDocNeedConfirmedUserType.Where(x => x.SystemDocumentId == entity.Id).Select(t => t.NeedConfirmUserTypeId).ToListAsync(); - } - else - { - needConfirmedUserTypeIdList = entity.NeedConfirmedUserTypeList.Select(t => t.NeedConfirmUserTypeId).ToList(); - } - - - var userTypeNameList = await _dbContext.UserType.Where(x => needConfirmedUserTypeIdList.Contains(x.Id)).Select(x => x.UserTypeShortName).ToListAsync(); - var userTypeName = string.Join(",", userTypeNameList); - await InsertInspection(entity, type, x => new InspectionConvertDTO() - { - IsDistinctionInterface = false - }, new - { - NeedConfirmedUserType = userTypeName, - }); - } - - // 项目文档 - foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(TrialDocument))) - { - var type = GetEntityAuditOpt(item); - - var entity = item.Entity as TrialDocument; - - List needConfirmedUserTypeIdList = new List(); - - if (entity.NeedConfirmedUserTypeList == null) - { - needConfirmedUserTypeIdList = await _dbContext.TrialDocNeedConfirmedUserType.Where(x => x.TrialDocumentId == entity.Id).Select(t => t.NeedConfirmUserTypeId).ToListAsync(); - } - else - { - needConfirmedUserTypeIdList = entity.NeedConfirmedUserTypeList.Select(t => t.NeedConfirmUserTypeId).ToList(); - } - - var usertypeNames = await _dbContext.UserType.Where(x => needConfirmedUserTypeIdList.Contains(x.Id)).Select(x => x.UserTypeShortName).ToListAsync(); - var usertypeName = string.Join(",", usertypeNames); - await InsertInspection(entity, type, x => new InspectionConvertDTO() - { - IsDistinctionInterface = false, - ObjectRelationParentId = x.TrialId - }, - new - { - NeedConfirmedUserType = usertypeName, - }); - - - } - //系统 Qc 问题 foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(QCQuestion))) { @@ -1368,45 +1564,6 @@ namespace IRaCIS.Core.Infra.EFCore.Common }); } - //系统 医学审核问题 - foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(ReadingMedicineSystemQuestion))) - { - var type = GetEntityAuditOpt(item); - - var entity = item.Entity as ReadingMedicineSystemQuestion; - - var parentQuestionName = string.Empty; - if (entity.ParentId != null) - { - parentQuestionName = await _dbContext.ReadingMedicineSystemQuestion.Where(x => x.Id == entity.ParentId).Select(x => x.QuestionName).FirstOrDefaultAsync(); - } - - await InsertInspection(entity, type, x => new InspectionConvertDTO() - { - IsDistinctionInterface = false, - }, new { ParentQuestionName = parentQuestionName }); - } - - //项目医学审核问题 - foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(ReadingMedicineTrialQuestion))) - { - var type = GetEntityAuditOpt(item); - - var entity = item.Entity as ReadingMedicineTrialQuestion; - - var parentQuestionName = string.Empty; - if (entity.ParentId != null) - { - parentQuestionName = await _dbContext.ReadingMedicineTrialQuestion.Where(x => x.Id == entity.ParentId).Select(x => x.QuestionName).FirstOrDefaultAsync(); - } - - await InsertInspection(entity, type, x => new InspectionConvertDTO() - { - IsDistinctionInterface = false, - ObjectRelationParentId = x.TrialId - - }, new { ParentQuestionName = parentQuestionName }); - } // 签名模板 @@ -1414,9 +1571,15 @@ namespace IRaCIS.Core.Infra.EFCore.Common { var type = GetEntityAuditOpt(item); + var extraIdentification = string.Empty; + + var basicData = item.Entity as SystemBasicData; + extraIdentification = (basicData.ParentId == null ? "/parent" : string.Empty); + await InsertInspection(item.Entity as SystemBasicData, type, x => new InspectionConvertDTO() { - IsDistinctionInterface = false + IsDistinctionInterface = false, + ExtraIndentification=extraIdentification }); } @@ -1559,8 +1722,66 @@ namespace IRaCIS.Core.Infra.EFCore.Common var entity = item.Entity as SubjectVisit; + var extraIdentification = string.Empty; + + var isDistinctionInterface = true; + + var reason = string.Empty; + + #region 处理标识 + + switch (_userInfo.RequestUrl.ToLower()) + { + //待处理? + case "qcoperation/qcpassedorfailed": + + extraIdentification = "/" + (40 % (int)entity.AuditState).ToString(); + + break; + + //设置核查通过 + case "qcoperation/setcheckpass": + + reason = entity.ManualPassReason; + break; + + //领取或者取消QC任务 + case "qcoperation/obtainorcancelqctask": + type = type + "/" + entity.IsTake.ToString(); + break; + + //确认重阅 区分用户类型 + case "visittask/confirmrereading": + + if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ProjectManager || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.APM) + { + type = type + "/" + 1; + + } + else + { + //SPM + type = type + "/" + 2; + } + break; + } + + if (entity.CheckChallengeState == CheckChanllengeTypeEnum.CRCWaitPMReply || entity.CheckChallengeState == CheckChanllengeTypeEnum.PMWaitCRCReply) + { + //发送对话 修改质疑状态 不需要区分接口 + isDistinctionInterface = false; + + extraIdentification = "/ModifyCheckChallengeState"; + } + + #endregion + + await InsertInspection(item.Entity as SubjectVisit, type, x => new InspectionConvertDTO() { + IsDistinctionInterface= isDistinctionInterface, + Reason= reason, + //Subject的信息 找离的最近的Subject稽查信息 ObjectRelationParentId = x.SubjectId, @@ -1608,10 +1829,19 @@ namespace IRaCIS.Core.Infra.EFCore.Common var entity = item.Entity as NoneDicomStudy; + var extraIdentification = string.Empty; + + if (_userInfo.RequestUrl.ToLower() == "nonedicomstudy/addorupdatenonedicomstudy") + { + extraIdentification = "/(" + _userInfo.UserTypeShortName + ")"; + } + + + await InsertInspection(item.Entity as NoneDicomStudy, type, x => new InspectionConvertDTO() { ObjectRelationParentId = x.SubjectVisitId, - + ExtraIndentification = extraIdentification }); } @@ -1924,6 +2154,40 @@ namespace IRaCIS.Core.Infra.EFCore.Common var entity = item.Entity as VisitTaskReReading; + var extraIdentification = string.Empty; + + + switch (_userInfo.RequestUrl) + { + case "VisitTask/applyReReading": + + extraIdentification = "/" + (int)entity.RequestReReadingType; + break; + + case "VisitTask/ConfirmReReading": + + if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ProjectManager || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.APM) + { + extraIdentification = "/" + 1; + } + else + { + extraIdentification = "/" + 2; + } + + if (entity.RequestReReadingResultEnum == RequestReReadingResult.Agree) + { + extraIdentification = "/" + 1; + + } + else if (entity.RequestReReadingResultEnum == RequestReReadingResult.Reject) + { + extraIdentification = "/" + 2; + } + break; + } + + await InsertInspection(entity, type, x => new InspectionConvertDTO() { VisitTaskId = entity.OriginalReReadingTaskId, @@ -1932,6 +2196,9 @@ namespace IRaCIS.Core.Infra.EFCore.Common ObjectRelationParentId = entity.OriginalReReadingTaskId, + + ExtraIndentification = extraIdentification, + }); } @@ -1944,11 +2211,30 @@ namespace IRaCIS.Core.Infra.EFCore.Common var entity = item.Entity as TaskConsistentRule; + + var extraIdentification = string.Empty; + + //自身一致性分析 + if (entity.IsSelfAnalysis == true) + { + extraIdentification = "/" + 1; + + } + //组件一致性分析 + else + { + extraIdentification = "/" + 2; + } + await InsertInspection(entity, type, x => new InspectionConvertDTO() { + IsDistinctionInterface = true, + ObjectRelationParentId = entity.TrialId, - ObjectRelationParentId2 = entity.TrialReadingCriterionId + ObjectRelationParentId2 = entity.TrialReadingCriterionId, + + ExtraIndentification = extraIdentification, }); } @@ -2370,6 +2656,57 @@ namespace IRaCIS.Core.Infra.EFCore.Common var obj = new object() { }; + #region 标识区分 + + if (type == AuditOpt.Add) + { + //生成一致性分析任务 + if (entity.IsSelfAnalysis == true) + { + type = type + "/" + "SelfAnalysis"; + } + else if (entity.IsSelfAnalysis == false) + { + type = type + "/" + "GroupAnalysis"; + } + else + { + type = type + "/" + "NotAnalysis"; + } + + //区分任务类型 + type = type + "/" + (int)entity.ReadingCategory; + + + } + else + { + switch (_userInfo.RequestUrl) + { + //申请重阅 + case "VisitTask/applyReReading": + type = type + "/" + (int)entity.ReReadingApplyState; + break; + + + //同意重阅 + case "VisitTask/ConfirmReReading": + + if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ProjectManager || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.APM) + { + type = type + "/" + 1; + + } + else + { + type = type + "/" + 2; + } + + break; + } + + } + //访视任务-- 非Dicom 阅片 if (_userInfo.RequestUrl == "ReadingImageTask/SubmitVisitTaskQuestions" && entity.ReadingTaskState != ReadingTaskState.HaveSigned && type == AuditOpt.Update) { @@ -2404,6 +2741,12 @@ namespace IRaCIS.Core.Infra.EFCore.Common obj = new { R1 = r1.FullName, R2 = r2.FullName, SelectResult = r1.Id == entity.JudgeResultTaskId ? "R1" : "R2" }; } + + #endregion + + + + #region 通过链接跳转 2022 12-19 ////肿瘤学任务 @@ -2527,7 +2870,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common var generalId = (inspection.GeneralId != null && inspection.GeneralId != Guid.Empty) ? inspection.GeneralId : entityObj.Id; inspection.GeneralId = generalId; - inspection.Identification = await GetInspectionRecordIdentificationAsync(inspection, entityObj, type, inspection.IsDistinctionInterface) + inspection.ExtraIndentification; + inspection.Identification = await GetInspectionRecordIdentificationAsync(entityObj, type, inspection.IsDistinctionInterface,inspection.IsSelfDefine) + inspection.ExtraIndentification; //将实体对象属性 映射到稽查实体 MapEntityPropertyToAuditEntity(entityObj, inspection); @@ -2736,43 +3079,79 @@ namespace IRaCIS.Core.Infra.EFCore.Common /// 获取稽查记录的标识符 部分业务会进行特殊处理 /// /// - public async Task GetInspectionRecordIdentificationAsync(InspectionConvertDTO inspection, T entityObj, string type, bool IsDistinctionInterface = true) + public async Task GetInspectionRecordIdentificationAsync( T entityObj, string type, bool IsDistinctionInterface = true,bool isSelfDefine = false) { var entityTypeName = entityObj.GetType().Name; - #region 标识符特殊处理 - //文档签署这块,不区分系统和项目的 需要处理为同一个标识 if (typeof(T) == typeof(TrialDocConfirmedUser) || typeof(T) == typeof(SystemDocConfirmedUser)) { entityTypeName = "New/" + "UserSigned"; } - switch (entityObj.GetType().Name) + //默认规则 + if (IsDistinctionInterface) { - case nameof(TrialDocConfirmedUser): - case nameof(SystemDocConfirmedUser): + //自定义 标识后面 补充由代码上层的 extraIdentification 附加 + if (isSelfDefine) + { + return $"{_userInfo.RequestUrl}/{entityTypeName}"; + } + else + { + return $"{_userInfo.RequestUrl}/{entityTypeName}/{type}"; + } - var softDelete = entityObj as ISoftDelete; + + } + else + { + //自定义 标识后面 补充由代码上层的 extraIdentification 附加 + if (isSelfDefine) + { + return $"{entityTypeName}"; + } + else + { + return $"{entityTypeName}/{type}"; + } + + } - if (type == AuditOpt.Update) - { - if (softDelete.IsDeleted == true) - { - type = type + "/" + 2; - } - else - { - type = type + "/" + 1; - } - } + + + - break; - case nameof(SystemBasicData): - var basicData = entityObj as SystemBasicData; - type = type + (basicData.ParentId == null ? "/parent" : string.Empty); - break; + #region 标识符特殊处理 废弃 + + + + //switch (entityObj.GetType().Name) + //{ + //case nameof(TrialDocConfirmedUser): + //case nameof(SystemDocConfirmedUser): + + // var softDelete = entityObj as ISoftDelete; + + // if (type == AuditOpt.Update) + // { + // if (softDelete.IsDeleted == true) + // { + // type = type + "/" + 2; + // } + // else + // { + // type = type + "/" + 1; + // } + // } + + // break; + + //case nameof(SystemBasicData): + // var basicData = entityObj as SystemBasicData; + // type = type + (basicData.ParentId == null ? "/parent" : string.Empty); + // break; //case nameof(Trial): // var trial = entityObj as Trial; @@ -2814,212 +3193,206 @@ namespace IRaCIS.Core.Infra.EFCore.Common #region 访视相关 - // 对话消息区分用户类型 - case nameof(CheckChallengeDialog): - type = type + "/(" + _userInfo.UserTypeShortName + ")"; + //// 对话消息区分用户类型 + //case nameof(CheckChallengeDialog): + // type = type + "/(" + _userInfo.UserTypeShortName + ")"; - var checkDialog = entityObj as CheckChallengeDialog; + // var checkDialog = entityObj as CheckChallengeDialog; - switch (_userInfo.RequestUrl.ToLower()) - { - case "qcoperation/closecheckchallenge": + // switch (_userInfo.RequestUrl.ToLower()) + // { + // case "qcoperation/closecheckchallenge": - inspection.Reason = checkDialog.TalkContent.Substring(checkDialog.TalkContent.LastIndexOf(':') + 1); - break; - } + // inspection.Reason = checkDialog.TalkContent.Substring(checkDialog.TalkContent.LastIndexOf(':') + 1); + // break; + // } - break; + // break; - // 对话消息区分用户类型 - case nameof(QCChallengeDialog): - type = type + "/(" + _userInfo.UserTypeShortName + ")"; - - var dialog = entityObj as QCChallengeDialog; - switch (_userInfo.RequestUrl.ToLower()) - { - case "qcoperation/closeqcchallenge": - - inspection.Reason = dialog.TalkContent.Substring(dialog.TalkContent.LastIndexOf(':') + 1); - break; - } - - break; + - case nameof(SubjectVisit): - var sv = entityObj as SubjectVisit; - switch (_userInfo.RequestUrl.ToLower()) - { - //待处理? - case "qcoperation/qcpassedorfailed": + //case nameof(SubjectVisit): + // var sv = entityObj as SubjectVisit; + // switch (_userInfo.RequestUrl.ToLower()) + // { + // //待处理? + // case "qcoperation/qcpassedorfailed": - type = type + "/" + (40 % (int)sv.AuditState).ToString(); + // type = type + "/" + (40 % (int)sv.AuditState).ToString(); - break; + // break; - //设置核查通过 - case "qcoperation/setcheckpass": + // //设置核查通过 + // case "qcoperation/setcheckpass": - inspection.Reason = sv.ManualPassReason; - break; + // inspection.Reason = sv.ManualPassReason; + // break; - //领取或者取消QC任务 - case "qcoperation/obtainorcancelqctask": - type = type + "/" + sv.IsTake.ToString(); - break; + // //领取或者取消QC任务 + // case "qcoperation/obtainorcancelqctask": + // type = type + "/" + sv.IsTake.ToString(); + // break; - //确认重阅 区分用户类型 - case "visittask/confirmrereading": + // //确认重阅 区分用户类型 + // case "visittask/confirmrereading": - if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ProjectManager || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.APM) - { - type = type + "/" + 1; + // if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ProjectManager || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.APM) + // { + // type = type + "/" + 1; - } - else - { - //SPM - type = type + "/" + 2; - } - break; - } + // } + // else + // { + // //SPM + // type = type + "/" + 2; + // } + // break; + // } - if (sv.CheckChallengeState == CheckChanllengeTypeEnum.CRCWaitPMReply || sv.CheckChallengeState == CheckChanllengeTypeEnum.PMWaitCRCReply) - { - //发送对话 修改质疑状态 不需要区分接口 - IsDistinctionInterface = false; + // if (sv.CheckChallengeState == CheckChanllengeTypeEnum.CRCWaitPMReply || sv.CheckChallengeState == CheckChanllengeTypeEnum.PMWaitCRCReply) + // { + // //发送对话 修改质疑状态 不需要区分接口 + // IsDistinctionInterface = false; - type = type + "/ModifyCheckChallengeState"; - } - break; + // type = type + "/ModifyCheckChallengeState"; + // } + // break; - case nameof(NoneDicomStudy): - switch (_userInfo.RequestUrl.ToLower()) - { - case "nonedicomstudy/addorupdatenonedicomstudy": - type = type + "/(" + _userInfo.UserTypeShortName + ")"; - break; - } - break; - #endregion + //case nameof(NoneDicomStudy): + // switch (_userInfo.RequestUrl.ToLower()) + // { + // case "nonedicomstudy/addorupdatenonedicomstudy": + // type = type + "/(" + _userInfo.UserTypeShortName + ")"; + // break; + // } + // break; + #endregion - #region 阅片任务相关 + #region 阅片任务相关 - //任务表 - case nameof(VisitTask): + ////任务表 + //case nameof(VisitTask): - var visitTask = entityObj as VisitTask; + // var visitTask = entityObj as VisitTask; - if (type == AuditOpt.Add) - { - //生成一致性分析任务 - if (visitTask.IsSelfAnalysis == true) - { - type = type + "/" + "SelfAnalysis"; - } - else if (visitTask.IsSelfAnalysis == false) - { - type = type + "/" + "GroupAnalysis"; - } - else - { - type = type + "/" + "NotAnalysis"; - } - - //区分任务类型 - type = type + "/" + (int)visitTask.ReadingCategory; - - - } - else - { - switch (_userInfo.RequestUrl) - { - //申请重阅 - case "VisitTask/applyReReading": - type = type + "/" + (int)visitTask.ReReadingApplyState; - break; - - - //同意重阅 - case "VisitTask/ConfirmReReading": - - if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ProjectManager || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.APM) - { - type = type + "/" + 1; - - } - else - { - type = type + "/" + 2; - } - - break; - } - - } + // #region 标识区分 - break; + // if (type == AuditOpt.Add) + // { + // //生成一致性分析任务 + // if (visitTask.IsSelfAnalysis == true) + // { + // type = type + "/" + "SelfAnalysis"; + // } + // else if (visitTask.IsSelfAnalysis == false) + // { + // type = type + "/" + "GroupAnalysis"; + // } + // else + // { + // type = type + "/" + "NotAnalysis"; + // } - //重阅记录表 - case nameof(VisitTaskReReading): + // //区分任务类型 + // type = type + "/" + (int)visitTask.ReadingCategory; - var visitTaskReReading = entityObj as VisitTaskReReading; - switch (_userInfo.RequestUrl) - { - case "VisitTask/applyReReading": - type = type + "/" + (int)visitTaskReReading.RequestReReadingType; - break; + // } + // else + // { + // switch (_userInfo.RequestUrl) + // { + // //申请重阅 + // case "VisitTask/applyReReading": + // type = type + "/" + (int)visitTask.ReReadingApplyState; + // break; - case "VisitTask/ConfirmReReading": - if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ProjectManager || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.APM) - { - type = type + "/" + 1; + // //同意重阅 + // case "VisitTask/ConfirmReReading": - } - else - { - type = type + "/" + 2; - } + // if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ProjectManager || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.APM) + // { + // type = type + "/" + 1; - if (visitTaskReReading.RequestReReadingResultEnum == RequestReReadingResult.Agree) - { - type = type + "/" + 1; + // } + // else + // { + // type = type + "/" + 2; + // } - } - else if (visitTaskReReading.RequestReReadingResultEnum == RequestReReadingResult.Reject) - { - type = type + "/" + 2; - } - break; - } + // break; + // } - break; + // } - //一致性分析规则 - case nameof(TaskConsistentRule): - var taskConsistentRule = entityObj as TaskConsistentRule; + // #endregion - //自身一致性分析 - if (taskConsistentRule.IsSelfAnalysis == true) - { - type = type + "/" + 1; - } - //组件一致性分析 - else - { - type = type + "/" + 2; - } - break; + // break; + + ////重阅记录表 + //case nameof(VisitTaskReReading): + + // var visitTaskReReading = entityObj as VisitTaskReReading; + + // switch (_userInfo.RequestUrl) + // { + // case "VisitTask/applyReReading": + // type = type + "/" + (int)visitTaskReReading.RequestReReadingType; + // break; + + // case "VisitTask/ConfirmReReading": + + // if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ProjectManager || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.APM) + // { + // type = type + "/" + 1; + + // } + // else + // { + // type = type + "/" + 2; + // } + + // if (visitTaskReReading.RequestReReadingResultEnum == RequestReReadingResult.Agree) + // { + // type = type + "/" + 1; + + // } + // else if (visitTaskReReading.RequestReReadingResultEnum == RequestReReadingResult.Reject) + // { + // type = type + "/" + 2; + // } + // break; + // } + + // break; + + ////一致性分析规则 + //case nameof(TaskConsistentRule): + + // var taskConsistentRule = entityObj as TaskConsistentRule; + + // //自身一致性分析 + // if (taskConsistentRule.IsSelfAnalysis == true) + // { + // type = type + "/" + 1; + + // } + // //组件一致性分析 + // else + // { + // type = type + "/" + 2; + // } + + // break; #endregion @@ -3048,19 +3421,11 @@ namespace IRaCIS.Core.Infra.EFCore.Common // break; - } + //} #endregion - if (IsDistinctionInterface) - { - return $"{_userInfo.RequestUrl}/{entityTypeName}/{type}"; - - } - else - { - return $"{entityTypeName}/{type}"; - } + } diff --git a/IRaCIS.Core.Infra.EFCore/Common/Dto/SetDictionaryValueDto.cs b/IRaCIS.Core.Infra.EFCore/Common/Dto/SetDictionaryValueDto.cs index 9aad9d978..8ef19d6d2 100644 --- a/IRaCIS.Core.Infra.EFCore/Common/Dto/SetDictionaryValueDto.cs +++ b/IRaCIS.Core.Infra.EFCore/Common/Dto/SetDictionaryValueDto.cs @@ -150,6 +150,8 @@ namespace IRaCIS.Core.Infra.EFCore.Common.Dto //标识操作 是否区分接口 public bool IsDistinctionInterface=true; + public bool IsSelfDefine = false; + public string ExtraIndentification = string.Empty;