From 2ea2c037e8e3de7767b2fe2c2af73e44e3ef0d44 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Wed, 14 Jun 2023 13:35:46 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=BA=93=E5=BC=82=E5=B8=B8?= =?UTF-8?q?=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Service/Management/UserService.cs | 1 - .../TrialSiteUser/PersonalWorkstation.cs | 19 +++++++++++++------ .../Context/IRaCISDBContext.cs | 5 +++++ 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/IRaCIS.Core.Application/Service/Management/UserService.cs b/IRaCIS.Core.Application/Service/Management/UserService.cs index b60b2e42d..8677beb20 100644 --- a/IRaCIS.Core.Application/Service/Management/UserService.cs +++ b/IRaCIS.Core.Application/Service/Management/UserService.cs @@ -477,7 +477,6 @@ namespace IRaCIS.Application.Services return await userQueryable.ToPagedListAsync(param.PageIndex, param.PageSize, param.SortField == string.Empty ? "UserName" : param.SortField, param.Asc); - } /// diff --git a/IRaCIS.Core.Application/Service/TrialSiteUser/PersonalWorkstation.cs b/IRaCIS.Core.Application/Service/TrialSiteUser/PersonalWorkstation.cs index d96ae367b..7b9bae7d9 100644 --- a/IRaCIS.Core.Application/Service/TrialSiteUser/PersonalWorkstation.cs +++ b/IRaCIS.Core.Application/Service/TrialSiteUser/PersonalWorkstation.cs @@ -192,8 +192,8 @@ namespace IRaCIS.Core.Application ToBeCheckedCount = t.SubjectVisitList.Where(u => u.CheckState == CheckStateEnum.ToCheck).Count(), - ToBeRepliedCount = t.SubjectVisitList.Where(u => u.CheckState == CheckStateEnum.ToCheck && - u.CheckChallengeDialogList.Any(t => t.UserTypeEnum == UserTypeEnum.ClinicalResearchCoordinator)).Count(), + ToBeRepliedCount = t.SubjectVisitList.Where(u => u.CheckState == CheckStateEnum.CVIng && + u.CheckChallengeDialogList.OrderByDescending(t=>t.CreateTime).First().UserTypeEnum== UserTypeEnum.ClinicalResearchCoordinator).Count(), }); @@ -204,8 +204,8 @@ namespace IRaCIS.Core.Application .Where(u => u.CheckState == CheckStateEnum.ToCheck).CountAsync(); var totalToBeRepliedCount = await _subjectVisitRepository.Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id)) - .Where(u => u.CheckState == CheckStateEnum.ToCheck && - u.CheckChallengeDialogList.Any(t => t.UserTypeEnum == UserTypeEnum.ClinicalResearchCoordinator)).CountAsync(); + .Where(u => u.CheckState == CheckStateEnum.CVIng && + u.CheckChallengeDialogList.OrderByDescending(t => t.CreateTime).First().UserTypeEnum == UserTypeEnum.ClinicalResearchCoordinator).CountAsync(); return ResponseOutput.Ok(result, new { TotalToBeCheckedCount = totalToBeCheckedCount, TotalToBeRepliedCount = totalToBeRepliedCount }); @@ -892,7 +892,7 @@ namespace IRaCIS.Core.Application [FromServices] IRepository _taskMedicalReviewRepository) { - var isPM = _userInfo.UserTypeEnumInt == (int)UserTypeEnum.ProjectManager; + var isPM = _userInfo.UserTypeEnumInt == (int)UserTypeEnum.ProjectManager|| _userInfo.UserTypeEnumInt == (int)UserTypeEnum.APM; var isCRC = _userInfo.UserTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator; var isIQC = _userInfo.UserTypeEnumInt == (int)UserTypeEnum.IQC; var isMIM = _userInfo.UserTypeEnumInt == (int)UserTypeEnum.MIM; @@ -917,9 +917,13 @@ namespace IRaCIS.Core.Application TrialStatusStr=t.TrialStatusStr, ExpetiedTaskCount= isPM ? t.VisitTaskList.Where(t=>t.IsUrgent).Count():0, + ReReadingApprovalCount= isPM? t.VisitTaskReReadingList.Where(t=>t.OriginalReReadingTask.ReReadingApplyState==ReReadingApplyState.DocotorHaveApplyed).Count():0, + PendingReconciliationCount=isPM? t.SubjectVisitList.Where(t=>t.CheckState==CheckStateEnum.ToCheck).Count():0, - + + PendingResponseCount=isPM? t.SubjectVisitList.Where(u => u.CheckState == CheckStateEnum.CVIng && + u.CheckChallengeDialogList.OrderByDescending(t => t.CreateTime).First().UserTypeEnum == UserTypeEnum.ClinicalResearchCoordinator).Count() : 0 @@ -934,6 +938,9 @@ namespace IRaCIS.Core.Application return ResponseOutput.Ok(result, new { TotalToBeReUploadCount = 0 }); } + + + #endregion } } diff --git a/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs b/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs index 4017c639c..b9fa19854 100644 --- a/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs +++ b/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs @@ -552,6 +552,11 @@ namespace IRaCIS.Core.Infra.EFCore throw new DBSaveFailedException("SQL 查询中存在语法错误。"); } + catch (ReferenceConstraintException ex) + { + _logger.LogError(ex.Message); + throw new DBSaveFailedException("无法进行当前操作,当前数据不符合外键约束。"); + } catch (DbUpdateConcurrencyException ex) { _logger.LogError(ex.Message);