返回默认值,如果没有任务

Test_IRC_Net10
hang 2026-06-09 16:32:53 +08:00
parent 7599e06b9d
commit e6d7a0c0e0
1 changed files with 27 additions and 0 deletions

View File

@ -215,6 +215,33 @@ namespace IRaCIS.Core.Application.Service
CriterionType = g.Key.CriterionType,
}).ToList();
// 获取所有符合条件的医生ID
var allDoctorIds = _enrollRepository
.Where(x => x.TrialId == inQuery.TrialId
&& x.EnrollStatus >= EnrollStatus.ConfirmIntoGroup)
.WhereIf(inQuery.DoctorUserIdList.Count > 0,
t => inQuery.DoctorUserIdList.Contains(t.DoctorUserId))
.Select(x => x.DoctorUserId)
.Distinct()
.ToList();
// 补全缺失的医生记录
var missingDoctors = allDoctorIds
.Except(list.Select(r => r.DoctorUserId))
.Select(doctorId => new DoctorTaskStat()
{
DoctorUserId = doctorId,
PendingCount = 0,
TotalCount = 0,
ComplectedCount = 0,
TrialReadingCriterionId = inQuery.TrialReadingCriterionId,
})
.ToList();
list.AddRange(missingDoctors);
return list;
}