diff --git a/IRaCIS.Core.Application/Service/Document/TrialDocumentService.cs b/IRaCIS.Core.Application/Service/Document/TrialDocumentService.cs index ddeec3919..cc1cac31d 100644 --- a/IRaCIS.Core.Application/Service/Document/TrialDocumentService.cs +++ b/IRaCIS.Core.Application/Service/Document/TrialDocumentService.cs @@ -400,7 +400,7 @@ namespace IRaCIS.Core.Application.Services var unionQuery = systemDocQuery.Concat(trialDocQuery) //过滤掉删除的,并且没有签名的 - .Where(t=>!(t.IsDeleted == true && t.ConfirmTime==null)) + .Where(t => !(t.IsDeleted == true && t.ConfirmTime == null)) .WhereIf(!string.IsNullOrEmpty(inQuery.Name), t => t.Name.Contains(inQuery.Name)) .WhereIf(inQuery.FileTypeId != null, t => t.FileTypeId == inQuery.FileTypeId) .WhereIf(inQuery.IsSign == true, t => t.ConfirmTime != null) @@ -477,6 +477,8 @@ namespace IRaCIS.Core.Application.Services && t.TrialUserRoleList.AsQueryable().Any(t => trialDoc.NeedConfirmedUserTypeList.Any(c => c.NeedConfirmUserTypeId == t.UserRole.UserTypeId)) ) .Where(t => inQuery.UserId != null ? t.IdentityUserId == inQuery.UserId : true) + .Where(t => inQuery.UserTypeId != null ? t.TrialUserRoleList.Any(t => t.UserRole.UserTypeId == inQuery.UserTypeId) : true) + join confirm in _trialDocConfirmedUserRepository.Where(t => t.TrialDocument.TrialId == inQuery.TrialId) on new { trialUser.IdentityUserId, TrialDocumentId = trialDoc.Id } equals new { IdentityUserId = confirm.ConfirmUserId, confirm.TrialDocumentId } into cc @@ -514,10 +516,11 @@ namespace IRaCIS.Core.Application.Services var systemDocQuery = from sysDoc in _systemDocumentRepository.AsQueryable(false).Where(u => trialInfo.TrialFinishedTime != null ? u.CreateTime < trialInfo.TrialFinishedTime : true) + .Where(t => inQuery.UserTypeId != null ? t.NeedConfirmedUserTypeList.Any(t => t.NeedConfirmUserTypeId == inQuery.UserTypeId) : true) from trialUser in _trialIdentityUserRepository.AsQueryable(false).Where(t => t.TrialId == inQuery.TrialId && t.TrialUserRoleList.Any(t => sysDoc.NeedConfirmedUserTypeList.AsQueryable().Any(c => c.NeedConfirmUserTypeId == t.UserRole.UserTypeId))) .Where(t => inQuery.UserId != null ? t.IdentityUserId == inQuery.UserId : true) - + .Where(t => inQuery.UserTypeId != null ? t.TrialUserRoleList.Any(t => t.UserRole.UserTypeId == inQuery.UserTypeId) : true) join confirm in _systemDocConfirmedUserRepository.Where() on new { ConfirmUserId = trialUser.IdentityUserId, SystemDocumentId = sysDoc.Id } equals new { confirm.ConfirmUserId, confirm.SystemDocumentId } into cc from confirm in cc.DefaultIfEmpty() select new UnionDocumentWithConfirmInfoView() @@ -570,7 +573,7 @@ namespace IRaCIS.Core.Application.Services var sysDocUserTypeList = _systemDocNeedConfirmedUserTypeRepository.Where(t => sysDocIdList.Contains(t.SystemDocumentId)).Select(t => new { t.SystemDocumentId, t.UserTypeRole.UserTypeShortName }).ToList(); - var trialUserUserTypeList = _trialIdentityUserRepository.Where(t => t.TrialId==inQuery.TrialId && trialIdentityUserIdList.Contains(t.IdentityUserId)).IgnoreQueryFilters().Select(t => new { t.IdentityUserId, UserTypeList = t.TrialUserRoleList.Select(c => c.UserRole.UserTypeRole.UserTypeShortName).ToList() }); + var trialUserUserTypeList = _trialIdentityUserRepository.Where(t => t.TrialId == inQuery.TrialId && trialIdentityUserIdList.Contains(t.IdentityUserId)).IgnoreQueryFilters().Select(t => new { t.IdentityUserId, UserTypeList = t.TrialUserRoleList.Select(c => c.UserRole.UserTypeRole.UserTypeShortName).ToList() }); foreach (var item in result.CurrentPageData) diff --git a/IRaCIS.Core.Application/Service/Inspection/DTO/InspectionModel.cs b/IRaCIS.Core.Application/Service/Inspection/DTO/InspectionModel.cs index 59ceefc6c..16c2630fa 100644 --- a/IRaCIS.Core.Application/Service/Inspection/DTO/InspectionModel.cs +++ b/IRaCIS.Core.Application/Service/Inspection/DTO/InspectionModel.cs @@ -472,7 +472,7 @@ namespace IRaCIS.Core.Application.Service.Inspection.DTO /// public string OpByUserName { get; set; } = string.Empty; - public string? CreateUserName { get; set; } + public string? CreateUserRealName { get; set; } /// /// 阅读片人 diff --git a/IRaCIS.Core.Application/Service/Inspection/InspectionService.cs b/IRaCIS.Core.Application/Service/Inspection/InspectionService.cs index 96b4c95f1..2b9c79c7a 100644 --- a/IRaCIS.Core.Application/Service/Inspection/InspectionService.cs +++ b/IRaCIS.Core.Application/Service/Inspection/InspectionService.cs @@ -106,7 +106,7 @@ namespace IRaCIS.Core.Application.Service.Inspection //OptType = data.OptType, IP = data.IP, Reason = data.Reason, - IsSign = leftfrontAuditConfig.IsHaveSign && lefttrialSign.SignText!=null&& lefttrialSign.SignText!=string.Empty, + IsSign = leftfrontAuditConfig.IsHaveSign && lefttrialSign.SignText != null && lefttrialSign.SignText != string.Empty, SignId = data.SignId, ParentId = data.ParentId, ChildrenTypeId = data.ChildrenTypeId, @@ -190,7 +190,7 @@ namespace IRaCIS.Core.Application.Service.Inspection .WhereIf(!inQuery.TaskName.IsNullOrEmpty(), x => x.TaskName.Contains(inQuery.TaskName) || x.BlindName.Contains(inQuery.TaskName)) .WhereIf(!inQuery.SubjectInfo.IsNullOrEmpty(), x => x.SubjectCode.Contains(inQuery.SubjectInfo)) - .WhereIf(!inQuery.RoleName.IsNullOrEmpty(), x => x.RoleName.Contains(inQuery.RoleName)) + .WhereIf(!inQuery.RoleName.IsNullOrEmpty(), x => x.RoleName == inQuery.RoleName) //.WhereIf(dto.VisitPlanInfo != null&& dto.VisitPlanInfo!=(decimal) 1.11, x => x.VisitNum == dto.VisitPlanInfo) //.WhereIf(dto.VisitPlanInfo != (decimal)1.11,x=>x.InPlan!=null&& x.InPlan==false) .WhereIf(inQuery.StartTime != null, x => x.CreateTime >= inQuery.StartTime) @@ -198,7 +198,7 @@ namespace IRaCIS.Core.Application.Service.Inspection .WhereIf(inQuery.ModuleType != null, x => x.ModuleTypeId == inQuery.ModuleType) .WhereIf(!inQuery.Description.IsNullOrEmpty(), x => x.Description.Contains(inQuery.Description) || x.DescriptionCN.Contains(inQuery.Description)) .WhereIf(!inQuery.OpByUserName.IsNullOrEmpty(), x => x.CreateUserName.Contains(inQuery.OpByUserName)) - .WhereIf(!inQuery.CreateUserName.IsNullOrEmpty(), x => x.CreateUserName.Contains(inQuery.CreateUserName) || x.CreateUserRealName.Contains(inQuery.CreateUserName)) + .WhereIf(!inQuery.CreateUserRealName.IsNullOrEmpty(), x => x.CreateUserName.Contains(inQuery.CreateUserRealName) || x.CreateUserRealName.Contains(inQuery.CreateUserRealName)) //.WhereIf(!dto.SubjectInfo.IsNullOrEmpty(), x => x.SubjectCode.Contains(dto.SubjectInfo)) .WhereIf(inQuery.IsSign != null, x => x.IsSign == inQuery.IsSign); diff --git a/IRaCIS.Core.Application/Service/Management/DTO/UserLogViewModel.cs b/IRaCIS.Core.Application/Service/Management/DTO/UserLogViewModel.cs index 39378df0e..0a019d707 100644 --- a/IRaCIS.Core.Application/Service/Management/DTO/UserLogViewModel.cs +++ b/IRaCIS.Core.Application/Service/Management/DTO/UserLogViewModel.cs @@ -56,12 +56,14 @@ namespace IRaCIS.Core.Application.ViewModel public DateTime? EndDate { get; set; } - public UserTypeEnum? LoginUserTypeEnum { get; set; } + public string? LoginUserType { get; set; } public Guid? UserTypeId { get; set; } public Guid? IdentityUserId { get; set; } + public Guid? TargetIdentityUserId { get; set; } + public bool? IsLoginUncommonly { get; set; } } diff --git a/IRaCIS.Core.Application/Service/Management/UserService.cs b/IRaCIS.Core.Application/Service/Management/UserService.cs index 393c9f8a8..cc0c9e42f 100644 --- a/IRaCIS.Core.Application/Service/Management/UserService.cs +++ b/IRaCIS.Core.Application/Service/Management/UserService.cs @@ -37,8 +37,7 @@ namespace IRaCIS.Core.Application.Service IOptionsMonitor _verifyConfig, IOptionsMonitor systemEmailConfig, IRepository _identityUserRepository, - IRepository _doctorRepository, - + IRepository _doctorRepository, ISearcher _searcher, IMapper _mapper, IUserInfo _userInfo, IStringLocalizer _localizer, IFusionCache _fusionCache) : BaseService, IUserService { @@ -184,9 +183,9 @@ namespace IRaCIS.Core.Application.Service await VerifyUserEmailAsync(_userInfo.IdentityUserId, newEmail); // 修改用户邮箱的时候 需要修改医生表的邮箱 - var oldEmail =await _identityUserRepository.Where(t => t.Id == _userInfo.IdentityUserId).Select(t => t.EMail).FirstOrDefaultAsync(); + var oldEmail = await _identityUserRepository.Where(t => t.Id == _userInfo.IdentityUserId).Select(t => t.EMail).FirstOrDefaultAsync(); - await _doctorRepository.UpdatePartialFromQueryAsync(x=>x.EMail== oldEmail, u => new Doctor() + await _doctorRepository.UpdatePartialFromQueryAsync(x => x.EMail == oldEmail, u => new Doctor() { EMail = newEmail }); @@ -942,9 +941,12 @@ namespace IRaCIS.Core.Application.Service { DateTime? trialCreateTime = inQuery.TrialId != null ? _trialRepository.Where(t => t.Id == inQuery.TrialId).Select(t => t.CreateTime).FirstOrDefault() : null; + + var userLogQueryable = _userLogRepository.AsQueryable().IgnoreQueryFilters() - .WhereIf(inQuery.IdentityUserId != null, t => t.ActionIdentityUserId == inQuery.IdentityUserId || t.TargetIdentityUserId == inQuery.IdentityUserId) + .WhereIf(inQuery.IdentityUserId != null, t => t.ActionIdentityUserId == inQuery.IdentityUserId) + .WhereIf(inQuery.TargetIdentityUserId != null, t => t.TargetIdentityUserId == inQuery.TargetIdentityUserId) .WhereIf(inQuery.TrialId != null, t => t.ActionIdentityUser.UserTrialList.Any(c => c.TrialId == inQuery.TrialId) || t.TargetIdentityUser.UserTrialList.Any(c => c.TrialId == inQuery.TrialId)) .WhereIf(trialCreateTime != null, t => t.CreateTime >= trialCreateTime) .WhereIf(inQuery.OptType != null, t => t.OptType == inQuery.OptType) @@ -954,7 +956,7 @@ namespace IRaCIS.Core.Application.Service .WhereIf(!string.IsNullOrEmpty(inQuery.LoginUserName), t => t.ActionUserName.Contains(inQuery.LoginUserName!)) .WhereIf(!string.IsNullOrEmpty(inQuery.LoginFaildName), t => t.ActionUserName.Contains(inQuery.LoginFaildName!)) .WhereIf(!string.IsNullOrEmpty(inQuery.IP), t => t.IP.Contains(inQuery.IP!)) - .WhereIf(inQuery.LoginUserTypeEnum != null, t => t.CreateUserRole.UserTypeEnum == inQuery.LoginUserTypeEnum) + .WhereIf(!string.IsNullOrEmpty(inQuery.LoginUserType), t => t.ActionUserType == inQuery.LoginUserType) .WhereIf(inQuery.UserTypeId != null, t => t.CreateUserRole.UserTypeId == inQuery.UserTypeId) .ProjectTo(_mapper.ConfigurationProvider); diff --git a/IRaCIS.Core.Application/Service/TrialSiteUser/DTO/UserTrialViewModel.cs b/IRaCIS.Core.Application/Service/TrialSiteUser/DTO/UserTrialViewModel.cs index fcad91614..23fee79b0 100644 --- a/IRaCIS.Core.Application/Service/TrialSiteUser/DTO/UserTrialViewModel.cs +++ b/IRaCIS.Core.Application/Service/TrialSiteUser/DTO/UserTrialViewModel.cs @@ -94,6 +94,15 @@ namespace IRaCIS.Application.Contracts public Guid UserId { get; set; } } + public class TrialIdentityUserBasicInfo + { + public Guid IdentityUserId { get; set; } + + public string UserName { get; set; } + + public string FullName { get; set; } + } + public class TrialMaintenanceDTO : UserTrialCommand { diff --git a/IRaCIS.Core.Application/Service/TrialSiteUser/TrialMaintenanceService.cs b/IRaCIS.Core.Application/Service/TrialSiteUser/TrialMaintenanceService.cs index 24db29490..f5b2befd9 100644 --- a/IRaCIS.Core.Application/Service/TrialSiteUser/TrialMaintenanceService.cs +++ b/IRaCIS.Core.Application/Service/TrialSiteUser/TrialMaintenanceService.cs @@ -21,10 +21,10 @@ namespace IRaCIS.Core.Application.Service { [HttpGet] - public async Task> GetTrialUserList(Guid trialId) + 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.IdentityUser.UserName }) + return await _trialIdentityUserRepository.Where(t => t.TrialId == trialId, ignoreQueryFilters: true) + .Select(t => new TrialIdentityUserBasicInfo() { FullName = t.IdentityUser.FullName, IdentityUserId = t.IdentityUserId, UserName = t.IdentityUser.UserName }) .ToListAsync(); } diff --git a/IRaCIS.Core.Application/Triggers/AfterSaveTrigger/UserLogAfterTrigger.cs b/IRaCIS.Core.Application/Triggers/AfterSaveTrigger/UserLogAfterTrigger.cs index 48c0017e0..fd7a64379 100644 --- a/IRaCIS.Core.Application/Triggers/AfterSaveTrigger/UserLogAfterTrigger.cs +++ b/IRaCIS.Core.Application/Triggers/AfterSaveTrigger/UserLogAfterTrigger.cs @@ -23,31 +23,40 @@ namespace IRaCIS.Core.Application.Triggers.AfterSaveTrigger if (userlog.TargetIdentityUserId != null) { - var obj = await _identityUserRepository.Where(t => t.Id == userlog.TargetIdentityUserId).Select(t => new UserLogJsonObj() + + //判断是否需要记录详情 + + if (userlog.OptType == UserOptType.AddUser || userlog.OptType == UserOptType.UpdateUser || userlog.OptType == UserOptType.UpdateUserRole + || userlog.OptType == UserOptType.AccountEnable || userlog.OptType == UserOptType.AccountLocked) { - DepartmentName = t.DepartmentName, - EMail = t.EMail, - FirstName = t.FirstName, - LastName = t.LastName, - OrganizationName = t.OrganizationName, - Phone = t.Phone, - PositionName = t.PositionName, - Sex = t.Sex, - Status = t.Status, - UserCode = t.UserCode, - UserName = t.UserName, - UserRoleList = t.UserRoleList.Select(t => new UserRoleLogObj() + var obj = await _identityUserRepository.Where(t => t.Id == userlog.TargetIdentityUserId).Select(t => new UserLogJsonObj() { - IsUserRoleDisabled = t.IsUserRoleDisabled, - UserTypeEnum = t.UserTypeEnum, - UserTypeShortName = t.UserTypeRole.UserTypeShortName - }).ToList() + DepartmentName = t.DepartmentName, + EMail = t.EMail, + FirstName = t.FirstName, + LastName = t.LastName, + OrganizationName = t.OrganizationName, + Phone = t.Phone, + PositionName = t.PositionName, + Sex = t.Sex, + Status = t.Status, + UserCode = t.UserCode, + UserName = t.UserName, + UserRoleList = t.UserRoleList.Select(t => new UserRoleLogObj() + { + IsUserRoleDisabled = t.IsUserRoleDisabled, + UserTypeEnum = t.UserTypeEnum, + UserTypeShortName = t.UserTypeRole.UserTypeShortName + }).ToList() - }).FirstOrDefaultAsync(); + }).FirstOrDefaultAsync(); - userlog.JsonObj = obj.ToJsonStr(); + userlog.JsonObj = obj.ToJsonStr(); + } + + }