From 93735fe203192dc04d790b185f40982b5b363293 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Fri, 8 Jul 2022 17:05:11 +0800 Subject: [PATCH] x --- .../IRaCIS.Core.Application.xml | 15 +-- .../DTO/TaskConsistentRuleViewModel.cs | 4 +- .../Allocation/TaskConsistentRuleService.cs | 99 +++++++++++-------- 3 files changed, 62 insertions(+), 56 deletions(-) diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml index 553bfbb92..de31a1e08 100644 --- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml +++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml @@ -79,18 +79,13 @@ - + - 组间一致性分析 选择Subejct 列表 + 仅仅组内一致性时使用( - - - - - - 确认生成自身一致性分析任务 - - + + + diff --git a/IRaCIS.Core.Application/Service/Allocation/DTO/TaskConsistentRuleViewModel.cs b/IRaCIS.Core.Application/Service/Allocation/DTO/TaskConsistentRuleViewModel.cs index 5c0580797..7baac4b07 100644 --- a/IRaCIS.Core.Application/Service/Allocation/DTO/TaskConsistentRuleViewModel.cs +++ b/IRaCIS.Core.Application/Service/Allocation/DTO/TaskConsistentRuleViewModel.cs @@ -118,10 +118,8 @@ namespace IRaCIS.Core.Application.ViewModel public string BlindSubjectCode { get; set; } = string.Empty; public string BlindTrialSiteCode { get; set; } = string.Empty; - - [JsonIgnore] public Guid? DoctorUserId { get; set; } - [JsonIgnore] + public Guid? TaskConsistentRuleId { get; set; } } diff --git a/IRaCIS.Core.Application/Service/Allocation/TaskConsistentRuleService.cs b/IRaCIS.Core.Application/Service/Allocation/TaskConsistentRuleService.cs index 272b145ac..5966948fa 100644 --- a/IRaCIS.Core.Application/Service/Allocation/TaskConsistentRuleService.cs +++ b/IRaCIS.Core.Application/Service/Allocation/TaskConsistentRuleService.cs @@ -128,17 +128,20 @@ namespace IRaCIS.Core.Application.Service blindSubjectCode = (maxCodeInt + 1).ToString($"D{filterObj.BlindSubjectNumberOfPlaces}"); } - subject.VisitTaskList.Take(filterObj.PlanVisitCount).ForEach(t => - { - t.DoctorUserId = doctorUserId; - t.TaskConsistentRuleId = filterObj.Id; - t.BlindTrialSiteCode = filterObj.BlindTrialSiteCode; - t.BlindSubjectCode = blindSubjectCode; - }); + subject.VisitTaskList= subject.VisitTaskList.Take(filterObj.PlanVisitCount).ToList(); + + subject.VisitTaskList.ForEach(t => + { + t.DoctorUserId = doctorUserId; + t.TaskConsistentRuleId = filterObj.Id; + t.BlindTrialSiteCode = filterObj.BlindTrialSiteCode; + t.BlindSubjectCode = blindSubjectCode; + }); //最后一个访视添加全局 - var globalTask = (subject.VisitTaskList[filterObj.PlanVisitCount - 1]).Clone(); + + var globalTask = (subject.VisitTaskList.Last()).Clone(); globalTask.ReadingCategory = ReadingCategory.Global; globalTask.VisitTaskNum += ReadingCommon.TaskNumDic[ReadingCategory.Global]; subject.VisitTaskList.Add(globalTask); @@ -172,7 +175,10 @@ namespace IRaCIS.Core.Application.Service //[HttpPost] //public async Task> GetGroupConsistentRuleSubjectList(GroupConsistentQuery inQuery) //{ - // var filterObj = await _taskConsistentRuleRepository.FirstOrDefaultAsync(t => t.TrialId == inQuery.TrialId && t.IsSelfAnalysis==false); + // var filterObj = await _taskConsistentRuleRepository.FirstOrDefaultAsync(t => t.TrialId == inQuery.TrialId && t.IsSelfAnalysis == false); + + + // var pagedList = await GetIQueryableDoctorSelfConsistentSubjectView(filterObj).ToPagedListAsync(inQuery.PageIndex, inQuery.PageSize, string.IsNullOrWhiteSpace(inQuery.SortField) ? nameof(DoctorSelfConsistentSubjectView.SubjectCode) : inQuery.SortField, inQuery.Asc); @@ -181,58 +187,60 @@ namespace IRaCIS.Core.Application.Service - /// - /// 确认生成自身一致性分析任务 - /// - /// - /// - [HttpPost] - public async Task ConfirmGenerateGroupConsistentTask(GroupConsistentConfirmGenrateCommand inCommand, [FromServices] IVisitTaskHelpeService _visitTaskCommonService) - { - throw new BusinessValidationFailedException("正在更新开发ing,不允许操作"); + ///// + ///// 确认生成组间一致性分析任务 + ///// + ///// + ///// + //[HttpPost] + //public async Task ConfirmGenerateGroupConsistentTask(GroupConsistentConfirmGenrateCommand inCommand, [FromServices] IVisitTaskHelpeService _visitTaskCommonService) + //{ + // throw new BusinessValidationFailedException("正在更新开发ing,不允许操作"); - var filterObj = await _taskConsistentRuleRepository.FirstOrDefaultAsync(t => t.TrialId == inCommand.TrialId && t.IsSelfAnalysis==false); + // var filterObj = await _taskConsistentRuleRepository.FirstOrDefaultAsync(t => t.TrialId == inCommand.TrialId && t.IsSelfAnalysis==false); - var list = await GetIQueryableDoctorSelfConsistentSubjectView(filterObj, null, inCommand.SubejctIdList).ToListAsync(); + // var list = await GetIQueryableDoctorSelfConsistentSubjectView(filterObj, null, inCommand.SubejctIdList).ToListAsync(); - foreach (var subject in list) - { + // foreach (var subject in list) + // { - //subject.VisitTaskList.Take(filterObj.PlanVisitCount).ForEach(t => - //{ - // t.DoctorUserId = doctorUserId; - // t.TaskConsistentRuleId = filterObj.Id; - - //}); + // //subject.VisitTaskList.Take(filterObj.PlanVisitCount).ForEach(t => + // //{ + // // t.DoctorUserId = doctorUserId; + // // t.TaskConsistentRuleId = filterObj.Id; + + // //}); - //最后一个访视添加全局 - //var globalTask = (subject.VisitTaskList[filterObj.PlanVisitCount - 1]).Clone(); - //globalTask.ReadingCategory = ReadingCategory.Global; - //globalTask.VisitTaskNum += ReadingCommon.TaskNumDic[ReadingCategory.Global]; - //subject.VisitTaskList.Add(globalTask); + // //最后一个访视添加全局 + // //var globalTask = (subject.VisitTaskList[filterObj.PlanVisitCount - 1]).Clone(); + // //globalTask.ReadingCategory = ReadingCategory.Global; + // //globalTask.VisitTaskNum += ReadingCommon.TaskNumDic[ReadingCategory.Global]; + // //subject.VisitTaskList.Add(globalTask); - await _visitTaskCommonService.AddTaskAsync(new GenerateTaskCommand() - { - TrialId = filterObj.TrialId, + // await _visitTaskCommonService.AddTaskAsync(new GenerateTaskCommand() + // { + // TrialId = filterObj.TrialId, - ReadingCategory = GenerateTaskCategory.SelfConsistent, + // ReadingCategory = GenerateTaskCategory.SelfConsistent, - //产生的过滤掉已经生成的 - GenerataConsistentTaskList = subject.VisitTaskList.Where(t => t.IsHaveGeneratedTask == false).ToList() - }); + // //产生的过滤掉已经生成的 + // GenerataConsistentTaskList = subject.VisitTaskList.Where(t => t.IsHaveGeneratedTask == false).ToList() + // }); - } + // } - return ResponseOutput.Ok(); + // return ResponseOutput.Ok(); + + + //} - } /// @@ -484,6 +492,11 @@ namespace IRaCIS.Core.Application.Service VerifyMsg = "已有该项目配置,不允许继续增加" }; + if( await _visitTaskRepository.AnyAsync(t=>t.IsSelfAnalysis==addOrEditTaskConsistentRule.IsSelfAnalysis && t.TrialId == addOrEditTaskConsistentRule.TrialId)) + { + return ResponseOutput.NotOk("已有Subject 生成了任务,不允许修改配置"); + } + var entity = await _taskConsistentRuleRepository.InsertOrUpdateAsync(addOrEditTaskConsistentRule, true, verifyExp1); return ResponseOutput.Ok(entity.Id.ToString());