diff --git a/IRaCIS.Core.Domain/Allocation/TaskAllocationRule.cs b/IRaCIS.Core.Domain/Allocation/TaskAllocationRule.cs index a8e1e3c58..d0db57051 100644 --- a/IRaCIS.Core.Domain/Allocation/TaskAllocationRule.cs +++ b/IRaCIS.Core.Domain/Allocation/TaskAllocationRule.cs @@ -35,6 +35,14 @@ namespace IRaCIS.Core.Domain.Models public Enroll Enroll { get; set; } + public Guid DoctorUserId { get; set; } + + [ForeignKey("DoctorUserId")] + + public User DoctorUser { get; set; } + + + @@ -42,11 +50,7 @@ namespace IRaCIS.Core.Domain.Models //是否是裁判医生 裁判医生单独加入 public bool IsJudgeDoctor { get; set; } - public Guid DoctorUserId { get; set; } - [ForeignKey("DoctorUserId")] - - public User DoctorUser { get; set; } public int PlanReadingRatio { get; set; } diff --git a/IRaCIS.Core.Domain/Allocation/VisitTask.cs b/IRaCIS.Core.Domain/Allocation/VisitTask.cs index d4c387760..302bd743b 100644 --- a/IRaCIS.Core.Domain/Allocation/VisitTask.cs +++ b/IRaCIS.Core.Domain/Allocation/VisitTask.cs @@ -100,7 +100,6 @@ namespace IRaCIS.Core.Domain.Models //public TaskAllocationRule DoctorTaskAllocationRule { get; set; } - public Enroll Enroll { get; set; } public TaskMedicalReviewRule DoctorTaskMedicalReviewRule { get; set; } diff --git a/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs b/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs index a877d9c4f..bb9401758 100644 --- a/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs +++ b/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs @@ -90,13 +90,8 @@ namespace IRaCIS.Core.Infra.EFCore - modelBuilder.Entity().HasMany(t => t.VisitTaskList).WithOne(t => t.DoctorUser).HasForeignKey(t => t.DoctorUserId); + modelBuilder.Entity().HasMany(t => t.VisitTaskList).WithOne(t => t.DoctorUser).HasForeignKey(t => t.DoctorUserId).IsRequired(false); - //modelBuilder.Entity().HasMany(t => t.DoctorTrialVisitTaskList).WithOne(t => t.Enroll).HasForeignKey(t => new { t.DoctorUserId, t.TrialId }).HasPrincipalKey(u => new { u.DoctorUserId, u.TrialId }).IsRequired(false); - - //modelBuilder.Entity().HasOne(t => t.Enroll).WithMany(t => t.DoctorTrialVisitTaskList).HasForeignKey(t => new { t.DoctorUserId, t.TrialId }).IsRequired(false).HasPrincipalKey(u => new { u.DoctorUserId, u.TrialId }).IsRequired(false); - - //modelBuilder.Entity().HasMany(t => t.DoctorVisitTaskList).WithOne(t => t.DoctorTaskAllocationRule).HasForeignKey(t => new { t.DoctorUserId, t.TrialId }).HasPrincipalKey(u => new { u.DoctorUserId, u.TrialId }); modelBuilder.Entity().HasMany(t => t.DoctorVisitTaskList).WithOne(t => t.DoctorTaskMedicalReviewRule).HasForeignKey(t => new { t.DoctorUserId, t.TrialId }).HasPrincipalKey(u => new { u.DoctorUserId, u.TrialId });