diff --git a/IRaCIS.Core.Application/Service/Allocation/DTO/TaskConsistentRuleViewModel.cs b/IRaCIS.Core.Application/Service/Allocation/DTO/TaskConsistentRuleViewModel.cs index d9470af0a..9f73b9a4a 100644 --- a/IRaCIS.Core.Application/Service/Allocation/DTO/TaskConsistentRuleViewModel.cs +++ b/IRaCIS.Core.Application/Service/Allocation/DTO/TaskConsistentRuleViewModel.cs @@ -33,10 +33,6 @@ namespace IRaCIS.Core.Application.ViewModel public class TaskConsistentRuleBasic : TaskConsistentRuleAddOrEdit { - /// - /// 任务展示访视 读片任务显示是否顺序 - /// - public ReadingOrder IsReadingTaskViewInOrder { get; set; } = ReadingOrder.InOrder; } public class SubjectGeneratedTask @@ -291,7 +287,14 @@ namespace IRaCIS.Core.Application.ViewModel } - + public class GetConsistentRuleOut + { + public TaskConsistentRuleBasic? ConsistentRuleBasic { get; set; } + /// + /// 任务展示访视 读片任务显示是否顺序 + /// + public ReadingOrder IsReadingTaskViewInOrder { get; set; } = ReadingOrder.InOrder; + } ///TaskConsistentRuleQuery 列表查询参数模型 public class TaskConsistentRuleQuery diff --git a/IRaCIS.Core.Application/Service/Allocation/TaskConsistentRuleService.cs b/IRaCIS.Core.Application/Service/Allocation/TaskConsistentRuleService.cs index 77e0a2737..c914ee5be 100644 --- a/IRaCIS.Core.Application/Service/Allocation/TaskConsistentRuleService.cs +++ b/IRaCIS.Core.Application/Service/Allocation/TaskConsistentRuleService.cs @@ -34,6 +34,7 @@ namespace IRaCIS.Core.Application.Service private readonly IRepository _taskConsistentRuleRepository; private readonly IRepository _visitTaskRepository; private readonly IRepository _readingConsistentClinicalDataRepository; + private readonly IRepository _trialReadingCriterionRepository; private readonly IReadingClinicalDataService _readingClinicalDataService; private readonly IRepository _subjectUserRepository; private readonly IRepository _subjectRepository; @@ -49,6 +50,7 @@ namespace IRaCIS.Core.Application.Service public TaskConsistentRuleService(IRepository visitTaskRepository, IRepository readingConsistentClinicalDataRepository, + IRepository trialReadingCriterionRepository, IReadingClinicalDataService readingClinicalDataService, IRepository enrollRepository, IRepository taskConsistentRuleRepository, IRepository subjectUserRepository, IRepository subjectRepository, IDistributedLockProvider distributedLockProvider, IRepository trialRepository, IRepository trialSiteRepository, IRepository trialVirtualSiteCodeUpdateRepository, IVisitTaskHelpeService visitTaskCommonService) @@ -56,6 +58,7 @@ namespace IRaCIS.Core.Application.Service _taskConsistentRuleRepository = taskConsistentRuleRepository; _visitTaskRepository = visitTaskRepository; this._readingConsistentClinicalDataRepository = readingConsistentClinicalDataRepository; + this._trialReadingCriterionRepository = trialReadingCriterionRepository; this._readingClinicalDataService = readingClinicalDataService; _subjectUserRepository = subjectUserRepository; _subjectRepository = subjectRepository; @@ -782,9 +785,16 @@ namespace IRaCIS.Core.Application.Service [HttpPost] - public async Task GetConsistentRule(TaskConsistentRuleQuery inQuery) + public async Task GetConsistentRule(TaskConsistentRuleQuery inQuery) { - return await _taskConsistentRuleRepository.Where(t => t.TrialId == inQuery.TrialId && t.IsSelfAnalysis == inQuery.IsSelfAnalysis && t.TrialReadingCriterionId == inQuery.TrialReadingCriterionId).ProjectTo(_mapper.ConfigurationProvider).FirstOrDefaultAsync(); + + var IsReadingTaskViewInOrder = await _trialReadingCriterionRepository.Where(x => x.Id == inQuery.TrialReadingCriterionId).Select(x => x.IsReadingTaskViewInOrder).FirstNotNullAsync(); + var result = await _taskConsistentRuleRepository.Where(t => t.TrialId == inQuery.TrialId && t.IsSelfAnalysis == inQuery.IsSelfAnalysis && t.TrialReadingCriterionId == inQuery.TrialReadingCriterionId).ProjectTo(_mapper.ConfigurationProvider).FirstOrDefaultAsync(); + return new GetConsistentRuleOut() + { + ConsistentRuleBasic = result, + IsReadingTaskViewInOrder = IsReadingTaskViewInOrder + }; } /// diff --git a/IRaCIS.Core.Application/Service/Allocation/_MapConfig.cs b/IRaCIS.Core.Application/Service/Allocation/_MapConfig.cs index f56b27d40..00dc9b3ef 100644 --- a/IRaCIS.Core.Application/Service/Allocation/_MapConfig.cs +++ b/IRaCIS.Core.Application/Service/Allocation/_MapConfig.cs @@ -293,8 +293,7 @@ namespace IRaCIS.Core.Application.Service //CreateMap() // .ForMember(o => o.GeneratedSubjectCount, t => t.MapFrom(u => u.DoctorVisitTaskList.Where(t => t.IsAnalysisCreate && t.TaskConsistentRuleId == u.Id).Select(t => t.SubjectId).Distinct().Count())) ; - CreateMap() - .ForMember(o => o.IsReadingTaskViewInOrder, t => t.MapFrom(u => u.TrialReadingCriterion.IsReadingTaskViewInOrder)); + CreateMap(); CreateMap();