From 7853614d2d317cb2dd460a5d6db14ea46704254b Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Fri, 27 Dec 2024 11:32:17 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Consumer/SiteSurverEmailConsumer.cs | 6 +- .../Recurring/IRRecurringConsumer.cs | 4 +- .../Recurring/OldRecurringEmailHelper.cs | 2 +- .../Service/Common/ExcelExportService.cs | 18 +- .../Service/Common/MailService.cs | 14 +- .../Service/Common/_MapConfig.cs | 2 +- .../Service/Doctor/_MapConfig.cs | 4 +- .../Service/Document/EmailSendService.cs | 2 +- .../Service/Document/SystemDocumentService.cs | 2 +- .../Service/Document/TrialDocumentService.cs | 14 +- .../Document/TrialEmailNoticeConfigService.cs | 2 +- .../ImageAndDoc/DownloadAndUploadService.cs | 2 +- .../Service/ImageAndDoc/StudyService.cs | 8 +- .../Service/ImageAndDoc/_MapConfig.cs | 8 +- .../Inspection/FrontAuditConfigService.cs | 6 +- .../Service/Management/DTO/UserModel.cs | 2 + .../Service/Management/UserFeedBackService.cs | 2 +- .../Service/Management/_MapConfig.cs | 4 +- .../Service/QC/QCListService.cs | 4 +- .../Service/QC/_MapConfig.cs | 8 +- .../ReadingMedicalReviewService.cs | 2 +- .../ReadingPeriod/ReadModuleService.cs | 2 +- .../Service/Reading/_MapConfig.cs | 4 +- .../General/GeneralCalculateService.cs | 4 +- .../IRECIST1Point1CalculateService.cs | 8 +- .../Service/SiteSurvey/_MapConfig.cs | 2 +- .../UltrasonicDicomService.cs | 2 +- .../TrialSiteUser/PersonalWorkstation.cs | 6 +- .../TrialSiteUser/TrialExternalUserService.cs | 244 +++++++++++------- .../TrialSiteUser/TrialMaintenanceService.cs | 2 +- .../Service/TrialSiteUser/TrialSiteService.cs | 4 +- .../Service/TrialSiteUser/_MapConfig.cs | 2 +- .../Service/Visit/_MapConfig.cs | 2 +- .../NoForeignKeyMigrationsSqlGenerator.cs | 4 +- 34 files changed, 237 insertions(+), 165 deletions(-) diff --git a/IRaCIS.Core.Application/MassTransit/Consumer/SiteSurverEmailConsumer.cs b/IRaCIS.Core.Application/MassTransit/Consumer/SiteSurverEmailConsumer.cs index bc831eada..3072bc632 100644 --- a/IRaCIS.Core.Application/MassTransit/Consumer/SiteSurverEmailConsumer.cs +++ b/IRaCIS.Core.Application/MassTransit/Consumer/SiteSurverEmailConsumer.cs @@ -49,7 +49,7 @@ public class UserSiteSurveySubmitedEventConsumer( var trialUserList = await _trialUserRoleRepository.Where(t => t.TrialId == siteSurveyInfo.TrialId) .Where(t => t.UserRole.UserTypeEnum == UserTypeEnum.SPM || t.UserRole.UserTypeEnum == UserTypeEnum.CPM || t.UserRole.UserTypeEnum == UserTypeEnum.ProjectManager || t.UserRole.UserTypeEnum == UserTypeEnum.APM) - .Select(t => new { t.UserRole.FullName, t.UserRole.EMail, t.UserRole.UserTypeEnum }).ToListAsync(); + .Select(t => new { t.UserRole.FullName, t.UserRole.IdentityUser.EMail, t.UserRole.UserTypeEnum }).ToListAsync(); var sPMOrCPMList = trialUserList.Where(t => t.UserTypeEnum == UserTypeEnum.SPM || t.UserTypeEnum == UserTypeEnum.CPM).ToList(); var pmAndAPMList = trialUserList.Where(t => t.UserTypeEnum == UserTypeEnum.ProjectManager || t.UserTypeEnum == UserTypeEnum.APM).ToList(); @@ -147,7 +147,7 @@ public class SiteSurveySPMSubmitedEventConsumer( var trialUserList = _trialUserRoleRepository.Where(t => t.TrialId == trialId) .Where(t => t.UserRole.UserTypeEnum == UserTypeEnum.SPM || t.UserRole.UserTypeEnum == UserTypeEnum.CPM || t.UserRole.UserTypeEnum == UserTypeEnum.ProjectManager || t.UserRole.UserTypeEnum == UserTypeEnum.APM) - .Select(t => new { t.UserRole.EMail, t.UserRole.FullName, t.UserRole.UserTypeEnum }).ToList(); + .Select(t => new { t.UserRole.IdentityUser.EMail, t.UserRole.FullName, t.UserRole.UserTypeEnum }).ToList(); var sPMOrCPMList = trialUserList.Where(t => t.UserTypeEnum == UserTypeEnum.SPM || t.UserTypeEnum == UserTypeEnum.CPM).ToList(); var pmAndAPMList = trialUserList.Where(t => t.UserTypeEnum == UserTypeEnum.ProjectManager || t.UserTypeEnum == UserTypeEnum.APM).ToList(); @@ -235,7 +235,7 @@ public class SiteSurverRejectedEventConsumer( var sPMOrCPMList = _trialUserRoleRepository.Where(t => t.TrialId == trialId) .Where(t => t.UserRole.UserTypeEnum == UserTypeEnum.SPM || t.UserRole.UserTypeEnum == UserTypeEnum.CPM) - .Select(t => new { t.UserRole.EMail, t.UserRole.FullName, t.UserRole.UserTypeEnum }).ToList(); + .Select(t => new { t.UserRole.IdentityUser.EMail, t.UserRole.FullName, t.UserRole.UserTypeEnum }).ToList(); foreach (var user in sPMOrCPMList) diff --git a/IRaCIS.Core.Application/MassTransit/Recurring/IRRecurringConsumer.cs b/IRaCIS.Core.Application/MassTransit/Recurring/IRRecurringConsumer.cs index fbcbecf48..d2e357b28 100644 --- a/IRaCIS.Core.Application/MassTransit/Recurring/IRRecurringConsumer.cs +++ b/IRaCIS.Core.Application/MassTransit/Recurring/IRRecurringConsumer.cs @@ -56,8 +56,8 @@ namespace IRaCIS.Core.Application.MassTransit.Recurring { t.UserId, t.UserRole.FullName, - t.UserRole.EMail, - t.UserRole.UserName, + t.UserRole.IdentityUser.EMail, + t.UserRole.IdentityUser.UserName, t.Trial.TrialCode, t.Trial.ResearchProgramNo //TrialReadingCriterionList = t.Trial.TrialReadingCriterionList.Select(t => new { t.CriterionName, TrialReadingCriterionId = t.Id }).ToList() diff --git a/IRaCIS.Core.Application/MassTransit/Recurring/OldRecurringEmailHelper.cs b/IRaCIS.Core.Application/MassTransit/Recurring/OldRecurringEmailHelper.cs index 14e57f9e1..99e12463a 100644 --- a/IRaCIS.Core.Application/MassTransit/Recurring/OldRecurringEmailHelper.cs +++ b/IRaCIS.Core.Application/MassTransit/Recurring/OldRecurringEmailHelper.cs @@ -59,7 +59,7 @@ public static class OldRecurringEmailHelper var allUserTypeEnumList = toUserTypeEnumList.Union(copyUserTypeEnumList).Distinct().ToList(); - var allUserList = await _trialUserRoleRepository.Where(t => t.TrialId == trialId && allUserTypeEnumList.Contains(t.UserRole.UserTypeEnum)).Select(t => new { t.UserId, t.UserRole.EMail, t.UserRole.FullName, t.UserRole.UserTypeEnum }).ToListAsync(); + var allUserList = await _trialUserRoleRepository.Where(t => t.TrialId == trialId && allUserTypeEnumList.Contains(t.UserRole.UserTypeEnum)).Select(t => new { t.UserId, t.UserRole.IdentityUser.EMail, t.UserRole.FullName, t.UserRole.UserTypeEnum }).ToListAsync(); var toUserList = allUserList.Where(t => toUserTypeEnumList.Contains(t.UserTypeEnum)) diff --git a/IRaCIS.Core.Application/Service/Common/ExcelExportService.cs b/IRaCIS.Core.Application/Service/Common/ExcelExportService.cs index e15f3b42f..0b41cae7e 100644 --- a/IRaCIS.Core.Application/Service/Common/ExcelExportService.cs +++ b/IRaCIS.Core.Application/Service/Common/ExcelExportService.cs @@ -73,7 +73,7 @@ namespace IRaCIS.Core.Application.Service.Common var list = await _trialUseRoleRepository.Where(t => t.TrialId == param.TrialId).IgnoreQueryFilters() .WhereIf(param.UserTypeId != null, t => t.UserRole.UserTypeId == param.UserTypeId) - .WhereIf(!string.IsNullOrWhiteSpace(param.UserName), t => t.UserRole.UserName.Contains(param.UserName)) + .WhereIf(!string.IsNullOrWhiteSpace(param.UserName), t => t.UserRole.IdentityUser.UserName.Contains(param.UserName)) .WhereIf(param.IsDeleted != null, t => t.IsDeleted == param.IsDeleted) .WhereIf(!string.IsNullOrWhiteSpace(param.OrganizationName), @@ -124,7 +124,7 @@ namespace IRaCIS.Core.Application.Service.Common .WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator, t => t.UserId == _userInfo.UserRoleId) .WhereIf(!string.IsNullOrWhiteSpace(param.UserKeyInfo), t => (t.UserRole.FullName).Contains(param.UserKeyInfo) - || t.UserRole.UserName.Contains(param.UserKeyInfo) || t.UserRole.EMail.Contains(param.UserKeyInfo)) + || t.UserRole.IdentityUser.UserName.Contains(param.UserKeyInfo) || t.UserRole.IdentityUser.EMail.Contains(param.UserKeyInfo)) .ProjectTo(_mapper.ConfigurationProvider).ToListAsync(); @@ -225,7 +225,7 @@ namespace IRaCIS.Core.Application.Service.Common .WhereIf(!string.IsNullOrWhiteSpace(inQuery.ExperimentName), o => o.ExperimentName.Contains(inQuery.ExperimentName)) .WhereIf(_userInfo.UserTypeEnumInt != (int)UserTypeEnum.SuperAdmin && _userInfo.UserTypeEnumInt != (int)UserTypeEnum.Admin && _userInfo.UserTypeEnumInt != (int)UserTypeEnum.OP, t => t.TrialUserList.Any(t => t.UserId == _userInfo.UserRoleId && t.IsDeleted == false) && t.IsDeleted == false) .WhereIf(inQuery.CriterionType != null, o => o.TrialReadingCriterionList.Any(t => t.CriterionType == inQuery.CriterionType && t.IsSigned && t.IsConfirm)) - .WhereIf(!string.IsNullOrEmpty(inQuery.PM_EMail), o => o.TrialUserList.Any(t => t.UserRole.EMail.Contains(inQuery.PM_EMail) && (t.UserRole.UserTypeEnum == UserTypeEnum.ProjectManager || t.UserRole.UserTypeEnum == UserTypeEnum.APM))) + .WhereIf(!string.IsNullOrEmpty(inQuery.PM_EMail), o => o.TrialUserList.Any(t => t.UserRole.IdentityUser.EMail.Contains(inQuery.PM_EMail) && (t.UserRole.UserTypeEnum == UserTypeEnum.ProjectManager || t.UserRole.UserTypeEnum == UserTypeEnum.APM))) .Select(t => new TrialToBeDoneDto() { TrialId = t.Id, @@ -286,7 +286,7 @@ namespace IRaCIS.Core.Application.Service.Common IR_ReadingCriterionList = isIR ? t.TrialReadingCriterionList.Where(t => t.IsConfirm && t.IsSigned).OrderBy(t => t.CriterionName).Select(t => t.CriterionName).ToList() : null, - IR_PMEmailList = isIR ? t.TrialUserList.Where(t => t.UserRole.UserTypeEnum == UserTypeEnum.ProjectManager || t.UserRole.UserTypeEnum == UserTypeEnum.APM).OrderBy(t => t.UserRole.EMail).Select(t => t.UserRole.EMail).ToList() : null, + IR_PMEmailList = isIR ? t.TrialUserList.Where(t => t.UserRole.UserTypeEnum == UserTypeEnum.ProjectManager || t.UserRole.UserTypeEnum == UserTypeEnum.APM).OrderBy(t => t.UserRole.IdentityUser.EMail).Select(t => t.UserRole.IdentityUser.EMail).ToList() : null, IR_TotalReadCount = isIR ? t.VisitTaskList.Where(t => t.DoctorUserId == _userInfo.UserRoleId && t.TaskState == TaskState.Effect && t.ReadingTaskState == ReadingTaskState.HaveSigned).Count() : 0, @@ -376,7 +376,7 @@ namespace IRaCIS.Core.Application.Service.Common //ConfirmUserId = confirm.ConfirmUserId, ConfirmTime = confirm.ConfirmTime, RealName = trialUser.UserRole.FullName, - UserName = trialUser.UserRole.UserName, + UserName = trialUser.UserRole.IdentityUser.UserName, UserTypeId = trialUser.UserRole.UserTypeId, UserTypeShortName = trialUser.UserRole.UserTypeRole.UserTypeShortName, @@ -410,7 +410,7 @@ namespace IRaCIS.Core.Application.Service.Common //ConfirmUserId = confirm.ConfirmUserId, ConfirmTime = confirm.ConfirmTime, RealName = trialUser.UserRole.FullName, - UserName = trialUser.UserRole.UserName, + UserName = trialUser.UserRole.IdentityUser.UserName, UserTypeId = trialUser.UserRole.UserTypeId, UserTypeShortName = trialUser.UserRole.UserTypeRole.UserTypeShortName, @@ -818,7 +818,7 @@ namespace IRaCIS.Core.Application.Service.Common .WhereIf(inQuery.SubjectVisitId != null, t => t.SubjectId == inQuery.SubjectVisitId) .WhereIf(inQuery.TrialSiteId != null, t => t.Subject.TrialSiteId == inQuery.TrialSiteId) .WhereIf(inQuery.IsDicom != null, t => t.IsDicom == inQuery.IsDicom) - .WhereIf(!string.IsNullOrWhiteSpace(inQuery.Uploader), t => t.CreateUserRole.UserName.Contains(inQuery.Uploader)) + .WhereIf(!string.IsNullOrWhiteSpace(inQuery.Uploader), t => t.CreateUserRole.IdentityUser.UserName.Contains(inQuery.Uploader)) .WhereIf(inQuery.IsSuccess != null, t => t.IsSuccess == inQuery.IsSuccess) .WhereIf(!string.IsNullOrWhiteSpace(inQuery.StudyCode), t => t.StudyCode.Contains(inQuery.StudyCode)) .Select(t => new UnionStudyMonitorExportDto() @@ -835,7 +835,7 @@ namespace IRaCIS.Core.Application.Service.Common IsDicom = t.IsDicom, - Uploader = t.CreateUserRole.UserName, + Uploader = t.CreateUserRole.IdentityUser.UserName, IP = t.IP, @@ -1233,7 +1233,7 @@ namespace IRaCIS.Core.Application.Service.Common 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.CreateUserRole.UserName.Contains(inQuery.Name) || t.CreateUserRole.FullName.Contains(inQuery.Name)) + .WhereIf(inQuery.Name.IsNotNullOrEmpty(), t => t.CreateUserRole.IdentityUser.UserName.Contains(inQuery.Name) || t.CreateUserRole.FullName.Contains(inQuery.Name)) .WhereIf(inQuery.ImageType != null, t => t.ImageType == inQuery.ImageType) .WhereIf(inQuery.UserType != null, t => t.CreateUserRole.UserTypeEnum == inQuery.UserType) .WhereIf(inQuery.IsSuccess != null, t => t.IsSuccess == inQuery.IsSuccess) diff --git a/IRaCIS.Core.Application/Service/Common/MailService.cs b/IRaCIS.Core.Application/Service/Common/MailService.cs index d89b9e63f..e15e61e3e 100644 --- a/IRaCIS.Core.Application/Service/Common/MailService.cs +++ b/IRaCIS.Core.Application/Service/Common/MailService.cs @@ -32,7 +32,7 @@ namespace IRaCIS.Core.Application.Service Task SiteSurveyUserJoinEmail(Guid trialId, Guid userId, string baseUrl, string rootUrl); - Task ExternalUserJoinEmail(Guid trialId, Guid userId, string baseUrl, string rootUrl); + Task ExternalUserJoinEmail(Guid trialId, Guid userId,string userTypes, string baseUrl, string rootUrl); Task<(Guid identityUserId, Guid userRoleId)> DoctorJoinTrialEmail(Guid trialId, Guid doctorId, string baseUrl, string rootUrl); @@ -429,15 +429,13 @@ namespace IRaCIS.Core.Application.Service } //外部用户 加入项目 - public async Task ExternalUserJoinEmail(Guid trialId, Guid userId, string baseUrl, string rootUrl) + public async Task ExternalUserJoinEmail(Guid trialId, Guid userId, string userTypes, string baseUrl, string rootUrl) { var trialInfo = (await _trialRepository.FirstOrDefaultAsync(t => t.Id == trialId)).IfNullThrowException(); var sysUserInfo = (await _identityUserRepository.Where(t => t.Id == userId).FirstOrDefaultAsync()).IfNullThrowException(); - - var userTypes = await _userRoleRepository.Where(t => t.IdentityUserId == sysUserInfo.Id).Select(t => t.UserTypeRole.UserTypeShortName).ToListAsync(); - - var messageToSend = new MimeMessage(); + + var messageToSend = new MimeMessage(); //发件地址 messageToSend.From.Add(new MailboxAddress(_systemEmailConfig.FromName, _systemEmailConfig.FromEmail)); //收件地址 @@ -473,7 +471,7 @@ namespace IRaCIS.Core.Application.Service trialInfo.ResearchProgramNo, trialInfo.TrialCode, sysUserInfo.UserName, - string.Join(',', userTypes), + userTypes, sysUserInfo.IsFirstAdd ? redirectUrl : baseUrl ); @@ -533,7 +531,7 @@ namespace IRaCIS.Core.Application.Service trialInfo.ExperimentName, trialInfo.ResearchProgramNo, trialInfo.TrialCode, - sysUserInfo.UserName, + sysUserInfo.UserName, string.Join(',', userTypes), sysUserInfo.IsFirstAdd ? redirectUrl : baseUrl ); diff --git a/IRaCIS.Core.Application/Service/Common/_MapConfig.cs b/IRaCIS.Core.Application/Service/Common/_MapConfig.cs index df1c0177c..a1ae89f86 100644 --- a/IRaCIS.Core.Application/Service/Common/_MapConfig.cs +++ b/IRaCIS.Core.Application/Service/Common/_MapConfig.cs @@ -100,7 +100,7 @@ namespace IRaCIS.Core.Application.Service CreateMap() .ForMember(d => d.UserFullName, u => u.MapFrom(s => s.CreateUserRole.FullName)) .ForMember(d => d.UserTypeEnum, u => u.MapFrom(s => s.CreateUserRole.UserTypeEnum)) - .ForMember(d => d.UserName, u => u.MapFrom(s => s.CreateUserRole.UserName)) + .ForMember(d => d.UserName, u => u.MapFrom(s => s.CreateUserRole.IdentityUser.UserName)) .ForMember(d => d.TrialSiteCode, u => u.MapFrom(s => s.Subject.TrialSite.TrialSiteCode)); diff --git a/IRaCIS.Core.Application/Service/Doctor/_MapConfig.cs b/IRaCIS.Core.Application/Service/Doctor/_MapConfig.cs index 3ad9f5fdc..0956b27dd 100644 --- a/IRaCIS.Core.Application/Service/Doctor/_MapConfig.cs +++ b/IRaCIS.Core.Application/Service/Doctor/_MapConfig.cs @@ -120,7 +120,7 @@ namespace IRaCIS.Core.Application.Service #region 医生基本信息 CreateMap() - .ForMember(d => d.DoctorUserName, u => u.MapFrom(t => t.UserRole.UserName)); + .ForMember(d => d.DoctorUserName, u => u.MapFrom(t => t.UserRole.IdentityUser.UserName)); CreateMap().IncludeMembers(t => t.Hospital).Include() .ForMember(d => d.AccountUserName, u => u.MapFrom(s => s.EnrollList.Where(t => t.DoctorUserId != null).Select(c => c.DoctorUser.UserName).FirstOrDefault())) .ForMember(d => d.Department, u => u.MapFrom(s => s.Department.Value)) @@ -178,7 +178,7 @@ namespace IRaCIS.Core.Application.Service CreateMap() .ForMember(d => d.IntoGroupState, u => u.MapFrom(s => s.EnrollStatus)) .ForMember(d => d.OptTime, u => u.MapFrom(s => s.CreateTime)) - .ForMember(d => d.OptUserName, u => u.MapFrom(s => s.CreateUserRole.UserName)); + .ForMember(d => d.OptUserName, u => u.MapFrom(s => s.CreateUserRole.IdentityUser.UserName)); CreateMap().IncludeMembers(t => t.Doctor, t => t.Doctor.Hospital) .ForMember(o => o.DictionaryList, t => t.MapFrom(u => u.Doctor.DoctorDicRelationList.Where(t => t.KeyName == StaticData.ReadingType || t.KeyName == StaticData.Subspeciality).Select(t => t.Dictionary).OrderBy(t => t.ShowOrder))) diff --git a/IRaCIS.Core.Application/Service/Document/EmailSendService.cs b/IRaCIS.Core.Application/Service/Document/EmailSendService.cs index 96dec62aa..2c436cb01 100644 --- a/IRaCIS.Core.Application/Service/Document/EmailSendService.cs +++ b/IRaCIS.Core.Application/Service/Document/EmailSendService.cs @@ -144,7 +144,7 @@ namespace IRaCIS.Core.Application.Service var allUserTypeEnumList = toUserTypeEnumList.Union(copyUserTypeEnumList).Distinct().ToList(); - var allUserList = await _trialUserRoleRepository.Where(t => t.TrialId == trialId && allUserTypeEnumList.Contains(t.UserRole.UserTypeEnum)).Select(t => new { t.UserId, t.UserRole.EMail, t.UserRole.FullName, t.UserRole.UserTypeEnum }).ToListAsync(); + var allUserList = await _trialUserRoleRepository.Where(t => t.TrialId == trialId && allUserTypeEnumList.Contains(t.UserRole.UserTypeEnum)).Select(t => new { t.UserId, t.UserRole.IdentityUser.EMail, t.UserRole.FullName, t.UserRole.UserTypeEnum }).ToListAsync(); var toUserList = allUserList.Where(t => toUserTypeEnumList.Contains(t.UserTypeEnum)) diff --git a/IRaCIS.Core.Application/Service/Document/SystemDocumentService.cs b/IRaCIS.Core.Application/Service/Document/SystemDocumentService.cs index 1034f965e..5495c010c 100644 --- a/IRaCIS.Core.Application/Service/Document/SystemDocumentService.cs +++ b/IRaCIS.Core.Application/Service/Document/SystemDocumentService.cs @@ -173,7 +173,7 @@ namespace IRaCIS.Core.Application.Services ConfirmUserId = confirm.ConfirmUserId, ConfirmTime = confirm.ConfirmTime, - RealName = user.LastName + " / " + user.FirstName, + RealName = user.FullName, UserName = user.UserName, UserTypeId = user.UserTypeId, UserTypeShortName = user.UserTypeRole.UserTypeShortName diff --git a/IRaCIS.Core.Application/Service/Document/TrialDocumentService.cs b/IRaCIS.Core.Application/Service/Document/TrialDocumentService.cs index a6947d540..3cacd7593 100644 --- a/IRaCIS.Core.Application/Service/Document/TrialDocumentService.cs +++ b/IRaCIS.Core.Application/Service/Document/TrialDocumentService.cs @@ -83,7 +83,7 @@ namespace IRaCIS.Core.Application.Services ConfirmUserId = confirm.ConfirmUserId, ConfirmTime = confirm.ConfirmTime, RealName = trialUser.UserRole.FullName, - UserName = trialUser.UserRole.UserName, + UserName = trialUser.UserRole.IdentityUser.UserName, UserTypeId = trialUser.UserRole.UserTypeId, UserTypeShortName = trialUser.UserRole.UserTypeRole.UserTypeShortName @@ -247,7 +247,7 @@ namespace IRaCIS.Core.Application.Services ConfirmUserId = confirm.ConfirmUserId, ConfirmTime = confirm.ConfirmTime, RealName = trialUser.UserRole.FullName, - UserName = trialUser.UserRole.UserName, + UserName = trialUser.UserRole.IdentityUser.UserName, UserTypeId = trialUser.UserRole.UserTypeId, UserTypeShortName = trialUser.UserRole.UserTypeRole.UserTypeShortName }; @@ -279,7 +279,7 @@ namespace IRaCIS.Core.Application.Services ConfirmUserId = confirm.ConfirmUserId, ConfirmTime = confirm.ConfirmTime, RealName = trialUser.UserRole.FullName, - UserName = trialUser.UserRole.UserName, + UserName = trialUser.UserRole.IdentityUser.UserName, UserTypeId = trialUser.UserRole.UserTypeId, UserTypeShortName = trialUser.UserRole.UserTypeRole.UserTypeShortName @@ -418,7 +418,7 @@ namespace IRaCIS.Core.Application.Services ConfirmUserId = confirm.ConfirmUserId, ConfirmTime = confirm.ConfirmTime, RealName = trialUser.UserRole.FullName, - UserName = trialUser.UserRole.UserName, + UserName = trialUser.UserRole.IdentityUser.UserName, UserTypeId = trialUser.UserRole.UserTypeId, UserTypeShortName = trialUser.UserRole.UserTypeRole.UserTypeShortName, @@ -452,7 +452,7 @@ namespace IRaCIS.Core.Application.Services ConfirmUserId = confirm.ConfirmUserId, ConfirmTime = confirm.ConfirmTime, RealName = trialUser.UserRole.FullName, - UserName = trialUser.UserRole.UserName, + UserName = trialUser.UserRole.IdentityUser.UserName, UserTypeId = trialUser.UserRole.UserTypeId, UserTypeShortName = trialUser.UserRole.UserTypeRole.UserTypeShortName, @@ -493,7 +493,7 @@ namespace IRaCIS.Core.Application.Services public async Task> GetTrialUserSelect(Guid trialId) { return await _trialUserRoleRepository.Where(t => t.TrialId == trialId) - .Select(t => new TrialUserDto() { UserId = t.UserId, RealName = t.UserRole.FullName, UserName = t.UserRole.UserName }) + .Select(t => new TrialUserDto() { UserId = t.UserId, RealName = t.UserRole.FullName, UserName = t.UserRole.IdentityUser.UserName }) .ToListAsync(); } @@ -778,7 +778,7 @@ namespace IRaCIS.Core.Application.Services .Select(t => new TrialUserUnionDocumentView() { UserId = t.UserId, - UserName = t.UserRole.UserName, + UserName = t.UserRole.IdentityUser.UserName, RealName = t.UserRole.FullName, UserTypeShortName = t.UserRole.UserTypeRole.UserTypeShortName, TrialDocumentCount = t.Trial.TrialDocumentList.Count(u => u.NeedConfirmedUserTypeList.Any(k => k.NeedConfirmUserTypeId == t.UserRole.UserTypeId)), diff --git a/IRaCIS.Core.Application/Service/Document/TrialEmailNoticeConfigService.cs b/IRaCIS.Core.Application/Service/Document/TrialEmailNoticeConfigService.cs index 8d976e894..8cc1e024f 100644 --- a/IRaCIS.Core.Application/Service/Document/TrialEmailNoticeConfigService.cs +++ b/IRaCIS.Core.Application/Service/Document/TrialEmailNoticeConfigService.cs @@ -1226,7 +1226,7 @@ namespace IRaCIS.Core.Application.Service .Select(t => new TrialSelectUser() { UserId = t.UserId, - UserName = t.UserRole.UserName, + UserName = t.UserRole.IdentityUser.UserName, RealName = t.UserRole.FullName, UserTypeEnum = t.UserRole.UserTypeEnum }).Distinct(); diff --git a/IRaCIS.Core.Application/Service/ImageAndDoc/DownloadAndUploadService.cs b/IRaCIS.Core.Application/Service/ImageAndDoc/DownloadAndUploadService.cs index 5a6bc7e5a..19df69976 100644 --- a/IRaCIS.Core.Application/Service/ImageAndDoc/DownloadAndUploadService.cs +++ b/IRaCIS.Core.Application/Service/ImageAndDoc/DownloadAndUploadService.cs @@ -1129,7 +1129,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc 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.CreateUserRole.UserName.Contains(inQuery.Name) || t.CreateUserRole.FullName.Contains(inQuery.Name)) + .WhereIf(inQuery.Name.IsNotNullOrEmpty(), t => t.CreateUserRole.IdentityUser.UserName.Contains(inQuery.Name) || t.CreateUserRole.FullName.Contains(inQuery.Name)) .WhereIf(inQuery.ImageType != null, t => t.ImageType == inQuery.ImageType) .WhereIf(inQuery.UserType != null, t => t.CreateUserRole.UserTypeEnum == inQuery.UserType) .WhereIf(inQuery.IsSuccess != null, t => t.IsSuccess == inQuery.IsSuccess) diff --git a/IRaCIS.Core.Application/Service/ImageAndDoc/StudyService.cs b/IRaCIS.Core.Application/Service/ImageAndDoc/StudyService.cs index 56c6a645f..9530c8a15 100644 --- a/IRaCIS.Core.Application/Service/ImageAndDoc/StudyService.cs +++ b/IRaCIS.Core.Application/Service/ImageAndDoc/StudyService.cs @@ -394,7 +394,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc TrialSiteCode = t.Subject.TrialSite.TrialSiteCode, - Uploader = t.CreateUserRole.UserName, + Uploader = t.CreateUserRole.IdentityUser.UserName, UploadTime = t.CreateTime @@ -444,7 +444,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc TrialSiteCode = t.Subject.TrialSite.TrialSiteCode, - Uploader = t.CreateUserRole.UserName, + Uploader = t.CreateUserRole.IdentityUser.UserName, UploadTime = t.CreateTime @@ -476,7 +476,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc .WhereIf(inQuery.SubjectVisitId != null, t => t.SubjectId == inQuery.SubjectVisitId) .WhereIf(inQuery.TrialSiteId != null, t => t.Subject.TrialSiteId == inQuery.TrialSiteId) .WhereIf(inQuery.IsDicom != null, t => t.IsDicom == inQuery.IsDicom) - .WhereIf(!string.IsNullOrWhiteSpace(inQuery.Uploader), t => t.CreateUserRole.UserName.Contains(inQuery.Uploader)) + .WhereIf(!string.IsNullOrWhiteSpace(inQuery.Uploader), t => t.CreateUserRole.IdentityUser.UserName.Contains(inQuery.Uploader)) .WhereIf(inQuery.IsSuccess != null, t => t.IsSuccess == inQuery.IsSuccess) .WhereIf(!string.IsNullOrWhiteSpace(inQuery.StudyCode), t => t.StudyCode.Contains(inQuery.StudyCode)) .WhereIf(inQuery.UploadStartTime != null, t => t.UploadStartTime >= inQuery.UploadStartTime) @@ -499,7 +499,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc TrialSiteCode = t.Subject.TrialSite.TrialSiteCode, - Uploader = t.CreateUserRole.UserName, + Uploader = t.CreateUserRole.IdentityUser.UserName, UploadTime = t.CreateTime, diff --git a/IRaCIS.Core.Application/Service/ImageAndDoc/_MapConfig.cs b/IRaCIS.Core.Application/Service/ImageAndDoc/_MapConfig.cs index 8b18ea4f3..72c31db41 100644 --- a/IRaCIS.Core.Application/Service/ImageAndDoc/_MapConfig.cs +++ b/IRaCIS.Core.Application/Service/ImageAndDoc/_MapConfig.cs @@ -40,8 +40,8 @@ namespace IRaCIS.Core.Application.Service CreateMap().IncludeMembers(t => t.Subject, u => u.SubjectVisit) .ForMember(d => d.SiteName, u => u.MapFrom(s => s.Subject.TrialSite.TrialSiteName)) - .ForMember(d => d.UploaderFirstName, u => u.MapFrom(s => s.CreateUserRole.FirstName)) - .ForMember(d => d.UploaderLastName, u => u.MapFrom(s => s.CreateUserRole.LastName)) + .ForMember(d => d.UploaderFirstName, u => u.MapFrom(s => s.CreateUserRole.IdentityUser.FirstName)) + .ForMember(d => d.UploaderLastName, u => u.MapFrom(s => s.CreateUserRole.IdentityUser.LastName)) .ForMember(d => d.UploadedTime, u => u.MapFrom(s => s.CreateTime)); CreateMap(); @@ -66,7 +66,7 @@ namespace IRaCIS.Core.Application.Service CreateMap() .ForMember(o => o.IsCompleteClinicalData, t => t.MapFrom(u => !u.ReadingClinicalDataList.Any(x => x.ReadingClinicalDataPDFList.Count() == 0))) .ForMember(o => o.UploadedTime, t => t.MapFrom(u => u.CreateTime)) - .ForMember(o => o.Uploader, t => t.MapFrom(u => u.CreateUserRole.LastName + " / " + u.CreateUserRole.FirstName)) + .ForMember(o => o.Uploader, t => t.MapFrom(u => u.CreateUserRole.IdentityUser.FullName)) .ForMember(o => o.StudyId, t => t.MapFrom(u => u.Id)) .ForMember(o => o.IsHaveUploadFailed, t => t.MapFrom(u => u.DicomStudyMonitorList.Any(t => t.FailedFileCount > 0))) .ForMember(o => o.Modalities, t => t.MapFrom(u => string.Join('、', u.SeriesList.Select(t => t.Modality).Distinct()))); @@ -143,7 +143,7 @@ namespace IRaCIS.Core.Application.Service CreateMap() .ForMember(d => d.UserFullName, u => u.MapFrom(s => s.CreateUserRole.FullName)) .ForMember(d => d.UserTypeEnum, u => u.MapFrom(s => s.CreateUserRole.UserTypeEnum)) - .ForMember(d => d.UserName, u => u.MapFrom(s => s.CreateUserRole.UserName)) + .ForMember(d => d.UserName, u => u.MapFrom(s => s.CreateUserRole.IdentityUser.UserName)) .ForMember(d => d.TrialSiteCode, u => u.MapFrom(s => s.Subject.TrialSite.TrialSiteCode)) ; diff --git a/IRaCIS.Core.Application/Service/Inspection/FrontAuditConfigService.cs b/IRaCIS.Core.Application/Service/Inspection/FrontAuditConfigService.cs index c7d3b6981..15f2cb8f5 100644 --- a/IRaCIS.Core.Application/Service/Inspection/FrontAuditConfigService.cs +++ b/IRaCIS.Core.Application/Service/Inspection/FrontAuditConfigService.cs @@ -63,7 +63,7 @@ namespace IRaCIS.Core.Application.Service AccessToDialogueOutDto title = (await _qCChallengeRepository.Where(x => x.Id == inDto.Id).Include(x => x.CreateUserRole).Select(x => new AccessToDialogueOutDto() { CreateTime = x.CreateTime, - CreateUserName = x.CreateUserRole.UserName, + CreateUserName = x.CreateUserRole.IdentityUser.UserName, TalkContent = x.Content, IsTitle = true, }).FirstOrDefaultAsync()) ?? new AccessToDialogueOutDto(); @@ -72,7 +72,7 @@ namespace IRaCIS.Core.Application.Service x => new AccessToDialogueOutDto() { CreateTime = x.CreateTime, - CreateUserName = x.CreateUserRole.UserName, + CreateUserName = x.CreateUserRole.IdentityUser.UserName, TalkContent = x.TalkContent } ).OrderBy(x => x.CreateTime).ToListAsync(); @@ -85,7 +85,7 @@ namespace IRaCIS.Core.Application.Service x => new AccessToDialogueOutDto() { CreateTime = x.CreateTime, - CreateUserName = x.CreateUserRole.UserName, + CreateUserName = x.CreateUserRole.IdentityUser.UserName, TalkContent = x.TalkContent } ).OrderBy(x => x.CreateTime).ToListAsync(); diff --git a/IRaCIS.Core.Application/Service/Management/DTO/UserModel.cs b/IRaCIS.Core.Application/Service/Management/DTO/UserModel.cs index 7c133f4f4..102282203 100644 --- a/IRaCIS.Core.Application/Service/Management/DTO/UserModel.cs +++ b/IRaCIS.Core.Application/Service/Management/DTO/UserModel.cs @@ -315,6 +315,8 @@ namespace IRaCIS.Application.Contracts public string FullName { get; set; } + public DateTime? LastChangePassWordTime { get; set; } + public List UserRoleList { get; set; } } diff --git a/IRaCIS.Core.Application/Service/Management/UserFeedBackService.cs b/IRaCIS.Core.Application/Service/Management/UserFeedBackService.cs index 3083adfc1..ab7d6c5d7 100644 --- a/IRaCIS.Core.Application/Service/Management/UserFeedBackService.cs +++ b/IRaCIS.Core.Application/Service/Management/UserFeedBackService.cs @@ -40,7 +40,7 @@ namespace IRaCIS.Core.Application.Service .WhereIf(inQuery.EndCreatime != null, t => t.CreateTime == inQuery.EndCreatime) .WhereIf(inQuery.UserTypeEnum != null, t => t.CreateUserRole.UserTypeEnum == inQuery.UserTypeEnum) - .WhereIf(!string.IsNullOrEmpty(inQuery.FeedBackUserKeyInfo), t => t.CreateUserRole.FullName.Contains(inQuery.FeedBackUserKeyInfo) || t.CreateUserRole.UserName.Contains(inQuery.FeedBackUserKeyInfo)) + .WhereIf(!string.IsNullOrEmpty(inQuery.FeedBackUserKeyInfo), t => t.CreateUserRole.FullName.Contains(inQuery.FeedBackUserKeyInfo) || t.CreateUserRole.IdentityUser.UserName.Contains(inQuery.FeedBackUserKeyInfo)) .WhereIf(!string.IsNullOrEmpty(inQuery.QuestionDescription), t => t.QuestionDescription.Contains(inQuery.QuestionDescription)) .WhereIf(!string.IsNullOrEmpty(inQuery.TrialKeyInfo), t => t.Trial.ExperimentName.Contains(inQuery.TrialKeyInfo) || t.Trial.TrialCode.Contains(inQuery.TrialKeyInfo)) .WhereIf(!string.IsNullOrEmpty(inQuery.SubejctAndVisitKeyInfo), t => t.Subject.Code.Contains(inQuery.SubejctAndVisitKeyInfo) || t.SubjectVisit.VisitName.Contains(inQuery.SubejctAndVisitKeyInfo)) diff --git a/IRaCIS.Core.Application/Service/Management/_MapConfig.cs b/IRaCIS.Core.Application/Service/Management/_MapConfig.cs index dff9c1309..65062672c 100644 --- a/IRaCIS.Core.Application/Service/Management/_MapConfig.cs +++ b/IRaCIS.Core.Application/Service/Management/_MapConfig.cs @@ -97,7 +97,7 @@ namespace IRaCIS.Core.Application.Service var userId = Guid.Empty; CreateMap() .ForMember(t => t.PublishUserName, d => d.MapFrom(t => t.PublishedUser.UserName)) - .ForMember(t => t.CreateUserName, d => d.MapFrom(t => t.CreateUserRole.UserName)) + .ForMember(t => t.CreateUserName, d => d.MapFrom(t => t.CreateUserRole.IdentityUser.UserName)) .ForMember(d => d.FullFilePath, u => u.MapFrom(s => s.Path + "?access_token=" + token)); @@ -105,7 +105,7 @@ namespace IRaCIS.Core.Application.Service CreateMap() .ForMember(t => t.PublishUserName, d => d.MapFrom(t => t.PublishedUser.UserName)) - .ForMember(t => t.CreateUserName, d => d.MapFrom(t => t.CreateUserRole.UserName)) + .ForMember(t => t.CreateUserName, d => d.MapFrom(t => t.CreateUserRole.IdentityUser.UserName)) .ForMember(t => t.IsRead, d => d.MapFrom(t => t.NoticeUserReadList.Any(t => t.CreateUserId == userId))) .ForMember(d => d.FullFilePath, u => u.MapFrom(s => s.Path + "?access_token=" + token)); diff --git a/IRaCIS.Core.Application/Service/QC/QCListService.cs b/IRaCIS.Core.Application/Service/QC/QCListService.cs index 2d9379933..f5f99cd48 100644 --- a/IRaCIS.Core.Application/Service/QC/QCListService.cs +++ b/IRaCIS.Core.Application/Service/QC/QCListService.cs @@ -587,7 +587,7 @@ namespace IRaCIS.Core.Application.Image.QA return await _trialUserRoleRepository.Where(t => t.TrialId == trialId && t.UserRole.UserTypeEnum == UserTypeEnum.IQC).Select(t => new QCChanllengeCreatorDto() { CreatorRealName = t.UserRole.FullName, - Creator = t.UserRole.UserName, + Creator = t.UserRole.IdentityUser.UserName, CreateUserId = t.UserId }).ToListAsync(); @@ -604,7 +604,7 @@ namespace IRaCIS.Core.Application.Image.QA return await _trialUserRoleRepository.Where(t => t.TrialId == trialId && (t.UserRole.UserTypeEnum == UserTypeEnum.IQC || t.UserRole.UserTypeEnum == UserTypeEnum.ClinicalResearchCoordinator)).Select(t => new ParticipantDTO() { HandleUserRealName = t.UserRole.FullName, - HandleUser = t.UserRole.UserName, + HandleUser = t.UserRole.IdentityUser.UserName, HandleUserId = t.UserId }).ToListAsync(); } diff --git a/IRaCIS.Core.Application/Service/QC/_MapConfig.cs b/IRaCIS.Core.Application/Service/QC/_MapConfig.cs index 54cc95648..f2457e0b1 100644 --- a/IRaCIS.Core.Application/Service/QC/_MapConfig.cs +++ b/IRaCIS.Core.Application/Service/QC/_MapConfig.cs @@ -58,7 +58,7 @@ namespace IRaCIS.Core.Application.Service .ForMember(d => d.TrialSiteCode, u => u.MapFrom(s => s.SubjectVisit.TrialSite.TrialSiteCode)) .ForMember(d => d.VisitName, u => u.MapFrom(s => s.SubjectVisit.VisitName)) - .ForMember(d => d.CreateUserName, u => u.MapFrom(s => s.CreateUserRole.UserName)) + .ForMember(d => d.CreateUserName, u => u.MapFrom(s => s.CreateUserRole.IdentityUser.UserName)) .ForMember(d => d.LatestReplyUserName, u => u.MapFrom(t => t.LatestReplyUser.UserName)) .ForMember(d => d.LatestReplyUserFullName, u => u.MapFrom(t => t.LatestReplyUser.FullName)) .ForMember(d => d.DialogList, u => u.MapFrom(t => t.DialogList)) @@ -554,7 +554,7 @@ namespace IRaCIS.Core.Application.Service //一致性核查 质疑对话 CreateMap() - .ForMember(d => d.CreateUserName, u => u.MapFrom(t => t.CreateUserRole.UserName)) + .ForMember(d => d.CreateUserName, u => u.MapFrom(t => t.CreateUserRole.IdentityUser.UserName)) .ForMember(d => d.CreateUserFullName, u => u.MapFrom(t => t.CreateUserRole.FullName)); CreateMap() @@ -602,7 +602,7 @@ namespace IRaCIS.Core.Application.Service //QC 质疑对话 var currentUserId = Guid.Empty; CreateMap() - .ForMember(d => d.CreateUserName, u => u.MapFrom(t => t.CreateUserRole.UserName)) + .ForMember(d => d.CreateUserName, u => u.MapFrom(t => t.CreateUserRole.IdentityUser.UserName)) .ForMember(d => d.CreateUserFullName, u => u.MapFrom(t => t.CreateUserRole.FullName)) .ForMember(d => d.IsCurrentUser, u => u.MapFrom(s => s.CreateUserId == currentUserId)); @@ -666,7 +666,7 @@ namespace IRaCIS.Core.Application.Service .ForMember(d => d.BlindName, u => u.MapFrom(s => s.SubjectVisit.BlindName)) //.ForMember(d => d.ClosedUserUserName, u => u.MapFrom(s => s.ClosedUser.UserName)) .ForMember(d => d.IsQCConfirmedReupload, u => u.MapFrom(s => s.SubjectVisit.IsQCConfirmedReupload)) - .ForMember(d => d.CreateUserName, u => u.MapFrom(s => s.CreateUserRole.UserName)) + .ForMember(d => d.CreateUserName, u => u.MapFrom(s => s.CreateUserRole.IdentityUser.UserName)) .ForMember(d => d.LatestReplyUserName, u => u.MapFrom(t => t.LatestReplyUser.UserName)) .ForMember(d => d.LatestReplyUserFullName, u => u.MapFrom(t => t.LatestReplyUser.FullName)) diff --git a/IRaCIS.Core.Application/Service/Reading/MedicalAudit/ReadingMedicalReviewService.cs b/IRaCIS.Core.Application/Service/Reading/MedicalAudit/ReadingMedicalReviewService.cs index f25387e44..98806d5c4 100644 --- a/IRaCIS.Core.Application/Service/Reading/MedicalAudit/ReadingMedicalReviewService.cs +++ b/IRaCIS.Core.Application/Service/Reading/MedicalAudit/ReadingMedicalReviewService.cs @@ -77,7 +77,7 @@ namespace IRaCIS.Core.Application.Service medicalReviewInfo.ArmEnum = taskInfo.ArmEnum; medicalReviewInfo.SubjectCode = taskInfo.IsAnalysisCreate ? taskInfo.BlindSubjectCode : taskInfo.Subject.Code; medicalReviewInfo.TaskBlindName = taskInfo.TaskBlindName; - medicalReviewInfo.ReadingUser = taskInfo.DoctorUser.FirstName + taskInfo.DoctorUser.LastName; + medicalReviewInfo.ReadingUser = taskInfo.DoctorUser.IdentityUser.FullName; medicalReviewInfo.SubjectId = taskInfo.SubjectId; medicalReviewInfo.IsClosedDialog = medicalReviewInfo.MedicalReviewInfo.IsClosedDialog; medicalReviewInfo.AuditState = medicalReviewInfo.MedicalReviewInfo.AuditState; diff --git a/IRaCIS.Core.Application/Service/Reading/ReadingPeriod/ReadModuleService.cs b/IRaCIS.Core.Application/Service/Reading/ReadingPeriod/ReadModuleService.cs index 151a0e22f..e25c0aba3 100644 --- a/IRaCIS.Core.Application/Service/Reading/ReadingPeriod/ReadModuleService.cs +++ b/IRaCIS.Core.Application/Service/Reading/ReadingPeriod/ReadModuleService.cs @@ -860,7 +860,7 @@ namespace IRaCIS.Core.Application.Service }; readModule.StakeholderIds = stakeholderIds.Distinct().ToList(); - readModule.StakeholderNames = await _userRoleRepository.Where(x => readModule.StakeholderIds.Contains(x.Id)).Select(x => x.FirstName + "/" + x.LastName).ToListAsync(); + readModule.StakeholderNames = await _userRoleRepository.Where(x => readModule.StakeholderIds.Contains(x.Id)).Select(x => x.IdentityUser.FullName).ToListAsync(); return readModule; } diff --git a/IRaCIS.Core.Application/Service/Reading/_MapConfig.cs b/IRaCIS.Core.Application/Service/Reading/_MapConfig.cs index 92413e56b..1577d6ed5 100644 --- a/IRaCIS.Core.Application/Service/Reading/_MapConfig.cs +++ b/IRaCIS.Core.Application/Service/Reading/_MapConfig.cs @@ -389,7 +389,7 @@ namespace IRaCIS.Core.Application.Service CreateMap() //.ForMember(x => x.FileList, y => y.MapFrom(n => n.FileList)) - .ForMember(x => x.CreateUserName, y => y.MapFrom(n => n.CreateUserRole.UserName)); + .ForMember(x => x.CreateUserName, y => y.MapFrom(n => n.CreateUserRole.IdentityUser.UserName)); #endregion @@ -422,7 +422,7 @@ namespace IRaCIS.Core.Application.Service CreateMap() .ForMember(o => o.UploadedTime, t => t.MapFrom(u => u.CreateTime)) - .ForMember(o => o.Uploader, t => t.MapFrom(u => u.CreateUserRole.LastName + " / " + u.CreateUserRole.FirstName)) + .ForMember(o => o.Uploader, t => t.MapFrom(u => u.CreateUserRole.IdentityUser.FullName)) .ForMember(o => o.StudyId, t => t.MapFrom(u => u.Id)); CreateMap() diff --git a/IRaCIS.Core.Application/Service/ReadingCalculate/General/GeneralCalculateService.cs b/IRaCIS.Core.Application/Service/ReadingCalculate/General/GeneralCalculateService.cs index 2f3023504..f6655ca5f 100644 --- a/IRaCIS.Core.Application/Service/ReadingCalculate/General/GeneralCalculateService.cs +++ b/IRaCIS.Core.Application/Service/ReadingCalculate/General/GeneralCalculateService.cs @@ -129,7 +129,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate { // 这里是记录日志 不需要国际化 var criterionInfo = await _readingQuestionCriterionTrialRepository.Where(x => x.Id == inDto.TrialReadingCriterionId).Include(x => x.Trial).FirstNotNullAsync(); - var taskInfo = await _visitTaskRepository.Where(x => x.Id == inDto.VisitTaskId).Include(x => x.Subject).Include(x => x.DoctorUser).FirstNotNullAsync(); + var taskInfo = await _visitTaskRepository.Where(x => x.Id == inDto.VisitTaskId).Include(x => x.Subject).Include(x => x.DoctorUser).ThenInclude(t => t.IdentityUser).FirstNotNullAsync(); //错误级别日志:项目、标准、受试者、阅片人、任务。输出其它既往新病灶数据: @@ -141,7 +141,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate builder.AppendLine($"【标准Id】:【{criterionInfo.Id}】"); builder.AppendLine($"【受试者】:【{taskInfo.Subject.ShortName}】"); builder.AppendLine($"【受试者Id】:【{taskInfo.Subject.Id}】"); - builder.AppendLine($"【阅片人】:【{taskInfo.DoctorUser.FirstName}】"); + builder.AppendLine($"【阅片人】:【{taskInfo.DoctorUser.IdentityUser.FullName}】"); builder.AppendLine($"【阅片人Id】:【{taskInfo.DoctorUser.Id}】"); builder.AppendLine($"【任务】:【{taskInfo.TaskBlindName}】"); builder.AppendLine($"【任务Id】:【{taskInfo.Id}】"); diff --git a/IRaCIS.Core.Application/Service/ReadingCalculate/IRECIST1Point1CalculateService.cs b/IRaCIS.Core.Application/Service/ReadingCalculate/IRECIST1Point1CalculateService.cs index 33890e963..289662e66 100644 --- a/IRaCIS.Core.Application/Service/ReadingCalculate/IRECIST1Point1CalculateService.cs +++ b/IRaCIS.Core.Application/Service/ReadingCalculate/IRECIST1Point1CalculateService.cs @@ -2698,7 +2698,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate //错误级别日志:项目、标准、受试者、阅片人、任务。输出新病灶数据: // 这里是记录日志 不需要国际化 var criterionInfo = await _readingQuestionCriterionTrialRepository.Where(x => x.Id == inDto.TrialReadingCriterionId).Include(x => x.Trial).FirstNotNullAsync(); - var taskInfo = await _visitTaskRepository.Where(x => x.Id == inDto.VisitTaskId).Include(x => x.Subject).Include(x => x.DoctorUser).FirstNotNullAsync(); + var taskInfo = await _visitTaskRepository.Where(x => x.Id == inDto.VisitTaskId).Include(x => x.Subject).Include(x => x.DoctorUser).ThenInclude(t => t.IdentityUser).FirstNotNullAsync(); StringBuilder builder = new StringBuilder(); builder.AppendLine($""); builder.AppendLine($"【项目】:【{criterionInfo.Trial.TrialCode}】"); @@ -2707,7 +2707,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate builder.AppendLine($"【标准Id】:【{criterionInfo.Id}】"); builder.AppendLine($"【受试者】:【{taskInfo.Subject.ShortName}】"); builder.AppendLine($"【受试者Id】:【{taskInfo.Subject.Id}】"); - builder.AppendLine($"【阅片人】:【{taskInfo.DoctorUser.FirstName}】"); + builder.AppendLine($"【阅片人】:【{taskInfo.DoctorUser.IdentityUser.FullName}】"); builder.AppendLine($"【阅片人Id】:【{taskInfo.DoctorUser.Id}】"); builder.AppendLine($"【任务】:【{taskInfo.TaskBlindName}】"); builder.AppendLine($"【任务Id】:【{taskInfo.Id}】"); @@ -3091,7 +3091,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate //错误级别日志:项目、标准、受试者、阅片人、任务。输出靶病灶、非靶病灶、新病灶的评估结果: // 这里是记录日志 不需要国际化 var criterionInfo = await _readingQuestionCriterionTrialRepository.Where(x => x.Id == inDto.TrialReadingCriterionId).Include(x => x.Trial).FirstNotNullAsync(); - var taskInfo = await _visitTaskRepository.Where(x => x.Id == inDto.VisitTaskId).Include(x => x.Subject).Include(x => x.DoctorUser).FirstNotNullAsync(); + var taskInfo = await _visitTaskRepository.Where(x => x.Id == inDto.VisitTaskId).Include(x => x.Subject).Include(x => x.DoctorUser).ThenInclude(t=>t.IdentityUser).FirstNotNullAsync(); StringBuilder builder = new StringBuilder(); builder.AppendLine($""); builder.AppendLine($"【项目】:【{criterionInfo.Trial.TrialCode}】"); @@ -3100,7 +3100,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate builder.AppendLine($"【标准Id】:【{criterionInfo.Id}】"); builder.AppendLine($"【受试者】:【{taskInfo.Subject.ShortName}】"); builder.AppendLine($"【受试者Id】:【{taskInfo.Subject.Id}】"); - builder.AppendLine($"【阅片人】:【{taskInfo.DoctorUser.FirstName}】"); + builder.AppendLine($"【阅片人】:【{taskInfo.DoctorUser.IdentityUser.FullName}】"); builder.AppendLine($"【阅片人Id】:【{taskInfo.DoctorUser.Id}】"); builder.AppendLine($"【任务】:【{taskInfo.TaskBlindName}】"); builder.AppendLine($"【任务Id】:【{taskInfo.Id}】"); diff --git a/IRaCIS.Core.Application/Service/SiteSurvey/_MapConfig.cs b/IRaCIS.Core.Application/Service/SiteSurvey/_MapConfig.cs index 455e7d5fc..80b34555b 100644 --- a/IRaCIS.Core.Application/Service/SiteSurvey/_MapConfig.cs +++ b/IRaCIS.Core.Application/Service/SiteSurvey/_MapConfig.cs @@ -83,7 +83,7 @@ namespace IRaCIS.Core.Application.AutoMapper CreateMap(); - CreateMap().ForMember(d => d.RealName, u => u.MapFrom(s => s.LastName + " / " + s.FirstName)); + CreateMap().ForMember(d => d.RealName, u => u.MapFrom(s => s.IdentityUser.FullName)); diff --git a/IRaCIS.Core.Application/Service/Third-partyProject/UltrasonicDicomService.cs b/IRaCIS.Core.Application/Service/Third-partyProject/UltrasonicDicomService.cs index 38845d607..c41d6c686 100644 --- a/IRaCIS.Core.Application/Service/Third-partyProject/UltrasonicDicomService.cs +++ b/IRaCIS.Core.Application/Service/Third-partyProject/UltrasonicDicomService.cs @@ -123,7 +123,7 @@ namespace IRaCIS.Core.Application.Service.Third_partyProject TrialSiteCode = dicomStudy.Subject.TrialSite.TrialSiteCode, - Uploader = dicomStudy.CreateUserRole.UserName, + Uploader = dicomStudy.CreateUserRole.IdentityUser.UserName, UploadTime = dicomStudy.CreateTime }; diff --git a/IRaCIS.Core.Application/Service/TrialSiteUser/PersonalWorkstation.cs b/IRaCIS.Core.Application/Service/TrialSiteUser/PersonalWorkstation.cs index 1a4dcd4c4..43230d123 100644 --- a/IRaCIS.Core.Application/Service/TrialSiteUser/PersonalWorkstation.cs +++ b/IRaCIS.Core.Application/Service/TrialSiteUser/PersonalWorkstation.cs @@ -1381,7 +1381,7 @@ namespace IRaCIS.Core.Application .WhereIf(!string.IsNullOrWhiteSpace(inQuery.ExperimentName), o => o.ExperimentName.Contains(inQuery.ExperimentName)) .WhereIf(_userInfo.UserTypeEnumInt != (int)UserTypeEnum.SuperAdmin && _userInfo.UserTypeEnumInt != (int)UserTypeEnum.Admin && _userInfo.UserTypeEnumInt != (int)UserTypeEnum.OP, t => t.TrialUserList.Any(t => t.UserId == _userInfo.UserRoleId && t.IsDeleted == false) && t.IsDeleted == false) .WhereIf(inQuery.CriterionType != null, o => o.TrialReadingCriterionList.Any(t => t.CriterionType == inQuery.CriterionType && t.IsSigned && t.IsConfirm)) - .WhereIf(!string.IsNullOrEmpty(inQuery.PM_EMail), o => o.TrialUserList.Any(t => t.UserRole.EMail.Contains(inQuery.PM_EMail) && (t.UserRole.UserTypeEnum == UserTypeEnum.ProjectManager || t.UserRole.UserTypeEnum == UserTypeEnum.APM))) + .WhereIf(!string.IsNullOrEmpty(inQuery.PM_EMail), o => o.TrialUserList.Any(t => t.UserRole.IdentityUser.EMail.Contains(inQuery.PM_EMail) && (t.UserRole.UserTypeEnum == UserTypeEnum.ProjectManager || t.UserRole.UserTypeEnum == UserTypeEnum.APM))) .Select(t => new TrialToBeDoneDto() { TrialId = t.Id, @@ -1442,7 +1442,7 @@ namespace IRaCIS.Core.Application IR_ReadingCriterionList = isIR ? t.TrialReadingCriterionList.Where(t => t.IsConfirm && t.IsSigned).OrderBy(t => t.CriterionName).Select(t => t.CriterionName).ToList() : null, - IR_PMEmailList = isIR ? t.TrialUserList.Where(t => t.UserRole.UserTypeEnum == UserTypeEnum.ProjectManager || t.UserRole.UserTypeEnum == UserTypeEnum.APM).OrderBy(t => t.UserRole.EMail).Select(t => t.UserRole.EMail).ToList() : null, + IR_PMEmailList = isIR ? t.TrialUserList.Where(t => t.UserRole.UserTypeEnum == UserTypeEnum.ProjectManager || t.UserRole.UserTypeEnum == UserTypeEnum.APM).OrderBy(t => t.UserRole.IdentityUser.EMail).Select(t => t.UserRole.IdentityUser.EMail).ToList() : null, IR_TotalReadCount = isIR ? t.VisitTaskList.Where(t => t.DoctorUserId == _userInfo.UserRoleId && t.TaskState == TaskState.Effect && t.ReadingTaskState == ReadingTaskState.HaveSigned).Count() : 0, @@ -1482,7 +1482,7 @@ namespace IRaCIS.Core.Application var query = _trialUserRoleRepository.Where(t => t.TrialId == inQuery.TrialId) .Select(t => new TrialUserToBeDoneDto() { - UserName = t.UserRole.UserName, + UserName = t.UserRole.IdentityUser.UserName, FullName = t.UserRole.FullName, UserType = t.UserRole.UserTypeEnum, diff --git a/IRaCIS.Core.Application/Service/TrialSiteUser/TrialExternalUserService.cs b/IRaCIS.Core.Application/Service/TrialSiteUser/TrialExternalUserService.cs index e0d77bd2c..cb615917e 100644 --- a/IRaCIS.Core.Application/Service/TrialSiteUser/TrialExternalUserService.cs +++ b/IRaCIS.Core.Application/Service/TrialSiteUser/TrialExternalUserService.cs @@ -15,6 +15,7 @@ using Medallion.Threading; using Microsoft.AspNetCore.Mvc; using DocumentFormat.OpenXml.Spreadsheet; using IRaCIS.Core.Domain.Models; +using IRaCIS.Application.Contracts; namespace IRaCIS.Core.Application.Service { @@ -90,79 +91,24 @@ namespace IRaCIS.Core.Application.Service return ResponseOutput.NotOk(_localizer["TrialExternalUser_EmailTypeDuplicate"]); } - - var addEntity = _mapper.Map(addOrEditTrialExternalUser); await _trialExternalUseRepository.AddAsync(addEntity); - - var trialType = await _trialRepository.Where(t => t.Id == addOrEditTrialExternalUser.TrialId).Select(t => t.TrialType).FirstOrDefaultAsync(); - if (existSysUser != null) { addEntity.IsSystemUser = true; addEntity.SystemUserId = existSysUser.Id; - - if (!existSysUser.UserRoleList.Any(t => t.UserTypeId == addOrEditTrialExternalUser.UserTypeId)) - { - var addRole = _mapper.Map(existSysUser); - addRole.UserTypeEnum = _userTypeRepository.Where(t => t.Id == addOrEditTrialExternalUser.UserTypeId).Select(t => t.UserTypeEnum).First(); - addRole.UserTypeId = addOrEditTrialExternalUser.UserTypeId; - addRole.IsUserRoleDisabled = true; - existSysUser.UserRoleList.Add(addRole); - } - } - else - { - //生成账户 并插入 - - var generateUser = _mapper.Map(addOrEditTrialExternalUser); - - if (trialType == TrialType.NoneOfficial) - { - generateUser.IsTestUser = true; - } - - // 外部人员生成账号 都是外部的 - generateUser.IsZhiZhun = false; - - generateUser.Code = _identityUserRepository.Select(t => t.Code).DefaultIfEmpty().Max() + 1; - - - generateUser.UserCode = AppSettings.GetCodeStr(generateUser.Code, nameof(IdentityUser)); - - generateUser.UserName = generateUser.UserCode; - - - generateUser.Password = MD5Helper.Md5(IRCEmailPasswordHelper.GenerateRandomPassword(10)); - - generateUser.Status = UserStateEnum.Disable; - - var addRole = _mapper.Map(generateUser); - addRole.UserTypeEnum = _userTypeRepository.Where(t => t.Id == addOrEditTrialExternalUser.UserTypeId).Select(t => t.UserTypeEnum).First(); - addRole.UserTypeId = addOrEditTrialExternalUser.UserTypeId; - - generateUser.UserRoleList = new List() { addRole }; - - var newAddUser = await _identityUserRepository.AddAsync(generateUser); - - addEntity.IsSystemUser = false; - addEntity.SystemUserId = newAddUser.Id; - - - existSysUser = newAddUser; - - } + var trialType = await _trialRepository.Where(t => t.Id == addOrEditTrialExternalUser.TrialId).Select(t => t.TrialType).FirstOrDefaultAsync(); #region 验证用户 能否加入 if (trialType == TrialType.OfficialTrial || trialType == TrialType.Training) { - if (existSysUser.IsTestUser) + if (existSysUser != null && existSysUser.IsTestUser) { //---正式类型 、培训类型的项目 不允许加入测试用户 throw new BusinessValidationFailedException(_localizer["TrialExternalUser_TestUserNotAllowed"]); @@ -173,7 +119,7 @@ namespace IRaCIS.Core.Application.Service if (trialType == TrialType.NoneOfficial) { - if (existSysUser.IsTestUser == false) + if (existSysUser != null && existSysUser.IsTestUser == false) { //---测试项目 不允许加入正式用户 throw new BusinessValidationFailedException(_localizer["TrialExternalUser_FormalUserNotAllowed"]); @@ -238,10 +184,6 @@ namespace IRaCIS.Core.Application.Service var success = await _trialExternalUseRepository.BatchDeleteNoTrackingAsync(t => t.Id == trialExternalUserId); - //if (isSystemUser == false) - //{ - // await _userRoleRepository.BatchDeleteNoTrackingAsync(t => t.Id == systemUserId); - //} return ResponseOutput.Result(success); } @@ -256,53 +198,181 @@ namespace IRaCIS.Core.Application.Service { var trialId = sendEmail.TrialId; - foreach (var userInfo in sendEmail.SendUsers) + var trialType = await _trialRepository.Where(t => t.Id == trialId).Select(t => t.TrialType).FirstOrDefaultAsync(); + + foreach (var item in sendEmail.SendUsers.GroupBy(t => t.Email)) { - var userId = userInfo.SystemUserId; - var userTypeId = userInfo.UserTypeId; - var findTrialUser = await _trialIdentityUserRepository.FirstOrDefaultAsync(t => t.TrialId == trialId && t.IdentityUserId == userId, true); + var userEmail = item.Key; - var findUserRoleId = await _identityUserRepository.Where(t => t.Id == userId, true).SelectMany(t => t.UserRoleList).Where(t => t.UserTypeId == userTypeId).Select(t => t.Id).FirstOrDefaultAsync(); + var userTypeIdList = item.Select(t => t.UserTypeId).ToList(); - if (findTrialUser == null || findUserRoleId == Guid.Empty) + var itemFirst = item.FirstOrDefault(); + + var externalIdList = item.Select(t => t.Id).ToList(); + + + //var identityUserId = item.Key; + + var existSysUser = await _identityUserRepository.Where(t => t.EMail == userEmail, true).Include(t => t.UserRoleList).FirstOrDefaultAsync(); + + if (existSysUser != null) { - return ResponseOutput.NotOk("database dirty data "); + + //账号状态设置为启用 + existSysUser.Status = UserStateEnum.Enable; + + foreach (var userTypeId in userTypeIdList) + { + var findRole = existSysUser.UserRoleList.FirstOrDefault(t => t.UserTypeId == userTypeId); + + if (findRole != null) + { + //存在该角色,设置为启用 + findRole.IsUserRoleDisabled = false; + } + else + { + //不存在该角色,那么就添加 + var addRole = _mapper.Map(existSysUser); + addRole.UserTypeEnum = _userTypeRepository.Where(t => t.Id == userTypeId).Select(t => t.UserTypeEnum).First(); + addRole.UserTypeId = userTypeId; + addRole.IsUserRoleDisabled = false; + existSysUser.UserRoleList.Add(addRole); + } + } + + //防止已经生成账号的信息与外部人员信息不一致 在此默认批量更一下 + + await _trialExternalUseRepository.BatchUpdateNoTrackingAsync(t => externalIdList.Contains(t.Id), u => new TrialExternalUser() + { + FirstName = existSysUser.FirstName, + LastName = existSysUser.LastName, + Phone = existSysUser.Phone, + OrganizationName = existSysUser.OrganizationName + }); } else { - var findTrialUserRole = await _trialUserRoleRepository.FirstOrDefaultAsync(t => t.TrialId == trialId && t.UserRole.IdentityUserId == userId && t.UserRole.UserTypeId == userTypeId, true); - if (findTrialUserRole == null) + //生成账户 并插入 + var externalUser = _trialExternalUseRepository.FirstOrDefaultAsync(t => t.Id == itemFirst.Id); + var generateUser = _mapper.Map(externalUser); + + if (trialType == TrialType.NoneOfficial) { + generateUser.IsTestUser = true; + } - await _trialUserRoleRepository.AddAsync(new TrialUserRole() { TrialId = trialId, TrialUserId = findTrialUser.Id, UserId = findUserRoleId, JoinTime = DateTime.Now }); + // 外部人员生成账号 都是外部的 + generateUser.IsZhiZhun = false; - await _userRoleRepository.BatchUpdateNoTrackingAsync(t => t.IdentityUserId == userId, u => new UserRole() { IsUserRoleDisabled =false }); - - await _trialExternalUseRepository.BatchUpdateNoTrackingAsync(t => t.Id == userInfo.Id, u => new TrialExternalUser() { IsJoin = true }); + generateUser.Code = _identityUserRepository.Select(t => t.Code).DefaultIfEmpty().Max() + 1; - await _userRoleRepository.SaveChangesAsync(); + generateUser.UserCode = AppSettings.GetCodeStr(generateUser.Code, nameof(IdentityUser)); + + generateUser.UserName = generateUser.UserCode; + + + generateUser.Password = MD5Helper.Md5(IRCEmailPasswordHelper.GenerateRandomPassword(10)); + + generateUser.Status = UserStateEnum.Disable; + + generateUser.UserRoleList = new List() { }; + + foreach (var userTypeId in userTypeIdList) + { + var addRole = _mapper.Map(generateUser); + + addRole.UserTypeEnum = _userTypeRepository.Where(t => t.Id == userTypeId).Select(t => t.UserTypeEnum).First(); + + addRole.UserTypeId = userTypeId; + + generateUser.UserRoleList.Add(addRole); + } + + var newAddUser = await _identityUserRepository.AddAsync(generateUser); + + await _trialExternalUseRepository.BatchUpdateNoTrackingAsync(t => externalIdList.Contains(t.Id), u => new TrialExternalUser() { IsSystemUser = false, SystemUserId = newAddUser.Id }); + + existSysUser = newAddUser; + + } + + await _identityUserRepository.SaveChangesAsync(); + + + var identityUserId = existSysUser.Id; + + + var userTypeList = await _identityUserRepository.Where(t => t.Id == identityUserId).SelectMany(t => t.UserRoleList).Select(t => new { t.UserTypeId, t.UserTypeRole.UserTypeShortName }).ToListAsync(); + + var userHaveUserTypeIdList = userTypeList.Select(t => t.UserTypeId).ToList(); + + if (userTypeIdList.Except(userHaveUserTypeIdList).Any()) + { + return ResponseOutput.NotOk("database dirty data "); + } + + var findTrialUser = await _trialIdentityUserRepository.Where(t => t.TrialId == trialId && t.IdentityUserId == identityUserId, true).Include(t => t.TrialUserRoleList).FirstOrDefaultAsync(); + + if (findTrialUser == null) + { + //没有项目参与人员 + findTrialUser = await _trialIdentityUserRepository.AddAsync(new TrialIdentityUser() + { + IdentityUserId = identityUserId, + TrialId = trialId, + JoinTime = DateTime.Now, + TrialUserRoleList = userTypeIdList.Select(u => new TrialUserRole() + { + TrialId = trialId, + UserId = u, + + }).ToList() + }); + } + else + { + //有该人员 + + //是否有该角色 + + foreach (var userTypeId in userTypeIdList) + { + var findTrialUserRole = findTrialUser.TrialUserRoleList.Where(t => t.UserId == userTypeId).FirstOrDefault(); + + if (findTrialUserRole == null) + { + //添加该角色 + findTrialUser.TrialUserRoleList.Add(new TrialUserRole() { TrialUserId = findTrialUser.Id, TrialId = trialId, UserId = userTypeId }); + } + else + { + //如果禁用,那么启用 + if (findTrialUserRole.IsDeleted == true) + { + findTrialUserRole.IsDeleted = false; + findTrialUserRole.DeletedTime = null; + } + + } + } } - } + var usertyps = string.Join(',', userTypeList.Select(t => t.UserTypeShortName)); + + await _mailVerificationService.ExternalUserJoinEmail(trialId, identityUserId, usertyps, sendEmail.BaseUrl, sendEmail.RouteUrl); + + await _trialExternalUseRepository.BatchUpdateNoTrackingAsync(t => externalIdList.Contains(t.Id), u => new TrialExternalUser() { IsJoin = true }); - foreach (var item in sendEmail.SendUsers.GroupBy(t => t.SystemUserId)) - { - await _mailVerificationService.ExternalUserJoinEmail(trialId, item.Key, sendEmail.BaseUrl, sendEmail.RouteUrl); } - return ResponseOutput.Ok(); + } - - - - - - } } diff --git a/IRaCIS.Core.Application/Service/TrialSiteUser/TrialMaintenanceService.cs b/IRaCIS.Core.Application/Service/TrialSiteUser/TrialMaintenanceService.cs index 140cdf627..dc1f94f7e 100644 --- a/IRaCIS.Core.Application/Service/TrialSiteUser/TrialMaintenanceService.cs +++ b/IRaCIS.Core.Application/Service/TrialSiteUser/TrialMaintenanceService.cs @@ -21,7 +21,7 @@ namespace IRaCIS.Core.Application.Service public async Task> GetTrialUserList(Guid trialId) { return await _trialUseRoleRepository.Where(t => t.TrialId == trialId, ignoreQueryFilters: true) - .Select(t => new TrialUserBasicInfo() { FullName = t.UserRole.FullName, UserId = t.UserId, UserTypeId = t.UserRole.UserTypeId, UserName = t.UserRole.UserName }) + .Select(t => new TrialUserBasicInfo() { FullName = t.UserRole.FullName, UserId = t.UserId, UserTypeId = t.UserRole.UserTypeId, UserName = t.UserRole.IdentityUser.UserName }) .ToListAsync(); } diff --git a/IRaCIS.Core.Application/Service/TrialSiteUser/TrialSiteService.cs b/IRaCIS.Core.Application/Service/TrialSiteUser/TrialSiteService.cs index e6697c018..f131d5625 100644 --- a/IRaCIS.Core.Application/Service/TrialSiteUser/TrialSiteService.cs +++ b/IRaCIS.Core.Application/Service/TrialSiteUser/TrialSiteService.cs @@ -89,7 +89,7 @@ namespace IRaCIS.Core.Application.Services .WhereIf(!string.IsNullOrWhiteSpace(inQuery.TrialSiteCode), t => t.TrialSiteCode.Contains(inQuery.TrialSiteCode)) .WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator, t => t.CRCUserList.Any(k => k.UserId == _userInfo.UserRoleId)) .WhereIf(!string.IsNullOrWhiteSpace(inQuery.UserKeyInfo), t => t.CRCUserList.Any(k => (k.UserRole.FullName).Contains(inQuery.UserKeyInfo) - || k.UserRole.UserName.Contains(inQuery.UserKeyInfo) || k.UserRole.EMail.Contains(inQuery.UserKeyInfo))) + || k.UserRole.IdentityUser.UserName.Contains(inQuery.UserKeyInfo) || k.UserRole.IdentityUser.EMail.Contains(inQuery.UserKeyInfo))) .ProjectTo(_mapper.ConfigurationProvider); @@ -111,7 +111,7 @@ namespace IRaCIS.Core.Application.Services .WhereIf(!string.IsNullOrWhiteSpace(inQuery.TrialSiteCode), t => t.TrialSiteCode.Contains(inQuery.TrialSiteCode)) .WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator, t => t.CRCUserList.Any(k => k.UserId == _userInfo.UserRoleId)) .WhereIf(!string.IsNullOrWhiteSpace(inQuery.UserKeyInfo), t => t.CRCUserList.Any(k => (k.UserRole.FullName).Contains(inQuery.UserKeyInfo) - || k.UserRole.UserName.Contains(inQuery.UserKeyInfo) || k.UserRole.EMail.Contains(inQuery.UserKeyInfo))) + || k.UserRole.IdentityUser.UserName.Contains(inQuery.UserKeyInfo) || k.UserRole.IdentityUser.EMail.Contains(inQuery.UserKeyInfo))) .ProjectTo(_mapper.ConfigurationProvider, new { isEn_Us = _userInfo.IsEn_Us }); diff --git a/IRaCIS.Core.Application/Service/TrialSiteUser/_MapConfig.cs b/IRaCIS.Core.Application/Service/TrialSiteUser/_MapConfig.cs index cb7c43c50..3af4d7205 100644 --- a/IRaCIS.Core.Application/Service/TrialSiteUser/_MapConfig.cs +++ b/IRaCIS.Core.Application/Service/TrialSiteUser/_MapConfig.cs @@ -192,7 +192,7 @@ namespace IRaCIS.Core.Application.Service CreateMap() .ForMember(t => t.UserRealName, u => u.MapFrom(c => c.CreateUserRole.FullName)) - .ForMember(t => t.UserName, u => u.MapFrom(c => c.CreateUserRole.UserName)); + .ForMember(t => t.UserName, u => u.MapFrom(c => c.CreateUserRole.IdentityUser.UserName)); diff --git a/IRaCIS.Core.Application/Service/Visit/_MapConfig.cs b/IRaCIS.Core.Application/Service/Visit/_MapConfig.cs index 848708e9e..54115ff3b 100644 --- a/IRaCIS.Core.Application/Service/Visit/_MapConfig.cs +++ b/IRaCIS.Core.Application/Service/Visit/_MapConfig.cs @@ -26,7 +26,7 @@ namespace IRaCIS.Core.Application.Service CreateMap() - .ForMember(d => d.CreateUser, u => u.MapFrom(g => g.CreateUserRole.LastName + " / " + g.CreateUserRole.FirstName)); + .ForMember(d => d.CreateUser, u => u.MapFrom(g => g.CreateUserRole.IdentityUser.FullName)); diff --git a/IRaCIS.Core.Infra.EFCore/Context/Convention/NoForeignKeyMigrationsSqlGenerator.cs b/IRaCIS.Core.Infra.EFCore/Context/Convention/NoForeignKeyMigrationsSqlGenerator.cs index 642c8c201..11ff097ee 100644 --- a/IRaCIS.Core.Infra.EFCore/Context/Convention/NoForeignKeyMigrationsSqlGenerator.cs +++ b/IRaCIS.Core.Infra.EFCore/Context/Convention/NoForeignKeyMigrationsSqlGenerator.cs @@ -21,6 +21,7 @@ public class NoForeignKeyMigrationsSqlGenerator : SqlServerMigrationsSqlGenerato protected override void Generate(Microsoft.EntityFrameworkCore.Migrations.Operations.CreateTableOperation operation, IModel? model, MigrationCommandListBuilder builder, bool terminate = true) { operation.ForeignKeys.Clear(); + base.Generate(operation, model, builder, terminate); } protected override void Generate(AddForeignKeyOperation operation, IModel? model, MigrationCommandListBuilder builder, bool terminate = true) @@ -33,7 +34,8 @@ public class NoForeignKeyMigrationsSqlGenerator : SqlServerMigrationsSqlGenerato // 忽略所有删除外键的操作 // 不调用 base.Generate 来跳过生成删除外键的SQL } - ////忽略掉唯一约束,因为dicom Id 的问题 + + ////忽略掉唯一约束 //protected override void Generate(CreateIndexOperation operation, IModel? model, MigrationCommandListBuilder builder, bool terminate = true) //{ // // 如果索引是唯一的,则忽略,不生成SQL语句