From 9b0872bab2db23de77c2611d911ef4e7fe7a001e Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Mon, 4 Jul 2022 16:29:29 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BB=BB=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../IRaCIS.Core.Application.xml | 7 +++++ .../DTO/TaskConsistentRuleViewModel.cs | 5 ++++ .../Allocation/DTO/VisitTaskViewModel.cs | 2 ++ .../Allocation/TaskConsistentRuleService.cs | 11 ++++---- .../Allocation/VisitTaskHelpeService.cs | 8 +++++- .../Service/Allocation/VisitTaskService.cs | 28 ++++++++++++------- .../Service/Allocation/_MapConfig.cs | 7 +++++ IRaCIS.Core.Domain/Allocation/VisitTask.cs | 8 ++++-- 8 files changed, 57 insertions(+), 19 deletions(-) diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml index 6601f2281..d2c1cb319 100644 --- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml +++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml @@ -242,6 +242,13 @@ + + + 重阅影响提示列表 + + + + 系统模板文档配置表 diff --git a/IRaCIS.Core.Application/Service/Allocation/DTO/TaskConsistentRuleViewModel.cs b/IRaCIS.Core.Application/Service/Allocation/DTO/TaskConsistentRuleViewModel.cs index d07d20efa..033dbfb37 100644 --- a/IRaCIS.Core.Application/Service/Allocation/DTO/TaskConsistentRuleViewModel.cs +++ b/IRaCIS.Core.Application/Service/Allocation/DTO/TaskConsistentRuleViewModel.cs @@ -6,6 +6,8 @@ using System; using IRaCIS.Core.Domain.Share; using System.Collections.Generic; +using Newtonsoft.Json; + namespace IRaCIS.Core.Application.ViewModel { /// TaskConsistentRuleView 列表视图模型 @@ -91,6 +93,9 @@ namespace IRaCIS.Core.Application.ViewModel public String TrialSiteCode { get; set; } = String.Empty; public string SubjectCode { get; set; } = String.Empty; + + [JsonIgnore] + public Guid? DoctorUserId { get; set; } } diff --git a/IRaCIS.Core.Application/Service/Allocation/DTO/VisitTaskViewModel.cs b/IRaCIS.Core.Application/Service/Allocation/DTO/VisitTaskViewModel.cs index b20704794..6488825d2 100644 --- a/IRaCIS.Core.Application/Service/Allocation/DTO/VisitTaskViewModel.cs +++ b/IRaCIS.Core.Application/Service/Allocation/DTO/VisitTaskViewModel.cs @@ -22,6 +22,8 @@ namespace IRaCIS.Core.Application.ViewModel public string TaskName { get; set; } public string TaskBlindName { get; set; } + public decimal VisitTaskNum { get; set; } + public ReadingCategory ReadingCategory { get; set; } public TaskAllocationState TaskAllocationState { get; set; } diff --git a/IRaCIS.Core.Application/Service/Allocation/TaskConsistentRuleService.cs b/IRaCIS.Core.Application/Service/Allocation/TaskConsistentRuleService.cs index e3e909665..81e9a32eb 100644 --- a/IRaCIS.Core.Application/Service/Allocation/TaskConsistentRuleService.cs +++ b/IRaCIS.Core.Application/Service/Allocation/TaskConsistentRuleService.cs @@ -175,9 +175,9 @@ namespace IRaCIS.Core.Application.Service var group = _visitTaskRepository.Where(t => t.TrialId == filterObj.TrialId && inCommand.SubejctIdList.Contains(t.SubjectId)) // 自身一致性分析 - .WhereIf(isSelfAnalysis, t => t.DoctorUserId == filterObj.AnalysisDoctorUserId) + .WhereIf(isSelfAnalysis, t => t.DoctorUserId == filterObj.AnalysisDoctorUserId) // 组内一致性分析 - .WhereIf(isSelfAnalysis == false, t => t.DoctorUserId == filterObj.AnalysisDoctorUserId && subjectfilter.Contains(t.SubjectId)) + .WhereIf(isSelfAnalysis == false, t => t.DoctorUserId == filterObj.AnalysisDoctorUserId && subjectfilter.Contains(t.SubjectId)) .Where(t => t.ReadingTaskState == ReadingTaskState.HaveSigned && t.TaskState == TaskState.Effect) .Where(t => t.SignTime!.Value.AddDays(filterObj.IntervalWeeks * 7 + 1) > DateTime.Now) //重阅产生的访视任务 要把之前的访视任务去除 @@ -185,8 +185,8 @@ namespace IRaCIS.Core.Application.Service .WhereIf(filterObj.IsHaveReadingPeriod == false, t => t.ReadingCategory == ReadingCategory.Visit) .WhereIf(filterObj.IsHaveReadingPeriod == true, t => t.ReadingCategory == ReadingCategory.Visit || t.ReadingCategory == ReadingCategory.Global) - .GroupBy(t => t.SubjectId) - .Where(g => g.Count() > filterObj.PlanVisitCount); + .GroupBy(t => t.SubjectId) + .Where(g => g.Count() > filterObj.PlanVisitCount); var query = group.Select(g => new DoctorConsistentRuleSubjectView() @@ -218,7 +218,7 @@ namespace IRaCIS.Core.Application.Service foreach (var subject in list) { - + subject.VisitTaskList.ForEach(t => t.DoctorUserId = doctorUserId); await _visitTaskCommonService.AddTaskAsync(new GenerateTaskCommand() @@ -237,7 +237,6 @@ namespace IRaCIS.Core.Application.Service - /// /// 一致性分配 配置+ 统计已经生成数量统计表 /// diff --git a/IRaCIS.Core.Application/Service/Allocation/VisitTaskHelpeService.cs b/IRaCIS.Core.Application/Service/Allocation/VisitTaskHelpeService.cs index 3cd93c051..d863de7a2 100644 --- a/IRaCIS.Core.Application/Service/Allocation/VisitTaskHelpeService.cs +++ b/IRaCIS.Core.Application/Service/Allocation/VisitTaskHelpeService.cs @@ -374,6 +374,12 @@ namespace IRaCIS.Core.Application.Service TaskState = TaskState.Effect, Code = currentMaxCodeInt + 1, TaskCode = AppSettings.GetCodeStr(currentMaxCodeInt + 1, nameof(VisitTask)), + + DoctorUserId = task.DoctorUserId, + TaskAllocationState = TaskAllocationState.Allocated, + AllocateTime = DateTime.Now, + + }; await _visitTaskRepository.AddAsync(consistentTask); @@ -407,7 +413,7 @@ namespace IRaCIS.Core.Application.Service TaskState = TaskState.Effect, DoctorUserId = subjectUser==null ? null : subjectUser.Id, TaskAllocationState = subjectUser == null? TaskAllocationState.NotAllocate: TaskAllocationState.Allocated, - AllocateTime = DateTime.Now, + AllocateTime = subjectUser == null ?null: DateTime.Now, }; await _visitTaskRepository.AddAsync(visitTask); currentMaxCodeInt = currentMaxCodeInt + 1; diff --git a/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs b/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs index b3b13b2d0..ea4a29050 100644 --- a/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs +++ b/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs @@ -199,7 +199,7 @@ namespace IRaCIS.Core.Application.Service } - + @@ -950,7 +950,7 @@ namespace IRaCIS.Core.Application.Service OriginalReReadingTaskId = task.Id, RequestReReadingTime = DateTime.Now, RequestReReadingUserId = _userInfo.Id, - IsCopyOrigenalForms= applyReReadingCommand.IsCopyOrigenalForms, + IsCopyOrigenalForms = applyReReadingCommand.IsCopyOrigenalForms, RequestReReadingReason = applyReReadingCommand.RequestReReadingReason, RequestReReadingType = applyReReadingCommand.RequestReReadingType, @@ -979,14 +979,6 @@ namespace IRaCIS.Core.Application.Service foreach (var item in agreeReReadingCommand.ConfirmReReadingList) { - - //await _visitTaskRepository.UpdatePartialFromQueryAsync(t => t.Id == item.OriginalReReadingTaskId, u => new VisitTask() - //{ - // ReReadingApplyState = (agreeReReadingCommand.RequestReReadingResultEnum == RequestReReadingResult.Agree ? ReReadingApplyState.Agree : ReReadingApplyState.Reject), - // TaskState = (agreeReReadingCommand.RequestReReadingResultEnum == RequestReReadingResult.Agree ? TaskState.HaveReturned : TaskState.Effect) - - //}); - var origenalTask = (await _visitTaskRepository.Where(t => item.OriginalReReadingTaskId == t.Id, true).FirstOrDefaultAsync()).IfNullThrowException(); //更新原始任务 @@ -1064,6 +1056,22 @@ namespace IRaCIS.Core.Application.Service + /// + /// 重阅影响提示列表 + /// + /// + /// + [HttpGet("{taskId:guid}")] + public async Task> GetReReadingInfluenceTaskList(Guid taskId) + { + var filterObj = await _visitTaskRepository.FirstOrDefaultNoTrackingAsync(t => t.Id == taskId); + + var list = await _visitTaskRepository.Where(t => t.TrialId == filterObj.TrialId && t.SubjectId == filterObj.SubjectId && t.VisitTaskNum >= filterObj.VisitTaskNum) + .Where(t => t.TaskState == TaskState.Effect && ! t.IsAnalysisCreate) + .ProjectTo(_mapper.ConfigurationProvider).ToListAsync(); + + return list; + } } diff --git a/IRaCIS.Core.Application/Service/Allocation/_MapConfig.cs b/IRaCIS.Core.Application/Service/Allocation/_MapConfig.cs index 7594ad55b..bf4baabf2 100644 --- a/IRaCIS.Core.Application/Service/Allocation/_MapConfig.cs +++ b/IRaCIS.Core.Application/Service/Allocation/_MapConfig.cs @@ -220,6 +220,13 @@ namespace IRaCIS.Core.Application.Service CreateMap(); + + + CreateMap() + .ForMember(o => o.TrialSiteCode, t => t.MapFrom(u => u.Subject.TrialSite.TrialSiteCode)) + .ForMember(o => o.SubjectCode, t => t.MapFrom(u => u.Subject.Code)); + + } } diff --git a/IRaCIS.Core.Domain/Allocation/VisitTask.cs b/IRaCIS.Core.Domain/Allocation/VisitTask.cs index a01d73267..f6fda178d 100644 --- a/IRaCIS.Core.Domain/Allocation/VisitTask.cs +++ b/IRaCIS.Core.Domain/Allocation/VisitTask.cs @@ -27,8 +27,7 @@ namespace IRaCIS.Core.Domain.Models public Guid? SouceReadModuleId { get; set; } public ReadingCategory ReadingCategory { get; set; } - - + public Guid CreateUserId { get; set; } public DateTime CreateTime { get; set; } @@ -114,6 +113,11 @@ namespace IRaCIS.Core.Domain.Models //是否是一致性分析产生 public bool IsAnalysisCreate { get; set; } + public string BlindSubjectCode { get; set; } = string.Empty; + public string BlindTrialSiteCode { get; set; } = string.Empty; + + + //一致性分析规则Id 用于最后统计 public Guid? TaskConsistentRuleId { get; set; }