diff --git a/IRaCIS.Core.Application/Service/Allocation/DTO/TaskAllocationRuleViewModel.cs b/IRaCIS.Core.Application/Service/Allocation/DTO/TaskAllocationRuleViewModel.cs index 1cd63736f..8f529dd33 100644 --- a/IRaCIS.Core.Application/Service/Allocation/DTO/TaskAllocationRuleViewModel.cs +++ b/IRaCIS.Core.Application/Service/Allocation/DTO/TaskAllocationRuleViewModel.cs @@ -34,12 +34,16 @@ namespace IRaCIS.Core.Application.ViewModel //该医生未应用的任务数 public int? WaitApplySelfTaskCount { get; set; } + public int? WaitApplySelfSubjectCount { get; set; } + //该医生已应用的任务数 public int? SelfTaskCount { get; set; } //已经分配该医生Subject数量 public int? SelfSubjectCount { get; set; } + public int? SelfApplyedSubjectCount { get; set; } + //已应用 的Subject 数 public int? ApplyedTotalSubjectCount { get; set; } diff --git a/IRaCIS.Core.Application/Service/Allocation/VisitTaskHelpeService.cs b/IRaCIS.Core.Application/Service/Allocation/VisitTaskHelpeService.cs index cdcdd2a51..fe195be10 100644 --- a/IRaCIS.Core.Application/Service/Allocation/VisitTaskHelpeService.cs +++ b/IRaCIS.Core.Application/Service/Allocation/VisitTaskHelpeService.cs @@ -80,6 +80,7 @@ namespace IRaCIS.Core.Application.Service CheckPassedTime = subjectVisit.CheckPassedTime, ArmEnum = 1,//特殊 Code = currentMaxCodeInt + 1, + SourceSubjectVisitId=subjectVisit.Id, TaskCode = AppSettings.GetCodeStr(currentMaxCodeInt + 1, nameof(VisitTask)), ReadingCategory = ReadingCategory.Visit }); @@ -94,6 +95,7 @@ namespace IRaCIS.Core.Application.Service CheckPassedTime = subjectVisit.CheckPassedTime, ArmEnum = 2,//特殊 Code = currentMaxCodeInt + 2, + SourceSubjectVisitId = subjectVisit.Id, TaskCode = AppSettings.GetCodeStr(currentMaxCodeInt + 2, nameof(VisitTask)), ReadingCategory = ReadingCategory.Visit }); @@ -203,6 +205,7 @@ namespace IRaCIS.Core.Application.Service CheckPassedTime = subjectVisit.CheckPassedTime, ArmEnum = 0, //特殊 Code = currentMaxCodeInt + 1, + SourceSubjectVisitId = subjectVisit.Id, TaskCode = AppSettings.GetCodeStr(currentMaxCodeInt + 1, nameof(VisitTask)), ReadingCategory = ReadingCategory.Visit }); diff --git a/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs b/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs index d555394f6..ae3b70d3c 100644 --- a/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs +++ b/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs @@ -122,7 +122,6 @@ namespace IRaCIS.Core.Application.Service - /// /// 获取影像阅片列表 (排除重阅的) 相比而言多了几个字段 和配置信息 /// diff --git a/IRaCIS.Core.Application/Service/Allocation/_MapConfig.cs b/IRaCIS.Core.Application/Service/Allocation/_MapConfig.cs index a560bf991..def204af4 100644 --- a/IRaCIS.Core.Application/Service/Allocation/_MapConfig.cs +++ b/IRaCIS.Core.Application/Service/Allocation/_MapConfig.cs @@ -22,17 +22,24 @@ namespace IRaCIS.Core.Application.Service //.ForMember(o => o.ArmList, t => t.MapFrom(u => u.DoctorVisitTaskList.Where(c => c.TrialId == u.TrialId).Select(t => t.ArmEnum).Distinct())) .ForMember(o => o.TotalTaskCount, t => t.MapFrom(u => u.Trial.VisitTaskList.Count())) .ForMember(o => o.ApplyedTotalTaskCount, t => t.MapFrom(u => u.Trial.VisitTaskList.Count(t => t.DoctorUserId != null))) - .ForMember(o => o.WaitApplySelfTaskCount, t => t.MapFrom(u => subjectIdList.Count==0? u.Trial.SubjectDoctorUserList.Where(d => d.DoctorUserId == u.DoctorUserId) - .SelectMany(t => t.SubjectArmVisitTaskList.Where(t => t.DoctorUserId == null)).Count(): - u.Trial.SubjectDoctorUserList.Where(d => d.DoctorUserId == u.DoctorUserId && subjectIdList.Contains(d.SubjectId)) - .SelectMany(t => t.SubjectArmVisitTaskList.Where(t => t.DoctorUserId == null)).Count() + .ForMember(o => o.WaitApplySelfTaskCount, t => t.MapFrom(u => + subjectIdList.Count==0? u.Trial.SubjectDoctorUserList.Where(d => d.DoctorUserId == u.DoctorUserId).SelectMany(t => t.SubjectArmVisitTaskList.Where(t => t.DoctorUserId == null)).Count() + : u.Trial.SubjectDoctorUserList.Where(d => d.DoctorUserId == u.DoctorUserId && subjectIdList.Contains(d.SubjectId)).SelectMany(t => t.SubjectArmVisitTaskList.Where(t => t.DoctorUserId == null)).Count() )) .ForMember(o => o.SelfUndoTaskCount, t => t.MapFrom(u => u.Trial.VisitTaskList.Count(t => t.DoctorUserId == u.DoctorUserId && t.ReadingTaskState != ReadingTaskState.HaveSigned))) .ForMember(o => o.SelfTaskCount, t => t.MapFrom(u => u.Trial.VisitTaskList.Count(t => t.DoctorUserId == u.DoctorUserId))) .ForMember(o => o.TotalSubjectCount, t => t.MapFrom(u => u.Trial.SubjectList.Count())) .ForMember(o => o.ApplyedTotalSubjectCount, t => t.MapFrom(u => u.Trial.SubjectList.Count(c => c.SubjectVisitTaskList.Any(d => d.DoctorUserId !=null)))) - .ForMember(o => o.SelfSubjectCount, t => t.MapFrom(u => u.Trial.SubjectDoctorUserList.Where(t => t.DoctorUserId == u.DoctorUserId).Count())); + .ForMember(o => o.SelfSubjectCount, t => t.MapFrom(u => u.Trial.SubjectDoctorUserList.Where(t => t.DoctorUserId == u.DoctorUserId).Count())) + .ForMember(o => o.SelfApplyedSubjectCount, t => t.MapFrom(u => u.Trial.SubjectDoctorUserList.Where(t => t.DoctorUserId == u.DoctorUserId && t.SubjectArmVisitTaskList.Any()).Count())) + .ForMember(o => o.WaitApplySelfSubjectCount, t => t.MapFrom(u => + subjectIdList.Count == 0 ? u.Trial.SubjectDoctorUserList.Where(t => t.DoctorUserId == u.DoctorUserId && t.SubjectArmVisitTaskList.Any(c=>c.DoctorUserId ==null)).Count() + : u.Trial.SubjectDoctorUserList.Where(t => t.DoctorUserId == u.DoctorUserId && subjectIdList.Contains(t.SubjectId) && t.SubjectArmVisitTaskList.Any(c => c.DoctorUserId == null)).Count() + + )) + + ; diff --git a/IRaCIS.Core.Application/Service/TrialSiteUser/DTO/TrialConfigDTO.cs b/IRaCIS.Core.Application/Service/TrialSiteUser/DTO/TrialConfigDTO.cs index 17c7c4628..a085d8406 100644 --- a/IRaCIS.Core.Application/Service/TrialSiteUser/DTO/TrialConfigDTO.cs +++ b/IRaCIS.Core.Application/Service/TrialSiteUser/DTO/TrialConfigDTO.cs @@ -144,6 +144,10 @@ namespace IRaCIS.Core.Application.Contracts public TaskAllocateDefaultState FollowGlobalVisitAutoAssignDefaultState { get; set; } + public ReadingTaskViewMethod ReadingTaskViewEnum { get; set; } + + public bool IsReadingTaskViewInOrder { get; set; } = true; + } public class TrialReadingTaskViewConfig diff --git a/IRaCIS.Core.Application/Service/TrialSiteUser/TrialConfigService.cs b/IRaCIS.Core.Application/Service/TrialSiteUser/TrialConfigService.cs index e6d5cd95f..6a6b76126 100644 --- a/IRaCIS.Core.Application/Service/TrialSiteUser/TrialConfigService.cs +++ b/IRaCIS.Core.Application/Service/TrialSiteUser/TrialConfigService.cs @@ -20,14 +20,18 @@ namespace IRaCIS.Core.Application private readonly IRepository _clinicalDataTrialSetRepository; private readonly IEasyCachingProvider _provider; + private readonly IRepository _taskAllocationRuleRepository; + public TrialConfigService(IRepository trialRepository, IRepository trialQCQuestionRepository, IRepository readingQuestionCriterionTrialRepository, IRepository clinicalDataTrialSetRepository, + IRepository taskAllocationRuleRepository, IEasyCachingProvider provider ) { _trialRepository = trialRepository; + _taskAllocationRuleRepository = taskAllocationRuleRepository; this._trialQCQuestionRepository = trialQCQuestionRepository; this._readingQuestionCriterionTrialRepository = readingQuestionCriterionTrialRepository; this._clinicalDataTrialSetRepository = clinicalDataTrialSetRepository; @@ -170,7 +174,7 @@ namespace IRaCIS.Core.Application { await _clinicalDataTrialSetRepository.UpdatePartialFromQueryAsync(item, x => new ClinicalDataTrialSet() { - + IsConfirm = true }); } @@ -179,7 +183,7 @@ namespace IRaCIS.Core.Application { await _clinicalDataTrialSetRepository.UpdatePartialFromQueryAsync(item, x => new ClinicalDataTrialSet() { - + IsConfirm = false }); } @@ -223,7 +227,7 @@ namespace IRaCIS.Core.Application } } - if((trialStatusStr == StaticData.TrialState.TrialStopped|| trialStatusStr == StaticData.TrialState.TrialCompleted)&& trial.TrialStatusStr!= StaticData.TrialState.TrialOngoing) + if ((trialStatusStr == StaticData.TrialState.TrialStopped || trialStatusStr == StaticData.TrialState.TrialCompleted) && trial.TrialStatusStr != StaticData.TrialState.TrialOngoing) { return ResponseOutput.NotOk("项目没有进入启动状态,不能设置为停止或完成状态"); } @@ -402,6 +406,11 @@ namespace IRaCIS.Core.Application _mapper.Map(trialConfig, trialInfo); + if (_taskAllocationRuleRepository.Where(t => t.TrialId == trialConfig.TrialId && t.IsEnable).Sum(t => t.PlanReadingRatio) != 100) + { + return ResponseOutput.NotOk("已启用医生的记录比率不为百分之100"); + } + return ResponseOutput.Ok(await _trialRepository.SaveChangesAsync()); }