From 32466cd16ded109c25857419f083346d43ab7f62 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Fri, 1 Jul 2022 09:45:53 +0800 Subject: [PATCH] x --- .../IRaCIS.Core.Application.xml | 1 - .../Allocation/DTO/VisitTaskViewModel.cs | 25 +++++++++-------- .../Service/Allocation/VisitTaskService.cs | 27 ++++++++++--------- 3 files changed, 29 insertions(+), 24 deletions(-) diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml index 7b06d4cd7..135cbb369 100644 --- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml +++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml @@ -207,7 +207,6 @@ 申请重阅 1:IR 2:PM - diff --git a/IRaCIS.Core.Application/Service/Allocation/DTO/VisitTaskViewModel.cs b/IRaCIS.Core.Application/Service/Allocation/DTO/VisitTaskViewModel.cs index 476fb5cf4..4e2bad049 100644 --- a/IRaCIS.Core.Application/Service/Allocation/DTO/VisitTaskViewModel.cs +++ b/IRaCIS.Core.Application/Service/Allocation/DTO/VisitTaskViewModel.cs @@ -251,8 +251,8 @@ namespace IRaCIS.Core.Application.ViewModel //public Guid SiteId { get; set; } public Guid SubjectId { get; set; } - public String TrialSiteCode { get; set; } = String.Empty; - public string SubjectCode { get; set; } = String.Empty; + public String TrialSiteCode => VisitTaskList.Select(t=>t.TrialSiteCode).First(); + public string SubjectCode => VisitTaskList.Select(t => t.TrialSiteCode).First(); public int? VisitValidTaskCount { get; set; } @@ -263,20 +263,23 @@ namespace IRaCIS.Core.Application.ViewModel public class VisitTaskSimpleView { - public Guid Id { get; set; } - public Guid TrialId { get; set; } + public Guid? Id { get; set; } + public Guid? TrialId { get; set; } - public Guid SubjectId { get; set; } + public Guid? SubjectId { get; set; } - public Arm ArmEnum { get; set; } - public string TaskCode { get; set; } + public Arm? ArmEnum { get; set; } + public string? TaskCode { get; set; } - public string TaskName { get; set; } - public string TaskBlindName { get; set; } + public string? TaskName { get; set; } + public string? TaskBlindName { get; set; } - public ReadingCategory ReadingCategory { get; set; } + public ReadingCategory? ReadingCategory { get; set; } - public TaskState TaskState { get; set; } + public TaskState? TaskState { get; set; } + + public String? TrialSiteCode { get; set; } = String.Empty; + public string? SubjectCode { get; set; } = String.Empty; } diff --git a/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs b/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs index c2acced63..12a68ca0c 100644 --- a/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs +++ b/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs @@ -241,16 +241,11 @@ namespace IRaCIS.Core.Application.Service .Where(t => t.ReReadingApplyState != ReReadingApplyState.Agree) .WhereIf(inQuery.IsHaveReadingPeriod == false, t => t.ReadingCategory == ReadingCategory.Visit) .WhereIf(inQuery.IsHaveReadingPeriod == true, t => t.ReadingCategory == ReadingCategory.Visit || t.ReadingCategory == ReadingCategory.Global) - .GroupBy(t => new { t.SubjectId, /*t.TrialId, t.Subject.SiteId,*/ t.Subject.Code, t.Subject.TrialSite.TrialSiteCode }) + .GroupBy(t => t.SubjectId) .Select(g => new SelfConsistentView() { - SubjectId = g.Key.SubjectId, - //TrialId = g.Key.TrialId, - //SiteId = g.Key.SiteId, - - SubjectCode = g.Key.Code, - TrialSiteCode = g.Key.TrialSiteCode, - + SubjectId = g.Key, + VisitTaskList = g.OrderBy(t => t.SubjectVisit.VisitNum).Select(c => new VisitTaskSimpleView() { Id = c.Id, @@ -261,13 +256,22 @@ namespace IRaCIS.Core.Application.Service TaskState = c.TaskState, ArmEnum = c.ArmEnum, SubjectId = c.SubjectId, - TrialId = c.TrialId - }).ToList(), + TrialId = c.TrialId, + SubjectCode = c.Subject.Code, + TrialSiteCode = c.Subject.TrialSite.TrialSiteCode, + }).Take(2).ToList(), VisitValidTaskCount = g.Count() }); + + var count = query.Count(); + + var list= query.Skip(0).Take(10).ToList(); + + + return query.ToList(); } @@ -968,7 +972,6 @@ namespace IRaCIS.Core.Application.Service /// 申请重阅 1:IR 2:PM /// /// - /// /// [HttpPost] [UnitOfWork] @@ -1094,7 +1097,7 @@ namespace IRaCIS.Core.Application.Service { var origenalAnswerList = _readingTaskQuestionAnswerRepository.Where(t => t.VisitTaskId == origenalTask.Id).ToList(); - origenalAnswerList.ForEach(t => { t.VisitTaskId = newTask.Id; }); + origenalAnswerList.ForEach(t => { t.VisitTaskId = newTask.Id; t.Id=Guid.Empty }); _readingTaskQuestionAnswerRepository.AddRangeAsync(origenalAnswerList); }