diff --git a/IRaCIS.Core.Application/Service/Visit/DTO/PatientViewModel.cs b/IRaCIS.Core.Application/Service/Visit/DTO/PatientViewModel.cs index 5d6765990..6c44d1ba3 100644 --- a/IRaCIS.Core.Application/Service/Visit/DTO/PatientViewModel.cs +++ b/IRaCIS.Core.Application/Service/Visit/DTO/PatientViewModel.cs @@ -1069,7 +1069,7 @@ namespace IRaCIS.Application.Contracts public List HospitalGroupList { get; set; } - public List CurrentUserHospitalGroupList { get; set; } + public List CurrentUserHospitalGroupList { get; set; } = new List(); public List ViewHospitalGroupList => HospitalGroupList.Where(t => CurrentUserHospitalGroupList.Any(c => c.Id == t.Id)).ToList(); diff --git a/IRaCIS.Core.Domain/Image/SCPStudy.cs b/IRaCIS.Core.Domain/Image/SCPStudy.cs index ad69ac672..59a352c51 100644 --- a/IRaCIS.Core.Domain/Image/SCPStudy.cs +++ b/IRaCIS.Core.Domain/Image/SCPStudy.cs @@ -80,8 +80,11 @@ public class SCPStudy : BaseFullDeleteAuditEntity, IEntitySeqId public class SCPStudyHospitalGroup : BaseFullAuditEntity { #region MyRegion + [ForeignKey("HospitalGroupId")] [JsonIgnore] public HospitalGroup HospitalGroup { get; set; } + + [ForeignKey("SCPStudyId")] [JsonIgnore] public SCPStudy SCPStudy { get; set; } diff --git a/IRaCIS.Core.Infra.EFCore/EntityConfigration/ImageConfigration.cs b/IRaCIS.Core.Infra.EFCore/EntityConfigration/ImageConfigration.cs index 1d3a4a86d..fc1cb27cf 100644 --- a/IRaCIS.Core.Infra.EFCore/EntityConfigration/ImageConfigration.cs +++ b/IRaCIS.Core.Infra.EFCore/EntityConfigration/ImageConfigration.cs @@ -91,6 +91,8 @@ public class SCPStudyConfigration : IEntityTypeConfiguration builder.HasMany(s => s.InstanceList).WithOne(se => se.SCPStudy).HasForeignKey(se => se.StudyId).HasPrincipalKey(st => st.Id); + builder.HasMany(s => s.HospitalGroupList).WithOne(se => se.SCPStudy).HasForeignKey(se => se.SCPStudyId).HasPrincipalKey(st => st.Id); + } }