From 988ac22ef65b0da685ea3ba7766bba6e61654669 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Thu, 13 Oct 2022 15:29:00 +0800 Subject: [PATCH] x --- .../DTO/TaskAllocationRuleViewModel.cs | 20 ++++++++++--------- .../Allocation/TaskAllocationRuleService.cs | 5 ++++- .../Service/Allocation/_MapConfig.cs | 4 ++-- 3 files changed, 17 insertions(+), 12 deletions(-) diff --git a/IRaCIS.Core.Application/Service/Allocation/DTO/TaskAllocationRuleViewModel.cs b/IRaCIS.Core.Application/Service/Allocation/DTO/TaskAllocationRuleViewModel.cs index 328e2624f..a0d82917b 100644 --- a/IRaCIS.Core.Application/Service/Allocation/DTO/TaskAllocationRuleViewModel.cs +++ b/IRaCIS.Core.Application/Service/Allocation/DTO/TaskAllocationRuleViewModel.cs @@ -8,6 +8,7 @@ using IRaCIS.Core.Domain.Share; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using IRaCIS.Application.Contracts; +using Newtonsoft.Json; namespace IRaCIS.Core.Application.ViewModel { @@ -103,18 +104,19 @@ namespace IRaCIS.Core.Application.ViewModel public List ReadingCategoryList { get; set; } - //public List TrialReadingCriterionList { get; set; } + public List TrialReadingCriterionList { get; set; } - //public List CriterionReadingCategoryList { get; set; } + [JsonIgnore] + public List CriterionReadingCategoryList { get; set; } - //public List CriterionCategoryList => + public List CriterionCategoryList => - // TrialReadingCriterionList.Select(t => - // new CriterionReadingCategory() { - // EnrollId = EnrollId, - // TrialReadingCriterionId = t.TrialReadingCriterionId, - // ReadingCategorys = CriterionReadingCategoryList.Where(c => c.TrialReadingCriterionId == t.TrialReadingCriterionId).Select(t => t.ReadingCategory).OrderBy(c => c).ToList() - // }).ToList(); + TrialReadingCriterionList.Select(t => + new CriterionReadingCategory() { + EnrollId = EnrollId, + TrialReadingCriterionId = t.TrialReadingCriterionId, + ReadingCategorys = CriterionReadingCategoryList.Where(c => c.TrialReadingCriterionId == t.TrialReadingCriterionId).Select(t => t.ReadingCategory).OrderBy(c => c).ToList() + }).ToList(); diff --git a/IRaCIS.Core.Application/Service/Allocation/TaskAllocationRuleService.cs b/IRaCIS.Core.Application/Service/Allocation/TaskAllocationRuleService.cs index 6aea5302f..b67e0f640 100644 --- a/IRaCIS.Core.Application/Service/Allocation/TaskAllocationRuleService.cs +++ b/IRaCIS.Core.Application/Service/Allocation/TaskAllocationRuleService.cs @@ -165,7 +165,10 @@ namespace IRaCIS.Core.Application.Service UserCode = user.UserCode, UserName = user.UserName, UserTypeEnum = user.UserTypeRole.UserTypeEnum, - ReadingCategoryList = allocationRule.Enroll.EnrollReadingCategoryList.Select(t => t.ReadingCategory).ToList() + ReadingCategoryList = allocationRule.Enroll.EnrollReadingCategoryList.AsQueryable() + .WhereIf(selectQuery.ReadingCategory != null,t=> t.ReadingCategory == selectQuery.ReadingCategory) + .WhereIf(selectQuery.TrialReadingCriterionId != null, t => t.TrialReadingCriterionId == selectQuery.TrialReadingCriterionId) + .Select(t => t.ReadingCategory).OrderBy(t=>t).ToList() }; return await query.ToListAsync(); diff --git a/IRaCIS.Core.Application/Service/Allocation/_MapConfig.cs b/IRaCIS.Core.Application/Service/Allocation/_MapConfig.cs index 47e5a48e1..7f7681103 100644 --- a/IRaCIS.Core.Application/Service/Allocation/_MapConfig.cs +++ b/IRaCIS.Core.Application/Service/Allocation/_MapConfig.cs @@ -68,8 +68,8 @@ namespace IRaCIS.Core.Application.Service var trialReadingCriterionId = Guid.Empty; CreateMap() .ForMember(o => o.DoctorUser, t => t.MapFrom(u => u.Enroll.DoctorUser)) - //.ForMember(o => o.CriterionReadingCategoryList, t => t.MapFrom(u => u.Enroll.EnrollReadingCategoryList.Select(t => new TrialCriterionReadingCategory() { EnrollId = t.EnrollId, ReadingCategory = t.ReadingCategory, TrialReadingCriterionId = t.TrialReadingCriterionId }))) - //.ForMember(o => o.TrialReadingCriterionList, t => t.MapFrom(u => u.Trial.ReadingQuestionCriterionTrialList.Where(t => t.IsConfirm).Select(t => new TrialReadingCriterionDto() { TrialReadingCriterionId = t.Id, TrialReadingCriterionName = t.CriterionName }))) + .ForMember(o => o.CriterionReadingCategoryList, t => t.MapFrom(u => u.Enroll.EnrollReadingCategoryList.Select(t => new TrialCriterionReadingCategory() { EnrollId = t.EnrollId, ReadingCategory = t.ReadingCategory, TrialReadingCriterionId = t.TrialReadingCriterionId }))) + .ForMember(o => o.TrialReadingCriterionList, t => t.MapFrom(u => u.Trial.ReadingQuestionCriterionTrialList.Where(t => t.IsConfirm).Select(t => new TrialReadingCriterionDto() { TrialReadingCriterionId = t.Id, TrialReadingCriterionName = t.CriterionName }))) .ForMember(o => o.ReadingCategoryList, t => t.MapFrom(u => u.Enroll.EnrollReadingCategoryList.Where(t=>t.TrialReadingCriterionId== trialReadingCriterionId).OrderBy(t => t.ReadingCategory).Select(t => t.ReadingCategory).ToList())) ;