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 passing
Details
continuous-integration/drone/push Build is passing
Details
commit
5258ae5d4b
|
|
@ -192,6 +192,7 @@ namespace IRaCIS.Core.SCP.Service
|
|||
{
|
||||
findStudy.DicomStudyDate = dataset.GetSingleValueOrDefault(DicomTag.StudyDate, string.Empty);
|
||||
findStudy.DicomStudyTime = dataset.GetSingleValueOrDefault(DicomTag.StudyTime, string.Empty);
|
||||
findStudy.CalledAE = calledAE;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
using IRaCIS.Core.Domain.Share;
|
||||
using Newtonsoft.Json;
|
||||
using static IRaCIS.Application.Contracts.UserHospitalGroupInfoWithName;
|
||||
|
||||
|
||||
namespace IRaCIS.Application.Contracts
|
||||
|
|
@ -172,7 +173,10 @@ namespace IRaCIS.Application.Contracts
|
|||
|
||||
public List<UserAccountInfo> AccountList { get; set; }
|
||||
|
||||
public List<Guid> HospitalGroupIdList { get; set; }
|
||||
public List<Guid> HospitalGroupIdList => HospitalGroupList.Select(t => t.HospitalGroupId).ToList();
|
||||
|
||||
|
||||
public List<UserHospitalGroupInfoWithName> HospitalGroupList { get; set; } = new List<UserHospitalGroupInfoWithName>();
|
||||
}
|
||||
|
||||
public class UserInfo
|
||||
|
|
@ -227,6 +231,12 @@ namespace IRaCIS.Application.Contracts
|
|||
|
||||
|
||||
}
|
||||
|
||||
public class UpdateUserHospitalGroupDto
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
public List<UserHospitalGroupInfo> HospitalGroupList { get; set; } = new List<UserHospitalGroupInfo>();
|
||||
}
|
||||
public class UpdateUserRolesDto
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
|
|
@ -248,7 +258,7 @@ namespace IRaCIS.Application.Contracts
|
|||
|
||||
public List<UserAddUserType> UserRoleList { get; set; }
|
||||
|
||||
public List<Guid> HospitalGroupIdList { get; set; } = new List<Guid>();
|
||||
public List<UserHospitalGroupInfo> HospitalGroupList { get; set; } = new List<UserHospitalGroupInfo>();
|
||||
|
||||
public string BaseUrl { get; set; } = string.Empty;
|
||||
public string RouteUrl { get; set; } = string.Empty;
|
||||
|
|
@ -256,6 +266,18 @@ namespace IRaCIS.Application.Contracts
|
|||
|
||||
}
|
||||
|
||||
public class UserHospitalGroupInfoWithName : UserHospitalGroupInfo
|
||||
{
|
||||
public string Name { get; set; }
|
||||
}
|
||||
|
||||
public class UserHospitalGroupInfo
|
||||
{
|
||||
public Guid HospitalGroupId { get; set; }
|
||||
|
||||
public bool IsDisabled { get; set; }
|
||||
}
|
||||
|
||||
public class EditPasswordCommand
|
||||
{
|
||||
public string NewUserName { get; set; } = string.Empty;
|
||||
|
|
|
|||
|
|
@ -530,7 +530,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
{
|
||||
var hospitalGroupId = _trialRepository.Where(t => t.Id == userAddModel.TrialId).Select(t => t.HospitalGroupId).FirstOrDefault();
|
||||
|
||||
userAddModel.HospitalGroupIdList = new List<Guid> { hospitalGroupId };
|
||||
userAddModel.HospitalGroupList = new List<UserHospitalGroupInfo>() { new UserHospitalGroupInfo() { HospitalGroupId = hospitalGroupId } };
|
||||
}
|
||||
|
||||
await VerifyUserEmailAsync(null, userAddModel.EMail);
|
||||
|
|
@ -572,7 +572,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
|
||||
saveItem.UserRoleList = addRoleList;
|
||||
|
||||
saveItem.IdentityUserHospitalGroupList = userAddModel.HospitalGroupIdList.Select(t => new HospitalGroupIdentityUser() { HospitalGroupId = t, IsManager = false }).ToList();
|
||||
saveItem.IdentityUserHospitalGroupList = userAddModel.HospitalGroupList.Select(t => new HospitalGroupIdentityUser() { HospitalGroupId = t.HospitalGroupId, IsDisabled = t.IsDisabled, IsManager = false }).ToList();
|
||||
|
||||
await _identityUserRepository.AddAsync(saveItem);
|
||||
|
||||
|
|
@ -656,17 +656,21 @@ namespace IRaCIS.Core.Application.Service
|
|||
}
|
||||
}
|
||||
|
||||
foreach (var item in model.HospitalGroupList)
|
||||
{
|
||||
var find = user.IdentityUserHospitalGroupList.FirstOrDefault(t => t.HospitalGroupId == item.HospitalGroupId);
|
||||
|
||||
var existHospitalGroupIdList = user.IdentityUserHospitalGroupList.Select(t => t.HospitalGroupId).ToList();
|
||||
|
||||
var removeIdList = existHospitalGroupIdList.Except(model.HospitalGroupIdList).ToList();
|
||||
|
||||
user.IdentityUserHospitalGroupList = user.IdentityUserHospitalGroupList.Where(t => !removeIdList.Contains(t.HospitalGroupId)).ToList();
|
||||
|
||||
var addIdList = model.HospitalGroupIdList.Except(existHospitalGroupIdList).ToList();
|
||||
|
||||
user.IdentityUserHospitalGroupList.AddRange(addIdList.Select(t => new HospitalGroupIdentityUser() { HospitalGroupId = t, IsManager = false, IdentityUserId = user.Id }));
|
||||
if (find != null)
|
||||
{
|
||||
find.IsDisabled = item.IsDisabled;
|
||||
}
|
||||
else
|
||||
{
|
||||
var addHospitalGroup = new HospitalGroupIdentityUser() { HospitalGroupId = item.HospitalGroupId, IsDisabled = item.IsDisabled, IsManager = false };
|
||||
|
||||
user.IdentityUserHospitalGroupList.Add(addHospitalGroup);
|
||||
}
|
||||
}
|
||||
|
||||
var success = await _identityUserRepository.SaveChangesAsync();
|
||||
|
||||
|
|
@ -676,8 +680,35 @@ namespace IRaCIS.Core.Application.Service
|
|||
return ResponseOutput.Ok(success);
|
||||
|
||||
}
|
||||
[HttpPut]
|
||||
public async Task<IResponseOutput> UpdateUserHospitalGroupInfo(UpdateUserHospitalGroupDto command)
|
||||
{
|
||||
var user = await _identityUserRepository.Where(t => t.Id == command.Id, true).Include(t => t.IdentityUserHospitalGroupList).FirstOrDefaultAsync();
|
||||
|
||||
if (user == null) return Null404NotFound(user);
|
||||
|
||||
foreach (var item in command.HospitalGroupList)
|
||||
{
|
||||
var find = user.IdentityUserHospitalGroupList.FirstOrDefault(t => t.HospitalGroupId == item.HospitalGroupId);
|
||||
|
||||
if (find != null)
|
||||
{
|
||||
find.IsDisabled = item.IsDisabled;
|
||||
}
|
||||
else
|
||||
{
|
||||
var addHospitalGroup = new HospitalGroupIdentityUser() { HospitalGroupId = item.HospitalGroupId, IsDisabled = item.IsDisabled, IsManager = false };
|
||||
|
||||
user.IdentityUserHospitalGroupList.Add(addHospitalGroup);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var success = await _userRoleRepository.SaveChangesAsync();
|
||||
await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, ActionIdentityUserId = _userInfo.IdentityUserId, ActionUserName = _userInfo.UserName, TargetIdentityUserId = command.Id, OptType = UserOptType.UpdateUserHospitalGroup }, true);
|
||||
|
||||
return ResponseOutput.Ok();
|
||||
}
|
||||
[HttpPut]
|
||||
public async Task<IResponseOutput> UpdateUserBasicInfo(UserBasicInfoCommand command)
|
||||
{
|
||||
|
|
@ -1165,7 +1196,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
var lastLoginIPRegion = await _userLogRepository.Where(t => t.ActionUserName == actionUserName && userOptTypes.Contains(t.OptType))
|
||||
.OrderByDescending(t => t.CreateTime).Select(t => t.IPRegion).FirstOrDefaultAsync();
|
||||
|
||||
if (lastLoginIPRegion != string.Empty&& lastLoginIPRegion!=null)
|
||||
if (lastLoginIPRegion != string.Empty && lastLoginIPRegion != null)
|
||||
{
|
||||
// 与上一次区域不一致
|
||||
//if (SplitAndConcatenate(existUserLoginInfo.LastLoginIP) != SplitAndConcatenate(iPRegion))
|
||||
|
|
@ -1281,7 +1312,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
UserName = t.IdentityUser.UserName,
|
||||
UserTypeShortName = t.UserTypeRole.UserTypeShortName,
|
||||
|
||||
HospitalGroupList = t.IdentityUser.IdentityUserHospitalGroupList.Select(t => new HospitalGroupInfo()
|
||||
HospitalGroupList = t.IdentityUser.IdentityUserHospitalGroupList.Where(t => t.IsDisabled == false).Select(t => new HospitalGroupInfo()
|
||||
{
|
||||
Id = t.HospitalGroupId,
|
||||
Name = t.HospitalGroup.Name,
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
.ForMember(d => d.UserType, u => u.MapFrom(t => t.UserTypeName));
|
||||
|
||||
CreateMap<IdentityUser, UserDetailDTO>()
|
||||
.ForMember(d => d.HospitalGroupIdList, u => u.MapFrom(s => s.IdentityUserHospitalGroupList.Select(t => t.HospitalGroupId)));
|
||||
.ForMember(d => d.HospitalGroupList, u => u.MapFrom(s => s.IdentityUserHospitalGroupList.Select(t => new UserHospitalGroupInfoWithName() { HospitalGroupId = t.HospitalGroupId, IsDisabled = t.IsDisabled, Name = t.HospitalGroup.Name })));
|
||||
|
||||
|
||||
CreateMap<IdentityUser, UserListDTO>()
|
||||
|
|
|
|||
|
|
@ -125,6 +125,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
|
||||
|
||||
//.Where(t => userTypeEnums.Contains(t.UserTypeEnum))
|
||||
.Where(t => t.IdentityUser.Status == UserStateEnum.Enable && t.IsUserRoleDisabled == false)
|
||||
.Where(t => t.IdentityUser.IdentityUserHospitalGroupList.Any(t => t.HospitalGroupId == hospitalGroupId))
|
||||
.WhereIf(!string.IsNullOrWhiteSpace(inQuery.UserRealName), t => (t.IdentityUser.FullName).Contains(inQuery.UserRealName))
|
||||
.WhereIf(!string.IsNullOrWhiteSpace(inQuery.UserName), t => t.IdentityUser.UserName.Contains(inQuery.UserName))
|
||||
|
|
|
|||
|
|
@ -106,6 +106,8 @@ namespace IRaCIS.Application.Contracts
|
|||
public string TrialStatusStr { get; set; }
|
||||
|
||||
public DateTime CreateTime { get; set; }
|
||||
|
||||
public string HospitalGroupName { get; set; }
|
||||
}
|
||||
|
||||
public class AddOrUpdateTrialCommand
|
||||
|
|
|
|||
|
|
@ -218,7 +218,7 @@ namespace IRaCIS.Application.Services
|
|||
//GA 要过滤课题组
|
||||
.WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.GA, t => _userInfo.HospitalGroupIdList.Contains(t.HospitalGroupId))
|
||||
.WhereIf(_userInfo.UserTypeEnumInt != (int)UserTypeEnum.SuperAdmin && _userInfo.UserTypeEnumInt != (int)UserTypeEnum.Admin && _userInfo.UserTypeEnumInt != (int)UserTypeEnum.OA && _userInfo.UserTypeEnumInt != (int)UserTypeEnum.GA
|
||||
, t => t.TrialUserRoleList.Any(t => t.UserId == _userInfo.UserRoleId))
|
||||
, t => t.TrialUserRoleList.Any(t => t.UserId == _userInfo.UserRoleId) && t.TrialIdentityUserList.Any(t => t.IdentityUserId == _userInfo.IdentityUserId))
|
||||
.ProjectTo<NewTrialView>(_mapper.ConfigurationProvider);
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -142,6 +142,8 @@ namespace IRaCIS.Core.Application.Service
|
|||
;
|
||||
|
||||
CreateMap<Trial, TrialInfoDTO>()
|
||||
.ForMember(d => d.HospitalGroupName, u => u.MapFrom(s => s.HospitalGroup.Name))
|
||||
|
||||
.ForMember(d => d.DictionaryList, u => u.MapFrom(s => s.TrialDicList.Select(t => t.Dictionary).OrderBy(t => t.ShowOrder)));
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -55,6 +55,8 @@ public enum UserOptType
|
|||
|
||||
[Description("选择登录角色")]
|
||||
LoginSelectRole = 18,
|
||||
|
||||
UpdateUserHospitalGroup = 20
|
||||
}
|
||||
|
||||
[Description("影像下载打包状态")]
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ namespace IRaCIS.Core.Domain.Models
|
|||
public string CallingAE { get; set; } = string.Empty;
|
||||
|
||||
|
||||
public bool IsEnable { get; set; }
|
||||
public bool IsEnable { get; set; }
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -56,6 +56,8 @@ namespace IRaCIS.Core.Domain.Models
|
|||
|
||||
public bool IsManager { get; set; }
|
||||
|
||||
public bool IsDisabled { get; set; }
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
19023
IRaCIS.Core.Infra.EFCore/Migrations/20250828012404_userHospitalGroupDisable.Designer.cs
generated
Normal file
19023
IRaCIS.Core.Infra.EFCore/Migrations/20250828012404_userHospitalGroupDisable.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,71 @@
|
|||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace IRaCIS.Core.Infra.EFCore.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class userHospitalGroupDisable : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<bool>(
|
||||
name: "IsDisabled",
|
||||
table: "HospitalGroupIdentityUser",
|
||||
type: "bit",
|
||||
nullable: false,
|
||||
defaultValue: false);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_User_CreateUserId",
|
||||
table: "User",
|
||||
column: "CreateUserId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_IdentityUser_CreateUserId",
|
||||
table: "IdentityUser",
|
||||
column: "CreateUserId");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_IdentityUser_User_CreateUserId",
|
||||
table: "IdentityUser",
|
||||
column: "CreateUserId",
|
||||
principalTable: "User",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_User_User_CreateUserId",
|
||||
table: "User",
|
||||
column: "CreateUserId",
|
||||
principalTable: "User",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_IdentityUser_User_CreateUserId",
|
||||
table: "IdentityUser");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_User_User_CreateUserId",
|
||||
table: "User");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_User_CreateUserId",
|
||||
table: "User");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_IdentityUser_CreateUserId",
|
||||
table: "IdentityUser");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "IsDisabled",
|
||||
table: "HospitalGroupIdentityUser");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2943,6 +2943,9 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
|
|||
b.Property<Guid>("IdentityUserId")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<bool>("IsDisabled")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<bool>("IsManager")
|
||||
.HasColumnType("bit");
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue