课题组修改
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
a3b57e2a04
commit
97c123677e
|
|
@ -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 class UpdateUserRolesDto
|
||||||
{
|
{
|
||||||
public Guid Id { get; set; }
|
public Guid Id { get; set; }
|
||||||
|
|
@ -248,7 +254,7 @@ namespace IRaCIS.Application.Contracts
|
||||||
|
|
||||||
public List<UserAddUserType> UserRoleList { get; set; }
|
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 BaseUrl { get; set; } = string.Empty;
|
||||||
public string RouteUrl { 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 class EditPasswordCommand
|
||||||
{
|
{
|
||||||
public string NewUserName { get; set; } = string.Empty;
|
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();
|
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);
|
await VerifyUserEmailAsync(null, userAddModel.EMail);
|
||||||
|
|
@ -572,7 +572,7 @@ namespace IRaCIS.Core.Application.Service
|
||||||
|
|
||||||
saveItem.UserRoleList = addRoleList;
|
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);
|
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();
|
if (find != null)
|
||||||
|
{
|
||||||
var removeIdList = existHospitalGroupIdList.Except(model.HospitalGroupIdList).ToList();
|
find.IsDisabled = item.IsDisabled;
|
||||||
|
}
|
||||||
user.IdentityUserHospitalGroupList = user.IdentityUserHospitalGroupList.Where(t => !removeIdList.Contains(t.HospitalGroupId)).ToList();
|
else
|
||||||
|
{
|
||||||
var addIdList = model.HospitalGroupIdList.Except(existHospitalGroupIdList).ToList();
|
var addHospitalGroup = new HospitalGroupIdentityUser() { HospitalGroupId = item.HospitalGroupId, IsDisabled = item.IsDisabled, IsManager = false };
|
||||||
|
|
||||||
user.IdentityUserHospitalGroupList.AddRange(addIdList.Select(t => new HospitalGroupIdentityUser() { HospitalGroupId = t, IsManager = false, IdentityUserId = user.Id }));
|
|
||||||
|
|
||||||
|
user.IdentityUserHospitalGroupList.Add(addHospitalGroup);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var success = await _identityUserRepository.SaveChangesAsync();
|
var success = await _identityUserRepository.SaveChangesAsync();
|
||||||
|
|
||||||
|
|
@ -676,8 +680,35 @@ namespace IRaCIS.Core.Application.Service
|
||||||
return ResponseOutput.Ok(success);
|
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]
|
[HttpPut]
|
||||||
public async Task<IResponseOutput> UpdateUserBasicInfo(UserBasicInfoCommand command)
|
public async Task<IResponseOutput> UpdateUserBasicInfo(UserBasicInfoCommand command)
|
||||||
{
|
{
|
||||||
|
|
@ -1281,7 +1312,7 @@ namespace IRaCIS.Core.Application.Service
|
||||||
UserName = t.IdentityUser.UserName,
|
UserName = t.IdentityUser.UserName,
|
||||||
UserTypeShortName = t.UserTypeRole.UserTypeShortName,
|
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,
|
Id = t.HospitalGroupId,
|
||||||
Name = t.HospitalGroup.Name,
|
Name = t.HospitalGroup.Name,
|
||||||
|
|
|
||||||
|
|
@ -55,6 +55,8 @@ public enum UserOptType
|
||||||
|
|
||||||
[Description("选择登录角色")]
|
[Description("选择登录角色")]
|
||||||
LoginSelectRole = 18,
|
LoginSelectRole = 18,
|
||||||
|
|
||||||
|
UpdateUserHospitalGroup = 20
|
||||||
}
|
}
|
||||||
|
|
||||||
[Description("影像下载打包状态")]
|
[Description("影像下载打包状态")]
|
||||||
|
|
|
||||||
|
|
@ -56,6 +56,8 @@ namespace IRaCIS.Core.Domain.Models
|
||||||
|
|
||||||
public bool IsManager { get; set; }
|
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")
|
b.Property<Guid>("IdentityUserId")
|
||||||
.HasColumnType("uniqueidentifier");
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<bool>("IsDisabled")
|
||||||
|
.HasColumnType("bit");
|
||||||
|
|
||||||
b.Property<bool>("IsManager")
|
b.Property<bool>("IsManager")
|
||||||
.HasColumnType("bit");
|
.HasColumnType("bit");
|
||||||
|
|
||||||
|
|
@ -3092,6 +3095,8 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
|
||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("CreateUserId");
|
||||||
|
|
||||||
b.HasIndex("TrialId");
|
b.HasIndex("TrialId");
|
||||||
|
|
||||||
b.ToTable("IdentityUser", t =>
|
b.ToTable("IdentityUser", t =>
|
||||||
|
|
@ -13568,6 +13573,8 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
|
||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("CreateUserId");
|
||||||
|
|
||||||
b.HasIndex("DoctorId")
|
b.HasIndex("DoctorId")
|
||||||
.IsUnique()
|
.IsUnique()
|
||||||
.HasFilter("[DoctorId] IS NOT NULL");
|
.HasFilter("[DoctorId] IS NOT NULL");
|
||||||
|
|
@ -15206,10 +15213,18 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
|
||||||
|
|
||||||
modelBuilder.Entity("IRaCIS.Core.Domain.Models.IdentityUser", b =>
|
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")
|
b.HasOne("IRaCIS.Core.Domain.Models.Trial", "Trial")
|
||||||
.WithMany()
|
.WithMany()
|
||||||
.HasForeignKey("TrialId");
|
.HasForeignKey("TrialId");
|
||||||
|
|
||||||
|
b.Navigation("CreateUserRole");
|
||||||
|
|
||||||
b.Navigation("Trial");
|
b.Navigation("Trial");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -16350,7 +16365,7 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
|
||||||
.IsRequired();
|
.IsRequired();
|
||||||
|
|
||||||
b.HasOne("IRaCIS.Core.Domain.Models.VisitTask", "VisitTask")
|
b.HasOne("IRaCIS.Core.Domain.Models.VisitTask", "VisitTask")
|
||||||
.WithMany()
|
.WithMany("ReadingTaskQuestionMarkList")
|
||||||
.HasForeignKey("VisitTaskId")
|
.HasForeignKey("VisitTaskId")
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
.IsRequired();
|
.IsRequired();
|
||||||
|
|
@ -18249,6 +18264,12 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
|
||||||
|
|
||||||
modelBuilder.Entity("IRaCIS.Core.Domain.Models.UserRole", b =>
|
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)
|
b.HasOne("IRaCIS.Core.Domain.Models.Doctor", null)
|
||||||
.WithOne("User")
|
.WithOne("User")
|
||||||
.HasForeignKey("IRaCIS.Core.Domain.Models.UserRole", "DoctorId");
|
.HasForeignKey("IRaCIS.Core.Domain.Models.UserRole", "DoctorId");
|
||||||
|
|
@ -18265,6 +18286,8 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
.IsRequired();
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("CreateUserRole");
|
||||||
|
|
||||||
b.Navigation("IdentityUser");
|
b.Navigation("IdentityUser");
|
||||||
|
|
||||||
b.Navigation("UserTypeRole");
|
b.Navigation("UserTypeRole");
|
||||||
|
|
@ -18979,6 +19002,8 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
|
||||||
|
|
||||||
b.Navigation("ReadingTaskQuestionAnswerList");
|
b.Navigation("ReadingTaskQuestionAnswerList");
|
||||||
|
|
||||||
|
b.Navigation("ReadingTaskQuestionMarkList");
|
||||||
|
|
||||||
b.Navigation("TaskInfluenceList");
|
b.Navigation("TaskInfluenceList");
|
||||||
|
|
||||||
b.Navigation("TaskMedicalReviewList");
|
b.Navigation("TaskMedicalReviewList");
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue