diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml index c476667bc..fd1c57686 100644 --- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml +++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml @@ -127,7 +127,7 @@ 一致性分析列表 (自身 组内 最后勾选 产生的任务) - + @@ -286,6 +286,11 @@ 访视读片任务 + + + 访视读片任务 + + 设置任务加急 @@ -367,7 +372,7 @@ 访视任务 - + @@ -375,14 +380,14 @@ 裁判任务 - + PM阅片跟踪 - + @@ -396,7 +401,7 @@ 获取IR 重阅影像阅片列表 - + @@ -416,7 +421,7 @@ IR 已阅片任务 - + @@ -871,7 +876,7 @@ 获取系统 邮件配置 勾选列表 - + @@ -3847,7 +3852,7 @@ 获取CRC受试者临床数据 - + @@ -9846,7 +9851,7 @@ 任务列表 第一层级 - + @@ -12296,7 +12301,7 @@ 模板列表 - + @@ -12322,7 +12327,7 @@ 管理端列表 - + @@ -12340,7 +12345,7 @@ Setting 界面的 项目所有文档列表 - + @@ -12354,7 +12359,7 @@ 具体用户看到的 系统文件列表 + 项目类型文档 - + @@ -12419,7 +12424,7 @@ 从 文档的维度 先看到文档列表(系统文档+项目文档 以及需要确认的人数 和已经确认人数) 点击数字查看某文档下面人确认情况 - + @@ -12554,7 +12559,7 @@ QC 质疑列表 分页 - + @@ -12590,7 +12595,7 @@ 转发列表 查询一致性核查通过的,针对不一致性核查的 要维护CV状态 - + @@ -12876,14 +12881,14 @@ 中心调研 每个项目 需要处理的审批统计 - + 待签署的项目文件 需要签署文件数量 系统级别的在第一行 - + @@ -13383,7 +13388,7 @@ New 查询条件 - + @@ -13977,7 +13982,7 @@ 获取用户列表 - + @@ -14214,7 +14219,7 @@ 获取单个阅片临床数据的所有文件 - + @@ -15124,7 +15129,7 @@ Setting页面 获取项目参与人员列表 - + @@ -15147,7 +15152,7 @@ 分页获取临床项目列表 默认后台加急状态为3 查所有的 - + diff --git a/IRaCIS.Core.Application/Service/Allocation/TaskConsistentRuleService.cs b/IRaCIS.Core.Application/Service/Allocation/TaskConsistentRuleService.cs index c914ee5be..0d342b128 100644 --- a/IRaCIS.Core.Application/Service/Allocation/TaskConsistentRuleService.cs +++ b/IRaCIS.Core.Application/Service/Allocation/TaskConsistentRuleService.cs @@ -96,38 +96,38 @@ namespace IRaCIS.Core.Application.Service /// /// 一致性分析列表 (自身 组内 最后勾选 产生的任务) /// - /// + /// /// [HttpPost] - public async Task>> GetAnalysisTaskList(VisitTaskQuery queryVisitTask) + public async Task>> GetAnalysisTaskList(VisitTaskQuery inQuery) { - var visitTaskQueryable = _visitTaskRepository.Where(t => t.TrialId == queryVisitTask.TrialId) + var visitTaskQueryable = _visitTaskRepository.Where(t => t.TrialId == inQuery.TrialId) .Where(t => t.IsAnalysisCreate) - .WhereIf(queryVisitTask.TrialReadingCriterionId != null, t => t.TrialReadingCriterionId == queryVisitTask.TrialReadingCriterionId) + .WhereIf(inQuery.TrialReadingCriterionId != null, t => t.TrialReadingCriterionId == inQuery.TrialReadingCriterionId) - .WhereIf(queryVisitTask.TrialSiteId != null, t => t.Subject.TrialSiteId == queryVisitTask.TrialSiteId) - .WhereIf(queryVisitTask.SubjectId != null, t => t.SubjectId == queryVisitTask.SubjectId) - .WhereIf(queryVisitTask.TaskState != null, t => t.TaskState == queryVisitTask.TaskState) - .WhereIf(queryVisitTask.IsUrgent != null, t => t.IsUrgent == queryVisitTask.IsUrgent) - .WhereIf(queryVisitTask.DoctorUserId != null, t => t.DoctorUserId == queryVisitTask.DoctorUserId) - .WhereIf(queryVisitTask.ReadingCategory != null, t => t.ReadingCategory == queryVisitTask.ReadingCategory) - .WhereIf(queryVisitTask.ReadingTaskState != null, t => t.ReadingTaskState == queryVisitTask.ReadingTaskState) - .WhereIf(queryVisitTask.TaskAllocationState != null, t => t.TaskAllocationState == queryVisitTask.TaskAllocationState) - .WhereIf(queryVisitTask.IsSelfAnalysis != null, t => t.IsSelfAnalysis == queryVisitTask.IsSelfAnalysis) - .WhereIf(queryVisitTask.ArmEnum != null, t => t.ArmEnum == queryVisitTask.ArmEnum) - .WhereIf(!string.IsNullOrEmpty(queryVisitTask.TrialSiteCode), t => /*(t.BlindTrialSiteCode.Contains(queryVisitTask.TrialSiteCode!) && t.IsAnalysisCreate) ||*/ (t.Subject.TrialSite.TrialSiteCode.Contains(queryVisitTask.TrialSiteCode!) /*&& t.IsAnalysisCreate == false*/)) - .WhereIf(!string.IsNullOrEmpty(queryVisitTask.TaskName), t => t.TaskName.Contains(queryVisitTask.TaskName) || t.TaskBlindName.Contains(queryVisitTask.TaskName)) - .WhereIf(!string.IsNullOrEmpty(queryVisitTask.SubjectCode), t => ((t.Subject.Code.Contains(queryVisitTask.SubjectCode) || t.Subject.MedicalNo.Contains(queryVisitTask.SubjectCode)) && t.IsAnalysisCreate == false) || (t.BlindSubjectCode.Contains(queryVisitTask.SubjectCode) && t.IsAnalysisCreate)) - .WhereIf(queryVisitTask.BeginAllocateDate != null, t => t.AllocateTime >= queryVisitTask.BeginAllocateDate) - .WhereIf(queryVisitTask.EndAllocateDate != null, t => t.AllocateTime <= queryVisitTask.EndAllocateDate) - .WhereIf(queryVisitTask.BeginSignTime != null, t => t.SignTime >= queryVisitTask.BeginSignTime) - .WhereIf(queryVisitTask.EndSignTime != null, t => t.SignTime <= queryVisitTask.EndSignTime) + .WhereIf(inQuery.TrialSiteId != null, t => t.Subject.TrialSiteId == inQuery.TrialSiteId) + .WhereIf(inQuery.SubjectId != null, t => t.SubjectId == inQuery.SubjectId) + .WhereIf(inQuery.TaskState != null, t => t.TaskState == inQuery.TaskState) + .WhereIf(inQuery.IsUrgent != null, t => t.IsUrgent == inQuery.IsUrgent) + .WhereIf(inQuery.DoctorUserId != null, t => t.DoctorUserId == inQuery.DoctorUserId) + .WhereIf(inQuery.ReadingCategory != null, t => t.ReadingCategory == inQuery.ReadingCategory) + .WhereIf(inQuery.ReadingTaskState != null, t => t.ReadingTaskState == inQuery.ReadingTaskState) + .WhereIf(inQuery.TaskAllocationState != null, t => t.TaskAllocationState == inQuery.TaskAllocationState) + .WhereIf(inQuery.IsSelfAnalysis != null, t => t.IsSelfAnalysis == inQuery.IsSelfAnalysis) + .WhereIf(inQuery.ArmEnum != null, t => t.ArmEnum == inQuery.ArmEnum) + .WhereIf(!string.IsNullOrEmpty(inQuery.TrialSiteCode), t => /*(t.BlindTrialSiteCode.Contains(queryVisitTask.TrialSiteCode!) && t.IsAnalysisCreate) ||*/ (t.Subject.TrialSite.TrialSiteCode.Contains(inQuery.TrialSiteCode!) /*&& t.IsAnalysisCreate == false*/)) + .WhereIf(!string.IsNullOrEmpty(inQuery.TaskName), t => t.TaskName.Contains(inQuery.TaskName) || t.TaskBlindName.Contains(inQuery.TaskName)) + .WhereIf(!string.IsNullOrEmpty(inQuery.SubjectCode), t => ((t.Subject.Code.Contains(inQuery.SubjectCode) || t.Subject.MedicalNo.Contains(inQuery.SubjectCode)) && t.IsAnalysisCreate == false) || (t.BlindSubjectCode.Contains(inQuery.SubjectCode) && t.IsAnalysisCreate)) + .WhereIf(inQuery.BeginAllocateDate != null, t => t.AllocateTime >= inQuery.BeginAllocateDate) + .WhereIf(inQuery.EndAllocateDate != null, t => t.AllocateTime <= inQuery.EndAllocateDate) + .WhereIf(inQuery.BeginSignTime != null, t => t.SignTime >= inQuery.BeginSignTime) + .WhereIf(inQuery.EndSignTime != null, t => t.SignTime <= inQuery.EndSignTime) .ProjectTo(_mapper.ConfigurationProvider); var defalutSortArray = new string[] { nameof(VisitTask.IsUrgent) + " desc", nameof(VisitTask.SubjectId), nameof(VisitTask.VisitTaskNum) }; - var pageList = await visitTaskQueryable.ToPagedListAsync(queryVisitTask.PageIndex, queryVisitTask.PageSize, queryVisitTask.SortField, queryVisitTask.Asc, string.IsNullOrWhiteSpace(queryVisitTask.SortField), defalutSortArray); + var pageList = await visitTaskQueryable.ToPagedListAsync(inQuery, defalutSortArray); #region 统计一致性分析临床数据数量 foreach (var item in pageList.CurrentPageData) @@ -143,7 +143,7 @@ namespace IRaCIS.Core.Application.Service } #endregion - var trialTaskConfig = _repository.Where(t => t.Id == queryVisitTask.TrialId).Select(t => new { IsHaveDoubleReadCriterion = t.TrialReadingCriterionList.Any(t => t.IsSigned && t.IsConfirm && t.ReadingType == ReadingMethod.Double), t.VitrualSiteCode }).FirstOrDefault(); + var trialTaskConfig = _repository.Where(t => t.Id == inQuery.TrialId).Select(t => new { IsHaveDoubleReadCriterion = t.TrialReadingCriterionList.Any(t => t.IsSigned && t.IsConfirm && t.ReadingType == ReadingMethod.Double), t.VitrualSiteCode }).FirstOrDefault(); return ResponseOutput.Ok(pageList, trialTaskConfig); } @@ -159,7 +159,7 @@ 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 pagedList = await GetIQueryableDoctorSelfConsistentSubjectView(filterObj, inQuery.DoctorUserId).ToPagedListAsync(inQuery); return pagedList; } @@ -347,7 +347,7 @@ namespace IRaCIS.Core.Application.Service var query = await GetGroupConsistentQueryAsync(filterObj); - var pagedList = await query.ToPagedListAsync(inQuery.PageIndex, inQuery.PageSize, string.IsNullOrWhiteSpace(inQuery.SortField) ? nameof(DoctorSelfConsistentSubjectView.SubjectCode) : inQuery.SortField, inQuery.Asc); + var pagedList = await query.ToPagedListAsync(inQuery, nameof(DoctorSelfConsistentSubjectView.SubjectCode)); var rule = await _taskConsistentRuleRepository.Where(t => t.TrialId == inQuery.TrialId && t.IsSelfAnalysis == false && t.TrialReadingCriterionId == inQuery.TrialReadingCriterionId).ProjectTo(_mapper.ConfigurationProvider).FirstOrDefaultAsync(); diff --git a/IRaCIS.Core.Application/Service/Allocation/TaskMedicalReviewService.cs b/IRaCIS.Core.Application/Service/Allocation/TaskMedicalReviewService.cs index b8e31ed21..a09852be4 100644 --- a/IRaCIS.Core.Application/Service/Allocation/TaskMedicalReviewService.cs +++ b/IRaCIS.Core.Application/Service/Allocation/TaskMedicalReviewService.cs @@ -84,7 +84,7 @@ namespace IRaCIS.Core.Application.Service .ProjectTo(_mapper.ConfigurationProvider); var defalutSortArray = new string[] { nameof(TaskMedicalReviewView.AuditState), nameof(TaskMedicalReviewView.SubjectId), nameof(TaskMedicalReviewView.ArmEnum) , nameof(TaskMedicalReviewView.VisitTaskNum) }; - var pageList = await taskMedicalReviewQueryable.ToPagedListAsync(inQuery.PageIndex, inQuery.PageSize, inQuery.SortField, inQuery.Asc, string.IsNullOrWhiteSpace(inQuery.SortField), defalutSortArray); + var pageList = await taskMedicalReviewQueryable.ToPagedListAsync(inQuery, defalutSortArray); return pageList; } @@ -120,7 +120,7 @@ namespace IRaCIS.Core.Application.Service .ProjectTo(_mapper.ConfigurationProvider); var defalutSortArray = new string[] { nameof(GenerateMedicalReviewTaskView.IsUrgent) + " desc", nameof(GenerateMedicalReviewTaskView.SubjectId) }; - var pageList = await visitTaskQueryable.ToPagedListAsync(inQuery.PageIndex, inQuery.PageSize, inQuery.SortField, inQuery.Asc, string.IsNullOrWhiteSpace(inQuery.SortField), defalutSortArray); + var pageList = await visitTaskQueryable.ToPagedListAsync(inQuery, defalutSortArray); return pageList; @@ -257,7 +257,7 @@ namespace IRaCIS.Core.Application.Service var defalutSortArray = new string[] { nameof(TaskMedicalReviewView.SubjectId), nameof(TaskMedicalReviewView.ArmEnum), nameof(TaskMedicalReviewView.VisitTaskNum) }; - var pageList = await taskMedicalReviewQueryable.ToPagedListAsync(inQuery.PageIndex, inQuery.PageSize, inQuery.SortField, inQuery.Asc, string.IsNullOrWhiteSpace(inQuery.SortField), defalutSortArray); + var pageList = await taskMedicalReviewQueryable.ToPagedListAsync(inQuery, defalutSortArray); return ResponseOutput.Ok(pageList, new { diff --git a/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs b/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs index ec1eff7b6..2e003506e 100644 --- a/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs +++ b/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs @@ -112,35 +112,35 @@ namespace IRaCIS.Core.Application.Service.Allocation /// /// [HttpPost] - public async Task>> GetSubjectAssignAndTaskStatList(SubjectAssignStatQuery querySubjectAssign) + public async Task>> GetSubjectAssignAndTaskStatList(SubjectAssignStatQuery inQuery) { - var isAddtinoarlCriterion = await _trialReadingCriterionRepository.AnyAsync(t => t.Id == querySubjectAssign.TrialReadingCriterionId && t.IsAutoCreate == false); + var isAddtinoarlCriterion = await _trialReadingCriterionRepository.AnyAsync(t => t.Id == inQuery.TrialReadingCriterionId && t.IsAutoCreate == false); - var subjectQuery = _subjectRepository.Where(t => t.TrialId == querySubjectAssign.TrialId && t.SubjectVisitTaskList.Any()) - .WhereIf(querySubjectAssign.TrialSiteId != null, t => t.TrialSiteId == querySubjectAssign.TrialSiteId) - .WhereIf(querySubjectAssign.SubjectId != null, t => t.Id == querySubjectAssign.SubjectId) - .WhereIf(querySubjectAssign.DoctorUserId != null, t => t.SubjectDoctorList.Any(t => t.DoctorUserId == querySubjectAssign.DoctorUserId && t.TrialReadingCriterionId == querySubjectAssign.TrialReadingCriterionId)) - .WhereIf(!string.IsNullOrEmpty(querySubjectAssign.SubjectCode), t => t.Code.Contains(querySubjectAssign.SubjectCode)) + var subjectQuery = _subjectRepository.Where(t => t.TrialId == inQuery.TrialId && t.SubjectVisitTaskList.Any()) + .WhereIf(inQuery.TrialSiteId != null, t => t.TrialSiteId == inQuery.TrialSiteId) + .WhereIf(inQuery.SubjectId != null, t => t.Id == inQuery.SubjectId) + .WhereIf(inQuery.DoctorUserId != null, t => t.SubjectDoctorList.Any(t => t.DoctorUserId == inQuery.DoctorUserId && t.TrialReadingCriterionId == inQuery.TrialReadingCriterionId)) + .WhereIf(!string.IsNullOrEmpty(inQuery.SubjectCode), t => t.Code.Contains(inQuery.SubjectCode)) //未分配 - .WhereIf(querySubjectAssign.SubjectAllocateState == 0, t => !t.SubjectDoctorList.Any(t => t.AssignTime != null && t.TrialReadingCriterionId == querySubjectAssign.TrialReadingCriterionId)) + .WhereIf(inQuery.SubjectAllocateState == 0, t => !t.SubjectDoctorList.Any(t => t.AssignTime != null && t.TrialReadingCriterionId == inQuery.TrialReadingCriterionId)) //已分配 - .WhereIf(querySubjectAssign.SubjectAllocateState == 1, t => t.SubjectDoctorList.Any(t => t.AssignTime != null && t.TrialReadingCriterionId == querySubjectAssign.TrialReadingCriterionId)) + .WhereIf(inQuery.SubjectAllocateState == 1, t => t.SubjectDoctorList.Any(t => t.AssignTime != null && t.TrialReadingCriterionId == inQuery.TrialReadingCriterionId)) - .WhereIf(querySubjectAssign.ArmList.Count > 0, t => !querySubjectAssign.ArmList.Except(t.SubjectDoctorList.Where(t => t.AssignTime != null && t.TrialReadingCriterionId == querySubjectAssign.TrialReadingCriterionId).Select(c => c.ArmEnum)).Any()) + .WhereIf(inQuery.ArmList.Count > 0, t => !inQuery.ArmList.Except(t.SubjectDoctorList.Where(t => t.AssignTime != null && t.TrialReadingCriterionId == inQuery.TrialReadingCriterionId).Select(c => c.ArmEnum)).Any()) - .WhereIf(isAddtinoarlCriterion, t => t.SubjectCriteriaEvaluationList.Where(t => t.TrialReadingCriterionId == querySubjectAssign.TrialReadingCriterionId).Any(t => t.IsJoinEvaluation)) + .WhereIf(isAddtinoarlCriterion, t => t.SubjectCriteriaEvaluationList.Where(t => t.TrialReadingCriterionId == inQuery.TrialReadingCriterionId).Any(t => t.IsJoinEvaluation)) - .ProjectTo(_mapper.ConfigurationProvider, new { trialReadingCriterionId = querySubjectAssign.TrialReadingCriterionId }); + .ProjectTo(_mapper.ConfigurationProvider, new { trialReadingCriterionId = inQuery.TrialReadingCriterionId }); - var pageList = await subjectQuery.ToPagedListAsync(querySubjectAssign.PageIndex, querySubjectAssign.PageSize, string.IsNullOrWhiteSpace(querySubjectAssign.SortField) ? nameof(querySubjectAssign.SubjectId) : querySubjectAssign.SortField, querySubjectAssign.Asc); + var pageList = await subjectQuery.ToPagedListAsync(inQuery); - var criterionConfig = (await _trialReadingCriterionRepository.Where(x => x.Id == querySubjectAssign.TrialReadingCriterionId).Select(x => new { x.ReadingTool, x.IsReadingTaskViewInOrder, x.ReadingType, x.IsArbitrationReading, x.IsOncologyReading, x.IsGlobalReading }).FirstOrDefaultAsync()).IfNullThrowException(); + var criterionConfig = (await _trialReadingCriterionRepository.Where(x => x.Id == inQuery.TrialReadingCriterionId).Select(x => new { x.ReadingTool, x.IsReadingTaskViewInOrder, x.ReadingType, x.IsArbitrationReading, x.IsOncologyReading, x.IsGlobalReading }).FirstOrDefaultAsync()).IfNullThrowException(); return ResponseOutput.Ok(pageList, criterionConfig); } @@ -385,32 +385,32 @@ namespace IRaCIS.Core.Application.Service.Allocation /// /// [HttpPost] - public async Task> GetSubjectAssignList(SubjectAssignQuery querySubjectAssign) + public async Task> GetSubjectAssignList(SubjectAssignQuery inQuery) { - var subjectQuery = _subjectRepository.Where(t => t.TrialId == querySubjectAssign.TrialId) - .WhereIf(querySubjectAssign.IsJudgeDoctor == false, t => t.SubjectVisitTaskList.Where(t => t.ArmEnum != Arm.JudgeArm).Any()) - .WhereIf(querySubjectAssign.IsJudgeDoctor, t => t.SubjectVisitTaskList.Where(t => t.ArmEnum == Arm.JudgeArm).Any()) + var subjectQuery = _subjectRepository.Where(t => t.TrialId == inQuery.TrialId) + .WhereIf(inQuery.IsJudgeDoctor == false, t => t.SubjectVisitTaskList.Where(t => t.ArmEnum != Arm.JudgeArm).Any()) + .WhereIf(inQuery.IsJudgeDoctor, t => t.SubjectVisitTaskList.Where(t => t.ArmEnum == Arm.JudgeArm).Any()) - .WhereIf(querySubjectAssign.TrialSiteId != null, t => t.TrialSiteId == querySubjectAssign.TrialSiteId) - .WhereIf(querySubjectAssign.SubjectId != null, t => t.Id == querySubjectAssign.SubjectId) + .WhereIf(inQuery.TrialSiteId != null, t => t.TrialSiteId == inQuery.TrialSiteId) + .WhereIf(inQuery.SubjectId != null, t => t.Id == inQuery.SubjectId) - .WhereIf(querySubjectAssign.IsHaveAssigned != null && querySubjectAssign.IsHaveAssigned == true && querySubjectAssign.IsJudgeDoctor == false, t => t.SubjectDoctorList.Where(t => t.ArmEnum != Arm.JudgeArm).Any()) - .WhereIf(querySubjectAssign.IsHaveAssigned != null && querySubjectAssign.IsHaveAssigned == true && querySubjectAssign.IsJudgeDoctor, t => t.SubjectDoctorList.Where(t => t.ArmEnum == Arm.JudgeArm).Any()) - .WhereIf(querySubjectAssign.IsHaveAssigned != null && querySubjectAssign.IsHaveAssigned == false && querySubjectAssign.IsJudgeDoctor == false, t => !t.SubjectDoctorList.Where(t => t.ArmEnum != Arm.JudgeArm).Any()) - .WhereIf(querySubjectAssign.IsHaveAssigned != null && querySubjectAssign.IsHaveAssigned == false && querySubjectAssign.IsJudgeDoctor, t => !t.SubjectDoctorList.Where(t => t.ArmEnum == Arm.JudgeArm).Any()) + .WhereIf(inQuery.IsHaveAssigned != null && inQuery.IsHaveAssigned == true && inQuery.IsJudgeDoctor == false, t => t.SubjectDoctorList.Where(t => t.ArmEnum != Arm.JudgeArm).Any()) + .WhereIf(inQuery.IsHaveAssigned != null && inQuery.IsHaveAssigned == true && inQuery.IsJudgeDoctor, t => t.SubjectDoctorList.Where(t => t.ArmEnum == Arm.JudgeArm).Any()) + .WhereIf(inQuery.IsHaveAssigned != null && inQuery.IsHaveAssigned == false && inQuery.IsJudgeDoctor == false, t => !t.SubjectDoctorList.Where(t => t.ArmEnum != Arm.JudgeArm).Any()) + .WhereIf(inQuery.IsHaveAssigned != null && inQuery.IsHaveAssigned == false && inQuery.IsJudgeDoctor, t => !t.SubjectDoctorList.Where(t => t.ArmEnum == Arm.JudgeArm).Any()) - .WhereIf(querySubjectAssign.IsAssignConfirmed != null && querySubjectAssign.IsAssignConfirmed == true && querySubjectAssign.IsJudgeDoctor == false, t => t.SubjectDoctorList.Where(t => t.ArmEnum != Arm.JudgeArm).All(u => u.IsConfirmed)) - .WhereIf(querySubjectAssign.IsAssignConfirmed != null && querySubjectAssign.IsAssignConfirmed == true && querySubjectAssign.IsJudgeDoctor, t => t.SubjectDoctorList.Where(t => t.ArmEnum == Arm.JudgeArm).All(u => u.IsConfirmed)) + .WhereIf(inQuery.IsAssignConfirmed != null && inQuery.IsAssignConfirmed == true && inQuery.IsJudgeDoctor == false, t => t.SubjectDoctorList.Where(t => t.ArmEnum != Arm.JudgeArm).All(u => u.IsConfirmed)) + .WhereIf(inQuery.IsAssignConfirmed != null && inQuery.IsAssignConfirmed == true && inQuery.IsJudgeDoctor, t => t.SubjectDoctorList.Where(t => t.ArmEnum == Arm.JudgeArm).All(u => u.IsConfirmed)) - .WhereIf(querySubjectAssign.IsAssignConfirmed != null && querySubjectAssign.IsAssignConfirmed == false && querySubjectAssign.IsJudgeDoctor == false, t => t.SubjectDoctorList.Where(t => t.ArmEnum != Arm.JudgeArm).Any(u => u.IsConfirmed == false)) - .WhereIf(querySubjectAssign.IsAssignConfirmed != null && querySubjectAssign.IsAssignConfirmed == false && querySubjectAssign.IsJudgeDoctor, t => t.SubjectDoctorList.Where(t => t.ArmEnum == Arm.JudgeArm).Any(u => u.IsConfirmed == false)) + .WhereIf(inQuery.IsAssignConfirmed != null && inQuery.IsAssignConfirmed == false && inQuery.IsJudgeDoctor == false, t => t.SubjectDoctorList.Where(t => t.ArmEnum != Arm.JudgeArm).Any(u => u.IsConfirmed == false)) + .WhereIf(inQuery.IsAssignConfirmed != null && inQuery.IsAssignConfirmed == false && inQuery.IsJudgeDoctor, t => t.SubjectDoctorList.Where(t => t.ArmEnum == Arm.JudgeArm).Any(u => u.IsConfirmed == false)) - .WhereIf(querySubjectAssign.DoctorUserId != null && querySubjectAssign.IsJudgeDoctor == false, t => t.SubjectDoctorList.Where(t => t.ArmEnum != Arm.JudgeArm).Any(t => t.DoctorUserId == querySubjectAssign.DoctorUserId)) - .WhereIf(querySubjectAssign.DoctorUserId != null && querySubjectAssign.IsJudgeDoctor, t => t.SubjectDoctorList.Where(t => t.ArmEnum == Arm.JudgeArm).Any(t => t.DoctorUserId == querySubjectAssign.DoctorUserId)) - .ProjectTo(_mapper.ConfigurationProvider, new { isJudgeDoctor = querySubjectAssign.IsJudgeDoctor }); + .WhereIf(inQuery.DoctorUserId != null && inQuery.IsJudgeDoctor == false, t => t.SubjectDoctorList.Where(t => t.ArmEnum != Arm.JudgeArm).Any(t => t.DoctorUserId == inQuery.DoctorUserId)) + .WhereIf(inQuery.DoctorUserId != null && inQuery.IsJudgeDoctor, t => t.SubjectDoctorList.Where(t => t.ArmEnum == Arm.JudgeArm).Any(t => t.DoctorUserId == inQuery.DoctorUserId)) + .ProjectTo(_mapper.ConfigurationProvider, new { isJudgeDoctor = inQuery.IsJudgeDoctor }); - var pageList = await subjectQuery.ToPagedListAsync(querySubjectAssign.PageIndex, querySubjectAssign.PageSize, string.IsNullOrWhiteSpace(querySubjectAssign.SortField) ? nameof(querySubjectAssign.SubjectId) : querySubjectAssign.SortField, querySubjectAssign.Asc); + var pageList = await subjectQuery.ToPagedListAsync(inQuery); return pageList; } @@ -636,43 +636,43 @@ namespace IRaCIS.Core.Application.Service.Allocation /// /// 访视任务 /// - /// + /// /// /// [HttpPost] - public async Task> GetVisitTaskList(VisitTaskQuery queryVisitTask, [FromServices] IVisitTaskHelpeService _visitTaskCommonService) + public async Task> GetVisitTaskList(VisitTaskQuery inQuery, [FromServices] IVisitTaskHelpeService _visitTaskCommonService) { //以前访视未产生任务的,在查询这里要产生 - var svIdList = await _subjectVisitRepository.Where(t => t.TrialId == queryVisitTask.TrialId && t.CheckState == CheckStateEnum.CVPassed && t.IsVisitTaskGenerated == false).Select(t => t.Id).ToListAsync(); + var svIdList = await _subjectVisitRepository.Where(t => t.TrialId == inQuery.TrialId && t.CheckState == CheckStateEnum.CVPassed && t.IsVisitTaskGenerated == false).Select(t => t.Id).ToListAsync(); //之前没有生成任务的逻辑 但是现在加了,任务要自动生成 - await _visitTaskCommonService.GenerateVisitTaskAsync(queryVisitTask.TrialId, svIdList); + await _visitTaskCommonService.GenerateVisitTaskAsync(inQuery.TrialId, svIdList); - var visitTaskQueryable = _visitTaskRepository.Where(t => t.TrialId == queryVisitTask.TrialId && t.IsAnalysisCreate == false) - .WhereIf(queryVisitTask.ReadingCategory != null, t => t.ReadingCategory == queryVisitTask.ReadingCategory) - .WhereIf(queryVisitTask.ReadingCategory == null, t => t.ReadingCategory != ReadingCategory.Judge) + var visitTaskQueryable = _visitTaskRepository.Where(t => t.TrialId == inQuery.TrialId && t.IsAnalysisCreate == false) + .WhereIf(inQuery.ReadingCategory != null, t => t.ReadingCategory == inQuery.ReadingCategory) + .WhereIf(inQuery.ReadingCategory == null, t => t.ReadingCategory != ReadingCategory.Judge) - .WhereIf(queryVisitTask.TaskState != null, t => t.TaskState == queryVisitTask.TaskState) - .WhereIf(queryVisitTask.TrialSiteId != null, t => t.Subject.TrialSiteId == queryVisitTask.TrialSiteId) - .WhereIf(queryVisitTask.SubjectId != null, t => t.SubjectId == queryVisitTask.SubjectId) - .WhereIf(queryVisitTask.IsUrgent != null, t => t.IsUrgent == queryVisitTask.IsUrgent) - .WhereIf(queryVisitTask.DoctorUserId != null, t => t.DoctorUserId == queryVisitTask.DoctorUserId) - .WhereIf(queryVisitTask.ReadingCategory != null, t => t.ReadingCategory == queryVisitTask.ReadingCategory) - .WhereIf(queryVisitTask.TaskAllocationState != null, t => t.TaskAllocationState == queryVisitTask.TaskAllocationState) - .WhereIf(queryVisitTask.TrialReadingCriterionId != null, t => t.TrialReadingCriterionId == queryVisitTask.TrialReadingCriterionId) + .WhereIf(inQuery.TaskState != null, t => t.TaskState == inQuery.TaskState) + .WhereIf(inQuery.TrialSiteId != null, t => t.Subject.TrialSiteId == inQuery.TrialSiteId) + .WhereIf(inQuery.SubjectId != null, t => t.SubjectId == inQuery.SubjectId) + .WhereIf(inQuery.IsUrgent != null, t => t.IsUrgent == inQuery.IsUrgent) + .WhereIf(inQuery.DoctorUserId != null, t => t.DoctorUserId == inQuery.DoctorUserId) + .WhereIf(inQuery.ReadingCategory != null, t => t.ReadingCategory == inQuery.ReadingCategory) + .WhereIf(inQuery.TaskAllocationState != null, t => t.TaskAllocationState == inQuery.TaskAllocationState) + .WhereIf(inQuery.TrialReadingCriterionId != null, t => t.TrialReadingCriterionId == inQuery.TrialReadingCriterionId) - .WhereIf(!string.IsNullOrEmpty(queryVisitTask.TrialSiteCode), t => (t.BlindTrialSiteCode.Contains(queryVisitTask.TrialSiteCode!) && t.IsAnalysisCreate) || (t.Subject.TrialSite.TrialSiteCode.Contains(queryVisitTask.TrialSiteCode!) && t.IsAnalysisCreate == false)) - .WhereIf(!string.IsNullOrEmpty(queryVisitTask.TaskName), t => t.TaskName.Contains(queryVisitTask.TaskName) || t.TaskBlindName.Contains(queryVisitTask.TaskName)) + .WhereIf(!string.IsNullOrEmpty(inQuery.TrialSiteCode), t => (t.BlindTrialSiteCode.Contains(inQuery.TrialSiteCode!) && t.IsAnalysisCreate) || (t.Subject.TrialSite.TrialSiteCode.Contains(inQuery.TrialSiteCode!) && t.IsAnalysisCreate == false)) + .WhereIf(!string.IsNullOrEmpty(inQuery.TaskName), t => t.TaskName.Contains(inQuery.TaskName) || t.TaskBlindName.Contains(inQuery.TaskName)) - .WhereIf(!string.IsNullOrEmpty(queryVisitTask.SubjectCode), t => (t.Subject.Code.Contains(queryVisitTask.SubjectCode) && t.IsAnalysisCreate == false) || (t.BlindSubjectCode.Contains(queryVisitTask.SubjectCode) && t.IsAnalysisCreate)) - .WhereIf(queryVisitTask.BeginAllocateDate != null, t => t.AllocateTime > queryVisitTask.BeginAllocateDate) - .WhereIf(queryVisitTask.EndAllocateDate != null, t => t.AllocateTime < queryVisitTask.EndAllocateDate!.Value.AddDays(1)) + .WhereIf(!string.IsNullOrEmpty(inQuery.SubjectCode), t => (t.Subject.Code.Contains(inQuery.SubjectCode) && t.IsAnalysisCreate == false) || (t.BlindSubjectCode.Contains(inQuery.SubjectCode) && t.IsAnalysisCreate)) + .WhereIf(inQuery.BeginAllocateDate != null, t => t.AllocateTime > inQuery.BeginAllocateDate) + .WhereIf(inQuery.EndAllocateDate != null, t => t.AllocateTime < inQuery.EndAllocateDate!.Value.AddDays(1)) .ProjectTo(_mapper.ConfigurationProvider); var defalutSortArray = new string[] { nameof(VisitTask.IsUrgent) + " desc", nameof(VisitTask.SubjectId), nameof(VisitTask.VisitTaskNum) }; - var pageList = await visitTaskQueryable.ToPagedListAsync(queryVisitTask.PageIndex, queryVisitTask.PageSize, queryVisitTask.SortField, queryVisitTask.Asc, string.IsNullOrWhiteSpace(queryVisitTask.SortField), defalutSortArray); + var pageList = await visitTaskQueryable.ToPagedListAsync(inQuery, defalutSortArray); //var trialTaskConfig = _trialRepository.Where(t => t.Id == queryVisitTask.TrialId).ProjectTo(_mapper.ConfigurationProvider).FirstOrDefault(); return pageList; @@ -683,35 +683,35 @@ namespace IRaCIS.Core.Application.Service.Allocation /// /// 裁判任务 /// - /// + /// /// [HttpPost] - public async Task/*, object)*/> GetJudgeVisitTaskList(VisitTaskQuery queryVisitTask) + public async Task/*, object)*/> GetJudgeVisitTaskList(VisitTaskQuery inQuery) { - var visitTaskQueryable = _visitTaskRepository.Where(t => t.TrialId == queryVisitTask.TrialId && t.IsAnalysisCreate == false) + var visitTaskQueryable = _visitTaskRepository.Where(t => t.TrialId == inQuery.TrialId && t.IsAnalysisCreate == false) .Where(t => t.ReadingCategory == ReadingCategory.Judge) - .WhereIf(queryVisitTask.TaskState != null, t => t.TaskState == queryVisitTask.TaskState) - .WhereIf(queryVisitTask.ReadingCategory != null, t => t.ReadingCategory == queryVisitTask.ReadingCategory) - .WhereIf(queryVisitTask.TrialSiteId != null, t => t.Subject.TrialSiteId == queryVisitTask.TrialSiteId) - .WhereIf(queryVisitTask.SubjectId != null, t => t.SubjectId == queryVisitTask.SubjectId) - .WhereIf(queryVisitTask.IsUrgent != null, t => t.IsUrgent == queryVisitTask.IsUrgent) - .WhereIf(queryVisitTask.DoctorUserId != null, t => t.DoctorUserId == queryVisitTask.DoctorUserId) - .WhereIf(queryVisitTask.TaskAllocationState != null, t => t.TaskAllocationState == queryVisitTask.TaskAllocationState) - .WhereIf(queryVisitTask.ReadingTaskState != null, t => t.ReadingTaskState == queryVisitTask.ReadingTaskState) - .WhereIf(queryVisitTask.TrialReadingCriterionId != null, t => t.TrialReadingCriterionId == queryVisitTask.TrialReadingCriterionId) + .WhereIf(inQuery.TaskState != null, t => t.TaskState == inQuery.TaskState) + .WhereIf(inQuery.ReadingCategory != null, t => t.ReadingCategory == inQuery.ReadingCategory) + .WhereIf(inQuery.TrialSiteId != null, t => t.Subject.TrialSiteId == inQuery.TrialSiteId) + .WhereIf(inQuery.SubjectId != null, t => t.SubjectId == inQuery.SubjectId) + .WhereIf(inQuery.IsUrgent != null, t => t.IsUrgent == inQuery.IsUrgent) + .WhereIf(inQuery.DoctorUserId != null, t => t.DoctorUserId == inQuery.DoctorUserId) + .WhereIf(inQuery.TaskAllocationState != null, t => t.TaskAllocationState == inQuery.TaskAllocationState) + .WhereIf(inQuery.ReadingTaskState != null, t => t.ReadingTaskState == inQuery.ReadingTaskState) + .WhereIf(inQuery.TrialReadingCriterionId != null, t => t.TrialReadingCriterionId == inQuery.TrialReadingCriterionId) - .WhereIf(!string.IsNullOrEmpty(queryVisitTask.TrialSiteCode), t => (t.BlindTrialSiteCode.Contains(queryVisitTask.TrialSiteCode!) && t.IsAnalysisCreate) || (t.Subject.TrialSite.TrialSiteCode.Contains(queryVisitTask.TrialSiteCode!) && t.IsAnalysisCreate == false)) - .WhereIf(!string.IsNullOrEmpty(queryVisitTask.TaskName), t => t.TaskName.Contains(queryVisitTask.TaskName) || t.TaskBlindName.Contains(queryVisitTask.TaskName)) - .WhereIf(!string.IsNullOrEmpty(queryVisitTask.SubjectCode), t => (t.Subject.Code.Contains(queryVisitTask.SubjectCode) && t.IsAnalysisCreate == false) || (t.BlindSubjectCode.Contains(queryVisitTask.SubjectCode) && t.IsAnalysisCreate)) - .WhereIf(queryVisitTask.BeginAllocateDate != null, t => t.AllocateTime > queryVisitTask.BeginAllocateDate) - .WhereIf(queryVisitTask.EndAllocateDate != null, t => t.AllocateTime < queryVisitTask.EndAllocateDate!.Value.AddDays(1)) + .WhereIf(!string.IsNullOrEmpty(inQuery.TrialSiteCode), t => (t.BlindTrialSiteCode.Contains(inQuery.TrialSiteCode!) && t.IsAnalysisCreate) || (t.Subject.TrialSite.TrialSiteCode.Contains(inQuery.TrialSiteCode!) && t.IsAnalysisCreate == false)) + .WhereIf(!string.IsNullOrEmpty(inQuery.TaskName), t => t.TaskName.Contains(inQuery.TaskName) || t.TaskBlindName.Contains(inQuery.TaskName)) + .WhereIf(!string.IsNullOrEmpty(inQuery.SubjectCode), t => (t.Subject.Code.Contains(inQuery.SubjectCode) && t.IsAnalysisCreate == false) || (t.BlindSubjectCode.Contains(inQuery.SubjectCode) && t.IsAnalysisCreate)) + .WhereIf(inQuery.BeginAllocateDate != null, t => t.AllocateTime > inQuery.BeginAllocateDate) + .WhereIf(inQuery.EndAllocateDate != null, t => t.AllocateTime < inQuery.EndAllocateDate!.Value.AddDays(1)) .ProjectTo(_mapper.ConfigurationProvider); var defalutSortArray = new string[] { nameof(VisitTask.IsUrgent) + " desc", nameof(VisitTask.SubjectId), nameof(VisitTaskView.VisitTaskNum) }; - var pageList = await visitTaskQueryable.ToPagedListAsync(queryVisitTask.PageIndex, queryVisitTask.PageSize, queryVisitTask.SortField, queryVisitTask.Asc, string.IsNullOrWhiteSpace(queryVisitTask.SortField), defalutSortArray); + var pageList = await visitTaskQueryable.ToPagedListAsync(inQuery, defalutSortArray); return pageList; //var trialTaskConfig = _trialRepository.Where(t => t.Id == queryVisitTask.TrialId).ProjectTo(_mapper.ConfigurationProvider).FirstOrDefault(); @@ -723,45 +723,45 @@ namespace IRaCIS.Core.Application.Service.Allocation /// /// PM阅片跟踪 /// - /// + /// /// [HttpPost] - public async Task>> GetReadingTaskList(VisitTaskQuery queryVisitTask) + public async Task>> GetReadingTaskList(VisitTaskQuery inQuery) { - var visitTaskQueryable = _visitTaskRepository.Where(t => t.TrialId == queryVisitTask.TrialId && t.IsAnalysisCreate == false) + var visitTaskQueryable = _visitTaskRepository.Where(t => t.TrialId == inQuery.TrialId && t.IsAnalysisCreate == false) //.Where(t => t.IsAnalysisCreate == false && t.DoctorUserId != null) - .WhereIf(queryVisitTask.IsEffect == true, t => t.TaskState == TaskState.Effect || t.TaskState == TaskState.Freeze) - .WhereIf(queryVisitTask.IsEffect == false, t => t.TaskState == TaskState.Adbandon || t.TaskState == TaskState.HaveReturned) + .WhereIf(inQuery.IsEffect == true, t => t.TaskState == TaskState.Effect || t.TaskState == TaskState.Freeze) + .WhereIf(inQuery.IsEffect == false, t => t.TaskState == TaskState.Adbandon || t.TaskState == TaskState.HaveReturned) - .WhereIf(queryVisitTask.TaskState != null, t => t.TaskState == queryVisitTask.TaskState) - .WhereIf(queryVisitTask.TrialSiteId != null, t => t.Subject.TrialSiteId == queryVisitTask.TrialSiteId) - .WhereIf(queryVisitTask.SubjectId != null, t => t.SubjectId == queryVisitTask.SubjectId) - .WhereIf(queryVisitTask.IsUrgent != null, t => t.IsUrgent == queryVisitTask.IsUrgent) - .WhereIf(queryVisitTask.DoctorUserId != null, t => t.DoctorUserId == queryVisitTask.DoctorUserId) - .WhereIf(queryVisitTask.ReadingCategory != null, t => t.ReadingCategory == queryVisitTask.ReadingCategory) - .WhereIf(queryVisitTask.ReadingTaskState != null, t => t.ReadingTaskState == queryVisitTask.ReadingTaskState) - .WhereIf(queryVisitTask.TaskAllocationState != null, t => t.TaskAllocationState == queryVisitTask.TaskAllocationState) - .WhereIf(queryVisitTask.TrialReadingCriterionId != null, t => t.TrialReadingCriterionId == queryVisitTask.TrialReadingCriterionId) - .WhereIf(queryVisitTask.ReReadingApplyState != null, t => t.ReReadingApplyState == queryVisitTask.ReReadingApplyState) + .WhereIf(inQuery.TaskState != null, t => t.TaskState == inQuery.TaskState) + .WhereIf(inQuery.TrialSiteId != null, t => t.Subject.TrialSiteId == inQuery.TrialSiteId) + .WhereIf(inQuery.SubjectId != null, t => t.SubjectId == inQuery.SubjectId) + .WhereIf(inQuery.IsUrgent != null, t => t.IsUrgent == inQuery.IsUrgent) + .WhereIf(inQuery.DoctorUserId != null, t => t.DoctorUserId == inQuery.DoctorUserId) + .WhereIf(inQuery.ReadingCategory != null, t => t.ReadingCategory == inQuery.ReadingCategory) + .WhereIf(inQuery.ReadingTaskState != null, t => t.ReadingTaskState == inQuery.ReadingTaskState) + .WhereIf(inQuery.TaskAllocationState != null, t => t.TaskAllocationState == inQuery.TaskAllocationState) + .WhereIf(inQuery.TrialReadingCriterionId != null, t => t.TrialReadingCriterionId == inQuery.TrialReadingCriterionId) + .WhereIf(inQuery.ReReadingApplyState != null, t => t.ReReadingApplyState == inQuery.ReReadingApplyState) - .WhereIf(queryVisitTask.CompleteClinicalDataEnum == CompleteClinicalDataEnum.Complete, t => t.IsClinicalDataSign && t.IsNeedClinicalDataSign == true) - .WhereIf(queryVisitTask.CompleteClinicalDataEnum == CompleteClinicalDataEnum.NotComplete, t => t.IsClinicalDataSign == false && t.IsNeedClinicalDataSign == true) - .WhereIf(queryVisitTask.CompleteClinicalDataEnum == CompleteClinicalDataEnum.NA, t => t.IsNeedClinicalDataSign == false) - .WhereIf(!string.IsNullOrEmpty(queryVisitTask.TrialSiteCode), t => (t.BlindTrialSiteCode.Contains(queryVisitTask.TrialSiteCode!) && t.IsAnalysisCreate) || (t.Subject.TrialSite.TrialSiteCode.Contains(queryVisitTask.TrialSiteCode!) && t.IsAnalysisCreate == false)) - .WhereIf(!string.IsNullOrEmpty(queryVisitTask.TaskName), t => t.TaskName.Contains(queryVisitTask.TaskName) || t.TaskBlindName.Contains(queryVisitTask.TaskName)) - .WhereIf(!string.IsNullOrEmpty(queryVisitTask.SubjectCode), t => (t.Subject.Code.Contains(queryVisitTask.SubjectCode) && t.IsAnalysisCreate == false) || (t.BlindSubjectCode.Contains(queryVisitTask.SubjectCode) && t.IsAnalysisCreate)) - .WhereIf(queryVisitTask.BeginAllocateDate != null, t => t.AllocateTime > queryVisitTask.BeginAllocateDate) - .WhereIf(queryVisitTask.EndAllocateDate != null, t => t.AllocateTime < queryVisitTask.EndAllocateDate) - .WhereIf(queryVisitTask.BeginSignTime != null, t => t.SignTime > queryVisitTask.BeginSignTime) - .WhereIf(queryVisitTask.EndSignTime != null, t => t.SignTime < queryVisitTask.EndSignTime) + .WhereIf(inQuery.CompleteClinicalDataEnum == CompleteClinicalDataEnum.Complete, t => t.IsClinicalDataSign && t.IsNeedClinicalDataSign == true) + .WhereIf(inQuery.CompleteClinicalDataEnum == CompleteClinicalDataEnum.NotComplete, t => t.IsClinicalDataSign == false && t.IsNeedClinicalDataSign == true) + .WhereIf(inQuery.CompleteClinicalDataEnum == CompleteClinicalDataEnum.NA, t => t.IsNeedClinicalDataSign == false) + .WhereIf(!string.IsNullOrEmpty(inQuery.TrialSiteCode), t => (t.BlindTrialSiteCode.Contains(inQuery.TrialSiteCode!) && t.IsAnalysisCreate) || (t.Subject.TrialSite.TrialSiteCode.Contains(inQuery.TrialSiteCode!) && t.IsAnalysisCreate == false)) + .WhereIf(!string.IsNullOrEmpty(inQuery.TaskName), t => t.TaskName.Contains(inQuery.TaskName) || t.TaskBlindName.Contains(inQuery.TaskName)) + .WhereIf(!string.IsNullOrEmpty(inQuery.SubjectCode), t => (t.Subject.Code.Contains(inQuery.SubjectCode) && t.IsAnalysisCreate == false) || (t.BlindSubjectCode.Contains(inQuery.SubjectCode) && t.IsAnalysisCreate)) + .WhereIf(inQuery.BeginAllocateDate != null, t => t.AllocateTime > inQuery.BeginAllocateDate) + .WhereIf(inQuery.EndAllocateDate != null, t => t.AllocateTime < inQuery.EndAllocateDate) + .WhereIf(inQuery.BeginSignTime != null, t => t.SignTime > inQuery.BeginSignTime) + .WhereIf(inQuery.EndSignTime != null, t => t.SignTime < inQuery.EndSignTime) .ProjectTo(_mapper.ConfigurationProvider); var defalutSortArray = new string[] { nameof(VisitTask.IsUrgent) + " desc", nameof(VisitTask.SubjectId), nameof(VisitTask.VisitTaskNum) }; - var pageList = await visitTaskQueryable.ToPagedListAsync(queryVisitTask.PageIndex, queryVisitTask.PageSize, queryVisitTask.SortField, queryVisitTask.Asc, string.IsNullOrWhiteSpace(queryVisitTask.SortField), defalutSortArray); + var pageList = await visitTaskQueryable.ToPagedListAsync(inQuery, defalutSortArray); - var trialTaskConfig = _trialRepository.Where(t => t.Id == queryVisitTask.TrialId).ProjectTo(_mapper.ConfigurationProvider).FirstOrDefault(); + var trialTaskConfig = _trialRepository.Where(t => t.Id == inQuery.TrialId).ProjectTo(_mapper.ConfigurationProvider).FirstOrDefault(); return ResponseOutput.Ok(pageList, trialTaskConfig); } @@ -820,7 +820,7 @@ namespace IRaCIS.Core.Application.Service.Allocation - var pageList = await visitTaskQueryable.ToPagedListAsync(inQuery.PageIndex, inQuery.PageSize, inQuery.SortField, inQuery.Asc, string.IsNullOrWhiteSpace(inQuery.SortField), defalutSortArray); + var pageList = await visitTaskQueryable.ToPagedListAsync(inQuery, defalutSortArray); return pageList; } @@ -829,43 +829,43 @@ namespace IRaCIS.Core.Application.Service.Allocation /// /// 获取IR 重阅影像阅片列表 /// - /// + /// /// [HttpPost] - public async Task> GetIRReReadingTaskList(VisitTaskQuery queryVisitTask) + public async Task> GetIRReReadingTaskList(VisitTaskQuery inQuery) { var visitTaskQueryable = _visitTaskReReadingRepository .Where(t => t.RequestReReadingType == RequestReReadingType.DocotorApply) .Where(t => t.OriginalReReadingTask.DoctorUserId == _userInfo.Id) - .Where(t => t.OriginalReReadingTask.TrialId == queryVisitTask.TrialId) - .WhereIf(queryVisitTask.RequestReReadingResultEnum != null, t => t.RequestReReadingResultEnum == queryVisitTask.RequestReReadingResultEnum) - .WhereIf(queryVisitTask.RootReReadingTaskId != null, t => t.RootReReadingTaskId == queryVisitTask.RootReReadingTaskId || t.OriginalReReadingTaskId == queryVisitTask.RootReReadingTaskId) - .WhereIf(!string.IsNullOrEmpty(queryVisitTask.TaskCode), t => t.OriginalReReadingTask.TaskCode.Contains(queryVisitTask.TaskCode!) || t.RootReReadingTask.TaskCode.Contains(queryVisitTask.TaskCode!)) - .WhereIf(queryVisitTask.TaskState != null, t => t.OriginalReReadingTask.TaskState == queryVisitTask.TaskState) - .WhereIf(queryVisitTask.ReadingCategory != null, t => t.OriginalReReadingTask.ReadingCategory == queryVisitTask.ReadingCategory) - .WhereIf(queryVisitTask.ReReadingApplyState != null, t => t.OriginalReReadingTask.ReReadingApplyState == queryVisitTask.ReReadingApplyState) - .WhereIf(queryVisitTask.TrialSiteId != null, t => t.OriginalReReadingTask.Subject.TrialSiteId == queryVisitTask.TrialSiteId) - .WhereIf(queryVisitTask.SubjectId != null, t => t.OriginalReReadingTask.SubjectId == queryVisitTask.SubjectId) - .WhereIf(queryVisitTask.IsUrgent != null, t => t.OriginalReReadingTask.IsUrgent == queryVisitTask.IsUrgent) - .WhereIf(queryVisitTask.DoctorUserId != null, t => t.OriginalReReadingTask.DoctorUserId == queryVisitTask.DoctorUserId) - .WhereIf(queryVisitTask.ReadingTaskState != null, t => t.OriginalReReadingTask.ReadingTaskState == queryVisitTask.ReadingTaskState) - .WhereIf(queryVisitTask.TaskAllocationState != null, t => t.OriginalReReadingTask.TaskAllocationState == queryVisitTask.TaskAllocationState) - .WhereIf(queryVisitTask.TrialReadingCriterionId != null, t => t.OriginalReReadingTask.TrialReadingCriterionId == queryVisitTask.TrialReadingCriterionId) + .Where(t => t.OriginalReReadingTask.TrialId == inQuery.TrialId) + .WhereIf(inQuery.RequestReReadingResultEnum != null, t => t.RequestReReadingResultEnum == inQuery.RequestReReadingResultEnum) + .WhereIf(inQuery.RootReReadingTaskId != null, t => t.RootReReadingTaskId == inQuery.RootReReadingTaskId || t.OriginalReReadingTaskId == inQuery.RootReReadingTaskId) + .WhereIf(!string.IsNullOrEmpty(inQuery.TaskCode), t => t.OriginalReReadingTask.TaskCode.Contains(inQuery.TaskCode!) || t.RootReReadingTask.TaskCode.Contains(inQuery.TaskCode!)) + .WhereIf(inQuery.TaskState != null, t => t.OriginalReReadingTask.TaskState == inQuery.TaskState) + .WhereIf(inQuery.ReadingCategory != null, t => t.OriginalReReadingTask.ReadingCategory == inQuery.ReadingCategory) + .WhereIf(inQuery.ReReadingApplyState != null, t => t.OriginalReReadingTask.ReReadingApplyState == inQuery.ReReadingApplyState) + .WhereIf(inQuery.TrialSiteId != null, t => t.OriginalReReadingTask.Subject.TrialSiteId == inQuery.TrialSiteId) + .WhereIf(inQuery.SubjectId != null, t => t.OriginalReReadingTask.SubjectId == inQuery.SubjectId) + .WhereIf(inQuery.IsUrgent != null, t => t.OriginalReReadingTask.IsUrgent == inQuery.IsUrgent) + .WhereIf(inQuery.DoctorUserId != null, t => t.OriginalReReadingTask.DoctorUserId == inQuery.DoctorUserId) + .WhereIf(inQuery.ReadingTaskState != null, t => t.OriginalReReadingTask.ReadingTaskState == inQuery.ReadingTaskState) + .WhereIf(inQuery.TaskAllocationState != null, t => t.OriginalReReadingTask.TaskAllocationState == inQuery.TaskAllocationState) + .WhereIf(inQuery.TrialReadingCriterionId != null, t => t.OriginalReReadingTask.TrialReadingCriterionId == inQuery.TrialReadingCriterionId) - .WhereIf(!string.IsNullOrEmpty(queryVisitTask.TrialSiteCode), t => (t.OriginalReReadingTask.BlindTrialSiteCode.Contains(queryVisitTask.TrialSiteCode!) && t.OriginalReReadingTask.IsAnalysisCreate) || (t.OriginalReReadingTask.Subject.TrialSite.TrialSiteCode.Contains(queryVisitTask.TrialSiteCode!) && t.OriginalReReadingTask.IsAnalysisCreate == false)) - .WhereIf(!string.IsNullOrEmpty(queryVisitTask.TaskName), t => t.OriginalReReadingTask.TaskName.Contains(queryVisitTask.TaskName) || t.NewReReadingTask.TaskBlindName.Contains(queryVisitTask.TaskName)) - .WhereIf(!string.IsNullOrEmpty(queryVisitTask.SubjectCode), t => (t.OriginalReReadingTask.Subject.Code.Contains(queryVisitTask.SubjectCode) && t.OriginalReReadingTask.IsAnalysisCreate == false) || (t.OriginalReReadingTask.BlindSubjectCode.Contains(queryVisitTask.SubjectCode) && t.OriginalReReadingTask.IsAnalysisCreate)) - .WhereIf(queryVisitTask.BeginAllocateDate != null, t => t.OriginalReReadingTask.AllocateTime > queryVisitTask.BeginAllocateDate) - .WhereIf(queryVisitTask.EndAllocateDate != null, t => t.OriginalReReadingTask.AllocateTime < queryVisitTask.EndAllocateDate!.Value.AddDays(1)) + .WhereIf(!string.IsNullOrEmpty(inQuery.TrialSiteCode), t => (t.OriginalReReadingTask.BlindTrialSiteCode.Contains(inQuery.TrialSiteCode!) && t.OriginalReReadingTask.IsAnalysisCreate) || (t.OriginalReReadingTask.Subject.TrialSite.TrialSiteCode.Contains(inQuery.TrialSiteCode!) && t.OriginalReReadingTask.IsAnalysisCreate == false)) + .WhereIf(!string.IsNullOrEmpty(inQuery.TaskName), t => t.OriginalReReadingTask.TaskName.Contains(inQuery.TaskName) || t.NewReReadingTask.TaskBlindName.Contains(inQuery.TaskName)) + .WhereIf(!string.IsNullOrEmpty(inQuery.SubjectCode), t => (t.OriginalReReadingTask.Subject.Code.Contains(inQuery.SubjectCode) && t.OriginalReReadingTask.IsAnalysisCreate == false) || (t.OriginalReReadingTask.BlindSubjectCode.Contains(inQuery.SubjectCode) && t.OriginalReReadingTask.IsAnalysisCreate)) + .WhereIf(inQuery.BeginAllocateDate != null, t => t.OriginalReReadingTask.AllocateTime > inQuery.BeginAllocateDate) + .WhereIf(inQuery.EndAllocateDate != null, t => t.OriginalReReadingTask.AllocateTime < inQuery.EndAllocateDate!.Value.AddDays(1)) .ProjectTo(_mapper.ConfigurationProvider); var defalutSortArray = new string[] { nameof(ReReadingTaskView.OriginalReReadingTask) + "." + nameof(ReReadingTaskView.OriginalReReadingTask.IsUrgent) + " desc", nameof(ReReadingTaskView.OriginalReReadingTask) + "." + nameof(ReReadingTaskView.OriginalReReadingTask.SubjectId), nameof(ReReadingTaskView.OriginalReReadingTask) + "." + nameof(ReReadingTaskView.OriginalReReadingTask.VisitTaskNum) }; - var pageList = await visitTaskQueryable.ToPagedListAsync(queryVisitTask.PageIndex, queryVisitTask.PageSize, queryVisitTask.SortField, queryVisitTask.Asc, string.IsNullOrWhiteSpace(queryVisitTask.SortField), defalutSortArray); + var pageList = await visitTaskQueryable.ToPagedListAsync(inQuery, defalutSortArray); return pageList; } @@ -873,34 +873,34 @@ namespace IRaCIS.Core.Application.Service.Allocation //SPM 能看到项目组申请记录 [HttpPost] - public async Task> GetSPMReReadingTaskList(VisitTaskQuery queryVisitTask) + public async Task> GetSPMReReadingTaskList(VisitTaskQuery inQuery) { var visitTaskQueryable = _visitTaskReReadingRepository.Where(t => t.RequestReReadingType == RequestReReadingType.TrialGroupApply && t.OriginalReReadingTask.IsAnalysisCreate == false) - .Where(t => t.OriginalReReadingTask.TrialId == queryVisitTask.TrialId) - .WhereIf(queryVisitTask.RootReReadingTaskId != null, t => t.RootReReadingTaskId == queryVisitTask.RootReReadingTaskId || t.OriginalReReadingTaskId == queryVisitTask.RootReReadingTaskId) - .WhereIf(!string.IsNullOrEmpty(queryVisitTask.TaskCode), t => t.OriginalReReadingTask.TaskCode.Contains(queryVisitTask.TaskCode!) || t.RootReReadingTask.TaskCode.Contains(queryVisitTask.TaskCode!)) - .WhereIf(queryVisitTask.TaskState != null, t => t.OriginalReReadingTask.TaskState == queryVisitTask.TaskState) - .WhereIf(queryVisitTask.TrialSiteId != null, t => t.OriginalReReadingTask.Subject.TrialSiteId == queryVisitTask.TrialSiteId) - .WhereIf(queryVisitTask.SubjectId != null, t => t.OriginalReReadingTask.SubjectId == queryVisitTask.SubjectId) - .WhereIf(queryVisitTask.IsUrgent != null, t => t.OriginalReReadingTask.IsUrgent == queryVisitTask.IsUrgent) - .WhereIf(queryVisitTask.DoctorUserId != null, t => t.OriginalReReadingTask.DoctorUserId == queryVisitTask.DoctorUserId) - .WhereIf(queryVisitTask.ReadingTaskState != null, t => t.OriginalReReadingTask.ReadingTaskState == queryVisitTask.ReadingTaskState) - .WhereIf(queryVisitTask.TaskAllocationState != null, t => t.OriginalReReadingTask.TaskAllocationState == queryVisitTask.TaskAllocationState) - .WhereIf(queryVisitTask.TrialReadingCriterionId != null, t => t.OriginalReReadingTask.TrialReadingCriterionId == queryVisitTask.TrialReadingCriterionId) + .Where(t => t.OriginalReReadingTask.TrialId == inQuery.TrialId) + .WhereIf(inQuery.RootReReadingTaskId != null, t => t.RootReReadingTaskId == inQuery.RootReReadingTaskId || t.OriginalReReadingTaskId == inQuery.RootReReadingTaskId) + .WhereIf(!string.IsNullOrEmpty(inQuery.TaskCode), t => t.OriginalReReadingTask.TaskCode.Contains(inQuery.TaskCode!) || t.RootReReadingTask.TaskCode.Contains(inQuery.TaskCode!)) + .WhereIf(inQuery.TaskState != null, t => t.OriginalReReadingTask.TaskState == inQuery.TaskState) + .WhereIf(inQuery.TrialSiteId != null, t => t.OriginalReReadingTask.Subject.TrialSiteId == inQuery.TrialSiteId) + .WhereIf(inQuery.SubjectId != null, t => t.OriginalReReadingTask.SubjectId == inQuery.SubjectId) + .WhereIf(inQuery.IsUrgent != null, t => t.OriginalReReadingTask.IsUrgent == inQuery.IsUrgent) + .WhereIf(inQuery.DoctorUserId != null, t => t.OriginalReReadingTask.DoctorUserId == inQuery.DoctorUserId) + .WhereIf(inQuery.ReadingTaskState != null, t => t.OriginalReReadingTask.ReadingTaskState == inQuery.ReadingTaskState) + .WhereIf(inQuery.TaskAllocationState != null, t => t.OriginalReReadingTask.TaskAllocationState == inQuery.TaskAllocationState) + .WhereIf(inQuery.TrialReadingCriterionId != null, t => t.OriginalReReadingTask.TrialReadingCriterionId == inQuery.TrialReadingCriterionId) - .WhereIf(!string.IsNullOrEmpty(queryVisitTask.TrialSiteCode), t => (t.OriginalReReadingTask.BlindTrialSiteCode.Contains(queryVisitTask.TrialSiteCode!) && t.OriginalReReadingTask.IsAnalysisCreate) || (t.OriginalReReadingTask.Subject.TrialSite.TrialSiteCode.Contains(queryVisitTask.TrialSiteCode!) && t.OriginalReReadingTask.IsAnalysisCreate == false)) + .WhereIf(!string.IsNullOrEmpty(inQuery.TrialSiteCode), t => (t.OriginalReReadingTask.BlindTrialSiteCode.Contains(inQuery.TrialSiteCode!) && t.OriginalReReadingTask.IsAnalysisCreate) || (t.OriginalReReadingTask.Subject.TrialSite.TrialSiteCode.Contains(inQuery.TrialSiteCode!) && t.OriginalReReadingTask.IsAnalysisCreate == false)) - .WhereIf(!string.IsNullOrEmpty(queryVisitTask.TaskName), t => t.OriginalReReadingTask.TaskName.Contains(queryVisitTask.TaskName) || t.NewReReadingTask.TaskBlindName.Contains(queryVisitTask.TaskName)) - .WhereIf(!string.IsNullOrEmpty(queryVisitTask.SubjectCode), t => (t.OriginalReReadingTask.Subject.Code.Contains(queryVisitTask.SubjectCode) && t.OriginalReReadingTask.IsAnalysisCreate == false) || (t.OriginalReReadingTask.BlindSubjectCode.Contains(queryVisitTask.SubjectCode) && t.OriginalReReadingTask.IsAnalysisCreate)) - .WhereIf(queryVisitTask.BeginAllocateDate != null, t => t.OriginalReReadingTask.AllocateTime > queryVisitTask.BeginAllocateDate) - .WhereIf(queryVisitTask.EndAllocateDate != null, t => t.OriginalReReadingTask.AllocateTime < queryVisitTask.EndAllocateDate!.Value.AddDays(1)) + .WhereIf(!string.IsNullOrEmpty(inQuery.TaskName), t => t.OriginalReReadingTask.TaskName.Contains(inQuery.TaskName) || t.NewReReadingTask.TaskBlindName.Contains(inQuery.TaskName)) + .WhereIf(!string.IsNullOrEmpty(inQuery.SubjectCode), t => (t.OriginalReReadingTask.Subject.Code.Contains(inQuery.SubjectCode) && t.OriginalReReadingTask.IsAnalysisCreate == false) || (t.OriginalReReadingTask.BlindSubjectCode.Contains(inQuery.SubjectCode) && t.OriginalReReadingTask.IsAnalysisCreate)) + .WhereIf(inQuery.BeginAllocateDate != null, t => t.OriginalReReadingTask.AllocateTime > inQuery.BeginAllocateDate) + .WhereIf(inQuery.EndAllocateDate != null, t => t.OriginalReReadingTask.AllocateTime < inQuery.EndAllocateDate!.Value.AddDays(1)) .ProjectTo(_mapper.ConfigurationProvider); var defalutSortArray = new string[] { nameof(ReReadingTaskView.RequestReReadingTime) }; //var defalutSortArray = new string[] { nameof(ReReadingTaskView.OriginalReReadingTask) + "." + nameof(ReReadingTaskView.OriginalReReadingTask.IsUrgent) + " desc", nameof(ReReadingTaskView.OriginalReReadingTask) + "." + nameof(ReReadingTaskView.OriginalReReadingTask.SubjectId), nameof(ReReadingTaskView.OriginalReReadingTask) + "." + nameof(ReReadingTaskView.OriginalReReadingTask.VisitTaskNum) }; - var pageList = await visitTaskQueryable.ToPagedListAsync(queryVisitTask.PageIndex, queryVisitTask.PageSize, queryVisitTask.SortField, queryVisitTask.Asc, string.IsNullOrWhiteSpace(queryVisitTask.SortField), defalutSortArray); + var pageList = await visitTaskQueryable.ToPagedListAsync(inQuery, defalutSortArray); return pageList; } @@ -1197,7 +1197,7 @@ namespace IRaCIS.Core.Application.Service.Allocation .ToList() }).Where(x => x.UnReadCanReadTaskCount > 0); - var pageList = await visitTaskQuery.ToPagedListAsync(inQuery.PageIndex, inQuery.PageSize, string.IsNullOrWhiteSpace(inQuery.SortField) ? nameof(IRUnReadSubjectView.UnReadCanReadTaskCount) : inQuery.SortField, inQuery.Asc); + var pageList = await visitTaskQuery.ToPagedListAsync(inQuery, nameof(IRUnReadSubjectView.UnReadCanReadTaskCount) ); return pageList; } @@ -1208,36 +1208,36 @@ namespace IRaCIS.Core.Application.Service.Allocation /// /// IR 已阅片任务 /// - /// + /// /// [HttpPost] - public async Task> GetIRHaveReadTaskList(VisitTaskQuery queryVisitTask) + public async Task> GetIRHaveReadTaskList(VisitTaskQuery inQuery) { - var visitTaskQueryable = _visitTaskRepository.Where(t => t.TrialId == queryVisitTask.TrialId) + var visitTaskQueryable = _visitTaskRepository.Where(t => t.TrialId == inQuery.TrialId) .Where(t => t.DoctorUserId == _userInfo.Id && t.ReadingTaskState == ReadingTaskState.HaveSigned)//该医生 已经签名的数据 - .WhereIf(queryVisitTask.TrialSiteId != null, t => t.Subject.TrialSiteId == queryVisitTask.TrialSiteId) - .WhereIf(queryVisitTask.SubjectId != null, t => t.SubjectId == queryVisitTask.SubjectId) - .WhereIf(queryVisitTask.IsUrgent != null, t => t.IsUrgent == queryVisitTask.IsUrgent) - .WhereIf(queryVisitTask.ReadingCategory != null, t => t.ReadingCategory == queryVisitTask.ReadingCategory) - .WhereIf(queryVisitTask.TaskAllocationState != null, t => t.TaskAllocationState == queryVisitTask.TaskAllocationState) - .WhereIf(queryVisitTask.TrialReadingCriterionId != null, t => t.TrialReadingCriterionId == queryVisitTask.TrialReadingCriterionId) + .WhereIf(inQuery.TrialSiteId != null, t => t.Subject.TrialSiteId == inQuery.TrialSiteId) + .WhereIf(inQuery.SubjectId != null, t => t.SubjectId == inQuery.SubjectId) + .WhereIf(inQuery.IsUrgent != null, t => t.IsUrgent == inQuery.IsUrgent) + .WhereIf(inQuery.ReadingCategory != null, t => t.ReadingCategory == inQuery.ReadingCategory) + .WhereIf(inQuery.TaskAllocationState != null, t => t.TaskAllocationState == inQuery.TaskAllocationState) + .WhereIf(inQuery.TrialReadingCriterionId != null, t => t.TrialReadingCriterionId == inQuery.TrialReadingCriterionId) - .WhereIf(queryVisitTask.TaskState != null, t => t.TaskState == queryVisitTask.TaskState) - .WhereIf(!string.IsNullOrEmpty(queryVisitTask.TrialSiteCode), t => (t.BlindTrialSiteCode.Contains(queryVisitTask.TrialSiteCode!) && t.IsAnalysisCreate) || (t.Subject.TrialSite.TrialSiteCode.Contains(queryVisitTask.TrialSiteCode!) && t.IsAnalysisCreate == false)) - .WhereIf(!string.IsNullOrEmpty(queryVisitTask.TaskName), t => t.TaskName.Contains(queryVisitTask.TaskName) || t.TaskBlindName.Contains(queryVisitTask.TaskName)) - .WhereIf(!string.IsNullOrEmpty(queryVisitTask.SubjectCode), t => (t.Subject.Code.Contains(queryVisitTask.SubjectCode) && t.IsAnalysisCreate == false) || (t.BlindSubjectCode.Contains(queryVisitTask.SubjectCode) && t.IsAnalysisCreate)) - .WhereIf(queryVisitTask.BeginAllocateDate != null, t => t.AllocateTime > queryVisitTask.BeginAllocateDate) - .WhereIf(queryVisitTask.EndAllocateDate != null, t => t.AllocateTime < queryVisitTask.EndAllocateDate!.Value.AddDays(1)) + .WhereIf(inQuery.TaskState != null, t => t.TaskState == inQuery.TaskState) + .WhereIf(!string.IsNullOrEmpty(inQuery.TrialSiteCode), t => (t.BlindTrialSiteCode.Contains(inQuery.TrialSiteCode!) && t.IsAnalysisCreate) || (t.Subject.TrialSite.TrialSiteCode.Contains(inQuery.TrialSiteCode!) && t.IsAnalysisCreate == false)) + .WhereIf(!string.IsNullOrEmpty(inQuery.TaskName), t => t.TaskName.Contains(inQuery.TaskName) || t.TaskBlindName.Contains(inQuery.TaskName)) + .WhereIf(!string.IsNullOrEmpty(inQuery.SubjectCode), t => (t.Subject.Code.Contains(inQuery.SubjectCode) && t.IsAnalysisCreate == false) || (t.BlindSubjectCode.Contains(inQuery.SubjectCode) && t.IsAnalysisCreate)) + .WhereIf(inQuery.BeginAllocateDate != null, t => t.AllocateTime > inQuery.BeginAllocateDate) + .WhereIf(inQuery.EndAllocateDate != null, t => t.AllocateTime < inQuery.EndAllocateDate!.Value.AddDays(1)) .ProjectTo(_mapper.ConfigurationProvider); var defalutSortArray = new string[] { nameof(VisitTask.IsUrgent) + " desc", nameof(VisitTask.SubjectId), nameof(VisitTask.VisitTaskNum) }; - var pageList = await visitTaskQueryable.ToPagedListAsync(queryVisitTask.PageIndex, queryVisitTask.PageSize, queryVisitTask.SortField, queryVisitTask.Asc, string.IsNullOrWhiteSpace(queryVisitTask.SortField), defalutSortArray); + var pageList = await visitTaskQueryable.ToPagedListAsync(inQuery, defalutSortArray); return pageList; } diff --git a/IRaCIS.Core.Application/Service/Common/DictionaryService.cs b/IRaCIS.Core.Application/Service/Common/DictionaryService.cs index f6ef4a91e..0174ee41d 100644 --- a/IRaCIS.Core.Application/Service/Common/DictionaryService.cs +++ b/IRaCIS.Core.Application/Service/Common/DictionaryService.cs @@ -116,27 +116,27 @@ namespace IRaCIS.Application.Services /// /// New 查询条件 /// - /// + /// /// [HttpPost] - public async Task> GetBasicDicList(BasicDicQuery basicDicQuery) + public async Task> GetBasicDicList(BasicDicQuery inQuery) { var systemBasicDataQueryable = _dicRepository.Where(t => t.ParentId == null) - .WhereIf(!string.IsNullOrEmpty(basicDicQuery.Code), t => t.Code.Contains(basicDicQuery.Code!)) - .WhereIf(!string.IsNullOrEmpty(basicDicQuery.keyInfo), t => t.Description.Contains(basicDicQuery.keyInfo!) - || t.Code.Contains(basicDicQuery.keyInfo!) - || t.ChildList.Any(u => u.ValueCN.Contains(basicDicQuery.keyInfo!)) - || t.ChildList.Any(u => u.Description.Contains(basicDicQuery.keyInfo!)) - || t.ChildList.Any(u => u.Value.Contains(basicDicQuery.keyInfo!))) + .WhereIf(!string.IsNullOrEmpty(inQuery.Code), t => t.Code.Contains(inQuery.Code!)) + .WhereIf(!string.IsNullOrEmpty(inQuery.keyInfo), t => t.Description.Contains(inQuery.keyInfo!) + || t.Code.Contains(inQuery.keyInfo!) + || t.ChildList.Any(u => u.ValueCN.Contains(inQuery.keyInfo!)) + || t.ChildList.Any(u => u.Description.Contains(inQuery.keyInfo!)) + || t.ChildList.Any(u => u.Value.Contains(inQuery.keyInfo!))) - .WhereIf(basicDicQuery.ConfigTypeId != null, t => t.ConfigTypeId == basicDicQuery.ConfigTypeId!) - .WhereIf(basicDicQuery.DataTypeEnum != null, t => t.DataTypeEnum == basicDicQuery.DataTypeEnum) - .WhereIf(basicDicQuery.DataTypeEnum == null, t => t.DataTypeEnum != DicDataTypeEnum.Config) + .WhereIf(inQuery.ConfigTypeId != null, t => t.ConfigTypeId == inQuery.ConfigTypeId!) + .WhereIf(inQuery.DataTypeEnum != null, t => t.DataTypeEnum == inQuery.DataTypeEnum) + .WhereIf(inQuery.DataTypeEnum == null, t => t.DataTypeEnum != DicDataTypeEnum.Config) .ProjectTo(_mapper.ConfigurationProvider); - return await systemBasicDataQueryable.ToPagedListAsync(basicDicQuery.PageIndex, basicDicQuery.PageSize, String.IsNullOrEmpty(basicDicQuery.SortField) ? nameof(BasicDicView.ConfigType) : basicDicQuery.SortField, basicDicQuery.Asc, String.IsNullOrEmpty(basicDicQuery.SortField), new[] { nameof(BasicDicView.ConfigType), nameof(BasicDicView.ShowOrder) }); + return await systemBasicDataQueryable.ToPagedListAsync(inQuery, new[] { nameof(BasicDicView.ConfigType), nameof(BasicDicView.ShowOrder) }); } diff --git a/IRaCIS.Core.Application/Service/Common/EmailNoticeConfigService.cs b/IRaCIS.Core.Application/Service/Common/EmailNoticeConfigService.cs index ae9ff28d8..3a18b40e9 100644 --- a/IRaCIS.Core.Application/Service/Common/EmailNoticeConfigService.cs +++ b/IRaCIS.Core.Application/Service/Common/EmailNoticeConfigService.cs @@ -20,19 +20,19 @@ namespace IRaCIS.Core.Application.Contracts { [HttpPost] - public async Task> GetEmailNoticeConfigList(EmailNoticeConfigQuery queryEmailNoticeConfig) + public async Task> GetEmailNoticeConfigList(EmailNoticeConfigQuery inQuery) { var emailNoticeConfigQueryable = _emailNoticeConfigrepository - .WhereIf(queryEmailNoticeConfig.SystemLevel == null, t => t.SystemLevel == SysEmailLevel.not_sys) - .WhereIf(queryEmailNoticeConfig.SystemLevel!=null, t =>t.SystemLevel == queryEmailNoticeConfig.SystemLevel) - .WhereIf(queryEmailNoticeConfig.IsDistinguishCriteria != null, t => t.IsDistinguishCriteria == queryEmailNoticeConfig.IsDistinguishCriteria) - .WhereIf(queryEmailNoticeConfig.CriterionTypeEnum != null, t => t.CriterionTypeEnum == queryEmailNoticeConfig.CriterionTypeEnum) - .WhereIf(queryEmailNoticeConfig.BusinessScenarioEnum != null, t => t.BusinessScenarioEnum == queryEmailNoticeConfig.BusinessScenarioEnum) - .WhereIf(queryEmailNoticeConfig.IsReturnRequired != null, t => t.IsReturnRequired == queryEmailNoticeConfig.IsReturnRequired) - .WhereIf(queryEmailNoticeConfig.IsEnable != null, t => t.IsEnable == queryEmailNoticeConfig.IsEnable) + .WhereIf(inQuery.SystemLevel == null, t => t.SystemLevel == SysEmailLevel.not_sys) + .WhereIf(inQuery.SystemLevel!=null, t =>t.SystemLevel == inQuery.SystemLevel) + .WhereIf(inQuery.IsDistinguishCriteria != null, t => t.IsDistinguishCriteria == inQuery.IsDistinguishCriteria) + .WhereIf(inQuery.CriterionTypeEnum != null, t => t.CriterionTypeEnum == inQuery.CriterionTypeEnum) + .WhereIf(inQuery.BusinessScenarioEnum != null, t => t.BusinessScenarioEnum == inQuery.BusinessScenarioEnum) + .WhereIf(inQuery.IsReturnRequired != null, t => t.IsReturnRequired == inQuery.IsReturnRequired) + .WhereIf(inQuery.IsEnable != null, t => t.IsEnable == inQuery.IsEnable) .ProjectTo(_mapper.ConfigurationProvider); - return await emailNoticeConfigQueryable.ToPagedListAsync(queryEmailNoticeConfig.PageIndex, queryEmailNoticeConfig.PageSize, queryEmailNoticeConfig.SortField, queryEmailNoticeConfig.Asc); + return await emailNoticeConfigQueryable.ToPagedListAsync(inQuery); } diff --git a/IRaCIS.Core.Application/Service/Common/ExploreRecommendService.cs b/IRaCIS.Core.Application/Service/Common/ExploreRecommendService.cs index 944a72442..ee839ffbc 100644 --- a/IRaCIS.Core.Application/Service/Common/ExploreRecommendService.cs +++ b/IRaCIS.Core.Application/Service/Common/ExploreRecommendService.cs @@ -40,8 +40,7 @@ namespace IRaCIS.Core.Application.Service .ProjectTo(_mapper.ConfigurationProvider); var pageList = await exploreRecommendQueryable - .ToPagedListAsync(inQuery.PageIndex, inQuery.PageSize, string.IsNullOrWhiteSpace(inQuery.SortField) ? nameof(ExploreRecommendView.Id) : inQuery.SortField, - inQuery.Asc); + .ToPagedListAsync(inQuery); return pageList; } diff --git a/IRaCIS.Core.Application/Service/Common/InternationalizationService.cs b/IRaCIS.Core.Application/Service/Common/InternationalizationService.cs index d66ba79e1..4fd081a8d 100644 --- a/IRaCIS.Core.Application/Service/Common/InternationalizationService.cs +++ b/IRaCIS.Core.Application/Service/Common/InternationalizationService.cs @@ -113,8 +113,7 @@ namespace IRaCIS.Core.Application.Service .ProjectTo(_mapper.ConfigurationProvider); var pageList = await internationalizationQueryable - .ToPagedListAsync(inQuery.PageIndex, inQuery.PageSize, string.IsNullOrWhiteSpace(inQuery.SortField) ? nameof(InternationalizationView.State) : inQuery.SortField, - inQuery.Asc); + .ToPagedListAsync(inQuery); return pageList; } diff --git a/IRaCIS.Core.Application/Service/Common/PublishLogService.cs b/IRaCIS.Core.Application/Service/Common/PublishLogService.cs index f5e0bc35d..6f64894af 100644 --- a/IRaCIS.Core.Application/Service/Common/PublishLogService.cs +++ b/IRaCIS.Core.Application/Service/Common/PublishLogService.cs @@ -38,7 +38,7 @@ namespace IRaCIS.Core.Application.Service .ProjectTo(_mapper.ConfigurationProvider); var pageList = await publishLogQueryable - .ToPagedListAsync(inQuery.PageIndex, inQuery.PageSize, inQuery.SortField, inQuery.Asc); + .ToPagedListAsync(inQuery); return pageList; } diff --git a/IRaCIS.Core.Application/Service/Common/SystemBasicDataService.cs b/IRaCIS.Core.Application/Service/Common/SystemBasicDataService.cs index b45df75ff..989a59e74 100644 --- a/IRaCIS.Core.Application/Service/Common/SystemBasicDataService.cs +++ b/IRaCIS.Core.Application/Service/Common/SystemBasicDataService.cs @@ -24,15 +24,15 @@ namespace IRaCIS.Core.Application.Services /// /// 模板列表 /// - /// + /// /// [HttpPost] - public async Task> GetSystemBasicDataList(SystemBasicDataQuery querySystemBasicData) + public async Task> GetSystemBasicDataList(SystemBasicDataQuery inQuery) { var systemBasicDataQueryable = _systemBasicDataRepository.Where(t => t.ParentId == null) .ProjectTo(_mapper.ConfigurationProvider); - return await systemBasicDataQueryable.ToPagedListAsync(querySystemBasicData.PageIndex, querySystemBasicData.PageSize, String.IsNullOrEmpty(querySystemBasicData.SortField) ? "Code" : querySystemBasicData.SortField, querySystemBasicData.Asc); + return await systemBasicDataQueryable.ToPagedListAsync(inQuery); } diff --git a/IRaCIS.Core.Application/Service/Doctor/DoctorListService.cs b/IRaCIS.Core.Application/Service/Doctor/DoctorListService.cs index d1344f775..3bfcc8ae7 100644 --- a/IRaCIS.Core.Application/Service/Doctor/DoctorListService.cs +++ b/IRaCIS.Core.Application/Service/Doctor/DoctorListService.cs @@ -21,38 +21,38 @@ namespace IRaCIS.Application.Services /// Reviewer列表分页查询 /// [HttpPost] - public async Task> GetDoctorSearchList(DoctorSearchDTO doctorSearch) + public async Task> GetDoctorSearchList(DoctorSearchDTO inQuery) { // 项目经验 多选 - var evaluationCriteriaCount = doctorSearch.EvaluationCriteriaIdList.Count(); + var evaluationCriteriaCount = inQuery.EvaluationCriteriaIdList.Count(); // 搜索条件 ReadingType 、Subspeciality、Title 多选 - var count = doctorSearch.ReadingTypeIdList.Count + doctorSearch.TitleIdList.Count + doctorSearch.SubspecialityIdList.Count; + var count = inQuery.ReadingTypeIdList.Count + inQuery.TitleIdList.Count + inQuery.SubspecialityIdList.Count; - var guidList = doctorSearch.ReadingTypeIdList.Concat(doctorSearch.SubspecialityIdList).Concat(doctorSearch.TitleIdList); + var guidList = inQuery.ReadingTypeIdList.Concat(inQuery.SubspecialityIdList).Concat(inQuery.TitleIdList); var query = _doctorRepository.AsQueryable() - .WhereIf(doctorSearch.DepartmentId != null, t => t.DepartmentId == doctorSearch.DepartmentId) - .WhereIf(doctorSearch.SpecialityId != null, t => t.SpecialityId == doctorSearch.SpecialityId) - .WhereIf(doctorSearch.HospitalId != null, t => t.HospitalId == doctorSearch.HospitalId) - .WhereIf(doctorSearch.PositionId != null, t => t.PositionId == doctorSearch.PositionId) - .WhereIf(doctorSearch.RankId != null, t => t.RankId == doctorSearch.RankId) - .WhereIf(doctorSearch.ContractorStatus != null, t => t.CooperateStatus == doctorSearch.ContractorStatus) - .WhereIf(doctorSearch.InformationConfirmed != null, t => t.ResumeStatus == doctorSearch.InformationConfirmed) - .WhereIf(doctorSearch.AcceptingNewTrial != null, t => t.AcceptingNewTrial == doctorSearch.AcceptingNewTrial) - .WhereIf(!string.IsNullOrWhiteSpace(doctorSearch.Name), t => t.ChineseName.Contains(doctorSearch.Name) || (t.LastName + t.FirstName).Contains(doctorSearch.Name)) - .WhereIf(doctorSearch.Nation != null, t => t.Nation == doctorSearch.Nation) - .WhereIf(evaluationCriteriaCount > 0, t => t.TrialExperienceCriteriaList.Count(t => doctorSearch.EvaluationCriteriaIdList.Contains(t.EvaluationCriteriaId)) == evaluationCriteriaCount) + .WhereIf(inQuery.DepartmentId != null, t => t.DepartmentId == inQuery.DepartmentId) + .WhereIf(inQuery.SpecialityId != null, t => t.SpecialityId == inQuery.SpecialityId) + .WhereIf(inQuery.HospitalId != null, t => t.HospitalId == inQuery.HospitalId) + .WhereIf(inQuery.PositionId != null, t => t.PositionId == inQuery.PositionId) + .WhereIf(inQuery.RankId != null, t => t.RankId == inQuery.RankId) + .WhereIf(inQuery.ContractorStatus != null, t => t.CooperateStatus == inQuery.ContractorStatus) + .WhereIf(inQuery.InformationConfirmed != null, t => t.ResumeStatus == inQuery.InformationConfirmed) + .WhereIf(inQuery.AcceptingNewTrial != null, t => t.AcceptingNewTrial == inQuery.AcceptingNewTrial) + .WhereIf(!string.IsNullOrWhiteSpace(inQuery.Name), t => t.ChineseName.Contains(inQuery.Name) || (t.LastName + t.FirstName).Contains(inQuery.Name)) + .WhereIf(inQuery.Nation != null, t => t.Nation == inQuery.Nation) + .WhereIf(evaluationCriteriaCount > 0, t => t.TrialExperienceCriteriaList.Count(t => inQuery.EvaluationCriteriaIdList.Contains(t.EvaluationCriteriaId)) == evaluationCriteriaCount) ////用户类型 看到简历的范围这里需要确认 //.WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ReviewerCoordinator, t => t.UserList.Any(u => u.UserId == _userInfo.Id)) .WhereIf(count > 0, t => t.DoctorDicRelationList.Count(u => guidList.Contains(u.DictionaryId)) == count) - .WhereIf(doctorSearch.EnrollStatus != null && doctorSearch.EnrollStatus == (int)ReviewerEnrollStatus.Yes, t => t.EnrollList.Any(u => u.EnrollStatus == EnrollStatus.DoctorReading)) + .WhereIf(inQuery.EnrollStatus != null && inQuery.EnrollStatus == (int)ReviewerEnrollStatus.Yes, t => t.EnrollList.Any(u => u.EnrollStatus == EnrollStatus.DoctorReading)) .ProjectTo(_mapper.ConfigurationProvider); - return await query.ToPagedListAsync(doctorSearch.PageIndex, doctorSearch.PageSize, doctorSearch.SortField == string.Empty ? "CreateTime" : doctorSearch.SortField, doctorSearch.Asc); + return await query.ToPagedListAsync(inQuery); } @@ -64,45 +64,45 @@ namespace IRaCIS.Application.Services /// [HttpPost] public async Task> GetSelectionReviewerList( - ReviewerSelectionQueryDTO selectionQuery) + ReviewerSelectionQueryDTO inQuery) { //项目配置需要的医生过滤 2表示混合 - var trialConfig = await _repository.Where(s => s.Id == selectionQuery.TrialId).Select(t=>new { t.AttendedReviewerTypeEnumList ,t.TrialType} ).FirstOrDefaultAsync().IfNullThrowException(); + var trialConfig = await _repository.Where(s => s.Id == inQuery.TrialId).Select(t=>new { t.AttendedReviewerTypeEnumList ,t.TrialType} ).FirstOrDefaultAsync().IfNullThrowException(); //var nation = trialConfig.AttendedReviewerType; // 临床项目经验 多选 - var evaluationCriteriaCount = selectionQuery.EvaluationCriteriaIdList.Count(); + var evaluationCriteriaCount = inQuery.EvaluationCriteriaIdList.Count(); // 搜索条件 ReadingType 、Subspeciality、Title 多选 - var count = selectionQuery.ReadingTypeIdList.Count + selectionQuery.TitleIdList.Count + selectionQuery.SubspecialityIdList.Count; + var count = inQuery.ReadingTypeIdList.Count + inQuery.TitleIdList.Count + inQuery.SubspecialityIdList.Count; - var guidList = selectionQuery.ReadingTypeIdList.Concat(selectionQuery.SubspecialityIdList).Concat(selectionQuery.TitleIdList); + var guidList = inQuery.ReadingTypeIdList.Concat(inQuery.SubspecialityIdList).Concat(inQuery.TitleIdList); var query = _doctorRepository/*.WhereIf(nation != AttendedReviewerType.USAndCN, t => t.Nation ==(int) nation)*/ - .WhereIf(selectionQuery.DepartmentId != null, t => t.DepartmentId == selectionQuery.DepartmentId) - .WhereIf(selectionQuery.SpecialityId != null, t => t.SpecialityId == selectionQuery.SpecialityId) + .WhereIf(inQuery.DepartmentId != null, t => t.DepartmentId == inQuery.DepartmentId) + .WhereIf(inQuery.SpecialityId != null, t => t.SpecialityId == inQuery.SpecialityId) .WhereIf(trialConfig.TrialType == TrialType.NoneOfficial, t => t.IsVirtual ==true) .WhereIf(trialConfig.TrialType != TrialType.NoneOfficial, t => t.IsVirtual == false) - .WhereIf(selectionQuery.HospitalId != null, t => t.HospitalId == selectionQuery.HospitalId) - .WhereIf(selectionQuery.PositionId != null, t => t.PositionId == selectionQuery.PositionId) - .WhereIf(selectionQuery.RankId != null, t => t.RankId == selectionQuery.RankId) - .WhereIf(selectionQuery.ContractorStatus != null, t => t.CooperateStatus == selectionQuery.ContractorStatus ) - .WhereIf(selectionQuery.InformationConfirmed != null, t => t.ResumeStatus == selectionQuery.InformationConfirmed) - .WhereIf(selectionQuery.AcceptingNewTrial != null, t => t.AcceptingNewTrial == selectionQuery.AcceptingNewTrial) - .WhereIf(!string.IsNullOrWhiteSpace(selectionQuery.Name), t => t.ChineseName.Contains(selectionQuery.Name) || (t.LastName + t.FirstName).Contains(selectionQuery.Name)) - .WhereIf(evaluationCriteriaCount > 0, t => t.TrialExperienceCriteriaList.Count(t => selectionQuery.EvaluationCriteriaIdList.Contains(t.EvaluationCriteriaId)) == evaluationCriteriaCount) + .WhereIf(inQuery.HospitalId != null, t => t.HospitalId == inQuery.HospitalId) + .WhereIf(inQuery.PositionId != null, t => t.PositionId == inQuery.PositionId) + .WhereIf(inQuery.RankId != null, t => t.RankId == inQuery.RankId) + .WhereIf(inQuery.ContractorStatus != null, t => t.CooperateStatus == inQuery.ContractorStatus ) + .WhereIf(inQuery.InformationConfirmed != null, t => t.ResumeStatus == inQuery.InformationConfirmed) + .WhereIf(inQuery.AcceptingNewTrial != null, t => t.AcceptingNewTrial == inQuery.AcceptingNewTrial) + .WhereIf(!string.IsNullOrWhiteSpace(inQuery.Name), t => t.ChineseName.Contains(inQuery.Name) || (t.LastName + t.FirstName).Contains(inQuery.Name)) + .WhereIf(evaluationCriteriaCount > 0, t => t.TrialExperienceCriteriaList.Count(t => inQuery.EvaluationCriteriaIdList.Contains(t.EvaluationCriteriaId)) == evaluationCriteriaCount) //用户类型 看到简历的范围这里需要确认 //.WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ReviewerCoordinator, t => t.UserList.Any(u => u.UserId == _userInfo.Id)) .WhereIf(count > 0, t => t.DoctorDicRelationList.Count(u => guidList.Contains(u.DictionaryId)) == count) - .WhereIf(selectionQuery.EnrollStatus != null && selectionQuery.EnrollStatus == (int)ReviewerEnrollStatus.Yes, t => t.EnrollList.Any(u => u.EnrollStatus == EnrollStatus.DoctorReading)) + .WhereIf(inQuery.EnrollStatus != null && inQuery.EnrollStatus == (int)ReviewerEnrollStatus.Yes, t => t.EnrollList.Any(u => u.EnrollStatus == EnrollStatus.DoctorReading)) .ProjectTo(_mapper.ConfigurationProvider); - var result = await query.ToPagedListAsync(selectionQuery.PageIndex, selectionQuery.PageSize, selectionQuery.SortField == string.Empty ? "ReviewerCode" : selectionQuery.SortField, selectionQuery.Asc); + var result = await query.ToPagedListAsync(inQuery); //是否已申请 申请时间 申请人 - var doctorStateList = await _repository.Where(x => x.TrialId == selectionQuery.TrialId && x.EnrollStatus == EnrollStatus.HasApplyDownloadResume) + var doctorStateList = await _repository.Where(x => x.TrialId == inQuery.TrialId && x.EnrollStatus == EnrollStatus.HasApplyDownloadResume) .ProjectTo(_mapper.ConfigurationProvider).ToListAsync(); result.CurrentPageData.ToList().ForEach(doctor => @@ -130,24 +130,24 @@ namespace IRaCIS.Application.Services /// [HttpPost] public async Task> GetSubmissionOrApprovalReviewerList( - ReviewerSubmissionQueryDTO param) + ReviewerSubmissionQueryDTO inQuery) { - var doctorQuery = _repository.Where(x => x.TrialId == param.TrialId) + var doctorQuery = _repository.Where(x => x.TrialId == inQuery.TrialId) //提交CRO 以及下载简历列表 - .WhereIf(param.IntoGroupSearchState == 1, t => t.EnrollStatus >= EnrollStatus.HasApplyDownloadResume) + .WhereIf(inQuery.IntoGroupSearchState == 1, t => t.EnrollStatus >= EnrollStatus.HasApplyDownloadResume) //CRO确认列表 状态为 已提交CRO - .WhereIf(param.IntoGroupSearchState == 4, t => t.EnrollStatus >= EnrollStatus.HasCommittedToCRO) + .WhereIf(inQuery.IntoGroupSearchState == 4, t => t.EnrollStatus >= EnrollStatus.HasCommittedToCRO) .ProjectTo(_mapper.ConfigurationProvider); - var doctorPageList = await doctorQuery.ToPagedListAsync(param.PageIndex, param.PageSize, param.SortField == "" ? "Code" : param.SortField, param.Asc); + var doctorPageList = await doctorQuery.ToPagedListAsync(inQuery); - var enrollStateList = await _repository.Where(x => x.TrialId == param.TrialId) + var enrollStateList = await _repository.Where(x => x.TrialId == inQuery.TrialId) //提交CRO 以及下载简历列表 - .WhereIf(param.IntoGroupSearchState == 1, t => t.EnrollStatus == EnrollStatus.HasCommittedToCRO) + .WhereIf(inQuery.IntoGroupSearchState == 1, t => t.EnrollStatus == EnrollStatus.HasCommittedToCRO) //CRO确认列表 状态为 已提交CRO - .WhereIf(param.IntoGroupSearchState == 4, t => t.EnrollStatus == EnrollStatus.InviteIntoGroup) + .WhereIf(inQuery.IntoGroupSearchState == 4, t => t.EnrollStatus == EnrollStatus.InviteIntoGroup) .ProjectTo(_mapper.ConfigurationProvider).ToListAsync(); @@ -158,22 +158,22 @@ namespace IRaCIS.Application.Services var opt = enrollStateList.FirstOrDefault(t => t.DoctorId == u.Id); if (opt != null) { - u.DoctorTrialState = param.IntoGroupSearchState == 1 ? (int)EnrollStatus.HasCommittedToCRO : (int)EnrollStatus.InviteIntoGroup; + u.DoctorTrialState = inQuery.IntoGroupSearchState == 1 ? (int)EnrollStatus.HasCommittedToCRO : (int)EnrollStatus.InviteIntoGroup; u.OptTime = opt.OptTime; u.OptUserName = opt.OptUserName; } else { - u.DoctorTrialState = param.IntoGroupSearchState == 1 ? (int)EnrollStatus.HasDownloadResume : (int)EnrollStatus.HasCommittedToCRO; + u.DoctorTrialState = inQuery.IntoGroupSearchState == 1 ? (int)EnrollStatus.HasDownloadResume : (int)EnrollStatus.HasCommittedToCRO; } }); if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.SPM) { //SPM 要看到提交的时间 提交人 - var enrollCommitList = await _repository.Where(x => x.TrialId == param.TrialId) + var enrollCommitList = await _repository.Where(x => x.TrialId == inQuery.TrialId) //提交CRO 以及下载简历列表 - .WhereIf(param.IntoGroupSearchState == 4, t => t.EnrollStatus == EnrollStatus.HasCommittedToCRO) + .WhereIf(inQuery.IntoGroupSearchState == 4, t => t.EnrollStatus == EnrollStatus.HasCommittedToCRO) .ProjectTo(_mapper.ConfigurationProvider).ToListAsync(); @@ -237,16 +237,16 @@ namespace IRaCIS.Application.Services /// [HttpPost] public async Task> GetConfirmationReviewerList( - ReviewerConfirmationQueryDTO param) + ReviewerConfirmationQueryDTO inQuery) { - var doctorQuery = _repository.Where(x => x.TrialId == param.TrialId && x.EnrollStatus >= EnrollStatus.InviteIntoGroup) + var doctorQuery = _repository.Where(x => x.TrialId == inQuery.TrialId && x.EnrollStatus >= EnrollStatus.InviteIntoGroup) .ProjectTo(_mapper.ConfigurationProvider); - var doctorPageList = await doctorQuery.ToPagedListAsync(param.PageIndex, param.PageSize, param.SortField == "" ? "Code" : param.SortField, param.Asc); + var doctorPageList = await doctorQuery.ToPagedListAsync(inQuery); - var enrollStateList = await _repository.Where(x => x.TrialId == param.TrialId && x.EnrollStatus > EnrollStatus.InviteIntoGroup) + var enrollStateList = await _repository.Where(x => x.TrialId == inQuery.TrialId && x.EnrollStatus > EnrollStatus.InviteIntoGroup) .ProjectTo(_mapper.ConfigurationProvider).ToListAsync(); diff --git a/IRaCIS.Core.Application/Service/Doctor/VacationService.cs b/IRaCIS.Core.Application/Service/Doctor/VacationService.cs index 118688920..844b68f03 100644 --- a/IRaCIS.Core.Application/Service/Doctor/VacationService.cs +++ b/IRaCIS.Core.Application/Service/Doctor/VacationService.cs @@ -72,7 +72,7 @@ namespace IRaCIS.Application.Services var query = _vacationRepository.Where(u => u.DoctorId == doctorId) .ProjectTo(_mapper.ConfigurationProvider); - return await query.ToPagedListAsync(pageIndex, pageSize, "StartDate"); + return await query.ToPagedListAsync(new PageInput() { PageIndex = pageIndex,PageSize=pageSize },nameof(VacationCommand.StartDate)); } diff --git a/IRaCIS.Core.Application/Service/Document/SystemDocumentService.cs b/IRaCIS.Core.Application/Service/Document/SystemDocumentService.cs index abde4fd01..d2047a558 100644 --- a/IRaCIS.Core.Application/Service/Document/SystemDocumentService.cs +++ b/IRaCIS.Core.Application/Service/Document/SystemDocumentService.cs @@ -37,17 +37,17 @@ namespace IRaCIS.Core.Application.Services /// /// 管理端列表 /// - /// + /// /// [HttpPost] - public async Task> GetSystemDocumentListAsync(SystemDocumentQuery querySystemDocument) + public async Task> GetSystemDocumentListAsync(SystemDocumentQuery inQuery) { var systemDocumentQueryable = _systemDocumentRepository.AsQueryable(true) - .WhereIf(!string.IsNullOrEmpty(querySystemDocument.Name), t => t.Name.Contains(querySystemDocument.Name)) - .WhereIf(querySystemDocument.FileTypeId != null, t => t.FileTypeId == querySystemDocument.FileTypeId) + .WhereIf(!string.IsNullOrEmpty(inQuery.Name), t => t.Name.Contains(inQuery.Name)) + .WhereIf(inQuery.FileTypeId != null, t => t.FileTypeId == inQuery.FileTypeId) .ProjectTo(_mapper.ConfigurationProvider, new { token = _userInfo.UserToken, userId = _userInfo.Id }); - return await systemDocumentQueryable.ToPagedListAsync(querySystemDocument.PageIndex, querySystemDocument.PageSize, querySystemDocument.SortField, querySystemDocument.Asc); + return await systemDocumentQueryable.ToPagedListAsync(inQuery); } public async Task AddOrUpdateSystemDocumentAsync(AddOrEditSystemDocument addOrEditSystemDocument) @@ -151,11 +151,11 @@ namespace IRaCIS.Core.Application.Services /// /// [HttpPost] - public async Task> getWaitSignSysDocList(SystemDocumentQuery querySystemDocument) + public async Task> getWaitSignSysDocList(SystemDocumentQuery inQuery) { var query = from sysDoc in _systemDocumentRepository.Where(t => t.NeedConfirmedUserTypeList.Any(t => t.NeedConfirmUserTypeId == _userInfo.UserTypeId)) - .WhereIf(!string.IsNullOrEmpty(querySystemDocument.Name), t => t.Name.Contains(querySystemDocument.Name)) - .WhereIf(querySystemDocument.FileTypeId != null, t => t.FileTypeId == querySystemDocument.FileTypeId) + .WhereIf(!string.IsNullOrEmpty(inQuery.Name), t => t.Name.Contains(inQuery.Name)) + .WhereIf(inQuery.FileTypeId != null, t => t.FileTypeId == inQuery.FileTypeId) join confirm in _repository.GetQueryable() on new { ConfirmUserId = _userInfo.Id, SystemDocumentId = sysDoc.Id } equals new { confirm.ConfirmUserId, confirm.SystemDocumentId } into cc from confirm in cc.DefaultIfEmpty() @@ -184,9 +184,9 @@ namespace IRaCIS.Core.Application.Services UserTypeShortName = user.UserTypeRole.UserTypeShortName }; - return await query.WhereIf(querySystemDocument.IsSigned==true,t=>t.ConfirmTime!=null) - .WhereIf(querySystemDocument.IsSigned == false, t => t.ConfirmTime == null) - .ToPagedListAsync(querySystemDocument.PageIndex, querySystemDocument.PageSize, querySystemDocument.SortField, querySystemDocument.Asc); + return await query.WhereIf(inQuery.IsSigned==true,t=>t.ConfirmTime!=null) + .WhereIf(inQuery.IsSigned == false, t => t.ConfirmTime == null) + .ToPagedListAsync(inQuery); diff --git a/IRaCIS.Core.Application/Service/Document/TrialDocumentService.cs b/IRaCIS.Core.Application/Service/Document/TrialDocumentService.cs index 44f1b0324..7e7d13a35 100644 --- a/IRaCIS.Core.Application/Service/Document/TrialDocumentService.cs +++ b/IRaCIS.Core.Application/Service/Document/TrialDocumentService.cs @@ -55,27 +55,27 @@ namespace IRaCIS.Core.Application.Services /// /// Setting 界面的 项目所有文档列表 /// - /// + /// /// [HttpPost] - public async Task> GetTrialDocumentList(TrialDocumentQuery queryTrialDocument) + public async Task> GetTrialDocumentList(TrialDocumentQuery inQuery) { - var trialDocumentQueryable = _trialDocumentRepository.AsQueryable(true).Where(t => t.TrialId == queryTrialDocument.TrialId) - .WhereIf(!string.IsNullOrEmpty(queryTrialDocument.Name), t => t.Name.Contains(queryTrialDocument.Name)) - .WhereIf(queryTrialDocument.FileTypeId != null, t => t.FileTypeId == queryTrialDocument.FileTypeId) - .WhereIf(queryTrialDocument.UserTypeId != null, t => t.NeedConfirmedUserTypeList.Any(t => t.NeedConfirmUserTypeId == queryTrialDocument.UserTypeId)) - .WhereIf(queryTrialDocument.IsDeleted != null, t => t.IsDeleted == queryTrialDocument.IsDeleted) + var trialDocumentQueryable = _trialDocumentRepository.AsQueryable(true).Where(t => t.TrialId == inQuery.TrialId) + .WhereIf(!string.IsNullOrEmpty(inQuery.Name), t => t.Name.Contains(inQuery.Name)) + .WhereIf(inQuery.FileTypeId != null, t => t.FileTypeId == inQuery.FileTypeId) + .WhereIf(inQuery.UserTypeId != null, t => t.NeedConfirmedUserTypeList.Any(t => t.NeedConfirmUserTypeId == inQuery.UserTypeId)) + .WhereIf(inQuery.IsDeleted != null, t => t.IsDeleted == inQuery.IsDeleted) .ProjectTo(_mapper.ConfigurationProvider, new { token = _userInfo.UserToken, isEn_Us = _userInfo.IsEn_Us }); - return await trialDocumentQueryable.ToPagedListAsync(queryTrialDocument.PageIndex, queryTrialDocument.PageSize, queryTrialDocument.SortField, queryTrialDocument.Asc); + return await trialDocumentQueryable.ToPagedListAsync(inQuery); } [HttpPost] - public async Task> GetTrialSignDocumentList(TrialDocQuery querySystemDocument) + public async Task> GetTrialSignDocumentList(TrialDocQuery inQuery) { var trialDocQueryable = from trialDoc in _trialDocumentRepository.AsQueryable(true) - .WhereIf(querySystemDocument.TrialId != null, t => t.TrialId == querySystemDocument.TrialId) + .WhereIf(inQuery.TrialId != null, t => t.TrialId == inQuery.TrialId) .Where(t => t.NeedConfirmedUserTypeList.Any(t => t.NeedConfirmUserTypeId == _userInfo.UserTypeId)) join trialUser in _repository.Where(t => t.UserId == _userInfo.Id) on trialDoc.TrialId equals trialUser.TrialId @@ -110,13 +110,13 @@ namespace IRaCIS.Core.Application.Services }; - trialDocQueryable = trialDocQueryable.WhereIf(!string.IsNullOrEmpty(querySystemDocument.Name), t => t.Name.Contains(querySystemDocument.Name)) - .WhereIf(querySystemDocument.FileTypeId != null, t => t.FileTypeId == querySystemDocument.FileTypeId) - .WhereIf(querySystemDocument.IsSigned == true, t => t.ConfirmTime != null) - .WhereIf(querySystemDocument.IsSigned == false, t => t.ConfirmTime == null); + trialDocQueryable = trialDocQueryable.WhereIf(!string.IsNullOrEmpty(inQuery.Name), t => t.Name.Contains(inQuery.Name)) + .WhereIf(inQuery.FileTypeId != null, t => t.FileTypeId == inQuery.FileTypeId) + .WhereIf(inQuery.IsSigned == true, t => t.ConfirmTime != null) + .WhereIf(inQuery.IsSigned == false, t => t.ConfirmTime == null); - return await trialDocQueryable.ToPagedListAsync(querySystemDocument.PageIndex, querySystemDocument.PageSize, querySystemDocument.SortField, querySystemDocument.Asc); + return await trialDocQueryable.ToPagedListAsync(inQuery); } @@ -170,10 +170,10 @@ namespace IRaCIS.Core.Application.Services /// /// 具体用户看到的 系统文件列表 + 项目类型文档 /// - /// + /// /// [HttpPost] - public async Task>> GetUserDocumentList(TrialUserDocUnionQuery querySystemDocument) + public async Task>> GetUserDocumentList(TrialUserDocUnionQuery inQuery) { #region https://github.com/dotnet/efcore/issues/16243 操作不行 ////系统文档查询 @@ -235,9 +235,9 @@ namespace IRaCIS.Core.Application.Services #endregion - var trialId = querySystemDocument.TrialId; + var trialId = inQuery.TrialId; - var trialInfo = await (_repository.Where(t => t.Id == querySystemDocument.TrialId, ignoreQueryFilters: true).Select(t => new { t.TrialFinishedTime, t.TrialStatusStr }).FirstNotNullAsync()); + var trialInfo = await (_repository.Where(t => t.Id == inQuery.TrialId, ignoreQueryFilters: true).Select(t => new { t.TrialFinishedTime, t.TrialStatusStr }).FirstNotNullAsync()); //系统文档查询 var systemDocumentQueryable = from needConfirmedUserType in _repository.Where(t => t.NeedConfirmUserTypeId == _userInfo.UserTypeId) @@ -245,7 +245,7 @@ namespace IRaCIS.Core.Application.Services .WhereIf(trialInfo.TrialFinishedTime != null, u => u.SystemDocument.CreateTime < trialInfo.TrialFinishedTime) .WhereIf(!_userInfo.IsAdmin, t => t.SystemDocument.IsDeleted == false || (t.SystemDocument.IsDeleted == true && t.SystemDocument.SystemDocConfirmedUserList.Any(t => t.ConfirmUserId == _userInfo.Id))) - join trialUser in _repository.Where(t => t.TrialId == querySystemDocument.TrialId && t.UserId == _userInfo.Id) + join trialUser in _repository.Where(t => t.TrialId == inQuery.TrialId && t.UserId == _userInfo.Id) on needConfirmedUserType.NeedConfirmUserTypeId equals trialUser.User.UserTypeId join confirm in _repository.GetQueryable() on new { ConfirmUserId = trialUser.UserId, SystemDocumentId = needConfirmedUserType.SystemDocumentId } equals new { confirm.ConfirmUserId, confirm.SystemDocumentId } into cc from confirm in cc.DefaultIfEmpty() @@ -275,12 +275,12 @@ namespace IRaCIS.Core.Application.Services }; //项目文档查询 - var trialDocQueryable = from trialDoc in _trialDocumentRepository.AsQueryable(true).Where(t => t.TrialId == querySystemDocument.TrialId) + var trialDocQueryable = from trialDoc in _trialDocumentRepository.AsQueryable(true).Where(t => t.TrialId == inQuery.TrialId) .WhereIf(!_userInfo.IsAdmin, t => t.NeedConfirmedUserTypeList.Any(t => t.NeedConfirmUserTypeId == _userInfo.UserTypeId)) .WhereIf(!_userInfo.IsAdmin, t => t.IsDeleted == false || (t.IsDeleted == true && t.TrialDocConfirmedUserList.Any(t => t.ConfirmUserId == _userInfo.Id))) - join trialUser in _repository.Where(t => t.TrialId == querySystemDocument.TrialId && t.UserId == _userInfo.Id) on trialDoc.TrialId equals trialUser.TrialId - join confirm in _repository.Where(t => t.TrialDocument.TrialId == querySystemDocument.TrialId) on + join trialUser in _repository.Where(t => t.TrialId == inQuery.TrialId && t.UserId == _userInfo.Id) on trialDoc.TrialId equals trialUser.TrialId + join confirm in _repository.Where(t => t.TrialDocument.TrialId == inQuery.TrialId) on new { trialUser.UserId, TrialDocumentId = trialDoc.Id } equals new { UserId = confirm.ConfirmUserId, confirm.TrialDocumentId } into cc from confirm in cc.DefaultIfEmpty() select new UnionDocumentWithConfirmInfoView() @@ -309,14 +309,14 @@ namespace IRaCIS.Core.Application.Services #region 报错 奇怪的bug var unionQuery = systemDocumentQueryable.Union(trialDocQueryable) - .WhereIf(!string.IsNullOrEmpty(querySystemDocument.Name), t => t.Name.Contains(querySystemDocument.Name)) - .WhereIf(querySystemDocument.FileTypeId != null, t => t.FileTypeId == querySystemDocument.FileTypeId) - .WhereIf(querySystemDocument.IsSign == true, t => t.ConfirmTime != null) - .WhereIf(querySystemDocument.IsSign == false, t => t.ConfirmTime == null); + .WhereIf(!string.IsNullOrEmpty(inQuery.Name), t => t.Name.Contains(inQuery.Name)) + .WhereIf(inQuery.FileTypeId != null, t => t.FileTypeId == inQuery.FileTypeId) + .WhereIf(inQuery.IsSign == true, t => t.ConfirmTime != null) + .WhereIf(inQuery.IsSign == false, t => t.ConfirmTime == null); - var result = await unionQuery.ToPagedListAsync(querySystemDocument.PageIndex, querySystemDocument.PageSize, querySystemDocument.SortField, querySystemDocument.Asc); + var result = await unionQuery.ToPagedListAsync(inQuery); #endregion #region 临时方案 @@ -342,7 +342,7 @@ namespace IRaCIS.Core.Application.Services - var needSignTrialDocCount = await _trialDocumentRepository.AsQueryable(true).Where(t => t.TrialId == querySystemDocument.TrialId && t.Trial.TrialStatusStr != StaticData.TrialState.TrialStopped) + var needSignTrialDocCount = await _trialDocumentRepository.AsQueryable(true).Where(t => t.TrialId == inQuery.TrialId && t.Trial.TrialStatusStr != StaticData.TrialState.TrialStopped) .Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id)) .Where(t => t.IsDeleted == false && !t.TrialDocConfirmedUserList.Any(t => t.ConfirmUserId == _userInfo.Id && t.ConfirmTime != null) && t.NeedConfirmedUserTypeList.Any(u => u.NeedConfirmUserTypeId == _userInfo.UserTypeId)) .CountAsync(); @@ -352,7 +352,7 @@ namespace IRaCIS.Core.Application.Services .Where(t => t.IsDeleted == false && !t.SystemDocConfirmedUserList.Any(t => t.ConfirmUserId == _userInfo.Id && t.ConfirmTime != null) && t.NeedConfirmedUserTypeList.Any(u => u.NeedConfirmUserTypeId == _userInfo.UserTypeId)) .CountAsync(); - var trialTaskConfig = _trialRepository.Where(t => t.Id == querySystemDocument.TrialId).ProjectTo(_mapper.ConfigurationProvider).FirstOrDefault(); + var trialTaskConfig = _trialRepository.Where(t => t.Id == inQuery.TrialId).ProjectTo(_mapper.ConfigurationProvider).FirstOrDefault(); @@ -489,7 +489,7 @@ namespace IRaCIS.Core.Application.Services .WhereIf(inQuery.IsDeleted != null, t => t.IsDeleted == inQuery.IsDeleted) .WhereIf(inQuery.UserTypeId != null, t => t.UserTypeId == inQuery.UserTypeId); - var result = await unionQuery.ToPagedListAsync(inQuery.PageIndex, inQuery.PageSize, inQuery.SortField, inQuery.Asc); + var result = await unionQuery.ToPagedListAsync(inQuery); var needSignTrialDocCount = await _trialDocumentRepository.AsQueryable(true) .Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id)) @@ -819,11 +819,11 @@ namespace IRaCIS.Core.Application.Services /// /// 从 文档的维度 先看到文档列表(系统文档+项目文档 以及需要确认的人数 和已经确认人数) 点击数字查看某文档下面人确认情况 /// - /// + /// /// [HttpPost] [Obsolete] - public async Task> GetTrialSystemDocumentList(DocumentTrialUnionQuery querySystemDocument) + public async Task> GetTrialSystemDocumentList(DocumentTrialUnionQuery inQuery) { var systemDocumentQueryable = _repository .WhereIf(!_userInfo.IsAdmin, t => t.IsDeleted == false) @@ -842,10 +842,10 @@ namespace IRaCIS.Core.Application.Services DocumentConfirmedUserCount = t.SystemDocConfirmedUserList.Count(), //DocumentUserCount= _trialUserRepository.Where(tu=>tu.TrialId== querySystemDocument.TrialId).Count(u=>t.NeedConfirmedUserTypeList.Any(cc=>cc.NeedConfirmUserTypeId== u.User.UserTypeId )) - DocumentUserCount = t.NeedConfirmedUserTypeList.SelectMany(u => u.UserTypeRole.UserList.SelectMany(b => b.UserTrials.Where(r => r.TrialId == querySystemDocument.TrialId))).Count() + DocumentUserCount = t.NeedConfirmedUserTypeList.SelectMany(u => u.UserTypeRole.UserList.SelectMany(b => b.UserTrials.Where(r => r.TrialId == inQuery.TrialId))).Count() }); - var trialDocQueryable = _trialDocumentRepository.Where(t => t.TrialId == querySystemDocument.TrialId).Select(t => new DocumentUnionWithUserStatView() + var trialDocQueryable = _trialDocumentRepository.Where(t => t.TrialId == inQuery.TrialId).Select(t => new DocumentUnionWithUserStatView() { Id = t.Id, IsSystemDoc = false, @@ -864,10 +864,10 @@ namespace IRaCIS.Core.Application.Services }); var unionQuery = systemDocumentQueryable.Union(trialDocQueryable) - .WhereIf(!string.IsNullOrEmpty(querySystemDocument.Name), t => t.Name.Contains(querySystemDocument.Name)) - .WhereIf(querySystemDocument.FileTypeId != null, t => t.FileTypeId == querySystemDocument.FileTypeId); + .WhereIf(!string.IsNullOrEmpty(inQuery.Name), t => t.Name.Contains(inQuery.Name)) + .WhereIf(inQuery.FileTypeId != null, t => t.FileTypeId == inQuery.FileTypeId); - return await unionQuery.ToPagedListAsync(querySystemDocument.PageIndex, querySystemDocument.PageSize, querySystemDocument.SortField, querySystemDocument.Asc); + return await unionQuery.ToPagedListAsync(inQuery); } #endregion diff --git a/IRaCIS.Core.Application/Service/Document/TrialEmailNoticeConfigService.cs b/IRaCIS.Core.Application/Service/Document/TrialEmailNoticeConfigService.cs index 5698b1e26..95034f2ef 100644 --- a/IRaCIS.Core.Application/Service/Document/TrialEmailNoticeConfigService.cs +++ b/IRaCIS.Core.Application/Service/Document/TrialEmailNoticeConfigService.cs @@ -1266,21 +1266,21 @@ namespace IRaCIS.Core.Application.Service /// /// 获取系统 邮件配置 勾选列表 /// - /// + /// /// [HttpPost] - public async Task> GetSysEmailNoticeConfigList(EmailNoticeConfigQuery queryEmailNoticeConfig) + public async Task> GetSysEmailNoticeConfigList(EmailNoticeConfigQuery inQuery) { var emailNoticeConfigQueryable = _emailNoticeConfigRepository - .WhereIf(queryEmailNoticeConfig.SystemLevel == null, t => t.SystemLevel == SysEmailLevel.not_sys) - .WhereIf(queryEmailNoticeConfig.SystemLevel != null, t => t.SystemLevel == queryEmailNoticeConfig.SystemLevel) - .WhereIf(queryEmailNoticeConfig.BusinessScenarioEnum != null, t => t.BusinessScenarioEnum == queryEmailNoticeConfig.BusinessScenarioEnum) - .WhereIf(queryEmailNoticeConfig.IsReturnRequired != null, t => t.IsReturnRequired == queryEmailNoticeConfig.IsReturnRequired) - .WhereIf(queryEmailNoticeConfig.IsEnable != null, t => t.IsEnable == queryEmailNoticeConfig.IsEnable) - .WhereIf(queryEmailNoticeConfig.IsDistinguishCriteria != null, t => t.IsDistinguishCriteria == queryEmailNoticeConfig.IsDistinguishCriteria) - .ProjectTo(_mapper.ConfigurationProvider, new { trialId = queryEmailNoticeConfig.TrialId }); + .WhereIf(inQuery.SystemLevel == null, t => t.SystemLevel == SysEmailLevel.not_sys) + .WhereIf(inQuery.SystemLevel != null, t => t.SystemLevel == inQuery.SystemLevel) + .WhereIf(inQuery.BusinessScenarioEnum != null, t => t.BusinessScenarioEnum == inQuery.BusinessScenarioEnum) + .WhereIf(inQuery.IsReturnRequired != null, t => t.IsReturnRequired == inQuery.IsReturnRequired) + .WhereIf(inQuery.IsEnable != null, t => t.IsEnable == inQuery.IsEnable) + .WhereIf(inQuery.IsDistinguishCriteria != null, t => t.IsDistinguishCriteria == inQuery.IsDistinguishCriteria) + .ProjectTo(_mapper.ConfigurationProvider, new { trialId = inQuery.TrialId }); - return await emailNoticeConfigQueryable.ToPagedListAsync(queryEmailNoticeConfig.PageIndex, queryEmailNoticeConfig.PageSize, queryEmailNoticeConfig.SortField, queryEmailNoticeConfig.Asc); + return await emailNoticeConfigQueryable.ToPagedListAsync(inQuery); } /// diff --git a/IRaCIS.Core.Application/Service/Financial/ExchangeRateService.cs b/IRaCIS.Core.Application/Service/Financial/ExchangeRateService.cs index 1b686ac17..7dc010deb 100644 --- a/IRaCIS.Core.Application/Service/Financial/ExchangeRateService.cs +++ b/IRaCIS.Core.Application/Service/Financial/ExchangeRateService.cs @@ -99,16 +99,16 @@ namespace IRaCIS.Application.Services } [HttpPost] - public async Task> GetExchangeRateList(ExchangeRateQueryDTO queryParam) + public async Task> GetExchangeRateList(ExchangeRateQueryDTO inQuery) { - var yearMonth = queryParam.SearchMonth?.ToString("yyyy-MM"); + var yearMonth = inQuery.SearchMonth?.ToString("yyyy-MM"); var exchangeRateQueryable = _exchangeRateRepository.AsQueryable() - .WhereIf(queryParam.SearchMonth != null, o => o.YearMonth == yearMonth) + .WhereIf(inQuery.SearchMonth != null, o => o.YearMonth == yearMonth) .ProjectTo(_mapper.ConfigurationProvider); - return await exchangeRateQueryable.ToPagedListAsync(queryParam.PageIndex, queryParam.PageSize, "YearMonth", false); + return await exchangeRateQueryable.ToPagedListAsync(inQuery); diff --git a/IRaCIS.Core.Application/Service/Financial/FinancialService.cs b/IRaCIS.Core.Application/Service/Financial/FinancialService.cs index 7ddd39012..d1fffa024 100644 --- a/IRaCIS.Core.Application/Service/Financial/FinancialService.cs +++ b/IRaCIS.Core.Application/Service/Financial/FinancialService.cs @@ -63,7 +63,7 @@ namespace IRaCIS.Application.Services /// Financials /MonthlyPayment 列表查询接口 /// [NonDynamicMethod] - public async Task> GetMonthlyPaymentList(MonthlyPaymentQueryDTO queryParam) + public async Task> GetMonthlyPaymentList(MonthlyPaymentQueryDTO inQuery) { //var year = queryParam.StatisticsDate.Year; //var month = queryParam.StatisticsDate.Month; @@ -74,21 +74,21 @@ namespace IRaCIS.Application.Services //var rate = _exchangeRateRepository.FindSingleOrDefault(u => u.YearMonth == yearMonth); //var exchangeRate = rate == null ? 0 : rate.Rate; - var yearMonth = queryParam.StatisticsDate.ToString("yyyy-MM"); + var yearMonth = inQuery.StatisticsDate.ToString("yyyy-MM"); Expression> doctorLambda = x => true; - if (!string.IsNullOrWhiteSpace(queryParam.KeyWord)) + if (!string.IsNullOrWhiteSpace(inQuery.KeyWord)) { - var reviewer = queryParam.KeyWord.Trim(); + var reviewer = inQuery.KeyWord.Trim(); doctorLambda = doctorLambda.And(u => u.ChineseName.Contains(reviewer) || u.FirstName.Contains(reviewer) || u.LastName.Contains(reviewer) || u.ReviewerCode.Contains(reviewer)); } - if (queryParam.Nation != null) + if (inQuery.Nation != null) { - doctorLambda = doctorLambda.And(u => u.Nation == queryParam.Nation); + doctorLambda = doctorLambda.And(u => u.Nation == inQuery.Nation); } var costStatisticsQueryable = @@ -132,7 +132,7 @@ namespace IRaCIS.Application.Services - return await costStatisticsQueryable.ToPagedListAsync(queryParam.PageIndex, queryParam.PageSize, string.IsNullOrWhiteSpace(queryParam.SortField) ? "Code" : queryParam.SortField, queryParam.Asc); + return await costStatisticsQueryable.ToPagedListAsync(inQuery); //var propName = string.IsNullOrWhiteSpace(queryParam.SortField) ? "Code" : queryParam.SortField; //costStatisticsQueryable = queryParam.Asc ? costStatisticsQueryable.OrderBy(propName).ThenBy(u => u.Code) @@ -317,23 +317,23 @@ namespace IRaCIS.Application.Services /// Financials / Payment History 列表查询接口(已经支付锁定的数据,包含调整的)[New] /// [HttpPost] - public async Task> GetPaymentHistoryList(PaymentQueryDTO queryParam) + public async Task> GetPaymentHistoryList(PaymentQueryDTO inQuery) { Expression> doctorLambda = x => true; - if (!string.IsNullOrWhiteSpace(queryParam.Reviewer)) + if (!string.IsNullOrWhiteSpace(inQuery.Reviewer)) { - var reviewer = queryParam.Reviewer.Trim(); + var reviewer = inQuery.Reviewer.Trim(); doctorLambda = doctorLambda.And(u => u.ChineseName.Contains(reviewer) || u.FirstName.Contains(reviewer) || u.LastName.Contains(reviewer) || u.ReviewerCode.Contains(reviewer)); } - if (queryParam.Nation != null) + if (inQuery.Nation != null) { - doctorLambda = doctorLambda.And(u => u.Nation == queryParam.Nation); + doctorLambda = doctorLambda.And(u => u.Nation == inQuery.Nation); } - Expression> paymentLambda = x => x.IsLock && x.YearMonthDate >= queryParam.BeginMonth && x.YearMonthDate <= queryParam.EndMonth; + Expression> paymentLambda = x => x.IsLock && x.YearMonthDate >= inQuery.BeginMonth && x.YearMonthDate <= inQuery.EndMonth; #region 在 payment表加 调整总计前 @@ -416,7 +416,7 @@ namespace IRaCIS.Application.Services TotalUSD = monthlyPay.AdjustmentUSD + monthlyPay.PaymentUSD }; - return await query.ToPagedListAsync(queryParam.PageIndex, queryParam.PageSize, string.IsNullOrWhiteSpace(queryParam.SortField) ? "ReviewerCode" : queryParam.SortField, queryParam.Asc); + return await query.ToPagedListAsync(inQuery); //var propName = queryParam.SortField == string.Empty ? "ReviewerCode" : queryParam.SortField; //query = queryParam.Asc ? query.OrderBy(propName).ThenBy(u => u.ReviewerCode) : query.OrderByDescending(propName).ThenBy(u => u.ReviewerCode); diff --git a/IRaCIS.Core.Application/Service/Financial/PaymentAdjustmentService.cs b/IRaCIS.Core.Application/Service/Financial/PaymentAdjustmentService.cs index 754ec091a..583121eb4 100644 --- a/IRaCIS.Core.Application/Service/Financial/PaymentAdjustmentService.cs +++ b/IRaCIS.Core.Application/Service/Financial/PaymentAdjustmentService.cs @@ -231,19 +231,19 @@ namespace IRaCIS.Application.Services /// 获取费用调整列表 /// [HttpPost] - public async Task> GetPaymentAdjustmentList(PaymentAdjustmentQueryDTO queryParam) + public async Task> GetPaymentAdjustmentList(PaymentAdjustmentQueryDTO inQuery) { - var beginYearMonth = queryParam.BeginMonth.AddDays(1 - queryParam.BeginMonth.Day); - var endYearMonth = queryParam.EndMonth.AddDays(1 - queryParam.EndMonth.Day).AddMonths(1).AddDays(-1); + var beginYearMonth = inQuery.BeginMonth.AddDays(1 - inQuery.BeginMonth.Day); + var endYearMonth = inQuery.EndMonth.AddDays(1 - inQuery.EndMonth.Day).AddMonths(1).AddDays(-1); var costAdjustmentQueryable = from costAdjustment in _payAdjustmentRepository .Where(t => t.YearMonthDate >= beginYearMonth && t.YearMonthDate <= endYearMonth) join doctor in _doctorRepository.AsQueryable(). - WhereIf(!string.IsNullOrWhiteSpace(queryParam.Reviewer), - u => u.ChineseName.Contains(queryParam.Reviewer) || - (u.LastName + u.FirstName).Contains(queryParam.Reviewer) || - u.ReviewerCode.Contains(queryParam.Reviewer)) + WhereIf(!string.IsNullOrWhiteSpace(inQuery.Reviewer), + u => u.ChineseName.Contains(inQuery.Reviewer) || + (u.LastName + u.FirstName).Contains(inQuery.Reviewer) || + u.ReviewerCode.Contains(inQuery.Reviewer)) on costAdjustment.ReviewerId equals doctor.Id select new PaymentAdjustmentDetailDTO() @@ -262,7 +262,7 @@ namespace IRaCIS.Application.Services ChineseName = doctor.ChineseName }; - return await costAdjustmentQueryable.ToPagedListAsync(queryParam.PageIndex, queryParam.PageSize, string.IsNullOrWhiteSpace(queryParam.SortField) ? "YearMonthDate" : queryParam.SortField, queryParam.Asc); + return await costAdjustmentQueryable.ToPagedListAsync(inQuery); } diff --git a/IRaCIS.Core.Application/Service/Financial/RankPriceService.cs b/IRaCIS.Core.Application/Service/Financial/RankPriceService.cs index b5bb009b7..926d9de1d 100644 --- a/IRaCIS.Core.Application/Service/Financial/RankPriceService.cs +++ b/IRaCIS.Core.Application/Service/Financial/RankPriceService.cs @@ -86,10 +86,10 @@ namespace IRaCIS.Application.Services /// 获取职称单价列表 /// [HttpPost] - public async Task> GetRankPriceList(RankPriceQueryDTO queryParam) + public async Task> GetRankPriceList(RankPriceQueryDTO inQuery) { var rankPriceQueryable = _rankPriceRepository.ProjectTo(_mapper.ConfigurationProvider); - return await rankPriceQueryable.ToPagedListAsync(queryParam.PageIndex, queryParam.PageSize, "ShowOrder", queryParam.Asc); + return await rankPriceQueryable.ToPagedListAsync(inQuery); } diff --git a/IRaCIS.Core.Application/Service/Financial/ReviewerPayInfoService.cs b/IRaCIS.Core.Application/Service/Financial/ReviewerPayInfoService.cs index 3f12a31f6..9968ab9e3 100644 --- a/IRaCIS.Core.Application/Service/Financial/ReviewerPayInfoService.cs +++ b/IRaCIS.Core.Application/Service/Financial/ReviewerPayInfoService.cs @@ -52,14 +52,14 @@ namespace IRaCIS.Application.Services /// 获取医生支付信息列表 /// [HttpPost] - public async Task> GetReviewerPayInfoList(DoctorPaymentInfoQueryDTO queryParam) + public async Task> GetReviewerPayInfoList(DoctorPaymentInfoQueryDTO inQuery) { var doctorQueryable = from doctor in _doctorRepository.AsQueryable() - .WhereIf(queryParam.HospitalId != null, o => o.HospitalId == queryParam.HospitalId) - .WhereIf(!string.IsNullOrEmpty(queryParam.SearchName), - u => u.ChineseName.Contains(queryParam.SearchName)|| (u.LastName+ u.FirstName).Contains(queryParam.SearchName)) + .WhereIf(inQuery.HospitalId != null, o => o.HospitalId == inQuery.HospitalId) + .WhereIf(!string.IsNullOrEmpty(inQuery.SearchName), + u => u.ChineseName.Contains(inQuery.SearchName)|| (u.LastName+ u.FirstName).Contains(inQuery.SearchName)) join hospitalItem in _hospitalRepository.AsQueryable() on doctor.HospitalId equals hospitalItem.Id into gt from hospital in gt.DefaultIfEmpty() join trialPayInfo in _doctorPayInfoRepository.Where() @@ -88,7 +88,7 @@ namespace IRaCIS.Application.Services CreateTime = doctor.CreateTime }; - return await doctorQueryable.ToPagedListAsync(queryParam.PageIndex, queryParam.PageSize, "Code", queryParam.Asc); + return await doctorQueryable.ToPagedListAsync(inQuery); } diff --git a/IRaCIS.Core.Application/Service/Financial/TrialPaymentPriceService.cs b/IRaCIS.Core.Application/Service/Financial/TrialPaymentPriceService.cs index 3f8091bdf..22377d2e2 100644 --- a/IRaCIS.Core.Application/Service/Financial/TrialPaymentPriceService.cs +++ b/IRaCIS.Core.Application/Service/Financial/TrialPaymentPriceService.cs @@ -92,7 +92,7 @@ namespace IRaCIS.Application.Services /// 获取项目支付价格信息列表 /// [HttpPost] - public async Task> GetTrialPaymentPriceList(TrialPaymentPriceQueryDTO queryParam) + public async Task> GetTrialPaymentPriceList(TrialPaymentPriceQueryDTO inQuery) { #region hwt //var trialQueryable = from trial in _trialRepository.AsQueryable() @@ -171,11 +171,11 @@ namespace IRaCIS.Application.Services #region byzhouhang 方式二 var trialQueryable2 = _trialExtRepository.Where(t => t.Trial.IsDeleted == false) - .WhereIf(queryParam.CroId != null, o => o.Trial.CROId == queryParam.CroId) - .WhereIf(!string.IsNullOrEmpty(queryParam.KeyWord), o => o.Trial.TrialCode.Contains(queryParam.KeyWord) || o.Trial.Indication.Contains(queryParam.KeyWord)) + .WhereIf(inQuery.CroId != null, o => o.Trial.CROId == inQuery.CroId) + .WhereIf(!string.IsNullOrEmpty(inQuery.KeyWord), o => o.Trial.TrialCode.Contains(inQuery.KeyWord) || o.Trial.Indication.Contains(inQuery.KeyWord)) .ProjectTo(_mapper.ConfigurationProvider); - return await trialQueryable2.ToPagedListAsync(queryParam.PageIndex, queryParam.PageSize, string.IsNullOrEmpty(queryParam.SortField) ? "CreateTime" : queryParam.SortField, queryParam.Asc); + return await trialQueryable2.ToPagedListAsync(inQuery); #endregion diff --git a/IRaCIS.Core.Application/Service/Financial/TrialRevenuesPriceService.cs b/IRaCIS.Core.Application/Service/Financial/TrialRevenuesPriceService.cs index 28d088a11..26db169ab 100644 --- a/IRaCIS.Core.Application/Service/Financial/TrialRevenuesPriceService.cs +++ b/IRaCIS.Core.Application/Service/Financial/TrialRevenuesPriceService.cs @@ -108,12 +108,12 @@ namespace IRaCIS.Application.Services /// 获取项目收入费用信息列表[New] /// [HttpPost] - public async Task> GetTrialRevenuesPriceList(TrialRevenuesPriceQueryDTO queryParam) + public async Task> GetTrialRevenuesPriceList(TrialRevenuesPriceQueryDTO inQuery) { var trialQueryable = from trial in _trialRepository.AsQueryable() - .Where(u => u.TrialCode.Contains(queryParam.KeyWord)|| u.Indication.Contains(queryParam.KeyWord)) - .WhereIf(queryParam.CroId != null, o => o.CROId == queryParam.CroId) + .Where(u => u.TrialCode.Contains(inQuery.KeyWord)|| u.Indication.Contains(inQuery.KeyWord)) + .WhereIf(inQuery.CroId != null, o => o.CROId == inQuery.CroId) join cro in _croRepository.AsQueryable() on trial.CROId equals cro.Id into CRO from croInfo in CRO.DefaultIfEmpty() join dic in _dictionaryRepository.AsQueryable() on trial.ReviewModeId equals dic.Id into dict @@ -143,7 +143,7 @@ namespace IRaCIS.Application.Services }; - return await trialQueryable.ToPagedListAsync(queryParam.PageIndex, queryParam.PageSize, "TrialCode", queryParam.Asc); + return await trialQueryable.ToPagedListAsync(inQuery); } diff --git a/IRaCIS.Core.Application/Service/Financial/VolumeRewardService.cs b/IRaCIS.Core.Application/Service/Financial/VolumeRewardService.cs index 35fc890d6..6bab2ba44 100644 --- a/IRaCIS.Core.Application/Service/Financial/VolumeRewardService.cs +++ b/IRaCIS.Core.Application/Service/Financial/VolumeRewardService.cs @@ -50,11 +50,11 @@ namespace IRaCIS.Application.Services /// 分页获取奖励单价列表 /// [HttpPost] - public async Task> GetVolumeRewardPriceList(AwardPriceQueryDTO queryParam) + public async Task> GetVolumeRewardPriceList(AwardPriceQueryDTO inQuery) { var awardPriceQueryable = _volumeRewardRepository.ProjectTo(_mapper.ConfigurationProvider); - return await awardPriceQueryable.ToPagedListAsync(queryParam.PageIndex, queryParam.PageSize, "Min"); + return await awardPriceQueryable.ToPagedListAsync(inQuery); } } diff --git a/IRaCIS.Core.Application/Service/ImageAndDoc/StudyService.cs b/IRaCIS.Core.Application/Service/ImageAndDoc/StudyService.cs index 810997566..e4dc3a338 100644 --- a/IRaCIS.Core.Application/Service/ImageAndDoc/StudyService.cs +++ b/IRaCIS.Core.Application/Service/ImageAndDoc/StudyService.cs @@ -357,16 +357,16 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc [HttpPost] - public async Task> GetDicomAndNoneDicomStudyList(StudyQuery studyQuery) + public async Task> GetDicomAndNoneDicomStudyList(StudyQuery inQuery) { - var svExpression = QCCommon.GetDicomStudySubjectVisitFilter(studyQuery.VisitPlanArray); + var svExpression = QCCommon.GetDicomStudySubjectVisitFilter(inQuery.VisitPlanArray); - var dicomStudyQuery = _repository.Where(t => t.TrialId == studyQuery.TrialId) + var dicomStudyQuery = _repository.Where(t => t.TrialId == inQuery.TrialId) .WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.CRA, t => t.Subject.TrialSite.CRCUserList.Any(t => t.UserId == _userInfo.Id)) //.WhereIf(!string.IsNullOrEmpty(studyQuery.VisitPlanInfo), studyQuery.VisitPlanInfo.Contains('.') ? t => t.SubjectVisit.VisitNum.ToString().Contains(".") : t => t.SubjectVisit.VisitNum == decimal.Parse(studyQuery.VisitPlanInfo)) - .WhereIf(studyQuery.VisitPlanArray != null && studyQuery.VisitPlanArray?.Length > 0, svExpression) - .WhereIf(!string.IsNullOrWhiteSpace(studyQuery.SubjectInfo), t => t.Subject.Code.Contains(studyQuery.SubjectInfo)) + .WhereIf(inQuery.VisitPlanArray != null && inQuery.VisitPlanArray?.Length > 0, svExpression) + .WhereIf(!string.IsNullOrWhiteSpace(inQuery.SubjectInfo), t => t.Subject.Code.Contains(inQuery.SubjectInfo)) .Select(t => new UnionStudyViewModel() { TrialId = t.TrialId, @@ -408,14 +408,14 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc //.ProjectTo(_mapper.ConfigurationProvider); - var svExpression2 = QCCommon.GetNoneDicomStudySubjectVisitFilter(studyQuery.VisitPlanArray); + var svExpression2 = QCCommon.GetNoneDicomStudySubjectVisitFilter(inQuery.VisitPlanArray); - var nodeDicomStudyQuery = _repository.Where(t => t.TrialId == studyQuery.TrialId) + var nodeDicomStudyQuery = _repository.Where(t => t.TrialId == inQuery.TrialId) .WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.CRA, t => t.Subject.TrialSite.CRCUserList.Any(t => t.UserId == _userInfo.Id)) //.WhereIf(!string.IsNullOrEmpty(studyQuery.VisitPlanInfo), studyQuery.VisitPlanInfo.Contains('.') ? t => t.SubjectVisit.VisitNum.ToString().Contains(".") : t => t.SubjectVisit.VisitNum == decimal.Parse(studyQuery.VisitPlanInfo)) - .WhereIf(studyQuery.VisitPlanArray != null && studyQuery.VisitPlanArray?.Length > 0, svExpression2) - .WhereIf(!string.IsNullOrWhiteSpace(studyQuery.SubjectInfo), t => t.Subject.Code.Contains(studyQuery.SubjectInfo)) + .WhereIf(inQuery.VisitPlanArray != null && inQuery.VisitPlanArray?.Length > 0, svExpression2) + .WhereIf(!string.IsNullOrWhiteSpace(inQuery.SubjectInfo), t => t.Subject.Code.Contains(inQuery.SubjectInfo)) .Select(t => new UnionStudyViewModel() { @@ -460,12 +460,12 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc var unionQuery = dicomStudyQuery.Union(nodeDicomStudyQuery) - .WhereIf(studyQuery.SubjectId != null, t => t.SubjectId == studyQuery.SubjectId) - .WhereIf(studyQuery.SubjectVisitId != null, t => t.SubjectId == studyQuery.SubjectVisitId) - .WhereIf(studyQuery.TrialSiteId != null, t => t.TrialSiteId == studyQuery.TrialSiteId) - .WhereIf(studyQuery.IsFromPACS != null, t => t.IsFromPACS == studyQuery.IsFromPACS); + .WhereIf(inQuery.SubjectId != null, t => t.SubjectId == inQuery.SubjectId) + .WhereIf(inQuery.SubjectVisitId != null, t => t.SubjectId == inQuery.SubjectVisitId) + .WhereIf(inQuery.TrialSiteId != null, t => t.TrialSiteId == inQuery.TrialSiteId) + .WhereIf(inQuery.IsFromPACS != null, t => t.IsFromPACS == inQuery.IsFromPACS); - return await unionQuery.ToPagedListAsync(studyQuery.PageIndex, studyQuery.PageSize, studyQuery.SortField, studyQuery.Asc); + return await unionQuery.ToPagedListAsync(inQuery); } @@ -528,7 +528,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc }); - return await StudyMonitorQuery.ToPagedListAsync(inQuery.PageIndex, inQuery.PageSize, string.IsNullOrEmpty(inQuery.SortField) ? "UploadTime" : inQuery.SortField, inQuery.Asc); + return await StudyMonitorQuery.ToPagedListAsync(inQuery); diff --git a/IRaCIS.Core.Application/Service/ImageAndDoc/SystemAnonymizationService.cs b/IRaCIS.Core.Application/Service/ImageAndDoc/SystemAnonymizationService.cs index a2c4d82bf..3d45cb3ce 100644 --- a/IRaCIS.Core.Application/Service/ImageAndDoc/SystemAnonymizationService.cs +++ b/IRaCIS.Core.Application/Service/ImageAndDoc/SystemAnonymizationService.cs @@ -24,17 +24,17 @@ namespace IRaCIS.Core.Application.Service } [HttpPost] - public async Task> GetSystemAnonymizationList(SystemAnonymizationQuery querySystemAnonymization) + public async Task> GetSystemAnonymizationList(SystemAnonymizationQuery inQuery) { var systemAnonymizationQueryable = systemAnonymizationRepository - .WhereIf(!string.IsNullOrEmpty(querySystemAnonymization.Group), t => t.Group.Contains(querySystemAnonymization.Group)) - .WhereIf(!string.IsNullOrEmpty(querySystemAnonymization.Element), t => t.Element.Contains(querySystemAnonymization.Element)) - .WhereIf(querySystemAnonymization.IsAdd != null, t => t.IsAdd == querySystemAnonymization.IsAdd) - .WhereIf(!string.IsNullOrEmpty(querySystemAnonymization.ValueRepresentation), t => t.ValueRepresentation.Contains(querySystemAnonymization.ValueRepresentation)) + .WhereIf(!string.IsNullOrEmpty(inQuery.Group), t => t.Group.Contains(inQuery.Group)) + .WhereIf(!string.IsNullOrEmpty(inQuery.Element), t => t.Element.Contains(inQuery.Element)) + .WhereIf(inQuery.IsAdd != null, t => t.IsAdd == inQuery.IsAdd) + .WhereIf(!string.IsNullOrEmpty(inQuery.ValueRepresentation), t => t.ValueRepresentation.Contains(inQuery.ValueRepresentation)) .ProjectTo(_mapper.ConfigurationProvider); - return await systemAnonymizationQueryable.ToPagedListAsync(querySystemAnonymization.PageIndex, querySystemAnonymization.PageSize, querySystemAnonymization.SortField, querySystemAnonymization.Asc); + return await systemAnonymizationQueryable.ToPagedListAsync(inQuery); } diff --git a/IRaCIS.Core.Application/Service/Inspection/InspectionService.cs b/IRaCIS.Core.Application/Service/Inspection/InspectionService.cs index c73aa2032..dc20f7511 100644 --- a/IRaCIS.Core.Application/Service/Inspection/InspectionService.cs +++ b/IRaCIS.Core.Application/Service/Inspection/InspectionService.cs @@ -26,11 +26,11 @@ namespace IRaCIS.Core.Application.Service.Inspection - public async Task> GetInspectionList(GetDataInspectionDto dto) + public async Task> GetInspectionList(GetDataInspectionDto inQuery) { //_repository.GetQueryable.GetQueryable < DataInspection > - var trialData = await _repository.GetQueryable().Where(x => x.Id == dto.TrialId).AsNoTracking().FirstNotNullAsync(); + var trialData = await _repository.GetQueryable().Where(x => x.Id == inQuery.TrialId).AsNoTracking().FirstNotNullAsync(); trialData.TrialFinishTime = trialData.TrialFinishTime == null ? DateTime.Now : trialData.TrialFinishTime; @@ -164,9 +164,9 @@ namespace IRaCIS.Core.Application.Service.Inspection TrialReadingCriterionName = data.TrialReadingCriterion.CriterionName }; - query = query.WhereIf(dto.TrialSiteId != null, x => x.TrialSiteId == dto.TrialSiteId) + query = query.WhereIf(inQuery.TrialSiteId != null, x => x.TrialSiteId == inQuery.TrialSiteId) //.Where(x => (x.TrialId == dto.TrialId) || (x.TrialId == null && x.CreateTime >= trialData.CreateTime && x.CreateTime <= trialData.TrialFinishTime)) - .Where(x => x.TrialId == dto.TrialId ) + .Where(x => x.TrialId == inQuery.TrialId ) #region 废弃 // .WhereIf(dto.BatchId != null && dto.ObjectRelationParentId == null && dto.GeneralId == null, x => x.BatchId == dto.BatchId) @@ -183,36 +183,36 @@ namespace IRaCIS.Core.Application.Service.Inspection // x.ObjectRelationParentId == dto.GeneralId //父稽查 查询子记录 // ) && x.CreateTime <= dto.RelationDeadlineTime.Value.AddSeconds(1))) #endregion - .WhereIf(dto.BatchId != null, x => x.BatchId == dto.BatchId) - .WhereIf(dto.BatchId == null && dto.GeneralId != null, x => x.GeneralId == dto.GeneralId) - .WhereIf(dto.TrialReadingCriterionId != null, x => x.TrialReadingCriterionId == dto.TrialReadingCriterionId) + .WhereIf(inQuery.BatchId != null, x => x.BatchId == inQuery.BatchId) + .WhereIf(inQuery.BatchId == null && inQuery.GeneralId != null, x => x.GeneralId == inQuery.GeneralId) + .WhereIf(inQuery.TrialReadingCriterionId != null, x => x.TrialReadingCriterionId == inQuery.TrialReadingCriterionId) - .WhereIf(!dto.TaskName.IsNullOrEmpty(), x => x.TaskName.Contains(dto.TaskName) || x.BlindName.Contains(dto.TaskName)) - .WhereIf(!dto.SubjectInfo.IsNullOrEmpty(), x => x.SubjectCode.Contains(dto.SubjectInfo)) - .WhereIf(!dto.RoleName.IsNullOrEmpty(), x => x.RoleName.Contains(dto.RoleName)) + .WhereIf(!inQuery.TaskName.IsNullOrEmpty(), x => x.TaskName.Contains(inQuery.TaskName) || x.BlindName.Contains(inQuery.TaskName)) + .WhereIf(!inQuery.SubjectInfo.IsNullOrEmpty(), x => x.SubjectCode.Contains(inQuery.SubjectInfo)) + .WhereIf(!inQuery.RoleName.IsNullOrEmpty(), x => x.RoleName.Contains(inQuery.RoleName)) //.WhereIf(dto.VisitPlanInfo != null&& dto.VisitPlanInfo!=(decimal) 1.11, x => x.VisitNum == dto.VisitPlanInfo) //.WhereIf(dto.VisitPlanInfo != (decimal)1.11,x=>x.InPlan!=null&& x.InPlan==false) - .WhereIf(dto.StartTime != null, x => x.CreateTime >= dto.StartTime) - .WhereIf(dto.EndTime != null, x => x.CreateTime <= dto.EndTime) - .WhereIf(dto.ModuleType != null, x => x.ModuleTypeId == dto.ModuleType) - .WhereIf(!dto.Description.IsNullOrEmpty(), x => x.Description.Contains(dto.Description)|| x.DescriptionCN.Contains(dto.Description)) - .WhereIf(!dto.OpByUserName.IsNullOrEmpty(), x => x.CreateUserName.Contains(dto.OpByUserName)) - .WhereIf(!dto.CreateUserName.IsNullOrEmpty(), x => x.CreateUserName.Contains(dto.CreateUserName) || x.CreateUserRealName.Contains(dto.CreateUserName)) + .WhereIf(inQuery.StartTime != null, x => x.CreateTime >= inQuery.StartTime) + .WhereIf(inQuery.EndTime != null, x => x.CreateTime <= inQuery.EndTime) + .WhereIf(inQuery.ModuleType != null, x => x.ModuleTypeId == inQuery.ModuleType) + .WhereIf(!inQuery.Description.IsNullOrEmpty(), x => x.Description.Contains(inQuery.Description)|| x.DescriptionCN.Contains(inQuery.Description)) + .WhereIf(!inQuery.OpByUserName.IsNullOrEmpty(), x => x.CreateUserName.Contains(inQuery.OpByUserName)) + .WhereIf(!inQuery.CreateUserName.IsNullOrEmpty(), x => x.CreateUserName.Contains(inQuery.CreateUserName) || x.CreateUserRealName.Contains(inQuery.CreateUserName)) //.WhereIf(!dto.SubjectInfo.IsNullOrEmpty(), x => x.SubjectCode.Contains(dto.SubjectInfo)) - .WhereIf(dto.IsSign != null, x => x.IsSign == dto.IsSign); + .WhereIf(inQuery.IsSign != null, x => x.IsSign == inQuery.IsSign); #endregion - if (dto.VisitPlanInfo != null && dto.VisitPlanInfo.Value != (decimal)1.11) + if (inQuery.VisitPlanInfo != null && inQuery.VisitPlanInfo.Value != (decimal)1.11) { - query = query.Where(x => x.VisitNum == dto.VisitPlanInfo.Value); + query = query.Where(x => x.VisitNum == inQuery.VisitPlanInfo.Value); } - else if (dto.VisitPlanInfo != null) + else if (inQuery.VisitPlanInfo != null) { query = query.Where(x => x.InPlan == false); } - return await query.ToPagedListAsync(dto.PageIndex, dto.PageSize, dto.SortField.IsNullOrEmpty() ? nameof(GetDataInspectionOutDto.CreateTime) : dto.SortField, dto.Asc); + return await query.ToPagedListAsync(inQuery, nameof(GetDataInspectionOutDto.CreateTime) ); } diff --git a/IRaCIS.Core.Application/Service/Institution/CROService.cs b/IRaCIS.Core.Application/Service/Institution/CROService.cs index b4c475a11..476257290 100644 --- a/IRaCIS.Core.Application/Service/Institution/CROService.cs +++ b/IRaCIS.Core.Application/Service/Institution/CROService.cs @@ -19,15 +19,14 @@ namespace IRaCIS.Application.Services /// 分页获取CRO列表 [HttpPost] - public async Task> GetCroList(CROCompanyQueryDTO croCompanySearchModel) + public async Task> GetCroList(CROCompanyQueryDTO inQuery) { var croQueryable = _croRepository - .WhereIf(!string.IsNullOrEmpty(croCompanySearchModel.CROName), t => t.CROName.Contains(croCompanySearchModel.CROName) || t.CRONameCN.Contains(croCompanySearchModel.CROName)) - .WhereIf(!string.IsNullOrEmpty(croCompanySearchModel.CROCode), t => t.CROCode.Contains(croCompanySearchModel.CROCode)) + .WhereIf(!string.IsNullOrEmpty(inQuery.CROName), t => t.CROName.Contains(inQuery.CROName) || t.CRONameCN.Contains(inQuery.CROName)) + .WhereIf(!string.IsNullOrEmpty(inQuery.CROCode), t => t.CROCode.Contains(inQuery.CROCode)) .ProjectTo(_mapper.ConfigurationProvider); - return await croQueryable.ToPagedListAsync(croCompanySearchModel.PageIndex, croCompanySearchModel.PageSize, - string.IsNullOrWhiteSpace(croCompanySearchModel.SortField) ? "CROName" : croCompanySearchModel.SortField, croCompanySearchModel.Asc); + return await croQueryable.ToPagedListAsync(inQuery); } diff --git a/IRaCIS.Core.Application/Service/Institution/HospitalService.cs b/IRaCIS.Core.Application/Service/Institution/HospitalService.cs index e315983ed..88d014e8f 100644 --- a/IRaCIS.Core.Application/Service/Institution/HospitalService.cs +++ b/IRaCIS.Core.Application/Service/Institution/HospitalService.cs @@ -83,19 +83,18 @@ namespace IRaCIS.Application.Services /// 分页获取医院列表 [HttpPost] - public async Task> GetHospitalPageList(HospitalQueryDTO hospitalSearchModel) + public async Task> GetHospitalPageList(HospitalQueryDTO inQuery) { var hospitalQueryable = _hospitalRepository - .WhereIf(hospitalSearchModel.HospitalName != null, t => t.HospitalName.Contains(hospitalSearchModel.HospitalName!) || t.HospitalNameCN.Contains(hospitalSearchModel.HospitalName!)) - .WhereIf(hospitalSearchModel.City != null, t => t.City.Contains(hospitalSearchModel.City!) || t.HospitalNameCN.Contains(hospitalSearchModel.City!)) - .WhereIf(hospitalSearchModel.Province != null, t => t.Province.Contains(hospitalSearchModel.Province!) || t.HospitalNameCN.Contains(hospitalSearchModel.Province!)) + .WhereIf(inQuery.HospitalName != null, t => t.HospitalName.Contains(inQuery.HospitalName!) || t.HospitalNameCN.Contains(inQuery.HospitalName!)) + .WhereIf(inQuery.City != null, t => t.City.Contains(inQuery.City!) || t.HospitalNameCN.Contains(inQuery.City!)) + .WhereIf(inQuery.Province != null, t => t.Province.Contains(inQuery.Province!) || t.HospitalNameCN.Contains(inQuery.Province!)) .ProjectTo(_mapper.ConfigurationProvider); //优化后 - return await hospitalQueryable.ToPagedListAsync(hospitalSearchModel.PageIndex, hospitalSearchModel.PageSize, string.IsNullOrWhiteSpace(hospitalSearchModel.SortField) ? "HospitalName" : hospitalSearchModel.SortField, - hospitalSearchModel.Asc); + return await hospitalQueryable.ToPagedListAsync(inQuery); diff --git a/IRaCIS.Core.Application/Service/Institution/SiteService.cs b/IRaCIS.Core.Application/Service/Institution/SiteService.cs index 72e901cc3..324801916 100644 --- a/IRaCIS.Core.Application/Service/Institution/SiteService.cs +++ b/IRaCIS.Core.Application/Service/Institution/SiteService.cs @@ -28,19 +28,19 @@ namespace IRaCIS.Application.Services /// 分页获取研究中心列表 [HttpPost] - public async Task> GetSiteList(SiteQueryParam searchModel) + public async Task> GetSiteList(SiteQueryParam inQuery) { var siteQueryable = _siteRepository - .WhereIf(!string.IsNullOrWhiteSpace(searchModel.SiteName), t => t.SiteName.Contains(searchModel.SiteName) || t.SiteNameCN.Contains(searchModel.SiteName)) - .WhereIf(!string.IsNullOrWhiteSpace(searchModel.AliasName), t => t.AliasName.Contains(searchModel.AliasName)) - .WhereIf(!string.IsNullOrWhiteSpace(searchModel.City), t => t.City.Contains(searchModel.City)) - .WhereIf(!string.IsNullOrWhiteSpace(searchModel.Country), t => t.Country.Contains(searchModel.Country)) - .WhereIf(!string.IsNullOrWhiteSpace(searchModel.Province), t => t.Province.Contains(searchModel.Province)) + .WhereIf(!string.IsNullOrWhiteSpace(inQuery.SiteName), t => t.SiteName.Contains(inQuery.SiteName) || t.SiteNameCN.Contains(inQuery.SiteName)) + .WhereIf(!string.IsNullOrWhiteSpace(inQuery.AliasName), t => t.AliasName.Contains(inQuery.AliasName)) + .WhereIf(!string.IsNullOrWhiteSpace(inQuery.City), t => t.City.Contains(inQuery.City)) + .WhereIf(!string.IsNullOrWhiteSpace(inQuery.Country), t => t.Country.Contains(inQuery.Country)) + .WhereIf(!string.IsNullOrWhiteSpace(inQuery.Province), t => t.Province.Contains(inQuery.Province)) .ProjectTo(_mapper.ConfigurationProvider, new { isEn_Us = _userInfo.IsEn_Us }); - return await siteQueryable.ToPagedListAsync(searchModel.PageIndex, searchModel.PageSize, string.IsNullOrWhiteSpace(searchModel.SortField) ? "SiteName" : searchModel.SortField, searchModel.Asc); + return await siteQueryable.ToPagedListAsync(inQuery); } @@ -64,7 +64,7 @@ namespace IRaCIS.Application.Services TrialSiteName = t.TrialSiteName }); - return await query.ToPagedListAsync(inQuery.PageIndex, inQuery.PageSize, string.IsNullOrWhiteSpace(inQuery.SortField) ? nameof(TrialSiteAddView.TrialCode) : inQuery.SortField, inQuery.Asc); + return await query.ToPagedListAsync(inQuery, nameof(TrialSiteAddView.TrialCode)); } /// 添加研究中心 diff --git a/IRaCIS.Core.Application/Service/Institution/SponsorService.cs b/IRaCIS.Core.Application/Service/Institution/SponsorService.cs index 5bcad99b1..95f9aa17b 100644 --- a/IRaCIS.Core.Application/Service/Institution/SponsorService.cs +++ b/IRaCIS.Core.Application/Service/Institution/SponsorService.cs @@ -20,16 +20,15 @@ namespace IRaCIS.Application.Services /// 分页获取申办方列表 [HttpPost] - public async Task> GetSponsorList(SponsorQueryDTO sponsorSearchModel) + public async Task> GetSponsorList(SponsorQueryDTO inQuery) { var sponsorQueryable = _sponsorRepository - .WhereIf(!string.IsNullOrWhiteSpace(sponsorSearchModel.SponsorName),t => t.SponsorName.Contains(sponsorSearchModel.SponsorName)|| t.SponsorNameCN.Contains(sponsorSearchModel.SponsorName)) - .WhereIf(!string.IsNullOrEmpty(sponsorSearchModel.SponsorCode), t => t.SponsorCode.Contains(sponsorSearchModel.SponsorCode)) + .WhereIf(!string.IsNullOrWhiteSpace(inQuery.SponsorName),t => t.SponsorName.Contains(inQuery.SponsorName)|| t.SponsorNameCN.Contains(inQuery.SponsorName)) + .WhereIf(!string.IsNullOrEmpty(inQuery.SponsorCode), t => t.SponsorCode.Contains(inQuery.SponsorCode)) .ProjectTo(_mapper.ConfigurationProvider); - return await sponsorQueryable.ToPagedListAsync(sponsorSearchModel.PageIndex, - sponsorSearchModel.PageSize, string.IsNullOrWhiteSpace(sponsorSearchModel.SortField) ? "Id" : sponsorSearchModel.SortField, sponsorSearchModel.Asc); + return await sponsorQueryable.ToPagedListAsync(inQuery); } diff --git a/IRaCIS.Core.Application/Service/Management/SystemNoticeService.cs b/IRaCIS.Core.Application/Service/Management/SystemNoticeService.cs index e4735770c..340029246 100644 --- a/IRaCIS.Core.Application/Service/Management/SystemNoticeService.cs +++ b/IRaCIS.Core.Application/Service/Management/SystemNoticeService.cs @@ -25,23 +25,23 @@ namespace IRaCIS.Core.Application.Service } [HttpPost] - public async Task> GetSystemNoticeList(SystemNoticeQuery querySystemNotice) + public async Task> GetSystemNoticeList(SystemNoticeQuery inQuery) { //防止生成sql生成GETDATE() 时区导致的问题 var appDateTimeNow = DateTime.Now; var systemNoticeQueryable = _systemNoticeRepository - .WhereIf(querySystemNotice.ApplicableProjectEnum != null, t => t.ApplicableProjectEnum == querySystemNotice.ApplicableProjectEnum) - .WhereIf(querySystemNotice.NoticeLevelEnum != null, t => t.NoticeLevelEnum == querySystemNotice.NoticeLevelEnum) - .WhereIf(querySystemNotice.NoticeModeEnum != null, t => t.NoticeModeEnum == querySystemNotice.NoticeModeEnum) - .WhereIf(querySystemNotice.NoticeStateEnum != null && querySystemNotice.NoticeStateEnum != Domain.Share.Management.SystemNotice_NoticeStateEnum.HaveExpired, t => t.NoticeStateEnum == querySystemNotice.NoticeStateEnum) - .WhereIf(querySystemNotice.NoticeModeEnum != null && querySystemNotice.NoticeStateEnum == Domain.Share.Management.SystemNotice_NoticeStateEnum.HaveExpired, t => t.NoticeStateEnum == Domain.Share.Management.SystemNotice_NoticeStateEnum.HavePublished && t.EndDate !=null && t.EndDate < appDateTimeNow) - .WhereIf(querySystemNotice.NoticeTypeEnum != null, t => t.NoticeTypeEnum == querySystemNotice.NoticeTypeEnum) - .WhereIf(!string.IsNullOrWhiteSpace(querySystemNotice.FileName), t => t.FileName.Contains(querySystemNotice.FileName)) - .WhereIf(!string.IsNullOrWhiteSpace(querySystemNotice.NoticeContent), t => t.NoticeContent.Contains(querySystemNotice.NoticeContent)) + .WhereIf(inQuery.ApplicableProjectEnum != null, t => t.ApplicableProjectEnum == inQuery.ApplicableProjectEnum) + .WhereIf(inQuery.NoticeLevelEnum != null, t => t.NoticeLevelEnum == inQuery.NoticeLevelEnum) + .WhereIf(inQuery.NoticeModeEnum != null, t => t.NoticeModeEnum == inQuery.NoticeModeEnum) + .WhereIf(inQuery.NoticeStateEnum != null && inQuery.NoticeStateEnum != Domain.Share.Management.SystemNotice_NoticeStateEnum.HaveExpired, t => t.NoticeStateEnum == inQuery.NoticeStateEnum) + .WhereIf(inQuery.NoticeModeEnum != null && inQuery.NoticeStateEnum == Domain.Share.Management.SystemNotice_NoticeStateEnum.HaveExpired, t => t.NoticeStateEnum == Domain.Share.Management.SystemNotice_NoticeStateEnum.HavePublished && t.EndDate !=null && t.EndDate < appDateTimeNow) + .WhereIf(inQuery.NoticeTypeEnum != null, t => t.NoticeTypeEnum == inQuery.NoticeTypeEnum) + .WhereIf(!string.IsNullOrWhiteSpace(inQuery.FileName), t => t.FileName.Contains(inQuery.FileName)) + .WhereIf(!string.IsNullOrWhiteSpace(inQuery.NoticeContent), t => t.NoticeContent.Contains(inQuery.NoticeContent)) .ProjectTo(_mapper.ConfigurationProvider, new { token = _userInfo.UserToken }); - return await systemNoticeQueryable.ToPagedListAsync(querySystemNotice.PageIndex, querySystemNotice.PageSize, querySystemNotice.SortField, querySystemNotice.Asc); + return await systemNoticeQueryable.ToPagedListAsync(inQuery); } @@ -116,24 +116,24 @@ namespace IRaCIS.Core.Application.Service /// 获取登陆用户的系统通知列表 只是过滤了用户类型 和已经发布的 [HttpPost] - public async Task> GetUserSystemNoticeList(SystemNoticeQuery querySystemNotice) + public async Task> GetUserSystemNoticeList(SystemNoticeQuery inQuery) { //防止生成sql生成GETDATE() 时区导致的问题 var appDateTimeNow = DateTime.Now; var systemNoticeQueryable = _systemNoticeRepository .Where(t => t.NoticeUserTypeList.Any(t => t.UserTypeId == _userInfo.UserTypeId) && t.NoticeStateEnum==Domain.Share.Management.SystemNotice_NoticeStateEnum.HavePublished) - .WhereIf(querySystemNotice.ApplicableProjectEnum != null, t => t.ApplicableProjectEnum == querySystemNotice.ApplicableProjectEnum) - .WhereIf(querySystemNotice.NoticeLevelEnum != null, t => t.NoticeLevelEnum == querySystemNotice.NoticeLevelEnum) - .WhereIf(querySystemNotice.NoticeModeEnum != null, t => t.NoticeModeEnum == querySystemNotice.NoticeModeEnum) - .WhereIf(querySystemNotice.NoticeStateEnum != null && querySystemNotice.NoticeStateEnum != Domain.Share.Management.SystemNotice_NoticeStateEnum.HaveExpired, t => t.NoticeStateEnum == querySystemNotice.NoticeStateEnum) - .WhereIf(querySystemNotice.NoticeModeEnum != null && querySystemNotice.NoticeStateEnum == Domain.Share.Management.SystemNotice_NoticeStateEnum.HaveExpired, t => t.NoticeStateEnum == Domain.Share.Management.SystemNotice_NoticeStateEnum.HavePublished && t.EndDate != null && t.EndDate < appDateTimeNow) - .WhereIf(querySystemNotice.NoticeTypeEnum != null, t => t.NoticeTypeEnum == querySystemNotice.NoticeTypeEnum) - .WhereIf(!string.IsNullOrWhiteSpace(querySystemNotice.FileName), t => t.FileName.Contains(querySystemNotice.FileName)) - .WhereIf(!string.IsNullOrWhiteSpace(querySystemNotice.NoticeContent), t => t.NoticeContent.Contains(querySystemNotice.NoticeContent)) + .WhereIf(inQuery.ApplicableProjectEnum != null, t => t.ApplicableProjectEnum == inQuery.ApplicableProjectEnum) + .WhereIf(inQuery.NoticeLevelEnum != null, t => t.NoticeLevelEnum == inQuery.NoticeLevelEnum) + .WhereIf(inQuery.NoticeModeEnum != null, t => t.NoticeModeEnum == inQuery.NoticeModeEnum) + .WhereIf(inQuery.NoticeStateEnum != null && inQuery.NoticeStateEnum != Domain.Share.Management.SystemNotice_NoticeStateEnum.HaveExpired, t => t.NoticeStateEnum == inQuery.NoticeStateEnum) + .WhereIf(inQuery.NoticeModeEnum != null && inQuery.NoticeStateEnum == Domain.Share.Management.SystemNotice_NoticeStateEnum.HaveExpired, t => t.NoticeStateEnum == Domain.Share.Management.SystemNotice_NoticeStateEnum.HavePublished && t.EndDate != null && t.EndDate < appDateTimeNow) + .WhereIf(inQuery.NoticeTypeEnum != null, t => t.NoticeTypeEnum == inQuery.NoticeTypeEnum) + .WhereIf(!string.IsNullOrWhiteSpace(inQuery.FileName), t => t.FileName.Contains(inQuery.FileName)) + .WhereIf(!string.IsNullOrWhiteSpace(inQuery.NoticeContent), t => t.NoticeContent.Contains(inQuery.NoticeContent)) .ProjectTo(_mapper.ConfigurationProvider, new { token = _userInfo.UserToken, userId = _userInfo.Id }); - return await systemNoticeQueryable.ToPagedListAsync(querySystemNotice.PageIndex, querySystemNotice.PageSize, querySystemNotice.SortField, querySystemNotice.Asc); + return await systemNoticeQueryable.ToPagedListAsync(inQuery); } diff --git a/IRaCIS.Core.Application/Service/Management/UserFeedBackService.cs b/IRaCIS.Core.Application/Service/Management/UserFeedBackService.cs index 0b790efb5..a9eae96b4 100644 --- a/IRaCIS.Core.Application/Service/Management/UserFeedBackService.cs +++ b/IRaCIS.Core.Application/Service/Management/UserFeedBackService.cs @@ -52,7 +52,7 @@ namespace IRaCIS.Core.Application.Service .ProjectTo(_mapper.ConfigurationProvider); - var pageList = await userFeedBackQueryable.ToPagedListAsync(inQuery.PageIndex, inQuery.PageSize, string.IsNullOrWhiteSpace(inQuery.SortField) ? nameof(UserFeedBackView.Id) : inQuery.SortField, inQuery.Asc); + var pageList = await userFeedBackQueryable.ToPagedListAsync(inQuery); return pageList; } diff --git a/IRaCIS.Core.Application/Service/Management/UserService.cs b/IRaCIS.Core.Application/Service/Management/UserService.cs index 3fe37375c..0e2660266 100644 --- a/IRaCIS.Core.Application/Service/Management/UserService.cs +++ b/IRaCIS.Core.Application/Service/Management/UserService.cs @@ -499,26 +499,26 @@ namespace IRaCIS.Application.Services /// /// 获取用户列表 /// - /// + /// /// [HttpPost] - public async Task> GetUserList(UserListQueryDTO param) + public async Task> GetUserList(UserListQueryDTO inQuery) { var userQueryable = _userRepository.Where(x => x.UserTypeEnum != UserTypeEnum.SuperAdmin) - .WhereIf(!string.IsNullOrWhiteSpace(param.UserName), t => t.UserName.Contains(param.UserName)) - .WhereIf(!string.IsNullOrWhiteSpace(param.RealName), t => t.FullName.Contains(param.RealName)) - .WhereIf(!string.IsNullOrWhiteSpace(param.Phone), t => t.Phone.Contains(param.Phone)) - .WhereIf(!string.IsNullOrWhiteSpace(param.OrganizationName), t => t.OrganizationName.Contains(param.OrganizationName)) - .WhereIf(!string.IsNullOrWhiteSpace(param.EMail), t => t.EMail.Contains(param.EMail)) - .WhereIf(param.BeginCreateTime != null, t => t.CreateTime >= param.BeginCreateTime) - .WhereIf(param.EndCreateTime != null, t => t.CreateTime <= param.EndCreateTime) - .WhereIf(param.UserType != null, t => t.UserTypeId == param.UserType) - .WhereIf(param.UserState != null, t => t.Status == param.UserState) - .WhereIf(param.IsTestUser != null, t => t.IsTestUser == param.IsTestUser) - .WhereIf(param.IsZhiZhun != null, t => t.IsZhiZhun == param.IsZhiZhun) + .WhereIf(!string.IsNullOrWhiteSpace(inQuery.UserName), t => t.UserName.Contains(inQuery.UserName)) + .WhereIf(!string.IsNullOrWhiteSpace(inQuery.RealName), t => t.FullName.Contains(inQuery.RealName)) + .WhereIf(!string.IsNullOrWhiteSpace(inQuery.Phone), t => t.Phone.Contains(inQuery.Phone)) + .WhereIf(!string.IsNullOrWhiteSpace(inQuery.OrganizationName), t => t.OrganizationName.Contains(inQuery.OrganizationName)) + .WhereIf(!string.IsNullOrWhiteSpace(inQuery.EMail), t => t.EMail.Contains(inQuery.EMail)) + .WhereIf(inQuery.BeginCreateTime != null, t => t.CreateTime >= inQuery.BeginCreateTime) + .WhereIf(inQuery.EndCreateTime != null, t => t.CreateTime <= inQuery.EndCreateTime) + .WhereIf(inQuery.UserType != null, t => t.UserTypeId == inQuery.UserType) + .WhereIf(inQuery.UserState != null, t => t.Status == inQuery.UserState) + .WhereIf(inQuery.IsTestUser != null, t => t.IsTestUser == inQuery.IsTestUser) + .WhereIf(inQuery.IsZhiZhun != null, t => t.IsZhiZhun == inQuery.IsZhiZhun) .ProjectTo(_mapper.ConfigurationProvider); - return await userQueryable.ToPagedListAsync(param.PageIndex, param.PageSize, param.SortField == string.Empty ? "UserName" : param.SortField, param.Asc); + return await userQueryable.ToPagedListAsync(inQuery); } @@ -867,7 +867,7 @@ namespace IRaCIS.Application.Services .ProjectTo(_mapper.ConfigurationProvider); - var pageList = await userLogQueryable.ToPagedListAsync(inQuery.PageIndex, inQuery.PageSize, string.IsNullOrWhiteSpace(inQuery.SortField) ? "Id" : inQuery.SortField, inQuery.Asc); + var pageList = await userLogQueryable.ToPagedListAsync(inQuery); return pageList; } diff --git a/IRaCIS.Core.Application/Service/QC/DTO/QARecordViewModel.cs b/IRaCIS.Core.Application/Service/QC/DTO/QARecordViewModel.cs index 1ea08ae56..d7e41ff55 100644 --- a/IRaCIS.Core.Application/Service/QC/DTO/QARecordViewModel.cs +++ b/IRaCIS.Core.Application/Service/QC/DTO/QARecordViewModel.cs @@ -169,12 +169,11 @@ namespace IRaCIS.Core.Application.Contracts.DTO } - public class GetConsistencyCheckFileInDto + public class GetConsistencyCheckFileInDto:PageInput { public Guid TrialId { get; set; } - public int PageIndex { get; set; } = 1; - public int PageSize { set; get; } = 10; + } diff --git a/IRaCIS.Core.Application/Service/QC/QCListService.cs b/IRaCIS.Core.Application/Service/QC/QCListService.cs index a44086439..dc8207a68 100644 --- a/IRaCIS.Core.Application/Service/QC/QCListService.cs +++ b/IRaCIS.Core.Application/Service/QC/QCListService.cs @@ -78,7 +78,7 @@ namespace IRaCIS.Core.Application.Image.QA var defalutSortArray = new string[] { nameof(SubjectVisit.IsUrgent) + " desc", nameof(SubjectVisit.SubjectId), nameof(SubjectVisit.VisitNum) }; - var pageList = await query.ToPagedListAsync(inQuery.PageIndex, inQuery.PageSize, inQuery.SortField, inQuery.Asc, string.IsNullOrWhiteSpace(inQuery.SortField), defalutSortArray); + var pageList = await query.ToPagedListAsync(inQuery, defalutSortArray); var config = await _repository.Where(t => t.Id == inQuery.TrialId).ProjectTo(_mapper.ConfigurationProvider).FirstOrDefaultAsync().IfNullThrowException(); config.IsHaveSubjectClinicalData = await _clinicalDataTrialSet.AnyAsync(x => x.TrialId == inQuery.TrialId && x.IsConfirm && (x.ClinicalDataLevel == ClinicalLevel.Subject ) && x.UploadRole == UploadRole.CRC); @@ -172,7 +172,7 @@ namespace IRaCIS.Core.Application.Image.QA .WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.CRA, t => t.SubjectVisit.TrialSite.CRCUserList.Any(t => t.UserId == _userInfo.Id)) .ProjectTo(_mapper.ConfigurationProvider); - var pageList = await query.ToPagedListAsync(inQuery.PageIndex, inQuery.PageSize, inQuery.SortField, inQuery.Asc, string.IsNullOrWhiteSpace(inQuery.SortField), new string[] { "IsUrgent desc", "CreateTime asc" }); + var pageList = await query.ToPagedListAsync(inQuery, new string[] { "IsUrgent desc", "CreateTime asc" }); var config = await _repository.Where(t => t.Id == inQuery.TrialId).ProjectTo(_mapper.ConfigurationProvider).FirstOrDefaultAsync().IfNullThrowException(); return ResponseOutput.Ok (pageList, config); @@ -187,32 +187,32 @@ namespace IRaCIS.Core.Application.Image.QA /// /// QC 质疑列表 分页 /// - /// + /// /// [HttpPost] - public async Task<(PageOutput, TrialSubjectAndSVConfig)> GetQCChallengeList(ChallengeQuery challengeQuery) + public async Task<(PageOutput, TrialSubjectAndSVConfig)> GetQCChallengeList(ChallengeQuery inQuery) { - var svExpression = QCCommon.GetQCChallengeFilter(challengeQuery.VisitPlanArray); + var svExpression = QCCommon.GetQCChallengeFilter(inQuery.VisitPlanArray); - var query = _repository.Where(x => x.TrialId == challengeQuery.TrialId) + var query = _repository.Where(x => x.TrialId == inQuery.TrialId) //.WhereIf(challengeQuery.ChallengeState != null, t => t.SubjectVisit.ChallengeState == challengeQuery.ChallengeState) - .WhereIf(challengeQuery.ReuploadEnum != null, t => t.ReuploadEnum == challengeQuery.ReuploadEnum) - .WhereIf(challengeQuery.IsClosed != null, t => t.IsClosed == challengeQuery.IsClosed) - .WhereIf(challengeQuery.TrialSiteId != null, t => t.SubjectVisit.TrialSiteId == challengeQuery.TrialSiteId) - .WhereIf(challengeQuery.SubjectId != null, t => t.SubjectVisit.SubjectId == challengeQuery.SubjectId) - .WhereIf(challengeQuery.CreateUserId != null, t => t.CreateUserId == challengeQuery.CreateUserId) - .WhereIf(!string.IsNullOrEmpty(challengeQuery.SubjectCode), t => t.SubjectVisit.Subject.Code.Contains(challengeQuery.SubjectCode)) - .WhereIf(challengeQuery.VisitPlanArray != null && challengeQuery.VisitPlanArray?.Length > 0, svExpression) + .WhereIf(inQuery.ReuploadEnum != null, t => t.ReuploadEnum == inQuery.ReuploadEnum) + .WhereIf(inQuery.IsClosed != null, t => t.IsClosed == inQuery.IsClosed) + .WhereIf(inQuery.TrialSiteId != null, t => t.SubjectVisit.TrialSiteId == inQuery.TrialSiteId) + .WhereIf(inQuery.SubjectId != null, t => t.SubjectVisit.SubjectId == inQuery.SubjectId) + .WhereIf(inQuery.CreateUserId != null, t => t.CreateUserId == inQuery.CreateUserId) + .WhereIf(!string.IsNullOrEmpty(inQuery.SubjectCode), t => t.SubjectVisit.Subject.Code.Contains(inQuery.SubjectCode)) + .WhereIf(inQuery.VisitPlanArray != null && inQuery.VisitPlanArray?.Length > 0, svExpression) //.WhereIf(!string.IsNullOrEmpty(challengeQuery.VisitPlanInfo), challengeQuery.VisitPlanInfo.Contains('.') ? t => t.SubjectVisit.InPlan == false : t => t.SubjectVisit.VisitNum == decimal.Parse(challengeQuery.VisitPlanInfo)) - .WhereIf(challengeQuery.IsUrgent != null, t => t.SubjectVisit.IsUrgent == challengeQuery.IsUrgent) - .WhereIf(challengeQuery.IsOverTime != null && challengeQuery.IsOverTime == true, t => t.IsClosed ? t.ClosedTime > t.DeadlineTime : DateTime.Now > t.DeadlineTime) - .WhereIf(challengeQuery.IsOverTime != null && challengeQuery.IsOverTime == false, t => t.IsClosed ? t.ClosedTime < t.DeadlineTime : DateTime.Now < t.DeadlineTime) + .WhereIf(inQuery.IsUrgent != null, t => t.SubjectVisit.IsUrgent == inQuery.IsUrgent) + .WhereIf(inQuery.IsOverTime != null && inQuery.IsOverTime == true, t => t.IsClosed ? t.ClosedTime > t.DeadlineTime : DateTime.Now > t.DeadlineTime) + .WhereIf(inQuery.IsOverTime != null && inQuery.IsOverTime == false, t => t.IsClosed ? t.ClosedTime < t.DeadlineTime : DateTime.Now < t.DeadlineTime) .ProjectTo(_mapper.ConfigurationProvider); - var pageList = await query.ToPagedListAsync(challengeQuery.PageIndex, challengeQuery.PageSize, challengeQuery.SortField, challengeQuery.Asc, string.IsNullOrWhiteSpace(challengeQuery.SortField), new string[] { "IsUrgent desc", "IsClosed asc" }); + var pageList = await query.ToPagedListAsync(inQuery, new string[] { "IsUrgent desc", "IsClosed asc" }); - var config = await _repository.Where(t => t.Id == challengeQuery.TrialId).ProjectTo(_mapper.ConfigurationProvider).FirstOrDefaultAsync().IfNullThrowException(); + var config = await _repository.Where(t => t.Id == inQuery.TrialId).ProjectTo(_mapper.ConfigurationProvider).FirstOrDefaultAsync().IfNullThrowException(); return (pageList, config); } @@ -277,7 +277,7 @@ namespace IRaCIS.Core.Application.Image.QA var defalutSortArray = new string[] { nameof(QCVisitViewModel.IsUrgent) + " desc", nameof(QCVisitViewModel.SubjectId), nameof(QCVisitViewModel.VisitNum) }; //var defalutSortArray = new string[] { nameof(SubjectVisit.IsUrgent) + " desc", nameof(QCVisitViewModel.AuditState) +" asc" }; - var pageList = await query.ToPagedListAsync(inQuery.PageIndex, inQuery.PageSize, inQuery.SortField, inQuery.Asc, string.IsNullOrWhiteSpace(inQuery.SortField), defalutSortArray); + var pageList = await query.ToPagedListAsync(inQuery, defalutSortArray); @@ -313,7 +313,7 @@ namespace IRaCIS.Core.Application.Image.QA .WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.CRA, t => t.TrialSite.CRCUserList.Any(t => t.UserId == _userInfo.Id))//CRC 过滤负责的site .ProjectTo(_mapper.ConfigurationProvider); - var pageList = await query.ToPagedListAsync(inQuery.PageIndex, inQuery.PageSize, inQuery.SortField, inQuery.Asc); + var pageList = await query.ToPagedListAsync(inQuery); var config = await _repository.Where(t => t.Id == inQuery.TrialId).ProjectTo(_mapper.ConfigurationProvider).FirstOrDefaultAsync().IfNullThrowException(); return (pageList, config); } @@ -340,26 +340,26 @@ namespace IRaCIS.Core.Application.Image.QA /// /// 转发列表 查询一致性核查通过的,针对不一致性核查的 要维护CV状态 /// - /// + /// /// [HttpPost] - public async Task> GetForwardList(ForwardQuery forwardQuery) + public async Task> GetForwardList(ForwardQuery inQuery) { //var trialConfig = _trialReposioty.Select(t => new { TrialId = t.Id, t.QCProcessEnum, t.IsImageConsistencyVerification }).FirstOrDefault(t => t.TrialId == forwardQuery.TrialId); - var svExpression = QCCommon.GetSubjectVisitFilter(forwardQuery.VisitPlanArray); + var svExpression = QCCommon.GetSubjectVisitFilter(inQuery.VisitPlanArray); - var query = _subjectVisitRepository.Where(x => x.TrialId == forwardQuery.TrialId) + var query = _subjectVisitRepository.Where(x => x.TrialId == inQuery.TrialId) .Where(t => t.CheckState == CheckStateEnum.CVPassed) - .WhereIf(forwardQuery.ForwardState != null, t => t.ForwardState == forwardQuery.ForwardState) - .WhereIf(forwardQuery.TrialSiteId != null, t => t.TrialSiteId == forwardQuery.TrialSiteId) - .WhereIf(!string.IsNullOrEmpty(forwardQuery.SubjectInfo), t => t.Subject.Code.Contains(forwardQuery.SubjectInfo)) - .WhereIf(forwardQuery.VisitPlanArray != null && forwardQuery.VisitPlanArray?.Length > 0, svExpression) + .WhereIf(inQuery.ForwardState != null, t => t.ForwardState == inQuery.ForwardState) + .WhereIf(inQuery.TrialSiteId != null, t => t.TrialSiteId == inQuery.TrialSiteId) + .WhereIf(!string.IsNullOrEmpty(inQuery.SubjectInfo), t => t.Subject.Code.Contains(inQuery.SubjectInfo)) + .WhereIf(inQuery.VisitPlanArray != null && inQuery.VisitPlanArray?.Length > 0, svExpression) //.WhereIf(!string.IsNullOrEmpty(forwardQuery.VisitPlanInfo), forwardQuery.VisitPlanInfo.Contains('.') ? t => t.InPlan == false : t => t.VisitNum == decimal.Parse(forwardQuery.VisitPlanInfo)) //.WhereIf(_userInfo.UserTypeEnumInt == (int)UserType.ClinicalResearchCoordinator, t => t.TrialSite.CRCUserList.Any(t => t.UserId == _userInfo.Id))//CRC 过滤负责的site .ProjectTo(_mapper.ConfigurationProvider); - return await query.ToPagedListAsync(forwardQuery.PageIndex, forwardQuery.PageSize, forwardQuery.SortField, forwardQuery.Asc); + return await query.ToPagedListAsync(inQuery); } @@ -635,12 +635,12 @@ namespace IRaCIS.Core.Application.Image.QA /// /// [HttpPost] - public async Task> GetConsistencyCheckFile(GetConsistencyCheckFileInDto indto) + public async Task> GetConsistencyCheckFile(GetConsistencyCheckFileInDto inQuery) { - var query = _repository.Where(t => t.TrialId == indto.TrialId) + var query = _repository.Where(t => t.TrialId == inQuery.TrialId) .ProjectTo(_mapper.ConfigurationProvider); - return await query.ToPagedListAsync(indto.PageIndex, indto.PageSize, "CreateTime", false); + return await query.ToPagedListAsync(inQuery); } diff --git a/IRaCIS.Core.Application/Service/Reading/AdditionalEvaluate/SubjectCriteriaEvaluationService.cs b/IRaCIS.Core.Application/Service/Reading/AdditionalEvaluate/SubjectCriteriaEvaluationService.cs index 82f19867c..3a7e64d60 100644 --- a/IRaCIS.Core.Application/Service/Reading/AdditionalEvaluate/SubjectCriteriaEvaluationService.cs +++ b/IRaCIS.Core.Application/Service/Reading/AdditionalEvaluate/SubjectCriteriaEvaluationService.cs @@ -149,7 +149,7 @@ namespace IRaCIS.Core.Application.Service var pageList = await subjectCriteriaEvaluationQueryable .WhereIf(inQuery.IsImageFiltering != null, t => t.IsImageFiltering == inQuery.IsImageFiltering) .WhereIf(inQuery.IsJoinEvaluation != null, t => t.IsJoinEvaluation == inQuery.IsJoinEvaluation) - .ToPagedListAsync(inQuery.PageIndex, inQuery.PageSize, inQuery.SortField == string.Empty ? nameof(SubjectCriteriaEvaluationView.SubjectCode) : inQuery.SortField, inQuery.Asc); + .ToPagedListAsync(inQuery,nameof(SubjectCriteriaEvaluationView.SubjectCode)); foreach (var item in pageList.CurrentPageData) diff --git a/IRaCIS.Core.Application/Service/Reading/ClinicalData/ClinicalAnswerService.cs b/IRaCIS.Core.Application/Service/Reading/ClinicalData/ClinicalAnswerService.cs index e5aa5e786..ef54fb883 100644 --- a/IRaCIS.Core.Application/Service/Reading/ClinicalData/ClinicalAnswerService.cs +++ b/IRaCIS.Core.Application/Service/Reading/ClinicalData/ClinicalAnswerService.cs @@ -264,10 +264,10 @@ namespace IRaCIS.Core.Application.Service /// /// 获取CRC受试者临床数据 /// - /// + /// /// [HttpPost] - public async Task> GetCRCSubjectClinicalList(GetCRCSubjectClinicalInDto inDto) + public async Task> GetCRCSubjectClinicalList(GetCRCSubjectClinicalInDto inQuery) { //await AutoAddCRCClinical(new AutoAddClinicalInDto() @@ -275,22 +275,22 @@ namespace IRaCIS.Core.Application.Service // TrialId = inDto.TrialId //}) ; - var subjects = await _subjectRepository.Where(x => x.TrialId == inDto.TrialId).Select(x => new GetCRCSubjectClinicalResultDto() + var subjects = await _subjectRepository.Where(x => x.TrialId == inQuery.TrialId).Select(x => new GetCRCSubjectClinicalResultDto() { SubjectId = x.Id, SubjectCode = x.Code }).ToListAsync(); - var clinicalData= _readingClinicalDataRepository.Where(x=>x.TrialId == inDto.TrialId&&x.ClinicalDataTrialSet.UploadRole==UploadRole.CRC&&x.ClinicalDataTrialSet.ClinicalDataLevel!= ClinicalLevel.SubjectVisit) + var clinicalData= _readingClinicalDataRepository.Where(x=>x.TrialId == inQuery.TrialId&&x.ClinicalDataTrialSet.UploadRole==UploadRole.CRC&&x.ClinicalDataTrialSet.ClinicalDataLevel!= ClinicalLevel.SubjectVisit) .Where(x=>!x.IsSign) - .WhereIf(inDto.SubjectId!=null,x=>x.SubjectId==inDto.SubjectId) - .WhereIf(inDto.SubjectCode != null, x => x.Subject.Code.Contains(inDto.SubjectCode??string.Empty)) + .WhereIf(inQuery.SubjectId!=null,x=>x.SubjectId==inQuery.SubjectId) + .WhereIf(inQuery.SubjectCode != null, x => x.Subject.Code.Contains(inQuery.SubjectCode??string.Empty)) .Where(x=> x.ClinicalDataTrialSet.ClinicalDataLevel != ClinicalLevel.Subject) .Include(x=>x.ClinicalDataTrialSet).Select(x=>new GetCRCSubjectClinicalOutDto() { SubjectId=x.SubjectId, SubjectCode=x.Subject.Code, - TrialId=inDto.TrialId, + TrialId=inQuery.TrialId, ReadingId= x.ReadingId, ReadingClinicalDataId=x.Id, UploadRole = x.ClinicalDataTrialSet.UploadRole, @@ -302,13 +302,13 @@ namespace IRaCIS.Core.Application.Service ClinicalDataSetName = x.ClinicalDataTrialSet.ClinicalDataSetName, }); - var pageList = await clinicalData.ToPagedListAsync(inDto.PageIndex, inDto.PageSize, string.IsNullOrWhiteSpace(inDto.SortField) ? nameof(GetCRCSubjectClinicalOutDto.SubjectCode) : inDto.SortField, inDto.Asc); + var pageList = await clinicalData.ToPagedListAsync(inQuery, nameof(GetCRCSubjectClinicalOutDto.SubjectCode) ); // 一次查询报错 分两次写 pageList.CurrentPageData.ForEach(x => { x.ClinicalDataSetEnName = x.ClinicalDataSetName.LanguageName(x.ClinicalDataSetEnName, _userInfo.IsEn_Us); }); - var clinicalFormData = await _clinicalFormRepository.Where(x => x.TrialId == inDto.TrialId).ToListAsync(); + var clinicalFormData = await _clinicalFormRepository.Where(x => x.TrialId == inQuery.TrialId).ToListAsync(); pageList.CurrentPageData.ForEach(n => { n.ClinicalCount = clinicalFormData.Where(y => y.ClinicalDataTrialSetId == n.ClinicalDataTrialSetId && y.SubjectId == n.SubjectId).Count(); diff --git a/IRaCIS.Core.Application/Service/Reading/ClinicalData/ClinicalQuestionService.cs b/IRaCIS.Core.Application/Service/Reading/ClinicalData/ClinicalQuestionService.cs index 6950d35d9..4d23c881a 100644 --- a/IRaCIS.Core.Application/Service/Reading/ClinicalData/ClinicalQuestionService.cs +++ b/IRaCIS.Core.Application/Service/Reading/ClinicalData/ClinicalQuestionService.cs @@ -43,79 +43,79 @@ namespace IRaCIS.Core.Application.Service _systemClinicalQuestionRepository = systemClinicalQuestionRepository; } - /// - /// 获取问题计算关系 - /// - /// - /// - [HttpPost] - public async Task> GetTrialClinicalQuestionCalculateRelation(GetTrialClinicalQuestionCalculateRelationInDto inDto) + /// + /// 获取问题计算关系 + /// + /// + /// + [HttpPost] + public async Task> GetTrialClinicalQuestionCalculateRelation(GetTrialClinicalQuestionCalculateRelationInDto inDto) { - var result= await _trialClinicalQuestionRepository.Where(x => x.TrialClinicalId == inDto.TrialClinicalId) - .Where( x=> x.ClinicalQuestionType == "number") - .Where(x => x.CustomCalculateMark != null && x.CustomCalculateMark > ClinicalCalculateMark.None) - .Select(x => new GetTrialClinicalQuestionCalculateRelationOutDto() - { - QuestionId = x.Id, - QuestionName = x.QuestionName, - CustomCalculateMark = x.CustomCalculateMark, - CalculateQuestionList = x.CalculateQuestionList, - }).ToListAsync(); + var result = await _trialClinicalQuestionRepository.Where(x => x.TrialClinicalId == inDto.TrialClinicalId) + .Where(x => x.ClinicalQuestionType == "number") + .Where(x => x.CustomCalculateMark != null && x.CustomCalculateMark > ClinicalCalculateMark.None) + .Select(x => new GetTrialClinicalQuestionCalculateRelationOutDto() + { + QuestionId = x.Id, + QuestionName = x.QuestionName, + CustomCalculateMark = x.CustomCalculateMark, + CalculateQuestionList = x.CalculateQuestionList, + }).ToListAsync(); result = result.Where(x => x.CalculateQuestionList.Count() > 0).ToList(); return result; - } + } - /// - /// 获取计算问题 - /// - /// - /// - [HttpPost] - public async Task> GetClinicalCalculateQuestions(GetClinicalCalculateQuestionsInDto inDto) - { - var result = await _trialClinicalQuestionRepository + /// + /// 获取计算问题 + /// + /// + /// + [HttpPost] + public async Task> GetClinicalCalculateQuestions(GetClinicalCalculateQuestionsInDto inDto) + { + var result = await _trialClinicalQuestionRepository - .Where(x => x.TrialClinicalId == inDto.TrialClinicalId) - .WhereIf(!inDto.ClinicalQuestionType.IsNullOrEmpty(), x => x.ClinicalQuestionType == inDto.ClinicalQuestionType) - .OrderBy(x => x.ShowOrder) - .Select(x => new GetClinicalCalculateQuestionsOutDto - () - { - QuestionId = x.Id, - QuestionName = x.QuestionName.LanguageName(x.QuestionEnName, _userInfo.IsEn_Us) + .Where(x => x.TrialClinicalId == inDto.TrialClinicalId) + .WhereIf(!inDto.ClinicalQuestionType.IsNullOrEmpty(), x => x.ClinicalQuestionType == inDto.ClinicalQuestionType) + .OrderBy(x => x.ShowOrder) + .Select(x => new GetClinicalCalculateQuestionsOutDto + () + { + QuestionId = x.Id, + QuestionName = x.QuestionName.LanguageName(x.QuestionEnName, _userInfo.IsEn_Us) - }).ToListAsync(); + }).ToListAsync(); - var tablequestion = await _trialClinicalTableQuestionRepository.Where(x => x.TrialClinicalId == inDto.TrialClinicalId && x.ClinicalTableQuestionType == "number").Select(x => - new - { - TableQuestionId = x.Id, - QuestionId= x.QuestionId, - QuestionName = x.QuestionName.LanguageName(x.QuestionEnName, _userInfo.IsEn_Us) - }).ToListAsync(); + var tablequestion = await _trialClinicalTableQuestionRepository.Where(x => x.TrialClinicalId == inDto.TrialClinicalId && x.ClinicalTableQuestionType == "number").Select(x => + new + { + TableQuestionId = x.Id, + QuestionId = x.QuestionId, + QuestionName = x.QuestionName.LanguageName(x.QuestionEnName, _userInfo.IsEn_Us) + }).ToListAsync(); - result.ForEach(x => - { - x.TableQuestions = tablequestion.Where(y => x.QuestionId == y.QuestionId).Select(y => new CalculateQuestion() - { + result.ForEach(x => + { + x.TableQuestions = tablequestion.Where(y => x.QuestionId == y.QuestionId).Select(y => new CalculateQuestion() + { - QuestionId = y.QuestionId, - QuestionName = y.QuestionName + QuestionId = y.QuestionId, + QuestionName = y.QuestionName - }).ToList(); - }); + }).ToList(); + }); - return result; - } + return result; + } - /// - /// 获取系统临床数据预览 - /// - /// - /// - [HttpPost] + /// + /// 获取系统临床数据预览 + /// + /// + /// + [HttpPost] public async Task<(List, bool)> GetSystemClinicalQuestionPreview(GetSystemClinicalQuestionPreviewDto inDto) { var questions = await _systemClinicalQuestionRepository.Where(x => x.SystemClinicalId == inDto.SystemClinicalId) @@ -123,18 +123,20 @@ namespace IRaCIS.Core.Application.Service if (_userInfo.IsEn_Us) { - questions.ForEach(x => { + questions.ForEach(x => + { x.GroupName = x.GroupEnName; x.QuestionName = x.QuestionEnName; }); } - var tableQuestions= await _systemClinicalTableQuestionRepository.Where(x => x.SystemClinicalId == inDto.SystemClinicalId) + var tableQuestions = await _systemClinicalTableQuestionRepository.Where(x => x.SystemClinicalId == inDto.SystemClinicalId) .ProjectTo(_mapper.ConfigurationProvider).OrderBy(x => x.ShowOrder).ToListAsync(); if (_userInfo.IsEn_Us) { - tableQuestions.ForEach(x => { + tableQuestions.ForEach(x => + { x.QuestionName = x.QuestionEnName; }); } @@ -159,11 +161,12 @@ namespace IRaCIS.Core.Application.Service public async Task<(List, bool)> GetTrialClinicalQuestionPreview(GetTrialClinicalQuestionPreviewDto inDto) { var questions = await _trialClinicalQuestionRepository.Where(x => x.TrialClinicalId == inDto.TrialClinicalId) - .ProjectTo(_mapper.ConfigurationProvider).OrderBy(x=>x.ShowOrder).ToListAsync(); - + .ProjectTo(_mapper.ConfigurationProvider).OrderBy(x => x.ShowOrder).ToListAsync(); + if (_userInfo.IsEn_Us) { - questions.ForEach(x => { + questions.ForEach(x => + { x.GroupName = x.GroupEnName; x.QuestionName = x.QuestionEnName; }); @@ -175,7 +178,8 @@ namespace IRaCIS.Core.Application.Service if (_userInfo.IsEn_Us) { - tableQuestions.ForEach(x => { + tableQuestions.ForEach(x => + { x.QuestionName = x.QuestionEnName; }); } @@ -185,7 +189,7 @@ namespace IRaCIS.Core.Application.Service result.ForEach(x => { - this.FindChildQuestion(x, questions, tableQuestions,new List (),new List()); + this.FindChildQuestion(x, questions, tableQuestions, new List(), new List()); }); return (result, true); @@ -201,15 +205,15 @@ namespace IRaCIS.Core.Application.Service /// /// /// - public void FindChildQuestion(ClinicalQuestionPreviewDto item, List questions, List tableQuestions,List answers, List tableAnswers) + public void FindChildQuestion(ClinicalQuestionPreviewDto item, List questions, List tableQuestions, List answers, List tableAnswers) { - item.Childrens = questions.Where(x => (x.ParentId == item.Id)||(x.GroupId== item.Id&&x.ParentId==null)).OrderBy(x => x.ShowOrder).ToList(); + item.Childrens = questions.Where(x => (x.ParentId == item.Id) || (x.GroupId == item.Id && x.ParentId == null)).OrderBy(x => x.ShowOrder).ToList(); - item.RelationQuestions = questions.Where(x => x.RelevanceId == item.Id).ToList(); + item.RelationQuestions = questions.Where(x => x.RelevanceId == item.Id).ToList(); - item.Answer = answers.Where(x => x.QuestionId == item.Id).Select(x => x.Answer).FirstOrDefault()??string.Empty; + item.Answer = answers.Where(x => x.QuestionId == item.Id).Select(x => x.Answer).FirstOrDefault() ?? string.Empty; - var tableIndexs = tableAnswers.Where(x => x.QuestionId == item.Id).Select(x => x.RowIndex).Distinct().OrderBy(x=>x).ToList(); + var tableIndexs = tableAnswers.Where(x => x.QuestionId == item.Id).Select(x => x.RowIndex).Distinct().OrderBy(x => x).ToList(); item.TableAnswer = new List>(); @@ -221,16 +225,18 @@ namespace IRaCIS.Core.Application.Service }); - item.TableQuestions = tableQuestions.Where(x => x.QuestionId == item.Id).OrderBy(x=>x.ShowOrder).OrderBy(x => x.ShowOrder).ToList(); + item.TableQuestions = tableQuestions.Where(x => x.QuestionId == item.Id).OrderBy(x => x.ShowOrder).OrderBy(x => x.ShowOrder).ToList(); - item.RelationQuestions.ForEach(x => { + item.RelationQuestions.ForEach(x => + { this.FindChildQuestion(x, questions, tableQuestions, answers, tableAnswers); }); - item.Childrens.ForEach(x => { - this.FindChildQuestion(x, questions, tableQuestions, answers, tableAnswers); - }); - } + item.Childrens.ForEach(x => + { + this.FindChildQuestion(x, questions, tableQuestions, answers, tableAnswers); + }); + } #region 项目问题 @@ -243,12 +249,11 @@ namespace IRaCIS.Core.Application.Service public async Task> GetTrialClinicalQuestionList(TrialClinicalQuestionQuery inQuery) { - var trialClinicalQuestionQueryable = _trialClinicalQuestionRepository.Where(x=>x.TrialClinicalId==inQuery.TrialClinicalId) + var trialClinicalQuestionQueryable = _trialClinicalQuestionRepository.Where(x => x.TrialClinicalId == inQuery.TrialClinicalId) .WhereIf(!inQuery.QuestionName.IsNullOrEmpty(), x => x.QuestionName.Contains(inQuery.QuestionName) || x.QuestionEnName.Contains(inQuery.QuestionName)) .ProjectTo(_mapper.ConfigurationProvider); var pageList = await trialClinicalQuestionQueryable - .ToPagedListAsync(inQuery.PageIndex, inQuery.PageSize, string.IsNullOrWhiteSpace(inQuery.SortField) ? nameof(TrialClinicalQuestion.ShowOrder) : inQuery.SortField, - inQuery.Asc); + .ToPagedListAsync(inQuery, nameof(TrialClinicalQuestion.ShowOrder)); return pageList; } @@ -265,18 +270,18 @@ namespace IRaCIS.Core.Application.Service { if (await _trialClinicalQuestionRepository.AnyAsync(x => x.TrialClinicalId == inDto.TrialClinicalId && x.Id != inDto.Id && x.QuestionName == inDto.QuestionName)) { - return ResponseOutput.NotOk(_localizer["ClinicalQuestion_Repeat"],string.Empty,ApiResponseCodeEnum.NeedTips); + return ResponseOutput.NotOk(_localizer["ClinicalQuestion_Repeat"], string.Empty, ApiResponseCodeEnum.NeedTips); } - + } - + if (await _trialClinicalQuestionRepository.AnyAsync(x => x.TrialClinicalId == inDto.TrialClinicalId && x.Id != inDto.Id && x.ShowOrder == inDto.ShowOrder)) { return ResponseOutput.NotOk("问题序号存在重复!"); } - if (await _trialClinicalQuestionRepository.AnyAsync(x => x.TrialClinicalId == inDto.TrialClinicalId && x.Id != inDto.Id && x.IsCheckDate == inDto.IsCheckDate&&inDto.IsCheckDate)) + if (await _trialClinicalQuestionRepository.AnyAsync(x => x.TrialClinicalId == inDto.TrialClinicalId && x.Id != inDto.Id && x.IsCheckDate == inDto.IsCheckDate && inDto.IsCheckDate)) { return ResponseOutput.NotOk("已经添加过类型为检查日期的问题!"); } @@ -306,7 +311,7 @@ namespace IRaCIS.Core.Application.Service [HttpPost] public async Task> GetTrialClinicalGroupQuestionList(GetTrialGroupDto inDto) { - return await this._trialClinicalQuestionRepository.Where(x => x.TrialClinicalId == inDto.TrialClinicalId&&x.ClinicalQuestionType== "group") + return await this._trialClinicalQuestionRepository.Where(x => x.TrialClinicalId == inDto.TrialClinicalId && x.ClinicalQuestionType == "group") .ProjectTo(_mapper.ConfigurationProvider).ToListAsync(); } @@ -322,7 +327,7 @@ namespace IRaCIS.Core.Application.Service { "select","radio" }; - return await this._trialClinicalQuestionRepository.Where(x => x.TrialClinicalId == inDto.TrialClinicalId && types.Contains( x.ClinicalQuestionType)) + return await this._trialClinicalQuestionRepository.Where(x => x.TrialClinicalId == inDto.TrialClinicalId && types.Contains(x.ClinicalQuestionType)) .ProjectTo(_mapper.ConfigurationProvider).ToListAsync(); } @@ -341,12 +346,11 @@ namespace IRaCIS.Core.Application.Service { var systemClinicalQuestionQueryable = _systemClinicalQuestionRepository - .Where(x=>x.SystemClinicalId==inQuery.SystemClinicalId) + .Where(x => x.SystemClinicalId == inQuery.SystemClinicalId) .WhereIf(!inQuery.QuestionName.IsNullOrEmpty(), x => x.QuestionName.Contains(inQuery.QuestionName) || x.QuestionEnName.Contains(inQuery.QuestionName)) .ProjectTo(_mapper.ConfigurationProvider); var pageList = await systemClinicalQuestionQueryable - .ToPagedListAsync(inQuery.PageIndex, inQuery.PageSize, string.IsNullOrWhiteSpace(inQuery.SortField) ? nameof(SystemClinicalQuestion.ShowOrder) : inQuery.SortField, - inQuery.Asc); + .ToPagedListAsync(inQuery, nameof(SystemClinicalQuestion.ShowOrder)); return pageList; } @@ -367,7 +371,7 @@ namespace IRaCIS.Core.Application.Service return ResponseOutput.NotOk(_localizer["ClinicalQuestion_Repeat"], string.Empty, ApiResponseCodeEnum.NeedTips); } } - + if (await _systemClinicalQuestionRepository.AnyAsync(x => x.SystemClinicalId == inDto.SystemClinicalId && x.Id != inDto.Id && x.ShowOrder == inDto.ShowOrder)) { @@ -404,7 +408,7 @@ namespace IRaCIS.Core.Application.Service [HttpPost] public async Task> GetSystemClinicalGroupQuestionList(GetSystemGroupDto inDto) { - return await this._systemClinicalQuestionRepository.Where(x => x.SystemClinicalId == inDto.SystemClinicalId && x.ClinicalQuestionType =="group") + return await this._systemClinicalQuestionRepository.Where(x => x.SystemClinicalId == inDto.SystemClinicalId && x.ClinicalQuestionType == "group") .ProjectTo(_mapper.ConfigurationProvider).ToListAsync(); } @@ -443,8 +447,7 @@ namespace IRaCIS.Core.Application.Service .Where(x => x.QuestionId == inQuery.QuestionId) .ProjectTo(_mapper.ConfigurationProvider); - var pageList = await systemClinicalTableQuestionQueryable.ToPagedListAsync(inQuery.PageIndex, inQuery.PageSize, string.IsNullOrWhiteSpace(inQuery.SortField) ? nameof(SystemClinicalTableQuestion.ShowOrder) : inQuery.SortField, - inQuery.Asc); + var pageList = await systemClinicalTableQuestionQueryable.ToPagedListAsync(inQuery, nameof(SystemClinicalTableQuestion.ShowOrder)); return pageList; } @@ -502,7 +505,7 @@ namespace IRaCIS.Core.Application.Service "select","radio" }; return await this._systemClinicalTableQuestionRepository.Where(x => x.QuestionId == inDto.QuestionId && types.Contains(x.ClinicalTableQuestionType)) - .Where(x=>x.Id!= inDto.TableQuestionId) + .Where(x => x.Id != inDto.TableQuestionId) .ProjectTo(_mapper.ConfigurationProvider).ToListAsync(); } #endregion @@ -541,8 +544,7 @@ namespace IRaCIS.Core.Application.Service .Where(x => x.QuestionId == inQuery.QuestionId) .ProjectTo(_mapper.ConfigurationProvider); - var pageList = await trialClinicalTableQuestionQueryable.ToPagedListAsync(inQuery.PageIndex, inQuery.PageSize, string.IsNullOrWhiteSpace(inQuery.SortField) ? nameof(TrialClinicalTableQuestion.ShowOrder) : inQuery.SortField, - inQuery.Asc); + var pageList = await trialClinicalTableQuestionQueryable.ToPagedListAsync(inQuery, nameof(TrialClinicalTableQuestion.ShowOrder)); return pageList; } @@ -600,11 +602,11 @@ namespace IRaCIS.Core.Application.Service var trialClinicalId = inDto.Select(x => x.TrialClinicalId).ToList(); var systemClinicalId = inDto.Select(x => x.SystemClinicalId).ToList(); - var questionRelationList =await _trialClinicalQuestionRepository.Where(x => trialClinicalId.Contains(x.TrialClinicalId)).Select(x => new QuestionDic() + var questionRelationList = await _trialClinicalQuestionRepository.Where(x => trialClinicalId.Contains(x.TrialClinicalId)).Select(x => new QuestionDic() { - SystemQuestionId=x.SystemClinicalQuestionId?? default(Guid), - TrialQuestionId=x.Id, - TrialClinicalId=x.TrialClinicalId, + SystemQuestionId = x.SystemClinicalQuestionId ?? default(Guid), + TrialQuestionId = x.Id, + TrialClinicalId = x.TrialClinicalId, }).ToListAsync(); var tableQuestionRelationList = await _trialClinicalTableQuestionRepository.Where(x => trialClinicalId.Contains(x.TrialClinicalId)).Select(x => new QuestionDic() @@ -625,7 +627,7 @@ namespace IRaCIS.Core.Application.Service List addTrialTableList = new List(); foreach (var item in inDto) { - var questionRelation = questionRelationList.Where(x=>x.TrialClinicalId==item.TrialClinicalId).ToDictionary( + var questionRelation = questionRelationList.Where(x => x.TrialClinicalId == item.TrialClinicalId).ToDictionary( x => x.SystemQuestionId, x => x.TrialQuestionId ); @@ -659,11 +661,11 @@ namespace IRaCIS.Core.Application.Service { question.GroupId = questionRelation[question.GroupId ?? default(Guid)]; } - if (question.RelevanceId != null) - { - question.RelevanceId = questionRelation[question.RelevanceId ?? default(Guid)]; - } - addTrialDataList.Add(question); + if (question.RelevanceId != null) + { + question.RelevanceId = questionRelation[question.RelevanceId ?? default(Guid)]; + } + addTrialDataList.Add(question); }; @@ -711,7 +713,7 @@ namespace IRaCIS.Core.Application.Service await _trialClinicalQuestionRepository.BatchDeleteNoTrackingAsync(x => trialClinicalId.Contains(x.TrialClinicalId)); await _trialClinicalQuestionRepository.AddRangeAsync(addTrialDataList); - await _trialClinicalTableQuestionRepository.BatchDeleteNoTrackingAsync(x => trialClinicalId.Contains(x.TrialClinicalId) ); + await _trialClinicalTableQuestionRepository.BatchDeleteNoTrackingAsync(x => trialClinicalId.Contains(x.TrialClinicalId)); await _trialClinicalTableQuestionRepository.AddRangeAsync(addTrialTableList); await _trialClinicalQuestionRepository.SaveChangesAsync(); } diff --git a/IRaCIS.Core.Application/Service/Reading/ClinicalData/ReadingClinicalDataService.cs b/IRaCIS.Core.Application/Service/Reading/ClinicalData/ReadingClinicalDataService.cs index e5ea2ae3e..0444805be 100644 --- a/IRaCIS.Core.Application/Service/Reading/ClinicalData/ReadingClinicalDataService.cs +++ b/IRaCIS.Core.Application/Service/Reading/ClinicalData/ReadingClinicalDataService.cs @@ -255,7 +255,7 @@ namespace IRaCIS.Application.Services var query = _readingClinicalDataRepository.AsQueryable(); if (inDto.StudyId != null) { - query = query.Where(x => x.StudyId == inDto.StudyId.Value && x.TrialId==inDto.TrialId&&x.SubjectId==inDto.SubjectId); + query = query.Where(x => x.StudyId == inDto.StudyId.Value && x.TrialId == inDto.TrialId && x.SubjectId == inDto.SubjectId); } else { @@ -393,7 +393,7 @@ namespace IRaCIS.Application.Services //如果先生成了任务,再签名subject级别 PM 临床数据,那么会导致其他标准的任务签名状态无法得到维护 - if (await _repository.AnyAsync(t => t.Id == data.ClinicalDataTrialSetId && t.UploadRole == UploadRole.PM && (t.ClinicalDataLevel == ClinicalLevel.Subject|| t.ClinicalDataLevel == ClinicalLevel.SubjectVisit))) + if (await _repository.AnyAsync(t => t.Id == data.ClinicalDataTrialSetId && t.UploadRole == UploadRole.PM && (t.ClinicalDataLevel == ClinicalLevel.Subject || t.ClinicalDataLevel == ClinicalLevel.SubjectVisit))) { var needDealTrialReadingCriterionIdList = _repository.Where(t => t.Id == data.ClinicalDataTrialSetId) .SelectMany(t => t.TrialClinicalDataSetCriteriaList) @@ -435,7 +435,7 @@ namespace IRaCIS.Application.Services // var readingId = await _readingClinicalDataRepository.Where(x => x.Id == inDto.ReadingClinicalDataId).Select(x => x.ReadingId).FirstOrDefaultAsync(); - + // //如果先生成了任务,再签名subject级别 PM 临床数据,那么会导致其他标准的任务签名状态无法得到维护 @@ -511,7 +511,7 @@ namespace IRaCIS.Application.Services else { //判断是影像学 还是肿瘤学阅片 - readModule = await _readModuleRepository.Where(t => t.Id == readingId).FirstNotNullAsync(); + readModule = await _readModuleRepository.Where(t => t.Id == readingId).FirstNotNullAsync(); //CRC 阅片期自定义结构化录入是否签名 bool crcReadModuleSign = true; @@ -573,7 +573,7 @@ namespace IRaCIS.Application.Services Expression> visitTaskLambda = x => x.TrialId == trialId && x.SubjectId == subjectId && x.TrialReadingCriterionId == trialReadingCritrialId; - if (isVisit ||(isVisit==false && readModule.ReadingSetType == ReadingSetType.ImageReading)) + if (isVisit || (isVisit == false && readModule.ReadingSetType == ReadingSetType.ImageReading)) { //访视类型的任务 不影响肿瘤学任务的临床数据状态 visitTaskLambda = visitTaskLambda.And(x => x.ArmEnum != Arm.TumorArm); @@ -730,11 +730,11 @@ namespace IRaCIS.Application.Services var subjectCode = string.Empty; if (inDto.ReadingId == null) { - var visitTask = await _visitTaskRepository.AsQueryable().Include(x=>x.Subject) - + var visitTask = await _visitTaskRepository.AsQueryable().Include(x => x.Subject) + .FirstOrDefaultAsync(x => x.Id == inDto.VisitTaskId); - subjectCode=visitTask.BlindSubjectCode.IsNullOrEmpty() ? visitTask.Subject.Code : visitTask.BlindSubjectCode; - readingNameOrTaskBlindName = visitTask.TaskBlindName; + subjectCode = visitTask.BlindSubjectCode.IsNullOrEmpty() ? visitTask.Subject.Code : visitTask.BlindSubjectCode; + readingNameOrTaskBlindName = visitTask.TaskBlindName; } inDto.SelectIsSign = false; var result = await GetClinicalDataList(inDto); @@ -747,7 +747,7 @@ namespace IRaCIS.Application.Services } } - + var readingIds = result.Select(x => x.ReadingId).ToList(); @@ -806,14 +806,15 @@ namespace IRaCIS.Application.Services var isBaseLine = await _subjectVisitRepository.AnyAsync(x => x.Id == inDto.ReadingId && x.IsBaseLine); - var result = await this.GetClinicalDataList(new GetReadingOrTaskClinicalDataListInDto() { - ClinicalDataTrialSetId = inDto.ClinicalDataTrialSetId, - GetClinicalType=inDto.GetClinicalType, - SubjectId=inDto.SubjectId, - TrialId=inDto.TrialId, - SelectIsSign=false, - ReadingId =inDto.ReadingId, - TrialReadingCriterionId = inDto.TrialReadingCriterionId, + var result = await this.GetClinicalDataList(new GetReadingOrTaskClinicalDataListInDto() + { + ClinicalDataTrialSetId = inDto.ClinicalDataTrialSetId, + GetClinicalType = inDto.GetClinicalType, + SubjectId = inDto.SubjectId, + TrialId = inDto.TrialId, + SelectIsSign = false, + ReadingId = inDto.ReadingId, + TrialReadingCriterionId = inDto.TrialReadingCriterionId, }); var readingIds = result.Select(x => x.ReadingId).ToList(); @@ -841,9 +842,9 @@ namespace IRaCIS.Application.Services public async Task> GetClinicalDataList(GetReadingOrTaskClinicalDataListInDto inDto) { - var resultQuery = _readingClinicalDataRepository.Where(x=>1==1).Select(x=> new GetReadingClinicalDataListOutDto() { }); + var resultQuery = _readingClinicalDataRepository.Where(x => 1 == 1).Select(x => new GetReadingClinicalDataListOutDto() { }); bool isSelfAnalysis = false; - var otherIsSelfAnalysisList=new List(); + var otherIsSelfAnalysisList = new List(); if (inDto.ReadingId == null) { var visitTask = await _visitTaskRepository.FirstOrDefaultAsync(x => x.Id == inDto.VisitTaskId); @@ -890,23 +891,23 @@ namespace IRaCIS.Application.Services Id = y.Id, FileName = y.FileName, Path = y.Path, - Size=y.Size, - Type=y.Type, + Size = y.Size, + Type = y.Type, CreateTime = y.CreateTime, }).ToList(), }); // 是否获取所有一致性分析的数据 - if(inDto.IsGetAllConsistencyAnalysis) + if (inDto.IsGetAllConsistencyAnalysis) { // 原来的非PDF - otherIsSelfAnalysisList =await _readingClinicalDataRepository.Where(x => x.SubjectId == inDto.SubjectId) + otherIsSelfAnalysisList = await _readingClinicalDataRepository.Where(x => x.SubjectId == inDto.SubjectId) .WhereIf(inDto.ReadingClinicalDataId != null, x => x.Id == inDto.ReadingClinicalDataId) .WhereIf(inDto.ClinicalDataTrialSetId != null, x => x.ClinicalDataTrialSetId == inDto.ClinicalDataTrialSetId) .WhereIf(inDto.SelectIsSign, x => x.IsSign == true) .Where(x => x.ReadingId == inDto.ReadingId) .WhereIf(inDto.TrialReadingCriterionId != null, x => x.ClinicalDataTrialSet.TrialClinicalDataSetCriteriaList.Any(t => t.TrialReadingCriterionId == inDto.TrialReadingCriterionId)) - .Where(x => x.ClinicalDataTrialSet.ClinicalUploadType != ClinicalUploadType.PDF||x.ClinicalDataTrialSet.ClinicalDataLevel== ClinicalLevel.Study) + .Where(x => x.ClinicalDataTrialSet.ClinicalUploadType != ClinicalUploadType.PDF || x.ClinicalDataTrialSet.ClinicalDataLevel == ClinicalLevel.Study) .Select(x => new GetReadingClinicalDataListOutDto() { ClinicalDataLevel = x.ClinicalDataTrialSet.ClinicalDataLevel, @@ -937,9 +938,9 @@ namespace IRaCIS.Application.Services }).ToList(), }).ToListAsync(); - + } - + } else { @@ -980,9 +981,9 @@ namespace IRaCIS.Application.Services }); } - - + + var result = new List(); if (!inDto.IsOnlyGetCRCReadModule) @@ -1143,10 +1144,10 @@ namespace IRaCIS.Application.Services TrialId = inDto.TrialId, SelectIsSign = false, IsGetAllConsistencyAnalysis = false, - VisitTaskId=inDto.VisitTaskId, + VisitTaskId = inDto.VisitTaskId, }); - - return (result,true); + + return (result, true); } @@ -1227,7 +1228,7 @@ namespace IRaCIS.Application.Services entity.ReadingClinicalDataState = ReadingClinicalDataStatus.HaveUploaded; entity.IsSign = false; entity.FileCount = fileCount; - entity.CreateTime=DateTime.Now; + entity.CreateTime = DateTime.Now; var success = await _readingConsistentClinicalDataRepository.SaveChangesAsync(); return ResponseOutput.Ok(entity.Id); @@ -1254,7 +1255,7 @@ namespace IRaCIS.Application.Services IsSign = true, IsBlind = inDto.IsBlind, IsComplete = inDto.IsComplete, - ReadingClinicalDataState= ReadingClinicalDataStatus.HaveSigned, + ReadingClinicalDataState = ReadingClinicalDataStatus.HaveSigned, }); await _readingClinicalDataPDFRepository.SaveChangesAsync(); return ResponseOutput.Ok(pdfCount); @@ -1268,8 +1269,8 @@ namespace IRaCIS.Application.Services [HttpPost] public async Task SetTaskValid(SetTaskValidInDto inDto) { - var visittask = await _visitTaskRepository.AsQueryable().Include(x=>x.TrialReadingCriterion).Where(x => x.Id == inDto.VisitTaskId).FirstNotNullAsync(); - var readingId = visittask.SouceReadModuleId==null? visittask.SourceSubjectVisitId: visittask.SouceReadModuleId; + var visittask = await _visitTaskRepository.AsQueryable().Include(x => x.TrialReadingCriterion).Where(x => x.Id == inDto.VisitTaskId).FirstNotNullAsync(); + var readingId = visittask.SouceReadModuleId == null ? visittask.SourceSubjectVisitId : visittask.SouceReadModuleId; if (await _readingConsistentClinicalDataRepository.AnyAsync(x => x.ReadingId == readingId @@ -1277,12 +1278,12 @@ namespace IRaCIS.Application.Services { return ResponseOutput.NotOk(_localizer["ReadingClinicalData_HaveUnsignedClinicalData"]); } - if(visittask.TrialReadingCriterion.IsReadingTaskViewInOrder== ReadingOrder.InOrder) + if (visittask.TrialReadingCriterion.IsReadingTaskViewInOrder == ReadingOrder.InOrder) { - if(await _visitTaskRepository.Where(x=>x.SubjectId== visittask.SubjectId - &&x.TrialReadingCriterionId== visittask.TrialReadingCriterionId - &&x.VisitTaskNum< visittask.VisitTaskNum&&x.IsAnalysisCreate==visittask.IsAnalysisCreate - &&x.IsSelfAnalysis==visittask.IsSelfAnalysis&&x.ArmEnum==visittask.ArmEnum&&x.TaskState==TaskState.NotEffect).AnyAsync() + if (await _visitTaskRepository.Where(x => x.SubjectId == visittask.SubjectId + && x.TrialReadingCriterionId == visittask.TrialReadingCriterionId + && x.VisitTaskNum < visittask.VisitTaskNum && x.IsAnalysisCreate == visittask.IsAnalysisCreate + && x.IsSelfAnalysis == visittask.IsSelfAnalysis && x.ArmEnum == visittask.ArmEnum && x.TaskState == TaskState.NotEffect).AnyAsync() ) { return ResponseOutput.NotOk(_localizer["ReadingClinicalData_NeedSetBeforeTaskEffect"]); @@ -1305,15 +1306,14 @@ namespace IRaCIS.Application.Services /// /// 获取单个阅片临床数据的所有文件 /// - /// + /// /// [HttpPost] - public async Task> GetReadingClinicalDataPDFList(GetReadingClinicalDataPDFListIndto inDto) + public async Task> GetReadingClinicalDataPDFList(GetReadingClinicalDataPDFListIndto inQuery) { - var result = await _readingClinicalDataPDFRepository.Where(x => x.ReadingClinicalDataId == inDto.ReadingClinicalDataId).ProjectTo(_mapper.ConfigurationProvider) - .ToPagedListAsync(inDto.PageIndex, inDto.PageSize, inDto.SortField == null ? nameof(GetReadingClinicalDataPDFListOutDto.FileName) : inDto.SortField, - inDto.Asc); + var result = await _readingClinicalDataPDFRepository.Where(x => x.ReadingClinicalDataId == inQuery.ReadingClinicalDataId).ProjectTo(_mapper.ConfigurationProvider) + .ToPagedListAsync(inQuery, nameof(GetReadingClinicalDataPDFListOutDto.FileName)); return result; } diff --git a/IRaCIS.Core.Application/Service/Reading/MedicalAudit/ReadingMedicalReviewService.cs b/IRaCIS.Core.Application/Service/Reading/MedicalAudit/ReadingMedicalReviewService.cs index 6d410e1f7..ea21597e2 100644 --- a/IRaCIS.Core.Application/Service/Reading/MedicalAudit/ReadingMedicalReviewService.cs +++ b/IRaCIS.Core.Application/Service/Reading/MedicalAudit/ReadingMedicalReviewService.cs @@ -880,8 +880,7 @@ namespace IRaCIS.Core.Application.Service }).WhereIf(!inDto.SubjectCode.IsNullOrEmpty(), x => x.SubjectCode == inDto.SubjectCode); - var result=await taskMedicalReviewquery.ToPagedListAsync(inDto.PageIndex, inDto.PageSize, inDto.SortField.IsNullOrEmpty() ? nameof(GetIRMedicalFeedbackListOutDto.AuditState) : inDto.SortField, - inDto.Asc); + var result=await taskMedicalReviewquery.ToPagedListAsync(inDto, nameof(GetIRMedicalFeedbackListOutDto.AuditState)); return result; } diff --git a/IRaCIS.Core.Application/Service/Reading/MedicalAudit/ReadingMedicineQuestionService.cs b/IRaCIS.Core.Application/Service/Reading/MedicalAudit/ReadingMedicineQuestionService.cs index 187d7c502..14cca9309 100644 --- a/IRaCIS.Core.Application/Service/Reading/MedicalAudit/ReadingMedicineQuestionService.cs +++ b/IRaCIS.Core.Application/Service/Reading/MedicalAudit/ReadingMedicineQuestionService.cs @@ -166,26 +166,26 @@ namespace IRaCIS.Core.Application.Service /// /// [HttpPost] - public async Task<(PageOutput, object)> GetReadingMedicineTrialQuestionList(ReadingMedicineTrialQuestionQuery inDto) + public async Task<(PageOutput, object)> GetReadingMedicineTrialQuestionList(ReadingMedicineTrialQuestionQuery inQuery) { var query = _readingMedicineTrialQuestionRepository.AsQueryable() - .Where(x => x.TrialId == inDto.TrialId && x.TrialReadingCriterionId == inDto.TrialReadingCriterionId) - .WhereIf(!inDto.TypeValue.IsNullOrEmpty(), x => x.TypeValue.Contains(inDto.TypeValue)) - .WhereIf(!inDto.ParentTriggerValue.IsNullOrEmpty(), x => x.ParentTriggerValue.Contains(inDto.ParentTriggerValue)) - .WhereIf(!inDto.QuestionName.IsNullOrEmpty(), x => x.QuestionName.Contains(inDto.QuestionName)) - .WhereIf(!inDto.Type.IsNullOrEmpty(), x => x.Type.Contains(inDto.Type)) - .WhereIf(inDto.ReadingCategory != null, x => x.ReadingCategory == inDto.ReadingCategory) - .WhereIf(inDto.LanguageType != null, x => x.LanguageType == inDto.LanguageType) + .Where(x => x.TrialId == inQuery.TrialId && x.TrialReadingCriterionId == inQuery.TrialReadingCriterionId) + .WhereIf(!inQuery.TypeValue.IsNullOrEmpty(), x => x.TypeValue.Contains(inQuery.TypeValue)) + .WhereIf(!inQuery.ParentTriggerValue.IsNullOrEmpty(), x => x.ParentTriggerValue.Contains(inQuery.ParentTriggerValue)) + .WhereIf(!inQuery.QuestionName.IsNullOrEmpty(), x => x.QuestionName.Contains(inQuery.QuestionName)) + .WhereIf(!inQuery.Type.IsNullOrEmpty(), x => x.Type.Contains(inQuery.Type)) + .WhereIf(inQuery.ReadingCategory != null, x => x.ReadingCategory == inQuery.ReadingCategory) + .WhereIf(inQuery.LanguageType != null, x => x.LanguageType == inQuery.LanguageType) .ProjectTo(_mapper.ConfigurationProvider).OrderByDescending(x=>x.LanguageType).ThenBy(x => x.ShowOrder); - var isConfirmMedicineQuestion = await _readingQuestionCriterionTrialRepository.Where(x => x.Id == inDto.TrialReadingCriterionId).Select(x => x.IsConfirmMedicineQuestion).FirstOrDefaultAsync(); - var questionList = await query.ToPagedListAsync(inDto.PageIndex, inDto.PageSize, inDto.SortField, inDto.Asc); + var isConfirmMedicineQuestion = await _readingQuestionCriterionTrialRepository.Where(x => x.Id == inQuery.TrialReadingCriterionId).Select(x => x.IsConfirmMedicineQuestion).FirstOrDefaultAsync(); + var questionList = await query.ToPagedListAsync(inQuery); return (questionList, new { IsConfirmMedicineQuestion = isConfirmMedicineQuestion, - LanguageType=(await _readingMedicineTrialQuestionRepository.FirstOrDefaultAsync(x => x.TrialReadingCriterionId == inDto.TrialReadingCriterionId&& x.SystemQuestionId != null))?.LanguageType, + LanguageType=(await _readingMedicineTrialQuestionRepository.FirstOrDefaultAsync(x => x.TrialReadingCriterionId == inQuery.TrialReadingCriterionId&& x.SystemQuestionId != null))?.LanguageType, //QuestionCount = questionList.Count(), }); } diff --git a/IRaCIS.Core.Application/Service/Reading/ReadingCriterion/OrganInfoService.cs b/IRaCIS.Core.Application/Service/Reading/ReadingCriterion/OrganInfoService.cs index 48bb3097b..2439e2e49 100644 --- a/IRaCIS.Core.Application/Service/Reading/ReadingCriterion/OrganInfoService.cs +++ b/IRaCIS.Core.Application/Service/Reading/ReadingCriterion/OrganInfoService.cs @@ -106,7 +106,8 @@ namespace IRaCIS.Core.Application.Service .WhereIf(inQuery.LesionType != null, x => organs.Contains(x.OrganType)) .WhereIf(inQuery.OrganType != null, x => x.OrganType == inQuery.OrganType) .ProjectTo(_mapper.ConfigurationProvider); - return await organInfoQueryable.ToPagedListAsync(inQuery.PageIndex, inQuery.PageSize, string.IsNullOrWhiteSpace(inQuery.SortField) ? nameof(OrganInfoView.ShowOrder) : inQuery.SortField, inQuery.Asc,true,new string[] { nameof(OrganInfoView.OrganType) , nameof(OrganInfoView.ShowOrder) }); + + return await organInfoQueryable.ToPagedListAsync(inQuery,new string[] { nameof(OrganInfoView.OrganType) , nameof(OrganInfoView.ShowOrder) }); } /// diff --git a/IRaCIS.Core.Application/Service/Reading/ReadingCriterion/ReadingCriterionService.cs b/IRaCIS.Core.Application/Service/Reading/ReadingCriterion/ReadingCriterionService.cs index 2d0ae041e..f9e07ac0d 100644 --- a/IRaCIS.Core.Application/Service/Reading/ReadingCriterion/ReadingCriterionService.cs +++ b/IRaCIS.Core.Application/Service/Reading/ReadingCriterion/ReadingCriterionService.cs @@ -263,8 +263,7 @@ namespace IRaCIS.Core.Application.Service.RC .WhereIf(!inDto.CriterionName.IsNullOrEmpty(), x => x.CriterionName.Contains(inDto.CriterionName)) .ProjectTo(_mapper.ConfigurationProvider); - return await query.ToPagedListAsync(inDto.PageIndex, inDto.PageSize, inDto.SortField.IsNullOrEmpty() ? nameof(ReadingQuestionCriterionSystemView.ShowOrder) : inDto.SortField, - inDto.Asc); + return await query.ToPagedListAsync(inDto, nameof(ReadingQuestionCriterionSystemView.ShowOrder)); } /// @@ -450,8 +449,7 @@ namespace IRaCIS.Core.Application.Service.RC .WhereIf(!inDto.CriterionName.IsNullOrEmpty(), x => x.CriterionName.Contains(inDto.CriterionName)) .ProjectTo(_mapper.ConfigurationProvider); - return await query.ToPagedListAsync(inDto.PageIndex, inDto.PageSize, inDto.SortField.IsNullOrEmpty() ? nameof(ReadingQuestionCriterionTrialView.ShowOrder) : inDto.SortField, - inDto.Asc); + return await query.ToPagedListAsync(inDto, nameof(ReadingQuestionCriterionTrialView.ShowOrder)); } /// diff --git a/IRaCIS.Core.Application/Service/Reading/ReadingCriterion/ReadingQuestionService.cs b/IRaCIS.Core.Application/Service/Reading/ReadingCriterion/ReadingQuestionService.cs index 4089e8676..638e22288 100644 --- a/IRaCIS.Core.Application/Service/Reading/ReadingCriterion/ReadingQuestionService.cs +++ b/IRaCIS.Core.Application/Service/Reading/ReadingCriterion/ReadingQuestionService.cs @@ -231,8 +231,7 @@ namespace IRaCIS.Application.Services .WhereIf(!inDto.QuestionName.IsNullOrEmpty(), x => x.QuestionName.Contains(inDto.QuestionName)) .WhereIf(!inDto.Type.IsNullOrEmpty(), x => x.Type.Contains(inDto.Type)) .ProjectTo(_mapper.ConfigurationProvider); - return await query.ToPagedListAsync(inDto.PageIndex, inDto.PageSize, nameof(ReadingQuestionSystemView.ShowOrder), - inDto.Asc); + return await query.ToPagedListAsync(inDto, nameof(ReadingQuestionSystemView.ShowOrder)); } /// diff --git a/IRaCIS.Core.Application/Service/Reading/ReadingCriterion/TumorAssessmentService.cs b/IRaCIS.Core.Application/Service/Reading/ReadingCriterion/TumorAssessmentService.cs index 9aac2d762..2881be7e3 100644 --- a/IRaCIS.Core.Application/Service/Reading/ReadingCriterion/TumorAssessmentService.cs +++ b/IRaCIS.Core.Application/Service/Reading/ReadingCriterion/TumorAssessmentService.cs @@ -19,7 +19,7 @@ namespace IRaCIS.Core.Application.Service.TA private readonly IRepository _tumorAssessmentIRepository1Point1; private readonly IRepository _tumorAssessmentRepository1Point1BM; - public ReadingQuestionService( IRepository tumorAssessmentRepository1Point1, + public ReadingQuestionService(IRepository tumorAssessmentRepository1Point1, IRepository tumorAssessmentIRepository1Point1, IRepository tumorAssessmentRepository1Point1BM ) @@ -52,14 +52,14 @@ namespace IRaCIS.Core.Application.Service.TA /// /// [HttpPost] - public async Task<(object,List)> GetTumorAssessmentPageList(GetTumorAssessmentListInDto inQuery) + public async Task<(object, List)> GetTumorAssessmentPageList(GetTumorAssessmentListInDto inQuery) { var result = new object(); List columnList = new List(); switch (inQuery.CriterionType) { case CriterionType.RECIST1Point1: - result= await _tumorAssessmentRepository1Point1.AsQueryable().ToPagedListAsync(inQuery.PageIndex, inQuery.PageSize, string.IsNullOrWhiteSpace(inQuery.SortField) ? nameof(TumorAssessmentView.Id) : inQuery.SortField, inQuery.Asc); + result = await _tumorAssessmentRepository1Point1.AsQueryable().ToPagedListAsync(inQuery, nameof(TumorAssessmentView.Id)); columnList = new List() { new ColumnInfo(){ ColumnName="靶病灶",ColumnKey=nameof(TumorAssessment_RECIST1Point1.TargetLesion),DictionaryKey=typeof(TargetAssessment).Name }, @@ -69,7 +69,7 @@ namespace IRaCIS.Core.Application.Service.TA }; break; case CriterionType.RECIST1Pointt1_MB: - result = await _tumorAssessmentRepository1Point1BM.AsQueryable().ToPagedListAsync(inQuery.PageIndex, inQuery.PageSize, string.IsNullOrWhiteSpace(inQuery.SortField) ? nameof(TumorAssessmentView.Id) : inQuery.SortField, inQuery.Asc); + result = await _tumorAssessmentRepository1Point1BM.AsQueryable().ToPagedListAsync(inQuery, nameof(TumorAssessmentView.Id)); columnList = new List() { new ColumnInfo(){ ColumnName="靶病灶",ColumnKey=nameof(TumorAssessment_RECIST1Point1.TargetLesion),DictionaryKey=typeof(TargetAssessment).Name }, @@ -79,7 +79,7 @@ namespace IRaCIS.Core.Application.Service.TA }; break; case CriterionType.IRECIST1Point1: - result = await _tumorAssessmentIRepository1Point1.AsQueryable().ToPagedListAsync(inQuery.PageIndex, inQuery.PageSize, string.IsNullOrWhiteSpace(inQuery.SortField) ? nameof(TumorAssessmentView.Id) : inQuery.SortField, inQuery.Asc); + result = await _tumorAssessmentIRepository1Point1.AsQueryable().ToPagedListAsync(inQuery, nameof(TumorAssessmentView.Id)); columnList = new List() { new ColumnInfo(){ ColumnName="靶病灶",ColumnKey=nameof(TumorAssessment_RECIST1Point1.TargetLesion),DictionaryKey=typeof(TargetAssessment).Name }, diff --git a/IRaCIS.Core.Application/Service/Reading/ReadingPeriod/ReadingPeriodSetService.cs b/IRaCIS.Core.Application/Service/Reading/ReadingPeriod/ReadingPeriodSetService.cs index c0b542dbc..5306bec12 100644 --- a/IRaCIS.Core.Application/Service/Reading/ReadingPeriod/ReadingPeriodSetService.cs +++ b/IRaCIS.Core.Application/Service/Reading/ReadingPeriod/ReadingPeriodSetService.cs @@ -137,12 +137,12 @@ namespace IRaCIS.Application.Services { IsDeleted = true - }) ; + }); await _readingPeriodPlanRepository.UpdatePartialFromQueryAsync(t => t.ReadingPeriodSetId == readingPeriodSetId, x => new ReadingPeriodPlan() { IsDeleted = true - }) ; + }); await _readingPeriodPlanRepository.SaveChangesAsync(); return ResponseOutput.Ok(); } @@ -245,10 +245,11 @@ namespace IRaCIS.Application.Services var globalModuleIds = await _readModuleRepository.Where(x => x.TrialReadingCriterionId == readingPeriodSet.TrialReadingCriterionId && subjectVisitIds.Contains(x.SubjectVisitId) && x.ModuleType == ModuleTypeEnum.Global).Select(x => x.Id).ToListAsync(); //增加标准 - var globalTaskInfo = await _visitTaskRepository.Where(x => x.TrialReadingCriterionId == readingPeriodSet.TrialReadingCriterionId && globalModuleIds.Contains(x.SouceReadModuleId ?? default(Guid)) - + var globalTaskInfo = await _visitTaskRepository.Where(x => x.TrialReadingCriterionId == readingPeriodSet.TrialReadingCriterionId && globalModuleIds.Contains(x.SouceReadModuleId ?? default(Guid)) + && x.TaskState == TaskState.Effect && x.ReadingTaskState == ReadingTaskState.HaveSigned && !x.IsAnalysisCreate).GroupBy(x => new { x.SouceReadModuleId }).Select(x => - new { + new + { SouceReadModuleId = x.Key.SouceReadModuleId, Count = x.ToList().Count, TaskId = x.Select(x => x.Id).FirstOrDefault(), @@ -277,7 +278,7 @@ namespace IRaCIS.Application.Services { IsUrgent = readModule.IsUrgent ?? false, SubjectId = readModule.SubjectId, - + ReadingName = readModule.ModuleName, ReadModuleId =readModule.Id, ReadingCategory = ReadingCategory.Oncology, @@ -306,10 +307,10 @@ namespace IRaCIS.Application.Services List readModuleIds = await _readModuleRepository.Where(x => x.ReadingPeriodSetId == indto.Id).Select(x => x.Id).ToListAsync(); if (await _visitTaskRepository.AnyAsync(x => x.TrialReadingCriterionId == readingPeriodSet.TrialReadingCriterionId && readModuleIds.Contains(x.SouceReadModuleId ?? default(Guid)) - && x.TrialReadingCriterionId == readingPeriodSet.TrialReadingCriterionId + && x.TrialReadingCriterionId == readingPeriodSet.TrialReadingCriterionId && x.ReadingTaskState == ReadingTaskState.HaveSigned && x.TaskState == TaskState.Effect)) { - //---当前标准阅片已生成任务并且阅片完成,撤销失败。 + //---当前标准阅片已生成任务并且阅片完成,撤销失败。 throw new BusinessValidationFailedException(_localizer["ReadingPeriodSet_TaskCompletedCannotRevoke"]); } @@ -319,9 +320,10 @@ namespace IRaCIS.Application.Services TaskState = TaskState.Adbandon }); - await _readModuleRepository.UpdatePartialFromQueryAsync(x => x.ReadingPeriodSetId == indto.Id,x=>new ReadModule() { - - IsDeleted=true + await _readModuleRepository.UpdatePartialFromQueryAsync(x => x.ReadingPeriodSetId == indto.Id, x => new ReadModule() + { + + IsDeleted = true }); } @@ -366,8 +368,7 @@ namespace IRaCIS.Application.Services EffectOfTime = x.ReadingPeriodSet.EffectOfTime, }); - return await plans.ToPagedListAsync(inDto.PageIndex, inDto.PageSize, inDto.SortField == null ? nameof(PreviewTheReadingListOutDto.SubjectId) : inDto.SortField, - inDto.Asc); + return await plans.ToPagedListAsync(inDto, nameof(PreviewTheReadingListOutDto.SubjectId)); } @@ -420,8 +421,7 @@ namespace IRaCIS.Application.Services .WhereIf(query.ReadingPeriodName != null, x => x.ReadingPeriodName.Contains(query.ReadingPeriodName!)) .WhereIf(query.TrialReadingCriterionId != null, x => x.TrialReadingCriterionId == query.TrialReadingCriterionId) .ProjectTo(_mapper.ConfigurationProvider); - var pageList = await readQuery.ToPagedListAsync(query.PageIndex, query.PageSize, query.SortField == null ? nameof(ReadingPeriodSetView.CreateTime) : query.SortField, - query.Asc); + var pageList = await readQuery.ToPagedListAsync(query, nameof(ReadingPeriodSetView.CreateTime)); pageList.CurrentPageData.ForEach(x => { @@ -470,7 +470,7 @@ namespace IRaCIS.Application.Services List result = await _visitStageRepository.Where(x => x.TrialId == inDto.TrialId) .WhereIf(inDto.ReadingSetType == ReadingSetType.TumorReading, x => globalVisitNum.Contains(x.VisitNum)) - .Where(x=>x.VisitNum>0)// 不能是基线 + .Where(x => x.VisitNum > 0)// 不能是基线 .Where(x => x.VisitNum == thisVisitNum || x.VisitNum >= maxVisitNum).Select(x => new GetReadingVisitListOutDto() { VisitName = x.VisitName, @@ -494,7 +494,7 @@ namespace IRaCIS.Application.Services // 当前项目 最晚拍片日期不为null 中心筛选 var visitQuery = _subjectVisitRepository.Where(x => x.TrialId == inDto.TrialId && x.LatestScanDate != null && !x.IsLostVisit) .WhereIf(inDto.ReadingScope == ReadingScopeEnum.Site, x => inDto.SiteIds.Contains(x.TrialSiteId)) - .Where(x=>!x.IsBaseLine);// 排除基线 + .Where(x => !x.IsBaseLine);// 排除基线 // 已经存在的访视 需要排除 var existsBubjectVisitsQuery = _readModuleRepository.Where(y => y.ReadingSetType == inDto.ReadingSetType && y.TrialId == inDto.TrialId && y.TrialReadingCriterionId == inDto.TrialReadingCriterionId).Select(x => x.SubjectVisitId); diff --git a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs index 5affbbd80..ff60f4637 100644 --- a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs +++ b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs @@ -468,22 +468,22 @@ namespace IRaCIS.Core.Application.Contracts /// /// [HttpPost] - public async Task> GetTrialSiteSurveyList(TrialSiteSurveyQueryDTO surveyQueryDTO) + public async Task> GetTrialSiteSurveyList(TrialSiteSurveyQueryDTO inQuery) { - var trialSiteSurveyQueryable = _trialSiteSurveyRepository.Where(t => t.TrialId == surveyQueryDTO.TrialId).IgnoreQueryFilters() - .WhereIf(surveyQueryDTO.TrialSiteId != null, t => t.TrialSiteId == surveyQueryDTO.TrialSiteId) - .WhereIf(surveyQueryDTO.IsDeleted != null, t => t.IsDeleted == surveyQueryDTO.IsDeleted) - .WhereIf(!string.IsNullOrWhiteSpace(surveyQueryDTO.UserKeyInfo), t => t.UserName.Contains(surveyQueryDTO.UserKeyInfo) || t.Phone.Contains(surveyQueryDTO.UserKeyInfo) || t.Email.Contains(surveyQueryDTO.UserKeyInfo)) - .WhereIf(surveyQueryDTO.State != null, t => t.State == surveyQueryDTO.State) - .WhereIf(surveyQueryDTO.UpdateTimeBegin != null, t => t.UpdateTime >= surveyQueryDTO.UpdateTimeBegin) - .WhereIf(surveyQueryDTO.UpdateTimeEnd != null, t => t.UpdateTime <= surveyQueryDTO.UpdateTimeEnd) + var trialSiteSurveyQueryable = _trialSiteSurveyRepository.Where(t => t.TrialId == inQuery.TrialId).IgnoreQueryFilters() + .WhereIf(inQuery.TrialSiteId != null, t => t.TrialSiteId == inQuery.TrialSiteId) + .WhereIf(inQuery.IsDeleted != null, t => t.IsDeleted == inQuery.IsDeleted) + .WhereIf(!string.IsNullOrWhiteSpace(inQuery.UserKeyInfo), t => t.UserName.Contains(inQuery.UserKeyInfo) || t.Phone.Contains(inQuery.UserKeyInfo) || t.Email.Contains(inQuery.UserKeyInfo)) + .WhereIf(inQuery.State != null, t => t.State == inQuery.State) + .WhereIf(inQuery.UpdateTimeBegin != null, t => t.UpdateTime >= inQuery.UpdateTimeBegin) + .WhereIf(inQuery.UpdateTimeEnd != null, t => t.UpdateTime <= inQuery.UpdateTimeEnd) .ProjectTo(_mapper.ConfigurationProvider, new { isEn_Us = _userInfo.IsEn_Us }) - .WhereIf(!string.IsNullOrWhiteSpace(surveyQueryDTO.PreliminaryUserName), t => t.PreliminaryUser.RealName.Contains(surveyQueryDTO.PreliminaryUserName)) - .WhereIf(!string.IsNullOrWhiteSpace(surveyQueryDTO.ReviewerUserName), t => t.ReviewerUser.RealName.Contains(surveyQueryDTO.ReviewerUserName)) + .WhereIf(!string.IsNullOrWhiteSpace(inQuery.PreliminaryUserName), t => t.PreliminaryUser.RealName.Contains(inQuery.PreliminaryUserName)) + .WhereIf(!string.IsNullOrWhiteSpace(inQuery.ReviewerUserName), t => t.ReviewerUser.RealName.Contains(inQuery.ReviewerUserName)) ; - return await trialSiteSurveyQueryable.ToPagedListAsync(surveyQueryDTO.PageIndex, surveyQueryDTO.PageSize, surveyQueryDTO.SortField, surveyQueryDTO.Asc); + return await trialSiteSurveyQueryable.ToPagedListAsync(inQuery); } [HttpPost] @@ -501,32 +501,32 @@ namespace IRaCIS.Core.Application.Contracts /// 项目Site调研用户列表 所有site的调研用户 最新的调研表的记录的用户 new /// /// - public async Task> TrialSiteSurveyUserList(TrialSiteUserSurveyAllQuery queryParam) + public async Task> TrialSiteSurveyUserList(TrialSiteUserSurveyAllQuery inQuery) { var groupSelectIdQuery = - _trialSiteSurveyRepository.Where(t => t.TrialId == queryParam.TrialId) - .WhereIf(queryParam.TrialSiteId != null, t => t.TrialSiteId == queryParam.TrialSiteId) + _trialSiteSurveyRepository.Where(t => t.TrialId == inQuery.TrialId) + .WhereIf(inQuery.TrialSiteId != null, t => t.TrialSiteId == inQuery.TrialSiteId) - .WhereIf(!string.IsNullOrEmpty(queryParam.FormWriterKeyInfo), t => (t.UserName).Contains(queryParam.FormWriterKeyInfo) || t.Email.Contains(queryParam.FormWriterKeyInfo) || t.Phone.Contains(queryParam.FormWriterKeyInfo)) + .WhereIf(!string.IsNullOrEmpty(inQuery.FormWriterKeyInfo), t => (t.UserName).Contains(inQuery.FormWriterKeyInfo) || t.Email.Contains(inQuery.FormWriterKeyInfo) || t.Phone.Contains(inQuery.FormWriterKeyInfo)) .GroupBy(t => t.TrialSiteId) .Select(g => g.OrderByDescending(u => u.CreateTime).Select(t => t.Id).First()); var query = _trialSiteUserSurveyRepository .Where(t => groupSelectIdQuery.Contains(t.TrialSiteSurveyId)) - .WhereIf(queryParam.TrialRoleCode != null, t => t.TrialRoleCode == queryParam.TrialRoleCode) - .WhereIf(queryParam.UserTypeId != null, t => t.UserTypeId == queryParam.UserTypeId) - .WhereIf(queryParam.IsGenerateAccount != null, t => t.IsGenerateAccount == queryParam.IsGenerateAccount) - .WhereIf(queryParam.State != null && queryParam.State != TrialSiteUserStateEnum.OverTime, t => t.InviteState == queryParam.State) - .WhereIf(!string.IsNullOrEmpty(queryParam.UserName), t => (t.LastName + " / " + t.FirstName).Contains(queryParam.UserName)) - .WhereIf(!string.IsNullOrEmpty(queryParam.OrganizationName), t => t.OrganizationName.Contains(queryParam.OrganizationName)) + .WhereIf(inQuery.TrialRoleCode != null, t => t.TrialRoleCode == inQuery.TrialRoleCode) + .WhereIf(inQuery.UserTypeId != null, t => t.UserTypeId == inQuery.UserTypeId) + .WhereIf(inQuery.IsGenerateAccount != null, t => t.IsGenerateAccount == inQuery.IsGenerateAccount) + .WhereIf(inQuery.State != null && inQuery.State != TrialSiteUserStateEnum.OverTime, t => t.InviteState == inQuery.State) + .WhereIf(!string.IsNullOrEmpty(inQuery.UserName), t => (t.LastName + " / " + t.FirstName).Contains(inQuery.UserName)) + .WhereIf(!string.IsNullOrEmpty(inQuery.OrganizationName), t => t.OrganizationName.Contains(inQuery.OrganizationName)) .ProjectTo(_mapper.ConfigurationProvider); - return await query.ToPagedListAsync(queryParam.PageIndex, queryParam.PageSize, queryParam.SortField, queryParam.Asc); + return await query.ToPagedListAsync(inQuery); diff --git a/IRaCIS.Core.Application/Service/Stat/StatisticsService.cs b/IRaCIS.Core.Application/Service/Stat/StatisticsService.cs index c13ae8372..c4117e081 100644 --- a/IRaCIS.Core.Application/Service/Stat/StatisticsService.cs +++ b/IRaCIS.Core.Application/Service/Stat/StatisticsService.cs @@ -50,13 +50,13 @@ namespace IRaCIS.Application.Services /// 根据项目和医生,分页获取工作量统计[New] [HttpPost] public async Task> GetWorkloadByTrialAndReviewer( - StatisticsWorkloadQueryParam param) + StatisticsWorkloadQueryParam inQuery) { - var bDate = new DateTime(param.BeginDate.Year, param.BeginDate.Month, param.BeginDate.Day); - var eDate = new DateTime(param.EndDate.Year, param.EndDate.Month, param.EndDate.Day); + var bDate = new DateTime(inQuery.BeginDate.Year, inQuery.BeginDate.Month, inQuery.BeginDate.Day); + var eDate = new DateTime(inQuery.EndDate.Year, inQuery.EndDate.Month, inQuery.EndDate.Day); eDate = eDate.AddDays(1); Expression> workloadLambda = x => x.DataFrom == (int)WorkLoadFromStatus.FinalConfirm; workloadLambda = workloadLambda.And(x => x.WorkTime >= bDate && x.WorkTime < eDate); @@ -64,9 +64,9 @@ namespace IRaCIS.Application.Services Expression> trialLambda = x => true; if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.SuperAdmin) //超级管理员按照条件查询所有 { - if (param.CroId != null) + if (inQuery.CroId != null) { - trialLambda = trialLambda.And(u => u.CROId == param.CroId); + trialLambda = trialLambda.And(u => u.CROId == inQuery.CroId); } } @@ -75,16 +75,16 @@ namespace IRaCIS.Application.Services List trialIdList = _userTrialRepository.Where(u => u.UserId == _userInfo.Id).Select(u => u.TrialId).ToList(); trialLambda = trialLambda.And(u => trialIdList.Contains(u.Id)); } - if (!string.IsNullOrWhiteSpace(param.TrialCode)) + if (!string.IsNullOrWhiteSpace(inQuery.TrialCode)) { - trialLambda = trialLambda.And(u => u.TrialCode.Contains(param.TrialCode)); + trialLambda = trialLambda.And(u => u.TrialCode.Contains(inQuery.TrialCode)); } Expression> doctorLambda = x => true; - if (!string.IsNullOrWhiteSpace(param.Reviewer)) + if (!string.IsNullOrWhiteSpace(inQuery.Reviewer)) { - var reviewer = param.Reviewer.Trim(); + var reviewer = inQuery.Reviewer.Trim(); doctorLambda = doctorLambda.And(u => u.ChineseName.Contains(reviewer) || u.FirstName.Contains(reviewer) || u.LastName.Contains(reviewer) @@ -92,9 +92,9 @@ namespace IRaCIS.Application.Services ); } - if (Guid.Empty != param.HospitalId && param.HospitalId != null) + if (Guid.Empty != inQuery.HospitalId && inQuery.HospitalId != null) { - doctorLambda = doctorLambda.And(u => u.HospitalId == param.HospitalId); + doctorLambda = doctorLambda.And(u => u.HospitalId == inQuery.HospitalId); } var workloadQuery = from workLoad in _workloadRepository.Where(workloadLambda) @@ -154,7 +154,7 @@ namespace IRaCIS.Application.Services }; - return await query.ToPagedListAsync(param.PageIndex, param.PageSize, string.IsNullOrWhiteSpace(param.SortField) ? "ReviewerCode" : param.SortField, param.Asc); + return await query.ToPagedListAsync(inQuery); //var propName = param.SortField == "" ? "ReviewerCode" : param.SortField; //query = param.Asc @@ -182,26 +182,26 @@ namespace IRaCIS.Application.Services /// 项目入组 医生维度统计[New] [HttpPost] - public async Task> GetEnrollStatByReviewer(EnrollStatByReviewerQueryDTO param) + public async Task> GetEnrollStatByReviewer(EnrollStatByReviewerQueryDTO inQuery) { - var bDate = new DateTime(param.BeginDate.Year, param.BeginDate.Month, 1); - var eDate = new DateTime(param.EndDate.Year, param.EndDate.Month, 1); + var bDate = new DateTime(inQuery.BeginDate.Year, inQuery.BeginDate.Month, 1); + var eDate = new DateTime(inQuery.EndDate.Year, inQuery.EndDate.Month, 1); eDate = eDate.AddMonths(1); Expression> enrollLambda = x => true; enrollLambda = enrollLambda.And(x => x.EnrollTime >= bDate && x.EnrollTime < eDate); Expression> hospitalLambda = x => true; - if (Guid.Empty != param.HospitalId && param.HospitalId != null) + if (Guid.Empty != inQuery.HospitalId && inQuery.HospitalId != null) { - hospitalLambda = hospitalLambda.And(u => u.Id == param.HospitalId); + hospitalLambda = hospitalLambda.And(u => u.Id == inQuery.HospitalId); } Expression> doctorLambda = x => true; - if (!string.IsNullOrWhiteSpace(param.Reviewer)) + if (!string.IsNullOrWhiteSpace(inQuery.Reviewer)) { - var reviewer = param.Reviewer.Trim(); + var reviewer = inQuery.Reviewer.Trim(); doctorLambda = doctorLambda.And(u => u.ChineseName.Contains(reviewer) || u.FirstName.Contains(reviewer) || u.LastName.Contains(reviewer) @@ -249,9 +249,9 @@ namespace IRaCIS.Application.Services }; - var pageData = await query.ToPagedListAsync(param.PageIndex, param.PageIndex, param.SortField == "" ? "ReviewerCode" : param.SortField, param.Asc); + var pageData = await query.ToPagedListAsync(inQuery); - if (param.SortField == "EntryRate") + if (inQuery.SortField == "EntryRate") { pageData.CurrentPageData.OrderBy(t => t.EntryRate); } diff --git a/IRaCIS.Core.Application/Service/Third-partyProject/UltrasonicDicomService.cs b/IRaCIS.Core.Application/Service/Third-partyProject/UltrasonicDicomService.cs index ee25c579e..a9609d4dc 100644 --- a/IRaCIS.Core.Application/Service/Third-partyProject/UltrasonicDicomService.cs +++ b/IRaCIS.Core.Application/Service/Third-partyProject/UltrasonicDicomService.cs @@ -72,7 +72,7 @@ namespace IRaCIS.Core.Application.Service.Third_partyProject TrialStatusStr = t.TrialStatusStr }); - var result = await query.ToPagedListAsync(inQuery.PageIndex, inQuery.PageSize, string.IsNullOrWhiteSpace(inQuery.SortField) ? nameof(TrialListDTO_UltrasonicDicom.CreateTime) : inQuery.SortField, inQuery.Asc); + var result = await query.ToPagedListAsync(inQuery); return ResponseOutput.Ok(result); } @@ -81,27 +81,27 @@ namespace IRaCIS.Core.Application.Service.Third_partyProject /// /// 任务列表 第一层级 /// - /// + /// /// [HttpPost] - public async Task> GetVisitTaskList(VisitTaskQuery_UltrasonicDicom queryVisitTask) + public async Task> GetVisitTaskList(VisitTaskQuery_UltrasonicDicom inQuery) { - var visitTaskQueryable = _visitTaskRepository.Where(t => t.TrialId == queryVisitTask.TrialId && t.IsAnalysisCreate == false && t.TaskState == TaskState.Effect && t.TaskAllocationState == TaskAllocationState.Allocated && t.SourceSubjectVisitId != null) + var visitTaskQueryable = _visitTaskRepository.Where(t => t.TrialId == inQuery.TrialId && t.IsAnalysisCreate == false && t.TaskState == TaskState.Effect && t.TaskAllocationState == TaskAllocationState.Allocated && t.SourceSubjectVisitId != null) - .WhereIf(queryVisitTask.TrialSiteId != null, t => t.Subject.TrialSiteId == queryVisitTask.TrialSiteId) - .WhereIf(queryVisitTask.SubjectId != null, t => t.SubjectId == queryVisitTask.SubjectId) - .WhereIf(queryVisitTask.IsUrgent != null, t => t.IsUrgent == queryVisitTask.IsUrgent) - .WhereIf(queryVisitTask.DoctorUserId != null, t => t.DoctorUserId == queryVisitTask.DoctorUserId) - .WhereIf(queryVisitTask.TrialReadingCriterionId != null, t => t.TrialReadingCriterionId == queryVisitTask.TrialReadingCriterionId) - .WhereIf(!string.IsNullOrEmpty(queryVisitTask.TrialSiteCode), t => (t.BlindTrialSiteCode.Contains(queryVisitTask.TrialSiteCode!) && t.IsAnalysisCreate) || (t.Subject.TrialSite.TrialSiteCode.Contains(queryVisitTask.TrialSiteCode!) && t.IsAnalysisCreate == false)) - .WhereIf(!string.IsNullOrEmpty(queryVisitTask.TaskName), t => t.TaskName.Contains(queryVisitTask.TaskName) || t.TaskBlindName.Contains(queryVisitTask.TaskName)) - .WhereIf(!string.IsNullOrEmpty(queryVisitTask.SubjectCode), t => (t.Subject.Code.Contains(queryVisitTask.SubjectCode) && t.IsAnalysisCreate == false) || (t.BlindSubjectCode.Contains(queryVisitTask.SubjectCode) && t.IsAnalysisCreate)) + .WhereIf(inQuery.TrialSiteId != null, t => t.Subject.TrialSiteId == inQuery.TrialSiteId) + .WhereIf(inQuery.SubjectId != null, t => t.SubjectId == inQuery.SubjectId) + .WhereIf(inQuery.IsUrgent != null, t => t.IsUrgent == inQuery.IsUrgent) + .WhereIf(inQuery.DoctorUserId != null, t => t.DoctorUserId == inQuery.DoctorUserId) + .WhereIf(inQuery.TrialReadingCriterionId != null, t => t.TrialReadingCriterionId == inQuery.TrialReadingCriterionId) + .WhereIf(!string.IsNullOrEmpty(inQuery.TrialSiteCode), t => (t.BlindTrialSiteCode.Contains(inQuery.TrialSiteCode!) && t.IsAnalysisCreate) || (t.Subject.TrialSite.TrialSiteCode.Contains(inQuery.TrialSiteCode!) && t.IsAnalysisCreate == false)) + .WhereIf(!string.IsNullOrEmpty(inQuery.TaskName), t => t.TaskName.Contains(inQuery.TaskName) || t.TaskBlindName.Contains(inQuery.TaskName)) + .WhereIf(!string.IsNullOrEmpty(inQuery.SubjectCode), t => (t.Subject.Code.Contains(inQuery.SubjectCode) && t.IsAnalysisCreate == false) || (t.BlindSubjectCode.Contains(inQuery.SubjectCode) && t.IsAnalysisCreate)) .ProjectTo(_mapper.ConfigurationProvider); var defalutSortArray = new string[] { nameof(VisitTask.SubjectId), nameof(VisitTask.VisitTaskNum) }; - var pageList = await visitTaskQueryable.ToPagedListAsync(queryVisitTask.PageIndex, queryVisitTask.PageSize, queryVisitTask.SortField, queryVisitTask.Asc, string.IsNullOrWhiteSpace(queryVisitTask.SortField), defalutSortArray); + var pageList = await visitTaskQueryable.ToPagedListAsync(inQuery, defalutSortArray); return pageList; } diff --git a/IRaCIS.Core.Application/Service/TrialSiteUser/PersonalWorkstation.cs b/IRaCIS.Core.Application/Service/TrialSiteUser/PersonalWorkstation.cs index 936d470b7..ee821270c 100644 --- a/IRaCIS.Core.Application/Service/TrialSiteUser/PersonalWorkstation.cs +++ b/IRaCIS.Core.Application/Service/TrialSiteUser/PersonalWorkstation.cs @@ -123,10 +123,10 @@ namespace IRaCIS.Core.Application /// /// 中心调研 每个项目 需要处理的审批统计 /// - /// + /// /// [HttpPost] - public async Task> GetSiteSurveyApprovalList(TrialSiteSurveyStatQuery query) + public async Task> GetSiteSurveyApprovalList(TrialSiteSurveyStatQuery inQuery) { @@ -140,12 +140,12 @@ namespace IRaCIS.Core.Application .WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ProjectManager || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.APM, c => c.TrialSiteSurveyList.Where(t => t.State == TrialSiteSurveyEnum.SPMApproved).Count() > 0) .WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.CPM || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.SPM, c => c.TrialSiteSurveyList.Where(t => t.State == TrialSiteSurveyEnum.CRCSubmitted).Count() > 0) .ProjectTo(_mapper.ConfigurationProvider, new { userTypeEnumInt = _userInfo.UserTypeEnumInt, userId = _userInfo.Id }) - .OrderByDescending(t => t.ApprovalRequiredCount).ToPagedListAsync(query.PageIndex, query.PageSize, query.SortField, query.Asc); + .OrderByDescending(t => t.ApprovalRequiredCount).ToPagedListAsync(inQuery); } else { - return new PageOutput(query.PageIndex, query.PageSize, 0, new List()); + return new PageOutput(inQuery.PageIndex, inQuery.PageSize, 0, new List()); } @@ -155,14 +155,14 @@ namespace IRaCIS.Core.Application /// /// 待签署的项目文件 需要签署文件数量 系统级别的在第一行 /// - /// + /// /// [HttpPost] - public async Task> GetTrialDocStatList(TrialSiteSurveyStatQuery query) + public async Task> GetTrialDocStatList(TrialSiteSurveyStatQuery inQuery) { if (_userInfo.IsAdmin) { - return new PageOutput(query.PageIndex, query.PageSize, 0, new List()); + return new PageOutput(inQuery.PageIndex, inQuery.PageSize, 0, new List()); } else { @@ -172,7 +172,7 @@ namespace IRaCIS.Core.Application .Count() > 0) .ProjectTo(_mapper.ConfigurationProvider, new { userTypeEnumInt = _userInfo.UserTypeEnumInt, userId = _userInfo.Id, userTypeId = _userInfo.UserTypeId }) .OrderByDescending(t => t.WaitSignCount) - .ToPagedListAsync(query.PageIndex, query.PageSize, query.SortField, query.Asc); + .ToPagedListAsync(inQuery); return trialDocStat; @@ -215,7 +215,7 @@ namespace IRaCIS.Core.Application var defalutSortArray = new string[] { nameof(CheckToBeDoneDto.UrgentCount) + " desc", nameof(CheckToBeDoneDto.ToBeCheckedCount) + " desc" }; - var result = await query.ToPagedListAsync(inQuery.PageIndex, inQuery.PageSize, inQuery.SortField, inQuery.Asc, string.IsNullOrWhiteSpace(inQuery.SortField), defalutSortArray); + var result = await query.ToPagedListAsync(inQuery, defalutSortArray); var totalToBeCheckedCount = await _subjectVisitRepository.Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id)) .Where(u => u.CheckState == CheckStateEnum.ToCheck).CountAsync(); @@ -259,7 +259,7 @@ namespace IRaCIS.Core.Application var defalutSortArray = new string[] { nameof(ReReadingApplyToBeDoneDto.UrgentCount) + " desc", nameof(ReReadingApplyToBeDoneDto.ToBeApprovalCount) + " desc" }; - var result = await query.ToPagedListAsync(inQuery.PageIndex, inQuery.PageSize, inQuery.SortField, inQuery.Asc, string.IsNullOrWhiteSpace(inQuery.SortField), defalutSortArray); + var result = await query.ToPagedListAsync(inQuery, defalutSortArray); var toBeApprovalCount = _visitTaskReReadingRepository @@ -298,7 +298,7 @@ namespace IRaCIS.Core.Application var defalutSortArray = new string[] { nameof(ReviewerSelectToBeDoneDto.IsUrgent) + " desc", nameof(ReReadingApplyToBeDoneDto.ToBeApprovalCount) + " desc" }; - var result = await query.ToPagedListAsync(inQuery.PageIndex, inQuery.PageSize, inQuery.SortField, inQuery.Asc, string.IsNullOrWhiteSpace(inQuery.SortField), defalutSortArray); + var result = await query.ToPagedListAsync(inQuery, defalutSortArray); var toBeApprovalCount = await _enrollRepository.Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id)) @@ -334,7 +334,7 @@ namespace IRaCIS.Core.Application var defalutSortArray = new string[] { nameof(GetPMClinicalDataToBeDoneListOutDto.ToBeApprovalCount) + " desc" }; - var result = await query.ToPagedListAsync(inQuery.PageIndex, inQuery.PageSize, inQuery.SortField, inQuery.Asc, string.IsNullOrWhiteSpace(inQuery.SortField), defalutSortArray); + var result = await query.ToPagedListAsync(inQuery, defalutSortArray); @@ -383,7 +383,7 @@ namespace IRaCIS.Core.Application var defalutSortArray = new string[] { nameof(ReviewerSelectToBeDoneDto.IsUrgent) + " desc", nameof(ReviewerSelectToBeDoneDto.ToBeApprovalCount) + " desc" }; - var result = await query.ToPagedListAsync(inQuery.PageIndex, inQuery.PageSize, inQuery.SortField, inQuery.Asc, string.IsNullOrWhiteSpace(inQuery.SortField), defalutSortArray); + var result = await query.ToPagedListAsync(inQuery, defalutSortArray); var toBeApprovalCount = await _enrollRepository.Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id)) @@ -424,7 +424,7 @@ namespace IRaCIS.Core.Application var defalutSortArray = new string[] { nameof(ReReadingApprovalToBeDoneDto.UrgentCount) + " desc", nameof(ReReadingApprovalToBeDoneDto.ToBeApprovalCount) + " desc" }; - var result = await query.ToPagedListAsync(inQuery.PageIndex, inQuery.PageSize, inQuery.SortField, inQuery.Asc, string.IsNullOrWhiteSpace(inQuery.SortField), defalutSortArray); + var result = await query.ToPagedListAsync(inQuery, defalutSortArray); var toBeApprovalCount = _visitTaskReReadingRepository @@ -472,7 +472,7 @@ namespace IRaCIS.Core.Application var defalutSortArray = new string[] { nameof(ImageClinicalDataToBeDoneDto.UrgentCount) + " desc", nameof(ImageClinicalDataToBeDoneDto.ReadModuleCount) + " desc" }; - var result = await query.ToPagedListAsync(inQuery.PageIndex, inQuery.PageSize, inQuery.SortField, inQuery.Asc, string.IsNullOrWhiteSpace(inQuery.SortField), defalutSortArray); + var result = await query.ToPagedListAsync(inQuery, defalutSortArray); var toBeDealedCount = _subjectVisitRepository //.Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id) && t.Trial.clinicalDataTrialSets.Any(t => t.ClinicalDataLevel == ClinicalLevel.Subject && t.IsConfirm)) @@ -514,7 +514,7 @@ namespace IRaCIS.Core.Application var defalutSortArray = new string[] { nameof(ImageClinicalDataToBeDoneDto.UrgentCount) + " desc", nameof(ImageClinicalDataToBeDoneDto.ToBeDealedCount) + " desc" }; - var result = await query.ToPagedListAsync(inQuery.PageIndex, inQuery.PageSize, inQuery.SortField, inQuery.Asc, string.IsNullOrWhiteSpace(inQuery.SortField), defalutSortArray); + var result = await query.ToPagedListAsync(inQuery, defalutSortArray); // ReadModuleCount情况太多了 暂时用之前的方法 foreach (var item in result.CurrentPageData) @@ -579,7 +579,7 @@ namespace IRaCIS.Core.Application var defalutSortArray = new string[] { nameof(ImageQuestionToBeDoneDto.UrgentCount) + " desc", nameof(ImageQuestionToBeDoneDto.ToBeDealedCount) + " desc" }; - var result = await query.ToPagedListAsync(inQuery.PageIndex, inQuery.PageSize, inQuery.SortField, inQuery.Asc, string.IsNullOrWhiteSpace(inQuery.SortField), defalutSortArray); + var result = await query.ToPagedListAsync(inQuery, defalutSortArray); var toBeDealedCount = _subjectVisitRepository @@ -625,7 +625,7 @@ namespace IRaCIS.Core.Application var defalutSortArray = new string[] { nameof(ImageCheckQuestionToBeDoneDto.UrgentCount) + " desc", nameof(ImageCheckQuestionToBeDoneDto.ToBeReplyedCount) + " desc" }; - var result = await query.ToPagedListAsync(inQuery.PageIndex, inQuery.PageSize, inQuery.SortField, inQuery.Asc, string.IsNullOrWhiteSpace(inQuery.SortField), defalutSortArray); + var result = await query.ToPagedListAsync(inQuery, defalutSortArray); var toBeDealedCount = _subjectVisitRepository @@ -672,7 +672,7 @@ namespace IRaCIS.Core.Application var defalutSortArray = new string[] { nameof(ImageReUploadToBeDoneDto.UrgentCount) + " desc", nameof(ImageReUploadToBeDoneDto.ToBeReUploadCount) + " desc" }; - var result = await query.ToPagedListAsync(inQuery.PageIndex, inQuery.PageSize, inQuery.SortField, inQuery.Asc, string.IsNullOrWhiteSpace(inQuery.SortField), defalutSortArray); + var result = await query.ToPagedListAsync(inQuery, defalutSortArray); var toBeDealedCount = _subjectVisitRepository .Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id)) @@ -721,7 +721,7 @@ namespace IRaCIS.Core.Application var defalutSortArray = new string[] { nameof(ImageSubmittedToBeDoneDto.UrgentCount) + " desc", nameof(ImageSubmittedToBeDoneDto.ToBeDealedCount) + " desc" }; - var result = await query.ToPagedListAsync(inQuery.PageIndex, inQuery.PageSize, inQuery.SortField, inQuery.Asc, string.IsNullOrWhiteSpace(inQuery.SortField), defalutSortArray); + var result = await query.ToPagedListAsync(inQuery, defalutSortArray); var toBeDealedCount = _subjectVisitRepository @@ -780,7 +780,7 @@ namespace IRaCIS.Core.Application var defalutSortArray = new string[] { nameof(ImageQualityToBeDoneDto.UrgentCount) + " desc", nameof(ImageQualityToBeDoneDto.ToBeClaimedCount) + " desc" }; - var result = await query.ToPagedListAsync(inQuery.PageIndex, inQuery.PageSize, inQuery.SortField, inQuery.Asc, string.IsNullOrWhiteSpace(inQuery.SortField), defalutSortArray); + var result = await query.ToPagedListAsync(inQuery, defalutSortArray); @@ -829,7 +829,7 @@ namespace IRaCIS.Core.Application var defalutSortArray = new string[] { nameof(ImageQuestionToBeDoneDto.UrgentCount) + " desc", nameof(ImageQuestionToBeDoneDto.ToBeDealedCount) + " desc" }; - var result = await query.ToPagedListAsync(inQuery.PageIndex, inQuery.PageSize, inQuery.SortField, inQuery.Asc, string.IsNullOrWhiteSpace(inQuery.SortField), defalutSortArray); + var result = await query.ToPagedListAsync(inQuery, defalutSortArray); var toBeDealedCount = _subjectVisitRepository @@ -973,7 +973,7 @@ namespace IRaCIS.Core.Application var defalutSortArray = new string[] { nameof(IRImageReadingToBeDoneDto.TrialCode) ,nameof(IRImageReadingToBeDoneDto.UrgentCount) + " desc", nameof(IRImageReadingToBeDoneDto.UnReadCount) + " desc" }; - var result = await newQuery.ToPagedListAsync(inQuery.PageIndex, inQuery.PageSize, inQuery.SortField, inQuery.Asc, string.IsNullOrWhiteSpace(inQuery.SortField), defalutSortArray); + var result = await newQuery.ToPagedListAsync(inQuery, defalutSortArray); var toBeDealedCount = _trialRepository .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.Id)) @@ -1043,7 +1043,7 @@ namespace IRaCIS.Core.Application var defalutSortArray = new string[] { nameof(MedicalCommentsToBeDoneDto.UrgentCount) + " desc", nameof(MedicalCommentsToBeDoneDto.ToBeReplyedCount) + " desc" }; - var result = await query.ToPagedListAsync(inQuery.PageIndex, inQuery.PageSize, inQuery.SortField, inQuery.Asc, string.IsNullOrWhiteSpace(inQuery.SortField), defalutSortArray); + var result = await query.ToPagedListAsync(inQuery, defalutSortArray); @@ -1114,7 +1114,7 @@ namespace IRaCIS.Core.Application var defalutSortArray = new string[] { nameof(MedicalCommentsToBeDoneDto.UrgentCount) + " desc", nameof(MedicalCommentsToBeDoneDto.ToBeReplyedCount) + " desc" }; - var result = await query.ToPagedListAsync(inQuery.PageIndex, inQuery.PageSize, inQuery.SortField, inQuery.Asc, string.IsNullOrWhiteSpace(inQuery.SortField), defalutSortArray); + var result = await query.ToPagedListAsync(inQuery, defalutSortArray); @@ -1550,7 +1550,7 @@ namespace IRaCIS.Core.Application //.ProjectTo(_mapper.ConfigurationProvider, new { userTypeEnumInt = _userInfo.UserTypeEnumInt, userId = _userInfo.Id }); - var result = await query.ToPagedListAsync(inQuery.PageIndex, inQuery.PageSize, string.IsNullOrWhiteSpace(inQuery.SortField) ? "CreateTime" : inQuery.SortField, inQuery.Asc); + var result = await query.ToPagedListAsync(inQuery); return ResponseOutput.Ok(result); } diff --git a/IRaCIS.Core.Application/Service/TrialSiteUser/TrialMaintenanceService.cs b/IRaCIS.Core.Application/Service/TrialSiteUser/TrialMaintenanceService.cs index 9e060eb76..d96c14d7e 100644 --- a/IRaCIS.Core.Application/Service/TrialSiteUser/TrialMaintenanceService.cs +++ b/IRaCIS.Core.Application/Service/TrialSiteUser/TrialMaintenanceService.cs @@ -73,22 +73,22 @@ namespace IRaCIS.Application.Services /// /// Setting页面 获取项目参与人员列表 /// - /// + /// /// [HttpPost] - public async Task> GetMaintenanceUserList(TrialMaintenanceQuery param) + public async Task> GetMaintenanceUserList(TrialMaintenanceQuery inQuery) { - var query = _trialUseRepository.Where(t => t.TrialId == param.TrialId).IgnoreQueryFilters() - .WhereIf(param.UserTypeId != null, t => t.User.UserTypeId == param.UserTypeId) - .WhereIf(!string.IsNullOrWhiteSpace(param.UserName), t => t.User.UserName.Contains(param.UserName)) + var query = _trialUseRepository.Where(t => t.TrialId == inQuery.TrialId).IgnoreQueryFilters() + .WhereIf(inQuery.UserTypeId != null, t => t.User.UserTypeId == inQuery.UserTypeId) + .WhereIf(!string.IsNullOrWhiteSpace(inQuery.UserName), t => t.User.UserName.Contains(inQuery.UserName)) - .WhereIf(param.IsDeleted != null, t => t.IsDeleted == param.IsDeleted) - .WhereIf(!string.IsNullOrWhiteSpace(param.OrganizationName), t => t.User.OrganizationName.Contains(param.OrganizationName)) - .WhereIf(!string.IsNullOrWhiteSpace(param.UserRealName), t => (t.User.FullName).Contains(param.UserRealName)) + .WhereIf(inQuery.IsDeleted != null, t => t.IsDeleted == inQuery.IsDeleted) + .WhereIf(!string.IsNullOrWhiteSpace(inQuery.OrganizationName), t => t.User.OrganizationName.Contains(inQuery.OrganizationName)) + .WhereIf(!string.IsNullOrWhiteSpace(inQuery.UserRealName), t => (t.User.FullName).Contains(inQuery.UserRealName)) .ProjectTo(_mapper.ConfigurationProvider); - return await query.ToPagedListAsync(param.PageIndex, param.PageSize, string.IsNullOrWhiteSpace(param.SortField) ? "UpdateTime" : param.SortField, param.Asc); + return await query.ToPagedListAsync(inQuery); } @@ -98,28 +98,27 @@ namespace IRaCIS.Application.Services /// Setting页面 为 site 勾选CRC用户列表 [HttpPost] - public async Task> GetSiteCRCScreeningList(SiteCRCQuery param) + public async Task> GetSiteCRCScreeningList(SiteCRCQuery inQuery) { // 最开始过滤site已经选择的用户 现在又改回去。。。 - var query = _trialUseRepository.Where(t => t.TrialId == param.TrialId).IgnoreQueryFilters() + var query = _trialUseRepository.Where(t => t.TrialId == inQuery.TrialId).IgnoreQueryFilters() .Where(t => t.User.UserTypeEnum == UserTypeEnum.ClinicalResearchCoordinator || t.User.UserTypeEnum == UserTypeEnum.CRA) - .WhereIf(param.UserTypeId != null, t => t.User.UserTypeId == param.UserTypeId) - .WhereIf(!string.IsNullOrWhiteSpace(param.UserRealName), t => (t.User.FullName).Contains(param.UserRealName)) - .WhereIf(!string.IsNullOrWhiteSpace(param.OrganizationName), t => t.User.OrganizationName.Contains(param.OrganizationName)) - .ProjectTo(_mapper.ConfigurationProvider, new { trialSiteId = param.TrialSiteId }); + .WhereIf(inQuery.UserTypeId != null, t => t.User.UserTypeId == inQuery.UserTypeId) + .WhereIf(!string.IsNullOrWhiteSpace(inQuery.UserRealName), t => (t.User.FullName).Contains(inQuery.UserRealName)) + .WhereIf(!string.IsNullOrWhiteSpace(inQuery.OrganizationName), t => t.User.OrganizationName.Contains(inQuery.OrganizationName)) + .ProjectTo(_mapper.ConfigurationProvider, new { trialSiteId = inQuery.TrialSiteId }); - return await query.ToPagedListAsync(param.PageIndex, - param.PageSize, string.IsNullOrWhiteSpace(param.SortField) ? "UpdateTime" : param.SortField, param.Asc); + return await query.ToPagedListAsync(inQuery); } /// Setting页面 项目参与人员勾选列表 [HttpPost] - public async Task> GetTrialUserScreeningList(TrialUserQuery trialUserQuery) + public async Task> GetTrialUserScreeningList(TrialUserQuery inQuery) { - var trialType = _trialRepository.Where(t => t.Id == trialUserQuery.TrialId).Select(t => t.TrialType).FirstOrDefault(); + var trialType = _trialRepository.Where(t => t.Id == inQuery.TrialId).Select(t => t.TrialType).FirstOrDefault(); var userTypeEnums = new List() { UserTypeEnum.ClinicalResearchCoordinator, UserTypeEnum.CRA, UserTypeEnum.IQC, UserTypeEnum.APM, UserTypeEnum.MIM, UserTypeEnum.QA, UserTypeEnum.MW, UserTypeEnum.MC }; @@ -142,16 +141,15 @@ namespace IRaCIS.Application.Services .Where(t=>userTypeEnums.Contains(t.UserTypeEnum)) - .WhereIf(!string.IsNullOrWhiteSpace(trialUserQuery.UserRealName), t => (t.FullName).Contains(trialUserQuery.UserRealName)) - .WhereIf(!string.IsNullOrWhiteSpace(trialUserQuery.UserName), t => t.UserName.Contains(trialUserQuery.UserName)) - .WhereIf(!string.IsNullOrWhiteSpace(trialUserQuery.OrganizationName), t => t.OrganizationName.Contains(trialUserQuery.OrganizationName)) - .WhereIf(trialUserQuery.UserTypeEnum != null, t => t.UserTypeEnum == trialUserQuery.UserTypeEnum) + .WhereIf(!string.IsNullOrWhiteSpace(inQuery.UserRealName), t => (t.FullName).Contains(inQuery.UserRealName)) + .WhereIf(!string.IsNullOrWhiteSpace(inQuery.UserName), t => t.UserName.Contains(inQuery.UserName)) + .WhereIf(!string.IsNullOrWhiteSpace(inQuery.OrganizationName), t => t.OrganizationName.Contains(inQuery.OrganizationName)) + .WhereIf(inQuery.UserTypeEnum != null, t => t.UserTypeEnum == inQuery.UserTypeEnum) //.WhereIf(_userInfo.IsAdmin, t => t.UserTypeRole.Type == UserTypeGroup.TrialUser) //.WhereIf(!_userInfo.IsAdmin, t => t.UserTypeRole.Type == UserTypeGroup.TrialUser || t.UserTypeEnum != UserTypeEnum.ProjectManager) - .ProjectTo(_mapper.ConfigurationProvider, new { trialId = trialUserQuery.TrialId }); + .ProjectTo(_mapper.ConfigurationProvider, new { trialId = inQuery.TrialId }); - return await query.ToPagedListAsync(trialUserQuery.PageIndex, - trialUserQuery.PageSize, string.IsNullOrWhiteSpace(trialUserQuery.SortField) ? "UserRealName" : trialUserQuery.SortField, trialUserQuery.Asc); + return await query.ToPagedListAsync(inQuery); } diff --git a/IRaCIS.Core.Application/Service/TrialSiteUser/TrialService.cs b/IRaCIS.Core.Application/Service/TrialSiteUser/TrialService.cs index 6962141ae..a23fafb1e 100644 --- a/IRaCIS.Core.Application/Service/TrialSiteUser/TrialService.cs +++ b/IRaCIS.Core.Application/Service/TrialSiteUser/TrialService.cs @@ -42,52 +42,52 @@ namespace IRaCIS.Application.Services /// /// 分页获取临床项目列表 默认后台加急状态为3 查所有的 /// - /// + /// /// [HttpPost] - public async Task> GetTrialList(TrialQueryDTO searchParam) + public async Task> GetTrialList(TrialQueryDTO inQuery) { - var multiModalityIdSelectCount = searchParam.ModalityIds.Count; - var multiCriteriaSelectCount = searchParam.CriterionIds.Count; - var multiReviewTypeSelectCount = searchParam.ReviewTypeIds.Count; + var multiModalityIdSelectCount = inQuery.ModalityIds.Count; + var multiCriteriaSelectCount = inQuery.CriterionIds.Count; + var multiReviewTypeSelectCount = inQuery.ReviewTypeIds.Count; Expression> trialDeclarationTypeExpression = x => true; - foreach (var item in searchParam.DeclarationTypeEnumList) + foreach (var item in inQuery.DeclarationTypeEnumList) { trialDeclarationTypeExpression = trialDeclarationTypeExpression.And(t => t.DeclarationTypes.Contains($"|{item}|")); } Expression> trialAttendedReviewerTypeExpression = x => true; - foreach (var item in searchParam.AttendedReviewerTypeEnumList) + foreach (var item in inQuery.AttendedReviewerTypeEnumList) { trialAttendedReviewerTypeExpression = trialAttendedReviewerTypeExpression.And(t => t.AttendedReviewerTypes.Contains($"|{item}|")); } var query = _trialRepository.AsQueryable() - .WhereIf(!string.IsNullOrEmpty(searchParam.TrialStatusStr), o => o.TrialStatusStr.Contains(searchParam.TrialStatusStr)) - .WhereIf(searchParam.SponsorId != null, o => o.SponsorId == searchParam.SponsorId) - .WhereIf(searchParam.Expedited != null, o => o.Expedited == searchParam.Expedited) - .WhereIf(!string.IsNullOrEmpty(searchParam.Code), o => o.TrialCode.Contains(searchParam.Code)) - .WhereIf(!string.IsNullOrWhiteSpace(searchParam.Indication), o => o.Indication.Contains(searchParam.Indication)) - .WhereIf(!string.IsNullOrEmpty(searchParam.ResearchProgramNo), o => o.ResearchProgramNo.Contains(searchParam.ResearchProgramNo)) - .WhereIf(!string.IsNullOrWhiteSpace(searchParam.ExperimentName), o => o.ExperimentName.Contains(searchParam.ExperimentName)) - .WhereIf(searchParam.PhaseId != null, o => o.PhaseId == searchParam.PhaseId) + .WhereIf(!string.IsNullOrEmpty(inQuery.TrialStatusStr), o => o.TrialStatusStr.Contains(inQuery.TrialStatusStr)) + .WhereIf(inQuery.SponsorId != null, o => o.SponsorId == inQuery.SponsorId) + .WhereIf(inQuery.Expedited != null, o => o.Expedited == inQuery.Expedited) + .WhereIf(!string.IsNullOrEmpty(inQuery.Code), o => o.TrialCode.Contains(inQuery.Code)) + .WhereIf(!string.IsNullOrWhiteSpace(inQuery.Indication), o => o.Indication.Contains(inQuery.Indication)) + .WhereIf(!string.IsNullOrEmpty(inQuery.ResearchProgramNo), o => o.ResearchProgramNo.Contains(inQuery.ResearchProgramNo)) + .WhereIf(!string.IsNullOrWhiteSpace(inQuery.ExperimentName), o => o.ExperimentName.Contains(inQuery.ExperimentName)) + .WhereIf(inQuery.PhaseId != null, o => o.PhaseId == inQuery.PhaseId) - .WhereIf(searchParam.DeclarationTypeEnumList.Count > 0, trialDeclarationTypeExpression) - .WhereIf(searchParam.AttendedReviewerTypeEnumList.Count > 0, trialAttendedReviewerTypeExpression) + .WhereIf(inQuery.DeclarationTypeEnumList.Count > 0, trialDeclarationTypeExpression) + .WhereIf(inQuery.AttendedReviewerTypeEnumList.Count > 0, trialAttendedReviewerTypeExpression) //.WhereIf(searchParam.AttendedReviewerType != null, o => o.AttendedReviewerType == searchParam.AttendedReviewerType) - .WhereIf(searchParam.IndicationTypeId != null, o => o.IndicationTypeId == searchParam.IndicationTypeId) - .WhereIf(searchParam.CROId != null, o => o.CROId == searchParam.CROId) - .WhereIf(searchParam.BeginDate != null, o => o.CreateTime >= searchParam.BeginDate) - .WhereIf(searchParam.EndDate != null, o => o.CreateTime <= searchParam.EndDate) + .WhereIf(inQuery.IndicationTypeId != null, o => o.IndicationTypeId == inQuery.IndicationTypeId) + .WhereIf(inQuery.CROId != null, o => o.CROId == inQuery.CROId) + .WhereIf(inQuery.BeginDate != null, o => o.CreateTime >= inQuery.BeginDate) + .WhereIf(inQuery.EndDate != null, o => o.CreateTime <= inQuery.EndDate) .WhereIf(multiModalityIdSelectCount > 0, t => t.TrialDicList.Count(t => t.KeyName == StaticData.Modality) == multiModalityIdSelectCount) .WhereIf(multiCriteriaSelectCount > 0, t => t.TrialDicList.Count(t => t.KeyName == StaticData.Criterion) == multiCriteriaSelectCount) @@ -95,7 +95,7 @@ namespace IRaCIS.Application.Services .WhereIf(_userInfo.UserTypeEnumInt != (int)UserTypeEnum.SuperAdmin, t => t.TrialUserList.Any(t => t.UserId == _userInfo.Id && t.IsDeleted == false) && t.IsDeleted == false) .ProjectTo(_mapper.ConfigurationProvider, new { userTypeEnumInt = _userInfo.UserTypeEnumInt, userId = _userInfo.Id, isEn_Us = _userInfo.IsEn_Us }); - return await query.ToPagedListAsync(searchParam.PageIndex, searchParam.PageSize, string.IsNullOrWhiteSpace(searchParam.SortField) ? "CreateTime" : searchParam.SortField, searchParam.Asc); + return await query.ToPagedListAsync(inQuery); } @@ -606,17 +606,17 @@ namespace IRaCIS.Application.Services [HttpPost] - public async Task> GetReviewerTrialListByEnrollmentStatus(TrialByStatusQueryDTO param) + public async Task> GetReviewerTrialListByEnrollmentStatus(TrialByStatusQueryDTO inQuery) { var query = _trialRepository.AsQueryable() - .WhereIf(param.Status == 5, t => t.EnrollList.Any(u => u.EnrollStatus == EnrollStatus.HasCommittedToCRO)) - .WhereIf(param.Status == 8, t => t.EnrollList.Any(u => u.EnrollStatus == EnrollStatus.InviteIntoGroup)) - .WhereIf(param.Status == 10, t => t.EnrollList.Any(u => u.EnrollStatus == EnrollStatus.DoctorReading)) - .WhereIf(param.Status == 14, t => t.EnrollList.Any(u => u.EnrollStatus == EnrollStatus.Finished)) + .WhereIf(inQuery.Status == 5, t => t.EnrollList.Any(u => u.EnrollStatus == EnrollStatus.HasCommittedToCRO)) + .WhereIf(inQuery.Status == 8, t => t.EnrollList.Any(u => u.EnrollStatus == EnrollStatus.InviteIntoGroup)) + .WhereIf(inQuery.Status == 10, t => t.EnrollList.Any(u => u.EnrollStatus == EnrollStatus.DoctorReading)) + .WhereIf(inQuery.Status == 14, t => t.EnrollList.Any(u => u.EnrollStatus == EnrollStatus.Finished)) .ProjectTo(_mapper.ConfigurationProvider, new { userTypeEnumInt = _userInfo.UserTypeEnumInt, userId = _userInfo.Id, isEn_Us = _userInfo.IsEn_Us }); - return await query.ToPagedListAsync(param.PageIndex, param.PageSize, string.IsNullOrWhiteSpace(param.SortField) ? "CreateTime" : param.SortField, param.Asc); + return await query.ToPagedListAsync(inQuery); } @@ -639,20 +639,20 @@ namespace IRaCIS.Application.Services /// 分页获取医生参与的临床实验项目列表(查询条件) /// [HttpPost] - public async Task> GetTrialListByReviewer(ReviewerTrialQueryDTO searchModel) + public async Task> GetTrialListByReviewer(ReviewerTrialQueryDTO inQuery) { var query = _trialRepository - .WhereIf(searchModel.EnrollStatus != null, o => (int)searchModel.EnrollStatus! == 10 ? + .WhereIf(inQuery.EnrollStatus != null, o => (int)inQuery.EnrollStatus! == 10 ? o.EnrollList.Any(o => o.EnrollStatus >= EnrollStatus.ConfirmIntoGroup && o.EnrollStatus <= EnrollStatus.DoctorReading && o.DoctorId == _userInfo.Id) : - o.EnrollList.Any(o => o.EnrollStatus == searchModel.EnrollStatus && o.DoctorId == _userInfo.Id)) - .WhereIf(searchModel.Expedited != null, o => o.Expedited == searchModel.Expedited) - .WhereIf(!string.IsNullOrEmpty(searchModel.Code), o => o.TrialCode.Contains(searchModel.Code)) - .WhereIf(!string.IsNullOrWhiteSpace(searchModel.Indication), o => o.Indication.Contains(searchModel.Indication)) + o.EnrollList.Any(o => o.EnrollStatus == inQuery.EnrollStatus && o.DoctorId == _userInfo.Id)) + .WhereIf(inQuery.Expedited != null, o => o.Expedited == inQuery.Expedited) + .WhereIf(!string.IsNullOrEmpty(inQuery.Code), o => o.TrialCode.Contains(inQuery.Code)) + .WhereIf(!string.IsNullOrWhiteSpace(inQuery.Indication), o => o.Indication.Contains(inQuery.Indication)) .WhereIf(_userInfo.UserTypeEnumInt != (int)UserTypeEnum.SuperAdmin, t => t.TrialUserList.Any(t => t.UserId == _userInfo.Id)) .ProjectTo(_mapper.ConfigurationProvider, new { userTypeEnumInt = _userInfo.UserTypeEnumInt, userId = _userInfo.Id, isEn_Us = _userInfo.IsEn_Us }); - return await query.ToPagedListAsync(searchModel.PageIndex, searchModel.PageSize, string.IsNullOrWhiteSpace(searchModel.SortField) ? "CreateTime" : searchModel.SortField, searchModel.Asc); + return await query.ToPagedListAsync(inQuery); diff --git a/IRaCIS.Core.Application/Service/TrialSiteUser/TrialSiteService.cs b/IRaCIS.Core.Application/Service/TrialSiteUser/TrialSiteService.cs index 1f5420383..86627151f 100644 --- a/IRaCIS.Core.Application/Service/TrialSiteUser/TrialSiteService.cs +++ b/IRaCIS.Core.Application/Service/TrialSiteUser/TrialSiteService.cs @@ -34,22 +34,21 @@ namespace IRaCIS.Core.Application.Services /// Pannel 进去 SiteTab [HttpPost] - public async Task> GetSiteCRCList(SiteCrcQueryDTO param) + public async Task> GetSiteCRCList(SiteCrcQueryDTO inQuery) { - var siteStatQuery = _trialSiteRepository.Where(t => t.TrialId == param.TrialId, ignoreQueryFilters: true) - .WhereIf(param.IsDeleted != null, t => t.IsDeleted == param.IsDeleted) - .WhereIf(!string.IsNullOrWhiteSpace(param.SiteName), t => t.TrialSiteName.Contains(param.SiteName)) - .WhereIf(!string.IsNullOrWhiteSpace(param.TrialSiteAliasName), t => t.TrialSiteAliasName.Contains(param.TrialSiteAliasName)) - .WhereIf(!string.IsNullOrWhiteSpace(param.TrialSiteCode), t => t.TrialSiteCode.Contains(param.TrialSiteCode)) + var siteStatQuery = _trialSiteRepository.Where(t => t.TrialId == inQuery.TrialId, ignoreQueryFilters: true) + .WhereIf(inQuery.IsDeleted != null, t => t.IsDeleted == inQuery.IsDeleted) + .WhereIf(!string.IsNullOrWhiteSpace(inQuery.SiteName), t => t.TrialSiteName.Contains(inQuery.SiteName)) + .WhereIf(!string.IsNullOrWhiteSpace(inQuery.TrialSiteAliasName), t => t.TrialSiteAliasName.Contains(inQuery.TrialSiteAliasName)) + .WhereIf(!string.IsNullOrWhiteSpace(inQuery.TrialSiteCode), t => t.TrialSiteCode.Contains(inQuery.TrialSiteCode)) .WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator, t => t.CRCUserList.Any(k => k.UserId == _userInfo.Id)) - .WhereIf(!string.IsNullOrWhiteSpace(param.UserKeyInfo), t => t.CRCUserList.Any(k => (k.User.FullName).Contains(param.UserKeyInfo) - || k.User.UserName.Contains(param.UserKeyInfo) || k.User.EMail.Contains(param.UserKeyInfo))) + .WhereIf(!string.IsNullOrWhiteSpace(inQuery.UserKeyInfo), t => t.CRCUserList.Any(k => (k.User.FullName).Contains(inQuery.UserKeyInfo) + || k.User.UserName.Contains(inQuery.UserKeyInfo) || k.User.EMail.Contains(inQuery.UserKeyInfo))) .ProjectTo(_mapper.ConfigurationProvider); - return await siteStatQuery.ToPagedListAsync(param.PageIndex, - param.PageSize, string.IsNullOrWhiteSpace(param.SortField) ? "SiteCode" : param.SortField, param.Asc); + return await siteStatQuery.ToPagedListAsync(inQuery); } @@ -57,23 +56,22 @@ namespace IRaCIS.Core.Application.Services /// [new] setting页面Site列表,和getSiteCRCList对比 没有统计数据,增加了一些site信息 [HttpPost] - public async Task> GetSiteCRCSimpleList(SiteCrcQueryDTO param) + public async Task> GetSiteCRCSimpleList(SiteCrcQueryDTO inQuery) { - var siteStatQuery = _trialSiteRepository.Where(t => t.TrialId == param.TrialId).IgnoreQueryFilters() - .WhereIf(param.IsDeleted != null, t => t.IsDeleted == param.IsDeleted) - .WhereIf(!string.IsNullOrWhiteSpace(param.SiteName), t => t.TrialSiteName.Contains(param.SiteName) || t.TrialSiteAliasName.Contains(param.TrialSiteAliasName)) - .WhereIf(!string.IsNullOrWhiteSpace(param.TrialSiteAliasName), t => t.TrialSiteAliasName.Contains(param.TrialSiteAliasName)) - .WhereIf(!string.IsNullOrWhiteSpace(param.TrialSiteCode), t => t.TrialSiteCode.Contains(param.TrialSiteCode)) + var siteStatQuery = _trialSiteRepository.Where(t => t.TrialId == inQuery.TrialId).IgnoreQueryFilters() + .WhereIf(inQuery.IsDeleted != null, t => t.IsDeleted == inQuery.IsDeleted) + .WhereIf(!string.IsNullOrWhiteSpace(inQuery.SiteName), t => t.TrialSiteName.Contains(inQuery.SiteName) || t.TrialSiteAliasName.Contains(inQuery.TrialSiteAliasName)) + .WhereIf(!string.IsNullOrWhiteSpace(inQuery.TrialSiteAliasName), t => t.TrialSiteAliasName.Contains(inQuery.TrialSiteAliasName)) + .WhereIf(!string.IsNullOrWhiteSpace(inQuery.TrialSiteCode), t => t.TrialSiteCode.Contains(inQuery.TrialSiteCode)) .WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator, t => t.CRCUserList.Any(k => k.UserId == _userInfo.Id)) - .WhereIf(!string.IsNullOrWhiteSpace(param.UserKeyInfo), t => t.CRCUserList.Any(k => (k.User.FullName).Contains(param.UserKeyInfo) - || k.User.UserName.Contains(param.UserKeyInfo) || k.User.EMail.Contains(param.UserKeyInfo))) + .WhereIf(!string.IsNullOrWhiteSpace(inQuery.UserKeyInfo), t => t.CRCUserList.Any(k => (k.User.FullName).Contains(inQuery.UserKeyInfo) + || k.User.UserName.Contains(inQuery.UserKeyInfo) || k.User.EMail.Contains(inQuery.UserKeyInfo))) .ProjectTo(_mapper.ConfigurationProvider ,new { isEn_Us = _userInfo.IsEn_Us }); - var result = await siteStatQuery.ToPagedListAsync(param.PageIndex, - param.PageSize, string.IsNullOrWhiteSpace(param.SortField) ? "Site" : param.SortField, param.Asc); + var result = await siteStatQuery.ToPagedListAsync(inQuery); return result; } @@ -92,21 +90,20 @@ namespace IRaCIS.Core.Application.Services /// [new] Setting页面 Site勾选列表( [HttpPost] - public async Task> GetTrialSiteScreeningList(TrialSiteQuery searchModel) + public async Task> GetTrialSiteScreeningList(TrialSiteQuery inQuery) { // 之前选择了的不能再次出现在列表,做的时候我就不建议这样搞,搞好了 现在又要改回去。。。 瞎折腾。。。。 var siteQueryable = _siteRepository.AsQueryable(true) - .WhereIf(!string.IsNullOrWhiteSpace(searchModel.SiteName), t => t.SiteName.Contains(searchModel.SiteName) || t.SiteNameCN.Contains(searchModel.SiteName) || t.AliasName.Contains(searchModel.SiteName)) - .WhereIf(!string.IsNullOrWhiteSpace(searchModel.AliasName), t => t.AliasName.Contains(searchModel.AliasName)) - .WhereIf(!string.IsNullOrWhiteSpace(searchModel.City), t => t.City.Contains(searchModel.City)) - .WhereIf(!string.IsNullOrWhiteSpace(searchModel.Country), t => t.Country.Contains(searchModel.Country)) - .ProjectTo(_mapper.ConfigurationProvider, new { trialId = searchModel.TrialId , isEn_Us =_userInfo.IsEn_Us}); + .WhereIf(!string.IsNullOrWhiteSpace(inQuery.SiteName), t => t.SiteName.Contains(inQuery.SiteName) || t.SiteNameCN.Contains(inQuery.SiteName) || t.AliasName.Contains(inQuery.SiteName)) + .WhereIf(!string.IsNullOrWhiteSpace(inQuery.AliasName), t => t.AliasName.Contains(inQuery.AliasName)) + .WhereIf(!string.IsNullOrWhiteSpace(inQuery.City), t => t.City.Contains(inQuery.City)) + .WhereIf(!string.IsNullOrWhiteSpace(inQuery.Country), t => t.Country.Contains(inQuery.Country)) + .ProjectTo(_mapper.ConfigurationProvider, new { trialId = inQuery.TrialId , isEn_Us =_userInfo.IsEn_Us}); - return await siteQueryable.ToPagedListAsync(searchModel.PageIndex, - searchModel.PageSize, string.IsNullOrWhiteSpace(searchModel.SortField) ? "SiteName" : searchModel.SortField, searchModel.Asc); + return await siteQueryable.ToPagedListAsync(inQuery); } diff --git a/IRaCIS.Core.Application/Service/Visit/PatientService.cs b/IRaCIS.Core.Application/Service/Visit/PatientService.cs index b0d189b76..38735ef7a 100644 --- a/IRaCIS.Core.Application/Service/Visit/PatientService.cs +++ b/IRaCIS.Core.Application/Service/Visit/PatientService.cs @@ -125,7 +125,7 @@ namespace IRaCIS.Application.Services .ProjectTo(_mapper.ConfigurationProvider); - var pageList = await query.ToPagedListAsync(inQuery.PageIndex, inQuery.PageSize, inQuery.SortField == string.Empty ? nameof(SCPImageUploadView.CallingAE) : inQuery.SortField, inQuery.Asc); + var pageList = await query.ToPagedListAsync(inQuery); return ResponseOutput.Ok(pageList); @@ -197,7 +197,7 @@ namespace IRaCIS.Application.Services - var pageList = await resultQuery.ToPagedListAsync(inQuery.PageIndex, inQuery.PageSize, inQuery.SortField == string.Empty ? nameof(PatientQueryView.PatientIdStr) : inQuery.SortField, inQuery.Asc); + var pageList = await resultQuery.ToPagedListAsync(inQuery); #endregion @@ -246,7 +246,7 @@ namespace IRaCIS.Application.Services //var list = await orderQuery.ToListAsync(); - var pageList = await query.ToPagedListAsync(inQuery.PageIndex, inQuery.PageSize, inQuery.SortField == string.Empty ? nameof(PatientStudySimpleView.StudyTime) : inQuery.SortField, inQuery.Asc); + var pageList = await query.ToPagedListAsync(inQuery); return pageList; } @@ -315,7 +315,7 @@ namespace IRaCIS.Application.Services }; - var pageList = await query.ToPagedListAsync(inQuery.PageIndex, inQuery.PageSize, inQuery.SortField == string.Empty ? nameof(PatientStudySimpleView.StudyTime) : inQuery.SortField, inQuery.Asc); + var pageList = await query.ToPagedListAsync(inQuery); return pageList; } diff --git a/IRaCIS.Core.Application/Service/Visit/SubjectService.cs b/IRaCIS.Core.Application/Service/Visit/SubjectService.cs index cb21db1dc..60b60211b 100644 --- a/IRaCIS.Core.Application/Service/Visit/SubjectService.cs +++ b/IRaCIS.Core.Application/Service/Visit/SubjectService.cs @@ -127,7 +127,7 @@ namespace IRaCIS.Application.Services .WhereIf(inQuery.IsMissingImages != null, t => t.IsMissingImages == inQuery.IsMissingImages); - var pageList = await subjectQuery.ToPagedListAsync(inQuery.PageIndex, inQuery.PageSize, inQuery.SortField == string.Empty ? "Code" : inQuery.SortField, inQuery.Asc); + var pageList = await subjectQuery.ToPagedListAsync(inQuery); var trialConfig = await _repository.Where(t => t.Id == inQuery.TrialId).ProjectTo(_mapper.ConfigurationProvider).FirstOrDefaultAsync().IfNullThrowException(); diff --git a/IRaCIS.Core.Application/Service/Visit/VisitPlanService.cs b/IRaCIS.Core.Application/Service/Visit/VisitPlanService.cs index 28e7f55df..efd8d0d27 100644 --- a/IRaCIS.Core.Application/Service/Visit/VisitPlanService.cs +++ b/IRaCIS.Core.Application/Service/Visit/VisitPlanService.cs @@ -43,7 +43,7 @@ namespace IRaCIS.Application.Services .WhereIf(!string.IsNullOrWhiteSpace(param.Keyword), t => t.VisitName.Contains(param.Keyword)) .ProjectTo(_mapper.ConfigurationProvider); - return await visitStageQuery.ToPagedListAsync(param.PageIndex, param.PageSize, "CreateTime", param.Asc); + return await visitStageQuery.ToPagedListAsync(param); } diff --git a/IRaCIS.Core.Application/Service/WorkLoad/DoctorWorkloadService.cs b/IRaCIS.Core.Application/Service/WorkLoad/DoctorWorkloadService.cs index 773803cbf..78e80f70f 100644 --- a/IRaCIS.Core.Application/Service/WorkLoad/DoctorWorkloadService.cs +++ b/IRaCIS.Core.Application/Service/WorkLoad/DoctorWorkloadService.cs @@ -304,7 +304,7 @@ namespace IRaCIS.Application.Services }; - return await doctorIntoGroupQueryable.ToPagedListAsync(doctorSearchModel.PageIndex, doctorSearchModel.PageSize, doctorSearchModel.SortField == "" ? "EnrollTime" : doctorSearchModel.SortField, doctorSearchModel.Asc); + return await doctorIntoGroupQueryable.ToPagedListAsync(doctorSearchModel); } diff --git a/IRaCIS.Core.Application/Service/WorkLoad/EnrollService.cs b/IRaCIS.Core.Application/Service/WorkLoad/EnrollService.cs index 1f1b427c9..cdcfcab84 100644 --- a/IRaCIS.Core.Application/Service/WorkLoad/EnrollService.cs +++ b/IRaCIS.Core.Application/Service/WorkLoad/EnrollService.cs @@ -106,7 +106,7 @@ namespace IRaCIS.Application.Services ReviewerCode = dociorc.ReviewerCode, Downtime = enroll.Downtime, }; - return await costStatisticsQueryable.ToPagedListAsync(challengeQuery.PageIndex, challengeQuery.PageSize, "ChineseName"); + return await costStatisticsQueryable.ToPagedListAsync(challengeQuery); diff --git a/IRaCIS.Core.Infrastructure/_IRaCIS/IQueryablePageListExtensions.cs b/IRaCIS.Core.Infrastructure/_IRaCIS/IQueryablePageListExtensions.cs index caf5bac61..9746f100f 100644 --- a/IRaCIS.Core.Infrastructure/_IRaCIS/IQueryablePageListExtensions.cs +++ b/IRaCIS.Core.Infrastructure/_IRaCIS/IQueryablePageListExtensions.cs @@ -47,32 +47,34 @@ namespace IRaCIS.Core.Infrastructure.Extention } else { + #region 单字段排序,前端不传递,后端给排序字段 + //var propName = string.Empty; - var propName = string.Empty; + //if (string.IsNullOrWhiteSpace(pageInput.SortField)) + //{ + // //没有指定,优先以Id排序,否则从属性里面随便取出来一个排序 + // var propertyNameList = typeof(T).GetProperties(BindingFlags.Public | BindingFlags.Instance).Where(t => t.CanWrite).Select(t => t.Name).OrderBy(t => t).ToList(); - if (string.IsNullOrWhiteSpace(pageInput.SortField)) - { - //没有指定,优先以Id排序,否则从属性里面随便取出来一个排序 - var propertyNameList = typeof(T).GetProperties(BindingFlags.Public | BindingFlags.Instance).Where(t => t.CanWrite).Select(t => t.Name).OrderBy(t => t).ToList(); + // if (propertyNameList.Count == 0) + // { + // throw new InvalidOperationException("no default sort field."); + // } + // else + // { + // propName = propertyNameList.Contains("Id") ? "Id" : propertyNameList.FirstOrDefault(); + // } - if (propertyNameList.Count == 0) - { - throw new InvalidOperationException("no default sort field."); - } - else - { - propName = propertyNameList.Contains("Id") ? "Id" : propertyNameList.FirstOrDefault(); - } + //} + //else + //{ + // //有值,以前段传输的为主 + // propName = pageInput.SortField; + //} - } - else - { - //有值,以前段传输的为主 - propName = pageInput.SortField; - } - - source = pageInput.Asc ? source.OrderBy(propName) : source.OrderBy(propName + " desc"); + //source = pageInput.Asc ? source.OrderBy(propName) : source.OrderBy(propName + " desc"); + #endregion + source = string.IsNullOrWhiteSpace(pageInput.SortField) ? source : (pageInput.Asc ? source.OrderBy(pageInput.SortField) : source.OrderBy(pageInput.SortField + " desc")); } source = source.Skip((pageInput.PageIndex - 1) * pageInput.PageSize); @@ -93,54 +95,46 @@ namespace IRaCIS.Core.Infrastructure.Extention } - - //单字段排序 异步 - public static async Task> ToPagedListAsync(this IQueryable source, int pageNumber, int pageSize, string defaultSortFiled = "Id", bool isAsc = true, bool isMultiSortFiled = false, string[] sortArray = default) + //兼容之前后端给了默认值的,不影响之前的逻辑,只是改写法 + public static async Task> ToPagedListAsync(this IQueryable source, PageInput pageInput, string sortField , CancellationToken cancellationToken = default) { - if (isMultiSortFiled && sortArray == default) + + if (pageInput.PageIndex <= 0) { - throw new System.Exception("The sort field must be specified"); + pageInput.PageIndex = 1; + } + if (pageInput.PageSize <= 0) + { + pageInput.PageSize = 10; } - if (pageNumber <= 0) - { - pageNumber = 1; - } - if (pageSize <= 0) - { - pageSize = 10; - } - - var count = await source.CountAsync().ConfigureAwait(false); + var count = await source.CountAsync(cancellationToken).ConfigureAwait(false); if (count == 0) { return new PageOutput() { CurrentPageData = new T[0] }; } - var propName = string.IsNullOrWhiteSpace(defaultSortFiled) ? "Id" : defaultSortFiled; - if (!isMultiSortFiled) + var propName = string.Empty; + + if (string.IsNullOrWhiteSpace(pageInput.SortField)) { - source = isAsc ? source.OrderBy(propName) : source.OrderBy(propName + " desc"); - + propName = sortField; } - else - { - var sortString = string.Join(',', sortArray); - source = source.OrderBy(sortString); - } - source = source.Skip((pageNumber - 1) * pageSize); + source = string.IsNullOrWhiteSpace(propName) ? source : (pageInput.Asc ? source.OrderBy(propName) : source.OrderBy(propName + " desc")); + + source = source.Skip((pageInput.PageIndex - 1) * pageInput.PageSize); var items = await source - .Take(pageSize) - .ToArrayAsync() + .Take(pageInput.PageSize) + .ToArrayAsync(cancellationToken) .ConfigureAwait(false); var pagedList = new PageOutput() { - PageIndex = pageNumber, - PageSize = pageSize, + PageIndex = pageInput.PageIndex, + PageSize = pageInput.PageSize, TotalCount = count, CurrentPageData = items }; @@ -149,127 +143,6 @@ namespace IRaCIS.Core.Infrastructure.Extention } - #region 同步方法废弃 - ////单字段排序 - //public static PageOutput ToPagedList(this IQueryable source, int pageIndex, int pageSize, string defaultSortFiled = "Id", bool isAsc = true) - //{ - // if (pageIndex <= 0) - // { - // pageIndex = 1; - // } - // if (pageSize <= 0) - // { - // pageSize = 10; - // } - // var count = source.Count(); - - // if (count == 0) - // { - // return new PageOutput() { CurrentPageData = new T[0] }; - // } - - - // var propName = string.IsNullOrWhiteSpace(defaultSortFiled) ? "Id" : defaultSortFiled; - - // source = isAsc ? source.OrderBy(propName) : source.OrderBy(propName + " desc"); - - // source = source.Skip((pageIndex - 1) * pageSize); - - // var items = source - // .Take(pageSize) - // .ToArray(); - - // var pagedList = new PageOutput() - // { - // PageIndex = pageIndex, - // PageSize = pageSize, - // TotalCount = count, - // CurrentPageData = items - // }; - - // return pagedList; - //} - - //public static PageOutput ToPagedList(this IList source, int pageIndex, int pageSize, string defaultSortFiled = "Id", bool isAsc = true) - //{ - // if (pageIndex <= 0) - // { - // pageIndex = 1; - // } - // if (pageSize <= 0) - // { - // pageSize = 10; - // } - // var count = source.Count(); - - // if (count == 0) - // { - // return new PageOutput() { CurrentPageData = new List() }; - // } - - // var propName = string.IsNullOrWhiteSpace(defaultSortFiled) ? "Id" : defaultSortFiled; - - // IQueryable sourceQuery = isAsc ? source.AsQueryable().OrderBy(propName) : source.AsQueryable().OrderBy(propName + " desc"); - - // sourceQuery = sourceQuery.Skip((pageIndex - 1) * pageSize); - - // var items = sourceQuery - // .Take(pageSize) - // .ToArray(); - - // var pagedList = new PageOutput() - // { - // PageIndex = pageIndex, - // PageSize = pageSize, - // TotalCount = count, - // CurrentPageData = items - // }; - - // return pagedList; - //} - - - ////多字段排序 ["a asc", "b desc", "c asc"] - //public static PageOutput ToPagedList(this IQueryable source, int pageIndex, int pageSize, string[] sortArray) - //{ - // if (pageIndex <= 0) - // { - // pageIndex = 1; - // } - // if (pageSize <= 0) - // { - // pageSize = 10; - // } - // var count = source.Count(); - - // if (count == 0) - // { - // return new PageOutput() { CurrentPageData = new T[0] }; - // } - - // var sortString = string.Join(',', sortArray); - - // source.OrderBy(sortString); - - // source = source.Skip((pageIndex - 1) * pageSize); - - // var items = source - // .Take(pageSize) - // .ToArray(); - - // var pagedList = new PageOutput() - // { - // PageIndex = pageIndex, - // PageSize = pageSize, - // TotalCount = count, - // CurrentPageData = items - // }; - - // return pagedList; - //} - #endregion - - } }