Merge branch 'Test_HIR_Net8' of https://gitea.frp.extimaging.com/XCKJ/irc-netcore-api into Test_HIR_Net8
continuous-integration/drone/push Build is running
Details
continuous-integration/drone/push Build is running
Details
commit
ab79eff346
|
|
@ -84,6 +84,8 @@ namespace IRaCIS.Core.API
|
||||||
|
|
||||||
triggerOptions.AddTrigger<IdenttiyUserRoleInfoTrigger>();
|
triggerOptions.AddTrigger<IdenttiyUserRoleInfoTrigger>();
|
||||||
|
|
||||||
|
triggerOptions.AddTrigger<UserLogAfterTrigger>();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13604,7 +13604,7 @@
|
||||||
</summary>
|
</summary>
|
||||||
<returns></returns>
|
<returns></returns>
|
||||||
</member>
|
</member>
|
||||||
<member name="M:IRaCIS.Core.Application.Service.HospitalGroupService.GetGAUserList(System.Guid)">
|
<member name="M:IRaCIS.Core.Application.Service.HospitalGroupService.GetGAUserList(System.Guid,System.Boolean)">
|
||||||
<summary>
|
<summary>
|
||||||
GA用户列表
|
GA用户列表
|
||||||
</summary>
|
</summary>
|
||||||
|
|
@ -17471,6 +17471,18 @@
|
||||||
<param name="_identityUserRepository"></param>
|
<param name="_identityUserRepository"></param>
|
||||||
<param name="_userRoleRepository"></param>
|
<param name="_userRoleRepository"></param>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="T:IRaCIS.Core.Application.Triggers.AfterSaveTrigger.UserLogAfterTrigger">
|
||||||
|
<summary>
|
||||||
|
账户日志 记录账户每次操作的信息
|
||||||
|
</summary>
|
||||||
|
<param name="_identityUserRepository"></param>
|
||||||
|
</member>
|
||||||
|
<member name="M:IRaCIS.Core.Application.Triggers.AfterSaveTrigger.UserLogAfterTrigger.#ctor(IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.IdentityUser})">
|
||||||
|
<summary>
|
||||||
|
账户日志 记录账户每次操作的信息
|
||||||
|
</summary>
|
||||||
|
<param name="_identityUserRepository"></param>
|
||||||
|
</member>
|
||||||
<member name="T:IRaCIS.Core.Application.Triggers.TrialCriterionSignTrigger">
|
<member name="T:IRaCIS.Core.Application.Triggers.TrialCriterionSignTrigger">
|
||||||
<summary>
|
<summary>
|
||||||
因为可能先一致性核查通过,生成其他标准的任务了,新签名的标准也需要产生任务
|
因为可能先一致性核查通过,生成其他标准的任务了,新签名的标准也需要产生任务
|
||||||
|
|
|
||||||
|
|
@ -38,41 +38,6 @@ namespace IRaCIS.Core.Application.ViewModel
|
||||||
public UserLogJsonObj UserObj => JsonObj.IsNotNullOrEmpty() ? JsonConvert.DeserializeObject<UserLogJsonObj>(JsonObj) : new UserLogJsonObj();
|
public UserLogJsonObj UserObj => JsonObj.IsNotNullOrEmpty() ? JsonConvert.DeserializeObject<UserLogJsonObj>(JsonObj) : new UserLogJsonObj();
|
||||||
}
|
}
|
||||||
|
|
||||||
public class UserLogJsonObj
|
|
||||||
{
|
|
||||||
public string FullName => LastName + " / " + FirstName;
|
|
||||||
|
|
||||||
public string UserCode { get; set; }
|
|
||||||
public string UserName { get; set; }
|
|
||||||
public string EMail { get; set; }
|
|
||||||
|
|
||||||
public string FirstName { get; set; }
|
|
||||||
|
|
||||||
public string LastName { get; set; }
|
|
||||||
|
|
||||||
public string Phone { get; set; }
|
|
||||||
|
|
||||||
public int? Sex { get; set; }
|
|
||||||
|
|
||||||
public UserStateEnum Status { get; set; } = UserStateEnum.Enable;
|
|
||||||
|
|
||||||
public string OrganizationName { get; set; }
|
|
||||||
public string PositionName { get; set; }
|
|
||||||
|
|
||||||
public string DepartmentName { get; set; }
|
|
||||||
|
|
||||||
public List<UserRoleLogObj> UserRoleList { get; set; }
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public class UserRoleLogObj
|
|
||||||
{
|
|
||||||
public string UserTypeShortName { get; set; }
|
|
||||||
|
|
||||||
public UserTypeEnum UserTypeEnum { get; set; }
|
|
||||||
|
|
||||||
public bool IsUserRoleDisabled { get; set; }
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public class SetIsIgnoreUncommonlyInDto
|
public class SetIsIgnoreUncommonlyInDto
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
using IP2Region.Net.Abstractions;
|
using DocumentFormat.OpenXml.Bibliography;
|
||||||
|
using IP2Region.Net.Abstractions;
|
||||||
using IRaCIS.Application.Contracts;
|
using IRaCIS.Application.Contracts;
|
||||||
using IRaCIS.Core.Application.Auth;
|
using IRaCIS.Core.Application.Auth;
|
||||||
using IRaCIS.Core.Application.Contracts;
|
using IRaCIS.Core.Application.Contracts;
|
||||||
|
|
@ -27,6 +28,7 @@ namespace IRaCIS.Core.Application.Service
|
||||||
[ApiExplorerSettings(GroupName = "HIR")]
|
[ApiExplorerSettings(GroupName = "HIR")]
|
||||||
public class UserService(IRepository<UserRole> _userRoleRepository,
|
public class UserService(IRepository<UserRole> _userRoleRepository,
|
||||||
IMailVerificationService _mailVerificationService,
|
IMailVerificationService _mailVerificationService,
|
||||||
|
IRepository<TrialIdentityUser> _trialIdentityUserRepository,
|
||||||
IRepository<VerificationCode> _verificationCodeRepository,
|
IRepository<VerificationCode> _verificationCodeRepository,
|
||||||
IRepository<HIRHospital> _hirHospitalRepository,
|
IRepository<HIRHospital> _hirHospitalRepository,
|
||||||
IRepository<TrialUserRole> _userTrialRepository,
|
IRepository<TrialUserRole> _userTrialRepository,
|
||||||
|
|
@ -577,6 +579,24 @@ namespace IRaCIS.Core.Application.Service
|
||||||
await _identityUserRepository.AddAsync(saveItem);
|
await _identityUserRepository.AddAsync(saveItem);
|
||||||
|
|
||||||
var success = await _identityUserRepository.SaveChangesAsync();
|
var success = await _identityUserRepository.SaveChangesAsync();
|
||||||
|
|
||||||
|
if (userAddModel.UserName.IsNotNullOrEmpty())
|
||||||
|
{
|
||||||
|
//自动添加到项目用户里面
|
||||||
|
|
||||||
|
var trialId = (Guid)userAddModel.TrialId;
|
||||||
|
|
||||||
|
var currentUser = new TrialIdentityUser()
|
||||||
|
{
|
||||||
|
TrialId = trialId,
|
||||||
|
IdentityUserId = saveItem.Id,
|
||||||
|
JoinTime = DateTime.Now,
|
||||||
|
TrialUserRoleList = saveItem.UserRoleList.Select(t => new TrialUserRole() { UserId = t.Id, TrialId = trialId }).ToList()
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
await _trialIdentityUserRepository.AddAsync(currentUser);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hospitalInfo.IsCanConnectInternet)
|
if (hospitalInfo.IsCanConnectInternet)
|
||||||
|
|
|
||||||
|
|
@ -126,7 +126,7 @@ namespace IRaCIS.Core.Application.Service
|
||||||
|
|
||||||
//.Where(t => userTypeEnums.Contains(t.UserTypeEnum))
|
//.Where(t => userTypeEnums.Contains(t.UserTypeEnum))
|
||||||
.Where(t => t.IdentityUser.Status == UserStateEnum.Enable && t.IsUserRoleDisabled == false)
|
.Where(t => t.IdentityUser.Status == UserStateEnum.Enable && t.IsUserRoleDisabled == false)
|
||||||
.Where(t => t.IdentityUser.IdentityUserHospitalGroupList.Any(t => t.HospitalGroupId == hospitalGroupId))
|
.Where(t => t.IdentityUser.IdentityUserHospitalGroupList.Any(t => t.HospitalGroupId == hospitalGroupId && t.IsDisabled == false))
|
||||||
.WhereIf(!string.IsNullOrWhiteSpace(inQuery.UserRealName), t => (t.IdentityUser.FullName).Contains(inQuery.UserRealName))
|
.WhereIf(!string.IsNullOrWhiteSpace(inQuery.UserRealName), t => (t.IdentityUser.FullName).Contains(inQuery.UserRealName))
|
||||||
.WhereIf(!string.IsNullOrWhiteSpace(inQuery.UserName), t => t.IdentityUser.UserName.Contains(inQuery.UserName))
|
.WhereIf(!string.IsNullOrWhiteSpace(inQuery.UserName), t => t.IdentityUser.UserName.Contains(inQuery.UserName))
|
||||||
.WhereIf(!string.IsNullOrWhiteSpace(inQuery.OrganizationName), t => t.IdentityUser.OrganizationName.Contains(inQuery.OrganizationName))
|
.WhereIf(!string.IsNullOrWhiteSpace(inQuery.OrganizationName), t => t.IdentityUser.OrganizationName.Contains(inQuery.OrganizationName))
|
||||||
|
|
|
||||||
|
|
@ -62,7 +62,13 @@ public class HospitalGroupQuery : PageInput
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public class UserHospitalGroupAdminInfo : HospitalGroupAdminUserInfo
|
||||||
|
{
|
||||||
|
public bool IsUserDisabled { get; set; }
|
||||||
|
public bool IsGACurrentHospitalDisabled { get; set; }
|
||||||
|
|
||||||
|
public bool IsGARoleDisabled { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
public class HospitalGroupAdminUserInfo
|
public class HospitalGroupAdminUserInfo
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -24,10 +24,11 @@ public class HospitalGroupService(IRepository<HospitalGroup> _hospitalGroupRepos
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
|
|
||||||
public async Task<List<HospitalGroupAdminUserInfo>> GetGAUserList(Guid hospitalGroupId)
|
public async Task<List<UserHospitalGroupAdminInfo>> GetGAUserList(Guid hospitalGroupId, bool isAdd)
|
||||||
{
|
{
|
||||||
var list = await _identityUserRepository.Where(t => t.UserRoleList.Any(t => t.UserTypeEnum == UserTypeEnum.GA && t.IsUserRoleDisabled == false) && t.IdentityUserHospitalGroupList.Any(t => t.HospitalGroupId == hospitalGroupId))
|
var list = await _identityUserRepository.Where(t => t.UserRoleList.Any(t => t.UserTypeEnum == UserTypeEnum.GA /*&& t.IsUserRoleDisabled == false*/)
|
||||||
.ProjectTo<HospitalGroupAdminUserInfo>(_mapper.ConfigurationProvider).ToListAsync();
|
&& t.IdentityUserHospitalGroupList.Any(t => t.HospitalGroupId == hospitalGroupId /*&& t.IsDisabled == false*/) /*&& t.Status==UserStateEnum.Enable*/)
|
||||||
|
.ProjectTo<UserHospitalGroupAdminInfo>(_mapper.ConfigurationProvider, new { hostpitalGroupId = hospitalGroupId }).ToListAsync();
|
||||||
|
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,6 @@ using Microsoft.AspNetCore.Authorization;
|
||||||
using IRaCIS.Core.Application.Auth;
|
using IRaCIS.Core.Application.Auth;
|
||||||
using MassTransit;
|
using MassTransit;
|
||||||
using Panda.DynamicWebApi.Attributes;
|
using Panda.DynamicWebApi.Attributes;
|
||||||
using DocumentFormat.OpenXml.Spreadsheet;
|
|
||||||
using AutoMapper.EntityFrameworkCore;
|
using AutoMapper.EntityFrameworkCore;
|
||||||
using IRaCIS.Core.Domain.Models;
|
using IRaCIS.Core.Domain.Models;
|
||||||
using IRaCIS.Core.Application.Service.Reading.Dto;
|
using IRaCIS.Core.Application.Service.Reading.Dto;
|
||||||
|
|
@ -24,32 +23,27 @@ using Medallion.Threading;
|
||||||
using IRaCIS.Core.Infrastructure;
|
using IRaCIS.Core.Infrastructure;
|
||||||
using IRaCIS.Core.Application.Contracts;
|
using IRaCIS.Core.Application.Contracts;
|
||||||
using MailKit.Search;
|
using MailKit.Search;
|
||||||
using DocumentFormat.OpenXml.Office2010.Excel;
|
|
||||||
using IRaCIS.Core.Application.Contracts.Dicom.DTO;
|
using IRaCIS.Core.Application.Contracts.Dicom.DTO;
|
||||||
using IRaCIS.Core.Application.Helper;
|
using IRaCIS.Core.Application.Helper;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Linq.Dynamic.Core;
|
using System.Linq.Dynamic.Core;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using DocumentFormat.OpenXml.EMMA;
|
|
||||||
using Azure;
|
using Azure;
|
||||||
using System.IO.Compression;
|
using System.IO.Compression;
|
||||||
using static IRaCIS.Core.Domain.Share.StaticData;
|
using static IRaCIS.Core.Domain.Share.StaticData;
|
||||||
using FellowOakDicom;
|
using FellowOakDicom;
|
||||||
using IDistributedLockProvider = Medallion.Threading.IDistributedLockProvider;
|
using IDistributedLockProvider = Medallion.Threading.IDistributedLockProvider;
|
||||||
using DocumentFormat.OpenXml.InkML;
|
|
||||||
using Microsoft.AspNetCore.Hosting;
|
using Microsoft.AspNetCore.Hosting;
|
||||||
using IRaCIS.Core.Infrastructure.Encryption;
|
using IRaCIS.Core.Infrastructure.Encryption;
|
||||||
using FellowOakDicom.Network.Client;
|
using FellowOakDicom.Network.Client;
|
||||||
using FellowOakDicom.Network;
|
using FellowOakDicom.Network;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using DocumentFormat.OpenXml.Wordprocessing;
|
|
||||||
using System;
|
using System;
|
||||||
using IRaCIS.Core.Infra.EFCore.Migrations;
|
using IRaCIS.Core.Infra.EFCore.Migrations;
|
||||||
using System.Dynamic;
|
using System.Dynamic;
|
||||||
using System.Threading.Channels;
|
using System.Threading.Channels;
|
||||||
using IRaCIS.Core.Application.Helper.OtherTool;
|
using IRaCIS.Core.Application.Helper.OtherTool;
|
||||||
using IRaCIS.Core.Infrastructure.Extention;
|
using IRaCIS.Core.Infrastructure.Extention;
|
||||||
using NPOI.SS.Formula.Functions;
|
|
||||||
|
|
||||||
|
|
||||||
namespace IRaCIS.Application.Services
|
namespace IRaCIS.Application.Services
|
||||||
|
|
@ -864,6 +858,12 @@ namespace IRaCIS.Application.Services
|
||||||
{
|
{
|
||||||
foreach (var hospitalGroupId in incommand.HospitalGroupIdList)
|
foreach (var hospitalGroupId in incommand.HospitalGroupIdList)
|
||||||
{
|
{
|
||||||
|
if (_studySubjectVisitRepository.Where(t => t.SCPStudyId == item).Any(t => t.SCPStudy.HospitalGroupList.Any(c => c.HospitalGroupId == hospitalGroupId)))
|
||||||
|
{
|
||||||
|
//已经添加到项目,不允许删除课题组
|
||||||
|
return ResponseOutput.NotOk(_localizer["Patient_StudyHospitalGroupBinded"]);
|
||||||
|
}
|
||||||
|
|
||||||
await _SCPStudyHospitalGroupRepository.DeleteFromQueryAsync(t => t.HospitalGroupId == hospitalGroupId && t.SCPStudyId == item);
|
await _SCPStudyHospitalGroupRepository.DeleteFromQueryAsync(t => t.HospitalGroupId == hospitalGroupId && t.SCPStudyId == item);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -876,6 +876,16 @@ namespace IRaCIS.Application.Services
|
||||||
//更新
|
//更新
|
||||||
foreach (var item in incommand.SCPstudyIdList)
|
foreach (var item in incommand.SCPstudyIdList)
|
||||||
{
|
{
|
||||||
|
var existList = _SCPStudyHospitalGroupRepository.Where(t => t.SCPStudyId == item).Select(t => t.HospitalGroupId).ToList();
|
||||||
|
|
||||||
|
var deleteIdList = existList.Except(incommand.HospitalGroupIdList);
|
||||||
|
|
||||||
|
if (_studySubjectVisitRepository.Where(t => t.SCPStudyId == item).Any(t => t.SCPStudy.HospitalGroupList.Any(c => deleteIdList.Contains(c.HospitalGroupId))))
|
||||||
|
{
|
||||||
|
//已经添加到项目,不允许删除课题组
|
||||||
|
return ResponseOutput.NotOk(_localizer["Patient_StudyHospitalGroupBinded"]);
|
||||||
|
}
|
||||||
|
|
||||||
await _SCPStudyHospitalGroupRepository.BatchDeleteNoTrackingAsync(t => t.SCPStudyId == item);
|
await _SCPStudyHospitalGroupRepository.BatchDeleteNoTrackingAsync(t => t.SCPStudyId == item);
|
||||||
|
|
||||||
foreach (var hospitalGroupId in incommand.HospitalGroupIdList)
|
foreach (var hospitalGroupId in incommand.HospitalGroupIdList)
|
||||||
|
|
@ -1247,7 +1257,7 @@ namespace IRaCIS.Application.Services
|
||||||
MaxStudyTime = t.SCPStudySubjectVisitList.Max(t => t.SCPStudy.StudyTime),
|
MaxStudyTime = t.SCPStudySubjectVisitList.Max(t => t.SCPStudy.StudyTime),
|
||||||
MinStudyTime = t.SCPStudySubjectVisitList.Min(t => t.SCPStudy.StudyTime)
|
MinStudyTime = t.SCPStudySubjectVisitList.Min(t => t.SCPStudy.StudyTime)
|
||||||
})
|
})
|
||||||
.ToListAsync();
|
.OrderBy(t => t.VisitNum).ToListAsync();
|
||||||
|
|
||||||
|
|
||||||
//2、获取项目配置
|
//2、获取项目配置
|
||||||
|
|
@ -1255,7 +1265,26 @@ namespace IRaCIS.Application.Services
|
||||||
|
|
||||||
//3、 未提交的最小的访视号 从这个访视开始绑定 因为重新开始绑定,所以将访视未提交的状态重置
|
//3、 未提交的最小的访视号 从这个访视开始绑定 因为重新开始绑定,所以将访视未提交的状态重置
|
||||||
|
|
||||||
var subjectMaxVisitNum = startBindVisitNum == null ? subjectAllVisitList.Where(t => t.SubmitState != SubmitStateEnum.Submitted).MinOrDefault(t => t.VisitNum) : startBindVisitNum.Value;
|
decimal subjectMaxVisitNum = 0;
|
||||||
|
|
||||||
|
if (startBindVisitNum == null)
|
||||||
|
{
|
||||||
|
if (subjectAllVisitList.Any(t => t.SubmitState != SubmitStateEnum.Submitted))
|
||||||
|
{
|
||||||
|
subjectMaxVisitNum = subjectAllVisitList.Where(t => t.SubmitState != SubmitStateEnum.Submitted).MinOrDefault(t => t.VisitNum);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//没有未提交的,那么开始绑定的就是已提交的加1
|
||||||
|
subjectMaxVisitNum = subjectAllVisitList.Last().VisitNum + 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
subjectMaxVisitNum = startBindVisitNum.Value;
|
||||||
|
}
|
||||||
|
|
||||||
|
//var subjectMaxVisitNum = startBindVisitNum == null ? subjectAllVisitList.Where(t => t.SubmitState != SubmitStateEnum.Submitted).MinOrDefault(t => t.VisitNum) : startBindVisitNum.Value;
|
||||||
|
|
||||||
await _subjectVisitRepository.BatchUpdateNoTrackingAsync(t => t.SubjectId == subjectId && t.SubmitState != SubmitStateEnum.Submitted && t.VisitNum > subjectMaxVisitNum, c => new SubjectVisit() { SubmitState = SubmitStateEnum.None });
|
await _subjectVisitRepository.BatchUpdateNoTrackingAsync(t => t.SubjectId == subjectId && t.SubmitState != SubmitStateEnum.Submitted && t.VisitNum > subjectMaxVisitNum, c => new SubjectVisit() { SubmitState = SubmitStateEnum.None });
|
||||||
|
|
||||||
|
|
@ -2177,7 +2206,7 @@ namespace IRaCIS.Application.Services
|
||||||
VisitMinStudyTime = g.Min(c => c.StudyTime)
|
VisitMinStudyTime = g.Min(c => c.StudyTime)
|
||||||
}).ToList();
|
}).ToList();
|
||||||
|
|
||||||
var list = _subjectVisitReposiotry.Where(t => t.SubjectId == inQuery.SubjectId).ProjectTo<SubjectVisitSelectDto>(_mapper.ConfigurationProvider).ToList();
|
var list = _subjectVisitReposiotry.Where(t => t.SubjectId == inQuery.SubjectId).ProjectTo<SubjectVisitSelectDto>(_mapper.ConfigurationProvider).OrderBy(t => t.VisitNum).ToList();
|
||||||
|
|
||||||
foreach (var item in list)
|
foreach (var item in list)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -206,7 +206,7 @@ namespace IRaCIS.Core.Application.Service
|
||||||
|
|
||||||
|
|
||||||
CreateMap<HospitalGroup, HospitalGroupView>()
|
CreateMap<HospitalGroup, HospitalGroupView>()
|
||||||
.ForMember(d => d.GAUserList, u => u.MapFrom(s => s.IdentityUserList.Where(t=>t.IsManager).Select(t => t.IdentityUser)))
|
.ForMember(d => d.GAUserList, u => u.MapFrom(s => s.IdentityUserList.Where(t => t.IsManager).Select(t => t.IdentityUser)))
|
||||||
.ForMember(d => d.IdentityUserIdList, u => u.MapFrom(s => s.IdentityUserList.Where(t => t.IsManager).Select(t => t.IdentityUserId)));
|
.ForMember(d => d.IdentityUserIdList, u => u.MapFrom(s => s.IdentityUserList.Where(t => t.IsManager).Select(t => t.IdentityUserId)));
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -215,6 +215,12 @@ namespace IRaCIS.Core.Application.Service
|
||||||
|
|
||||||
CreateMap<IdentityUser, HospitalGroupAdminUserInfo>();
|
CreateMap<IdentityUser, HospitalGroupAdminUserInfo>();
|
||||||
|
|
||||||
|
var hostpitalGroupId = Guid.Empty;
|
||||||
|
CreateMap<IdentityUser, UserHospitalGroupAdminInfo>()
|
||||||
|
.ForMember(d => d.IsGARoleDisabled, u => u.MapFrom(s => s.UserRoleList.Any(t => t.UserTypeEnum == UserTypeEnum.GA && t.IsUserRoleDisabled)))
|
||||||
|
.ForMember(d => d.IsUserDisabled, u => u.MapFrom(s => s.Status == UserStateEnum.Disable))
|
||||||
|
.ForMember(d => d.IsGACurrentHospitalDisabled, u => u.MapFrom(s => s.IdentityUserHospitalGroupList.Any(t => t.IsDisabled && t.HospitalGroupId == hostpitalGroupId)));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,84 @@
|
||||||
|
using AutoMapper.QueryableExtensions;
|
||||||
|
using EntityFrameworkCore.Triggered;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace IRaCIS.Core.Application.Triggers.AfterSaveTrigger
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 账户日志 记录账户每次操作的信息
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="_identityUserRepository"></param>
|
||||||
|
public class UserLogAfterTrigger(IRepository<IdentityUser> _identityUserRepository) : IAfterSaveTrigger<UserLog>
|
||||||
|
{
|
||||||
|
public async Task AfterSave(ITriggerContext<UserLog> context, CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
var userlog = context.Entity;
|
||||||
|
|
||||||
|
if (context.ChangeType == ChangeType.Added)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (userlog.TargetIdentityUserId != null)
|
||||||
|
{
|
||||||
|
|
||||||
|
//判断是否需要记录详情
|
||||||
|
|
||||||
|
if (userlog.OptType == UserOptType.AddUser || userlog.OptType == UserOptType.UpdateUser || userlog.OptType == UserOptType.UpdateUserRole
|
||||||
|
|| userlog.OptType == UserOptType.AccountEnable || userlog.OptType == UserOptType.AccountLocked)
|
||||||
|
{
|
||||||
|
var obj = await _identityUserRepository.Where(t => t.Id == userlog.TargetIdentityUserId).Select(t => new UserLogJsonObj()
|
||||||
|
{
|
||||||
|
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(),
|
||||||
|
|
||||||
|
HospitalGroupList = t.IdentityUserHospitalGroupList.Select(t => new HospitalGroupLogObj()
|
||||||
|
{
|
||||||
|
HospitalGroupId = t.HospitalGroupId,
|
||||||
|
Code = t.HospitalGroup.Code,
|
||||||
|
Name = t.HospitalGroup.Name,
|
||||||
|
}).ToList(),
|
||||||
|
|
||||||
|
}).FirstOrDefaultAsync();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
userlog.JsonObj = obj.ToJsonStr();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (userlog.ActionIdentityUserId != null && userlog.ActionUserName.IsNullOrWhiteSpace())
|
||||||
|
{
|
||||||
|
userlog.ActionUserName = await _identityUserRepository.Where(t => t.Id == userlog.ActionIdentityUserId).Select(t => t.UserName).FirstOrDefaultAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
await _identityUserRepository.SaveChangesAsync();
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -64,3 +64,49 @@ public class UserLog : BaseAddAuditEntity
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class UserLogJsonObj
|
||||||
|
{
|
||||||
|
public string FullName => LastName + " / " + FirstName;
|
||||||
|
|
||||||
|
public string UserCode { get; set; }
|
||||||
|
public string UserName { get; set; }
|
||||||
|
public string EMail { get; set; }
|
||||||
|
|
||||||
|
public string FirstName { get; set; }
|
||||||
|
|
||||||
|
public string LastName { get; set; }
|
||||||
|
|
||||||
|
public string Phone { get; set; }
|
||||||
|
|
||||||
|
public int? Sex { get; set; }
|
||||||
|
|
||||||
|
public UserStateEnum Status { get; set; } = UserStateEnum.Enable;
|
||||||
|
|
||||||
|
public string OrganizationName { get; set; }
|
||||||
|
public string PositionName { get; set; }
|
||||||
|
|
||||||
|
public string DepartmentName { get; set; }
|
||||||
|
|
||||||
|
public List<UserRoleLogObj> UserRoleList { get; set; }
|
||||||
|
|
||||||
|
public List<HospitalGroupLogObj> HospitalGroupList { get; set; }
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public class UserRoleLogObj
|
||||||
|
{
|
||||||
|
public string UserTypeShortName { get; set; }
|
||||||
|
|
||||||
|
public UserTypeEnum UserTypeEnum { get; set; }
|
||||||
|
|
||||||
|
public bool IsUserRoleDisabled { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class HospitalGroupLogObj
|
||||||
|
{
|
||||||
|
public Guid HospitalGroupId { get; set; }
|
||||||
|
public string Name { get; set; }
|
||||||
|
|
||||||
|
public string Code { get; set; }
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue