diff --git a/IRaCIS.Core.Application/MassTransit/Consumer/SiteSurverEmailConsumer.cs b/IRaCIS.Core.Application/MassTransit/Consumer/SiteSurverEmailConsumer.cs index eaa991375..83d8e0eed 100644 --- a/IRaCIS.Core.Application/MassTransit/Consumer/SiteSurverEmailConsumer.cs +++ b/IRaCIS.Core.Application/MassTransit/Consumer/SiteSurverEmailConsumer.cs @@ -269,9 +269,45 @@ public class SiteSurverRejectedEventConsumer( if (context.Message.IsHaveSPMOrCPM) { - //PM 驳回到SPM - if (siteSurveyInfo.State == TrialSiteSurveyEnum.CRCSubmitted) + ////PM 驳回到SPM + //if (siteSurveyInfo.State == TrialSiteSurveyEnum.CRCSubmitted) + //{ + + // var sPMOrCPMList = _trialUserRoleRepository.Where(t => t.TrialId == trialId && t.TrialUser.IsDeleted == false) + // .Where(t => t.UserRole.UserTypeEnum == UserTypeEnum.SPM || t.UserRole.UserTypeEnum == UserTypeEnum.CPM) + // .Select(t => new { t.UserRole.IdentityUser.EMail, t.UserRole.FullName, t.UserRole.UserTypeEnum, t.UserRole.IdentityUser.UserWorkLanguage }).ToList(); + + // var lan_SPMOrCPMList = sPMOrCPMList.Where(t => t.UserWorkLanguage == workLanguage); + + // foreach (var user in lan_SPMOrCPMList) + // { + // messageToSend.To.Add(new MailboxAddress(user.FullName, user.EMail)); + // } + + // toUserName = string.Join('、', lan_SPMOrCPMList.Select(t => t.FullName)); + + //} + ////SPM 驳回到CRC + //else if (siteSurveyInfo.State == TrialSiteSurveyEnum.ToSubmit) + //{ + // //使用中心国家语言 一致才发送 + // if ((siteInfo.Country == StaticData.SiteCountry.US && isEn_US) || (siteInfo.Country == StaticData.SiteCountry.CN && isEn_US == false)) + // { + // messageToSend.To.Add(new MailboxAddress(toUserName, siteSurveyInfo.Email)); + + // } + + //} + + // PM 驳回到CRC + if (siteSurveyInfo.State == TrialSiteSurveyEnum.ToSubmit) { + //使用中心国家语言 一致才发送 + if ((siteInfo.Country == StaticData.SiteCountry.US && isEn_US) || (siteInfo.Country == StaticData.SiteCountry.CN && isEn_US == false)) + { + messageToSend.To.Add(new MailboxAddress(toUserName, siteSurveyInfo.Email)); + + } var sPMOrCPMList = _trialUserRoleRepository.Where(t => t.TrialId == trialId && t.TrialUser.IsDeleted == false) .Where(t => t.UserRole.UserTypeEnum == UserTypeEnum.SPM || t.UserRole.UserTypeEnum == UserTypeEnum.CPM) @@ -281,24 +317,10 @@ public class SiteSurverRejectedEventConsumer( foreach (var user in lan_SPMOrCPMList) { - messageToSend.To.Add(new MailboxAddress(user.FullName, user.EMail)); - } - - toUserName = string.Join('、', lan_SPMOrCPMList.Select(t => t.FullName)); - - } - //SPM 驳回到CRC - else if (siteSurveyInfo.State == TrialSiteSurveyEnum.ToSubmit) - { - //使用中心国家语言 一致才发送 - if ((siteInfo.Country == StaticData.SiteCountry.US && isEn_US) || (siteInfo.Country == StaticData.SiteCountry.CN && isEn_US == false)) - { - messageToSend.To.Add(new MailboxAddress(toUserName, siteSurveyInfo.Email)); - + messageToSend.Cc.Add(new MailboxAddress(user.FullName, user.EMail)); } } - } else { @@ -312,6 +334,11 @@ public class SiteSurverRejectedEventConsumer( } } + Uri uri = new Uri(_systemEmailConfig.SiteUrl); + + // 获取 Scheme + Host(不包含路径) + string baseUrl = uri.GetLeftPart(UriPartial.Authority); + //发件地址 messageToSend.From.Add(new MailboxAddress(_systemEmailConfig.FromName, _systemEmailConfig.FromEmail)); @@ -330,7 +357,7 @@ public class SiteSurverRejectedEventConsumer( siteInfo.TrialSiteCode, //中心编号 siteInfo.TrialSiteAliasName,//中心名称 siteSurveyInfo.LatestBackReason, //驳回原因 - _systemEmailConfig.SiteUrl, //链接 + $"{baseUrl}/researchLogin?trialId={trialId}", //链接 (siteSurveyInfo.State == TrialSiteSurveyEnum.ToSubmit ? "inline - block" : "none") ); diff --git a/IRaCIS.Core.Application/Service/Common/Export/ExcelExportService.cs b/IRaCIS.Core.Application/Service/Common/Export/ExcelExportService.cs index f33aeb28a..6ec1759e7 100644 --- a/IRaCIS.Core.Application/Service/Common/Export/ExcelExportService.cs +++ b/IRaCIS.Core.Application/Service/Common/Export/ExcelExportService.cs @@ -162,17 +162,20 @@ namespace IRaCIS.Core.Application.Service.Common var fields = new List<(string FieldName, int excelIndex)>() { - ("Parameters", 5), - ("ManufacturerType", 6), - ("ScannerType", 7), - ("MagneticFieldStrengthType", 8), - ("BodyCoilChannelCount", 9), - ("HasDedicatedPdfFatQuantificationSequence", 10), - ("PdfFatQuantificationSequenceType", 11), - ("OtherSequenceSpecification", 11), - ("HasT2R2Correction", 12), - ("CanFullyExportPdfParameterMapsAndRawDicom", 13), - ("Note", 14), + ("AverageEngravingCycle", 7), + ("IsConfirmImagingTechnologist", 8), + ("EfficacyEvaluatorType", 9), + ("IsFollowStudyParameters", 10), + ("NotFollowReson", 10), + + + ("IsRoutineMRIPDEE", 11), + ("MRIPDFFScanTime", 12), + ("MRIPDFFLeadTime", 13), + ("MRIPDFFOther", 14), + ("AssignFixedTechnologists", 15), + ("ISStrictManualBurnFlag", 16), + ("NotStrictManualBurnFlagReason",16) }; @@ -191,7 +194,7 @@ namespace IRaCIS.Core.Application.Service.Common exportInfo.List = ExportExcelConverterDate.ConvertToClientTimeInObject(list, _userInfo.TimeZoneId); exportInfo.CurrentTime = ExportExcelConverterDate.DateTimeInternationalToString(DateTime.Now, _userInfo.TimeZoneId); - return await ExcelExportHelper.DataExportAsync(StaticData.Export.TrialSiteSurvey_Info_Export, exportInfo, exportInfo.TrialCode, _commonDocumentRepository, _hostEnvironment, _dictionaryService, typeof(SiteSurveyEquipmentDto)); + return await ExcelExportHelper.DataExportAsync(StaticData.Export.TrialSiteSurvey_Info_Export, exportInfo, exportInfo.TrialCode, _commonDocumentRepository, _hostEnvironment, _dictionaryService, typeof(SiteSurveyEquipmentDto), removeExcelIndexList: columnsToDelete); } diff --git a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs index 0bdb9d158..fd935ace9 100644 --- a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs +++ b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs @@ -3,7 +3,9 @@ // 生成时间 2021-12-23 13:20:59 // 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。 //-------------------------------------------------------------------- +using DocumentFormat.OpenXml.Office2013.Excel; using DocumentFormat.OpenXml.Spreadsheet; +using DocumentFormat.OpenXml.Vml; using IRaCIS.Application.Contracts; using IRaCIS.Core.Application.Auth; using IRaCIS.Core.Application.Helper; @@ -496,40 +498,47 @@ namespace IRaCIS.Core.Application.Contracts } else if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ProjectManager || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.APM) { - var isTrialSPMJoin = await _trialRepository.AnyAsync(t => t.Id == trialSiteSubmitBackCommand.TrialId && t.IsSPMJoinSiteSurvey); + // var isTrialSPMJoin = await _trialRepository.AnyAsync(t => t.Id == trialSiteSubmitBackCommand.TrialId && t.IsSPMJoinSiteSurvey); - var hasSPMOrCPM = await _trialRepository.Where(t => t.Id == trialSiteSubmitBackCommand.TrialId).AnyAsync(t => t.TrialIdentityUserList.SelectMany(t => t.TrialUserRoleList).Any(t => - t.UserRole.IdentityUser.Status == UserStateEnum.Enable - && t.UserRole.IsUserRoleDisabled == false - && (t.UserRole.UserTypeEnum == UserTypeEnum.SPM || t.UserRole.UserTypeEnum == UserTypeEnum.CPM)) - ); + // var hasSPMOrCPM = await _trialRepository.Where(t => t.Id == trialSiteSubmitBackCommand.TrialId).AnyAsync(t => t.TrialIdentityUserList.SelectMany(t => t.TrialUserRoleList).Any(t => + //t.UserRole.IdentityUser.Status == UserStateEnum.Enable + //&& t.UserRole.IsUserRoleDisabled == false + //&& (t.UserRole.UserTypeEnum == UserTypeEnum.SPM || t.UserRole.UserTypeEnum == UserTypeEnum.CPM)) + //); - var isSPMjoin = isTrialSPMJoin && hasSPMOrCPM; + // var isSPMjoin = isTrialSPMJoin && hasSPMOrCPM; - if (isSPMjoin) - { - survey.State = TrialSiteSurveyEnum.CRCSubmitted; + // if (isSPMjoin) + // { + // survey.State = TrialSiteSurveyEnum.CRCSubmitted; - survey.ReviewerUserId = null; - survey.ReviewerTime = null; - } - else - { - survey.State = TrialSiteSurveyEnum.ToSubmit; + // survey.ReviewerUserId = null; + // survey.ReviewerTime = null; + // } + // else + // { + // survey.State = TrialSiteSurveyEnum.ToSubmit; - survey.PreliminaryUserId = null; - survey.ReviewerUserId = null; - survey.PreliminaryTime = null; - survey.ReviewerTime = null; + // survey.PreliminaryUserId = null; + // survey.ReviewerUserId = null; + // survey.PreliminaryTime = null; + // survey.ReviewerTime = null; - } + // } + + survey.State = TrialSiteSurveyEnum.ToSubmit; + + survey.PreliminaryUserId = null; + survey.ReviewerUserId = null; + survey.PreliminaryTime = null; + survey.ReviewerTime = null; + - } var info = await GetSiteSurveyInfo(trialSiteSurveyId, trialId); - await _siteSurveyLogRepository.AddAsync(new SiteSurveyLog() { TrialSiteSurveyId = trialSiteSurveyId, Name = _userInfo.FullName, UserType = (UserTypeEnum)_userInfo.UserTypeEnumInt, OptType = SiteSurveyOptTyp.Reject, Reason = survey.LatestBackReason, Json = info.ToJsonStr() }); + await _siteSurveyLogRepository.AddAsync(new SiteSurveyLog() { TrialSiteSurveyId = trialSiteSurveyId, Name = $"{_userInfo.FullName} ({_userInfo.UserName})", UserType = (UserTypeEnum)_userInfo.UserTypeEnumInt, OptType = SiteSurveyOptTyp.Reject, Reason = survey.LatestBackReason, Json = info.ToJsonStr() }); await _trialSiteSurveyRepository.SaveChangesAsync(); @@ -556,6 +565,10 @@ namespace IRaCIS.Core.Application.Contracts survey.IsDeleted = true; + var info = await GetSiteSurveyInfo(trialSiteSurveyId, survey.TrialId); + await _siteSurveyLogRepository.AddAsync(new SiteSurveyLog() { TrialSiteSurveyId = trialSiteSurveyId, Name = $"{_userInfo.FullName} ({_userInfo.UserName})", UserType = (UserTypeEnum)_userInfo.UserTypeEnumInt, OptType = SiteSurveyOptTyp.Over, Json = info.ToJsonStr() }); + + await _trialSiteSurveyRepository.SaveChangesAsync(); return ResponseOutput.Ok(); @@ -688,7 +701,8 @@ namespace IRaCIS.Core.Application.Contracts } //更新调研表日志 - 老的调研表 - //currentLatest.SiteSurveyLogList.Add(new SiteSurveyLog() { Name = userInfo.ReplaceUserEmailOrPhone, OptType = SiteSurveyOptTyp.Over }); + var info1 = await GetSiteSurveyInfo(currentLatest.Id, currentLatest.TrialId); + currentLatest.SiteSurveyLogList.Add(new SiteSurveyLog() { Name = userInfo.ReplaceUserEmailOrPhone, OptType = SiteSurveyOptTyp.Over, Json = info1.ToJsonStr() }); var copy = currentLatest.Clone(); @@ -701,6 +715,11 @@ namespace IRaCIS.Core.Application.Contracts copy.Id = Guid.Empty; copy.CreateTime = DateTime.Now; + copy.PreliminaryUserId = null; + copy.ReviewerUserId = null; + copy.PreliminaryTime = null; + copy.ReviewerTime = null; + if (userInfo.ReplaceUserEmailOrPhone != userInfo.EmailOrPhone) { copy.UserName = String.Empty; @@ -709,7 +728,8 @@ namespace IRaCIS.Core.Application.Contracts //更新调研表日志 var info = await GetSiteSurveyInfo(currentLatest.Id, currentLatest.TrialId); - copy.SiteSurveyLogList.Add(new SiteSurveyLog() { Name = userInfo.ReplaceUserEmailOrPhone, OptType = SiteSurveyOptTyp.Update, OriginTrialSiteSurveyId = currentLatest.Id, Json = info.ToJsonStr() }); + copy.SiteSurveyLogList.ForEach(t => { t.Id = Guid.Empty; }); + copy.SiteSurveyLogList.Add(new SiteSurveyLog() { Name = userInfo.EmailOrPhone, OptType = SiteSurveyOptTyp.Update, OriginTrialSiteSurveyId = currentLatest.Id, Json = info.ToJsonStr() }); } @@ -923,7 +943,7 @@ namespace IRaCIS.Core.Application.Contracts var info = await GetSiteSurveyInfo(trialSiteSurveyId, trialId); - await _siteSurveyLogRepository.AddAsync(new SiteSurveyLog() { TrialSiteSurveyId = trialSiteSurveyId, Name = _userInfo.FullName, UserType = (UserTypeEnum)_userInfo.UserTypeEnumInt, OptType = SiteSurveyOptTyp.Approved, Json = info.ToJsonStr() }); + await _siteSurveyLogRepository.AddAsync(new SiteSurveyLog() { TrialSiteSurveyId = trialSiteSurveyId, Name = $"{_userInfo.FullName} ({_userInfo.UserName})", UserType = (UserTypeEnum)_userInfo.UserTypeEnumInt, OptType = SiteSurveyOptTyp.Approved, Json = info.ToJsonStr() }); } else if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ProjectManager || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.APM) @@ -941,7 +961,7 @@ namespace IRaCIS.Core.Application.Contracts //审批调研表日志 var info = await GetSiteSurveyInfo(trialSiteSurveyId, trialId); - await _siteSurveyLogRepository.AddAsync(new SiteSurveyLog() { TrialSiteSurveyId = trialSiteSurveyId, Name = _userInfo.FullName, UserType = (UserTypeEnum)_userInfo.UserTypeEnumInt, OptType = SiteSurveyOptTyp.Approved, Json = info.ToJsonStr() }); + await _siteSurveyLogRepository.AddAsync(new SiteSurveyLog() { TrialSiteSurveyId = trialSiteSurveyId, Name = $"{_userInfo.FullName} ({_userInfo.UserName})", UserType = (UserTypeEnum)_userInfo.UserTypeEnumInt, OptType = SiteSurveyOptTyp.Approved, Json = info.ToJsonStr() }); } @@ -1458,7 +1478,7 @@ namespace IRaCIS.Core.Application.Contracts { return _siteSurveyLogRepository.Where(t => t.TrialSiteSurveyId == inQuery.TrialSiteSurveyId) .WhereIf(inQuery.Id != null, t => t.Id == inQuery.Id) - .ProjectTo(_mapper.ConfigurationProvider).OrderBy(t=>t.CreateTime).ToList(); + .ProjectTo(_mapper.ConfigurationProvider).OrderBy(t => t.CreateTime).ToList(); } ///