修复入组bug

Uat_Study
hang 2022-07-26 13:04:54 +08:00
parent 6e4788e27b
commit 839d72f05a
7 changed files with 13 additions and 7 deletions

View File

@ -130,8 +130,9 @@ namespace IRaCIS.Core.Application.ViewModel
public Guid TrialId { get; set; }
public Guid EnrollId { get; set; }
//public Guid DoctorUserId { get; set; }
[NotDefault]
public Guid DoctorUserId { get; set; }
public int PlanSubjectCount { get; set; }

View File

@ -72,7 +72,7 @@ namespace IRaCIS.Core.Application.Service
[HttpDelete("{taskAllocationRuleId:guid}")]
public async Task<IResponseOutput> DeleteTaskAllocationRule(Guid taskAllocationRuleId)
{
if (await _taskAllocationRuleRepository.Where(t => t.Id == taskAllocationRuleId).AnyAsync(t => t.Enroll.DoctorTrialVisitTaskList.Any()))
if (await _taskAllocationRuleRepository.Where(t => t.Id == taskAllocationRuleId).AnyAsync(t => t.DoctorUser.VisitTaskList.Any()))
{
return ResponseOutput.NotOk("已分配任务给该医生,不允许删除");
}

View File

@ -70,8 +70,8 @@ namespace IRaCIS.Core.Application.Service
.ForMember(o => o.ReadingCategoryList, t => t.MapFrom(u => u.Enroll.EnrollReadingCategoryList.OrderBy(t => t.ReadingCategory).Select(t=>t.ReadingCategory).ToList()));
CreateMap<TaskAllocationRule, AssignDoctorStatView>().IncludeBase<TaskAllocationRule, TaskAllocationRuleDTO>()
.ForMember(o => o.AssignedSubjectCount, t => t.MapFrom(u => u.Enroll.DoctorTrialVisitTaskList.Select(t=>t.SubjectId).Distinct().Count()))
.ForMember(o => o.WaitDealTrialTaskCount, t => t.MapFrom(u => u.Enroll.DoctorTrialVisitTaskList.Where(t=>t.ReadingTaskState!=ReadingTaskState.HaveSigned && t.TaskState==TaskState.Effect).Count()))
.ForMember(o => o.AssignedSubjectCount, t => t.MapFrom(u => u.DoctorUser.VisitTaskList.Where(t=>t.TrialId==u.TrialId).Select(t=>t.SubjectId).Distinct().Count()))
.ForMember(o => o.WaitDealTrialTaskCount, t => t.MapFrom(u => u.DoctorUser.VisitTaskList.Where(t => t.TrialId == u.TrialId).Where(t=>t.ReadingTaskState!=ReadingTaskState.HaveSigned && t.TaskState==TaskState.Effect).Count()))
.ForMember(o => o.WaitDealAllTaskCount, t => t.MapFrom(u => u.DoctorUser.VisitTaskList.Where(t => t.ReadingTaskState != ReadingTaskState.HaveSigned && t.TaskState == TaskState.Effect).Count()));

View File

@ -36,6 +36,10 @@ namespace IRaCIS.Core.Domain.Models
public Enroll Enroll { get; set; }
//是否是裁判医生 裁判医生单独加入
public bool IsJudgeDoctor { get; set; }
public Guid DoctorUserId { get; set; }

View File

@ -1,5 +1,4 @@
using IRaCIS.Core.Domain.Share;
using IRaCIS.Core.Domain.Share;
using System;
using System.Collections.Generic;
using System.Linq;

View File

@ -67,7 +67,7 @@ namespace IRaCIS.Core.Domain.Models
public User DoctorUser { get; set; }
public List<VisitTask> DoctorTrialVisitTaskList { get; set; } = new List<VisitTask>();
//public List<VisitTask> DoctorTrialVisitTaskList { get; set; } = new List<VisitTask>();

View File

@ -92,7 +92,9 @@ namespace IRaCIS.Core.Infra.EFCore
modelBuilder.Entity<User>().HasMany(t => t.VisitTaskList).WithOne(t => t.DoctorUser).HasForeignKey(t => t.DoctorUserId);
modelBuilder.Entity<VisitTask>().HasOne(t => t.Enroll).WithMany(t => t.DoctorTrialVisitTaskList).HasForeignKey(t => new { t.DoctorUserId, t.TrialId }).HasPrincipalKey(u => new { u.DoctorUserId, u.TrialId });
//modelBuilder.Entity<Enroll>().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<VisitTask>().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<TaskAllocationRule>().HasMany(t => t.DoctorVisitTaskList).WithOne(t => t.DoctorTaskAllocationRule).HasForeignKey(t => new { t.DoctorUserId, t.TrialId }).HasPrincipalKey(u => new { u.DoctorUserId, u.TrialId });