课题组修改
continuous-integration/drone/push Build is passing Details

Test_HIR_Net8
hang 2025-08-28 09:29:06 +08:00
parent a3b57e2a04
commit 97c123677e
7 changed files with 19183 additions and 16 deletions

View File

@ -227,6 +227,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 +254,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 +262,13 @@ namespace IRaCIS.Application.Contracts
}
public class UserHospitalGroupInfo
{
public Guid HospitalGroupId { get; set; }
public bool IsDisabled { get; set; }
}
public class EditPasswordCommand
{
public string NewUserName { get; set; } = string.Empty;

View File

@ -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,

View File

@ -55,6 +55,8 @@ public enum UserOptType
[Description("选择登录角色")]
LoginSelectRole = 18,
UpdateUserHospitalGroup = 20
}
[Description("影像下载打包状态")]

View File

@ -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; }
}

File diff suppressed because it is too large Load Diff

View File

@ -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");
}
}
}

View File

@ -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");
@ -3092,6 +3095,8 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
b.HasKey("Id");
b.HasIndex("CreateUserId");
b.HasIndex("TrialId");
b.ToTable("IdentityUser", t =>
@ -13568,6 +13573,8 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
b.HasKey("Id");
b.HasIndex("CreateUserId");
b.HasIndex("DoctorId")
.IsUnique()
.HasFilter("[DoctorId] IS NOT NULL");
@ -15206,10 +15213,18 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
modelBuilder.Entity("IRaCIS.Core.Domain.Models.IdentityUser", b =>
{
b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole")
.WithMany()
.HasForeignKey("CreateUserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("IRaCIS.Core.Domain.Models.Trial", "Trial")
.WithMany()
.HasForeignKey("TrialId");
b.Navigation("CreateUserRole");
b.Navigation("Trial");
});
@ -16350,7 +16365,7 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
.IsRequired();
b.HasOne("IRaCIS.Core.Domain.Models.VisitTask", "VisitTask")
.WithMany()
.WithMany("ReadingTaskQuestionMarkList")
.HasForeignKey("VisitTaskId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
@ -18249,6 +18264,12 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
modelBuilder.Entity("IRaCIS.Core.Domain.Models.UserRole", b =>
{
b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole")
.WithMany()
.HasForeignKey("CreateUserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("IRaCIS.Core.Domain.Models.Doctor", null)
.WithOne("User")
.HasForeignKey("IRaCIS.Core.Domain.Models.UserRole", "DoctorId");
@ -18265,6 +18286,8 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("CreateUserRole");
b.Navigation("IdentityUser");
b.Navigation("UserTypeRole");
@ -18979,6 +19002,8 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
b.Navigation("ReadingTaskQuestionAnswerList");
b.Navigation("ReadingTaskQuestionMarkList");
b.Navigation("TaskInfluenceList");
b.Navigation("TaskMedicalReviewList");