diff --git a/IRaCIS.Core.API/IRaCIS.Core.API.xml b/IRaCIS.Core.API/IRaCIS.Core.API.xml index 144782e94..010d63de3 100644 --- a/IRaCIS.Core.API/IRaCIS.Core.API.xml +++ b/IRaCIS.Core.API/IRaCIS.Core.API.xml @@ -222,6 +222,14 @@ + + + 上传裁判任务的图像 + + + + + 上传医学审核图片 diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml index 2afcd15b6..553bfbb92 100644 --- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml +++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml @@ -79,6 +79,20 @@ + + + 组间一致性分析 选择Subejct 列表 + + + + + + + 确认生成自身一致性分析任务 + + + + 自身一致性分配 配置+ 统计已经生成数量统计表 @@ -1513,6 +1527,11 @@ 项目Id + + + 医学审核对话关闭原因 + + 审核 质询状态 @@ -1658,6 +1677,16 @@ 是否关闭 + + + 医学审核对话关闭原因 + + + + + 对话关闭原因 + + 是否有问题 @@ -2696,6 +2725,17 @@ 文件保存路径 + + + 通用获取文件路径 + + + + + + + + TaskAllocationRuleView 列表视图模型 @@ -2736,6 +2776,11 @@ 审核建议 + + + 医学审核对话关闭原因 + + TaskMedicalReviewQuery 列表查询参数模型 diff --git a/IRaCIS.Core.Application/Service/Allocation/DTO/TaskConsistentRuleViewModel.cs b/IRaCIS.Core.Application/Service/Allocation/DTO/TaskConsistentRuleViewModel.cs index 43b604e9e..5c0580797 100644 --- a/IRaCIS.Core.Application/Service/Allocation/DTO/TaskConsistentRuleViewModel.cs +++ b/IRaCIS.Core.Application/Service/Allocation/DTO/TaskConsistentRuleViewModel.cs @@ -41,14 +41,11 @@ namespace IRaCIS.Core.Application.ViewModel [NotDefault] public Guid TaskConsistentRuleId { get; set; } - //public int PlanSubjectCount { get; set; } - //public int PlanVisitCount { get; set; } - //public int IntervalWeeks { get; set; } - //public Guid? CompareDoctorUserId { get; set; } - //public bool IsHaveReadingPeriod { get; set; } - //public bool IsGenerateGlobalTask { get; set; } - //public Guid? AnalysisDoctorUserId { get; set; } + } + public class GroupConsistentQuery : PageInput + { + public Guid TrialId { get; set; } } public class ConsistentConfirmGenerateCommand @@ -61,6 +58,13 @@ namespace IRaCIS.Core.Application.ViewModel } + public class GroupConsistentConfirmGenrateCommand + { + [NotDefault] + public Guid TrialId { get; set; } + public List SubejctIdList { get; set; } + } + public class DoctorSelfConsistentSubjectView { public Guid TrialId { get; set; } @@ -69,6 +73,8 @@ namespace IRaCIS.Core.Application.ViewModel public String TrialSiteCode { get; set; } public string SubjectCode { get; set; } + public string? BlindSubjectCode { get; set; } + public Guid SubjectId { get; set; } public bool IsHaveGeneratedTask { get; set; } diff --git a/IRaCIS.Core.Application/Service/Allocation/TaskConsistentRuleService.cs b/IRaCIS.Core.Application/Service/Allocation/TaskConsistentRuleService.cs index 5ec5a9f45..b01adceb4 100644 --- a/IRaCIS.Core.Application/Service/Allocation/TaskConsistentRuleService.cs +++ b/IRaCIS.Core.Application/Service/Allocation/TaskConsistentRuleService.cs @@ -81,31 +81,15 @@ namespace IRaCIS.Core.Application.Service { var filterObj = await _taskConsistentRuleRepository.FirstOrDefaultAsync(t => t.Id == inQuery.TaskConsistentRuleId); - var pagedList = await GetIQueryableDoctorSelfConsistentSubjectView(filterObj,inQuery.DoctorUserId).ToPagedListAsync(inQuery.PageIndex, inQuery.PageSize, string.IsNullOrWhiteSpace(inQuery.SortField) ? nameof(DoctorSelfConsistentSubjectView.SubjectCode) : inQuery.SortField, inQuery.Asc); - - - - - //var (group, query) = GetIQueryableDoctorSelfConsistentRuleSubjectView(filterObj); - - //var count = group.Count(); - - //query = query.OrderByDescending(t => t.IsHaveGeneratedTask).Skip((inQuery.PageIndex - 1) * inQuery.PageSize); - - //var items = await query.Take(inQuery.PageSize).ToArrayAsync().ConfigureAwait(false); - - //var pagedList = new PageOutput() - //{ - // PageIndex = inQuery.PageIndex, - // PageSize = inQuery.PageSize, - // TotalCount = count, - // CurrentPageData = items - //}; - + var pagedList = await GetIQueryableDoctorSelfConsistentSubjectView(filterObj, inQuery.DoctorUserId).ToPagedListAsync(inQuery.PageIndex, inQuery.PageSize, string.IsNullOrWhiteSpace(inQuery.SortField) ? nameof(DoctorSelfConsistentSubjectView.SubjectCode) : inQuery.SortField, inQuery.Asc); return pagedList; } + + + + /// /// 确认生成自身一致性分析任务 /// @@ -138,7 +122,10 @@ namespace IRaCIS.Core.Application.Service { var maxCodeStr = _visitTaskRepository.Where(t => t.TrialId == subject.TrialId).OrderByDescending(t => t.BlindSubjectCode).Select(t => t.BlindSubjectCode).FirstOrDefault(); - blindSubjectCode = (int.Parse(maxCodeStr) + 1).ToString($"D{filterObj.BlindSubjectNumberOfPlaces}"); + int maxCodeInt = 0; + int.TryParse(maxCodeStr,out maxCodeInt); + + blindSubjectCode = (maxCodeInt + 1).ToString($"D{filterObj.BlindSubjectNumberOfPlaces}"); } subject.VisitTaskList.Take(filterObj.PlanVisitCount).ForEach(t => @@ -175,7 +162,81 @@ namespace IRaCIS.Core.Application.Service } - private IQueryable GetIQueryableDoctorSelfConsistentSubjectView(TaskConsistentRule filterObj, Guid doctorUserId, List? subejctIdList = null) + + + /// + /// 组间一致性分析 选择Subejct 列表 + /// + /// + /// + [HttpPost] + public async Task> GetGroupConsistentRuleSubjectList(GroupConsistentQuery inQuery) + { + 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); + + return pagedList; + } + + + + /// + /// 确认生成自身一致性分析任务 + /// + /// + /// + [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 list = await GetIQueryableDoctorSelfConsistentSubjectView(filterObj, null, inCommand.SubejctIdList).ToListAsync(); + + + + foreach (var subject in list) + { + + + //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); + + await _visitTaskCommonService.AddTaskAsync(new GenerateTaskCommand() + { + TrialId = filterObj.TrialId, + + ReadingCategory = GenerateTaskCategory.SelfConsistent, + + + //产生的过滤掉已经生成的 + GenerataConsistentTaskList = subject.VisitTaskList.Where(t => t.IsHaveGeneratedTask == false).ToList() + }); + + } + + + return ResponseOutput.Ok(); + + + } + + + + private IQueryable GetIQueryableDoctorSelfConsistentSubjectView(TaskConsistentRule filterObj, Guid? doctorUserId=null, List? subejctIdList = null) { var trialId = filterObj.TrialId; @@ -187,9 +248,22 @@ namespace IRaCIS.Core.Application.Service (t.ReReadingApplyState == ReReadingApplyState.Default || t.ReReadingApplyState == ReReadingApplyState.Reject); + Expression> subjectIsHaveGeneratedTaskFilter = c => c.IsAnalysisCreate; + + //组间一致性 + if (doctorUserId == null) + { + subjectIsHaveGeneratedTaskFilter = subjectIsHaveGeneratedTaskFilter.And(c => c.IsSelfAnalysis == false); + } + //组内 + else + { + subjectIsHaveGeneratedTaskFilter = subjectIsHaveGeneratedTaskFilter.And(c => c.DoctorUserId == doctorUserId && c.IsSelfAnalysis == true); + } + if (subejctIdList != null && subejctIdList?.Count > 0) { - visitTaskFilter.And(t => subejctIdList.Contains(t.SubjectId)); + visitTaskFilter= visitTaskFilter.And(t => subejctIdList.Contains(t.SubjectId)); } //所选访视数量 的访视 其中必有一个访视后有全局任务 @@ -212,7 +286,9 @@ namespace IRaCIS.Core.Application.Service TrialSiteCode = t.TrialSite.TrialSiteCode, SubjectId = t.Id, - IsHaveGeneratedTask = t.SubjectVisitTaskList.Any(c => c.IsAnalysisCreate && c.DoctorUserId == doctorUserId), + BlindSubjectCode=t.SubjectVisitTaskList.Where(t=>t.IsAnalysisCreate).OrderByDescending(t=>t.BlindSubjectCode).Select(t=>t.BlindSubjectCode).FirstOrDefault(), + + IsHaveGeneratedTask = t.SubjectVisitTaskList.AsQueryable().Any(subjectIsHaveGeneratedTaskFilter), ValidVisitCount = t.SubjectVisitTaskList.AsQueryable().Where(visitTaskFilter).Count(), @@ -231,7 +307,8 @@ namespace IRaCIS.Core.Application.Service VisitTaskNum = c.VisitTaskNum, TrialId = c.TrialId, - IsHaveGeneratedTask = c.Subject.SubjectVisitTaskList.Any(t => t.ConsistentAnalysisOriginalTaskId == c.Id), + //自身一致性才有意义 + //IsHaveGeneratedTask = c.Subject.SubjectVisitTaskList.Any(t => t.ConsistentAnalysisOriginalTaskId == c.Id), GlobalVisitTaskList = c.Subject.SubjectVisitTaskList.Where(t => t.VisitTaskNum == c.VisitTaskNum + ReadingCommon.TaskNumDic[ReadingCategory.Global] && t.TaskState == TaskState.Effect && t.ReadingTaskState == ReadingTaskState.HaveSigned && t.SignTime!.Value.AddDays(filterObj.IntervalWeeks * 7) < DateTime.Now).Select(c => new VisitTaskSimpleDTO() { @@ -296,7 +373,7 @@ namespace IRaCIS.Core.Application.Service IsHaveReadingPeriod = taskConsistentRule.IsHaveReadingPeriod, PlanVisitCount = taskConsistentRule.PlanVisitCount, - GeneratedSubjectCount = taskConsistentRule.Trial.VisitTaskList.Where(t => t.IsAnalysisCreate && t.IsSelfAnalysis == true).Select(t => t.SubjectId).Distinct().Count(), + GeneratedSubjectCount = taskConsistentRule.Trial.VisitTaskList.Where(t => t.IsAnalysisCreate && t.IsSelfAnalysis == true && t.DoctorUserId==user.Id).Select(t => t.SubjectId).Distinct().Count(), AnalysisDoctorUser = new UserSimpleInfo() { @@ -309,19 +386,19 @@ namespace IRaCIS.Core.Application.Service - //if (await _taskConsistentRuleRepository.AnyAsync(t => t.TrialId == inQuery.TrialId)) - //{ - // var rule = await _taskConsistentRuleRepository.Where(t => t.TrialId == inQuery.TrialId).ProjectTo(_mapper.ConfigurationProvider).FirstAsync(); + //if (await _taskConsistentRuleRepository.AnyAsync(t => t.TrialId == inQuery.TrialId)) + //{ + // var rule = await _taskConsistentRuleRepository.Where(t => t.TrialId == inQuery.TrialId).ProjectTo(_mapper.ConfigurationProvider).FirstAsync(); - // rule.IsBatchAdd = true; + // rule.IsBatchAdd = true; - // await BatchAddOrUpdateTaskConsistentRule(rule); - //} + // await BatchAddOrUpdateTaskConsistentRule(rule); + //} - //#endregion + //#endregion - //var taskConsistentRuleQueryable = _taskConsistentRuleRepository.Where(t => t.TrialId == inQuery.TrialId) - // .ProjectTo(_mapper.ConfigurationProvider); + //var taskConsistentRuleQueryable = _taskConsistentRuleRepository.Where(t => t.TrialId == inQuery.TrialId) + // .ProjectTo(_mapper.ConfigurationProvider); return await taskConsistentRuleQueryable.ToListAsync(); } @@ -397,7 +474,7 @@ namespace IRaCIS.Core.Application.Service var verifyExp1 = new EntityVerifyExp() { - VerifyExp = t => t.TrialId == addOrEditTaskConsistentRule.TrialId && t.IsSelfAnalysis == addOrEditTaskConsistentRule.IsSelfAnalysis, + VerifyExp = t => t.TrialId == addOrEditTaskConsistentRule.TrialId && t.IsSelfAnalysis == addOrEditTaskConsistentRule.IsSelfAnalysis, VerifyMsg = "已有该项目配置,不允许继续增加" }; @@ -414,7 +491,7 @@ namespace IRaCIS.Core.Application.Service var config = await _taskConsistentRuleRepository.FirstOrDefaultAsync(t => t.Id == taskConsistentRuleId); - if (await _visitTaskRepository.AnyAsync(t => t.IsAnalysisCreate && t.TrialId == config.TrialId && t.IsSelfAnalysis == config.IsSelfAnalysis)) + if (await _visitTaskRepository.AnyAsync(t => t.IsAnalysisCreate && t.TrialId == config.TrialId && t.IsSelfAnalysis == config.IsSelfAnalysis)) { throw new BusinessValidationFailedException("已产生一致性分析任务,不允许删除"); }