【第一层级统计,需要迁移】
							parent
							
								
									b97f9f8f12
								
							
						
					
					
						commit
						d12f0bddad
					
				| 
						 | 
				
			
			@ -321,6 +321,89 @@ namespace IRaCIS.Core.Application.Contracts
 | 
			
		|||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public class UserToBeDoneRecord
 | 
			
		||||
    {
 | 
			
		||||
        #region PM/APM
 | 
			
		||||
        public int? PM_SiteSurveryCount { get; set; }
 | 
			
		||||
        public int? PM_CheckCount { get; set; }
 | 
			
		||||
        public int? PM_ReviewerSelectCount { get; set; }
 | 
			
		||||
 | 
			
		||||
        public int? PM_ReReadingApprovalCount { get; set; }
 | 
			
		||||
 | 
			
		||||
        public int? PM_TrialWaitSignDocCount { get; set; }
 | 
			
		||||
 | 
			
		||||
        public int? PM_SysWaitSignDocCount { get; set; }
 | 
			
		||||
 | 
			
		||||
        public int? PM_ClinicalDataCount { get; set; }
 | 
			
		||||
        #endregion
 | 
			
		||||
 | 
			
		||||
        #region CRC
 | 
			
		||||
 | 
			
		||||
        public int? CRC_ImageSubmitCount { get; set; }
 | 
			
		||||
        public int? CRC_ImageQuestionCount { get; set; }
 | 
			
		||||
        public int? CRC_CheckQuestionCount { get; set; }
 | 
			
		||||
 | 
			
		||||
        public int? CRC_ImageReUploadCount { get; set; }
 | 
			
		||||
 | 
			
		||||
        public int? CRC_TrialWaitSignDocCount { get; set; }
 | 
			
		||||
 | 
			
		||||
        public int? CRC_SysWaitSignDocCount { get; set; }
 | 
			
		||||
        #endregion
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        #region SPM/CPM
 | 
			
		||||
 | 
			
		||||
        public int? SPM_SiteSurveryCount { get; set; }
 | 
			
		||||
        public int? SPM_ReviewerApprovalCount { get; set; }
 | 
			
		||||
      
 | 
			
		||||
        public int? SPM_ReReadingApprovalCount { get; set; }
 | 
			
		||||
 | 
			
		||||
        public int? SPM_TrialWaitSignDocCount { get; set; }
 | 
			
		||||
 | 
			
		||||
        public int? SPM_SysWaitSignDocCount { get; set; }
 | 
			
		||||
        #endregion
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        #region IQC
 | 
			
		||||
 | 
			
		||||
        public int? IQC_IamgeQCCount { get; set; }
 | 
			
		||||
        public int? IQC_QCQuestionCount { get; set; }
 | 
			
		||||
 | 
			
		||||
        public int? IQC_TrialWaitSignDocCount { get; set; }
 | 
			
		||||
 | 
			
		||||
        public int? IQC_SysWaitSignDocCount { get; set; }
 | 
			
		||||
 | 
			
		||||
        #endregion
 | 
			
		||||
 | 
			
		||||
        #region IR
 | 
			
		||||
        public int? IR_IamgeWaitReadingCount { get; set; }
 | 
			
		||||
        public int? IR_MedicalReviewCount { get; set; }
 | 
			
		||||
 | 
			
		||||
        public int? IR_TrialWaitSignDocCount { get; set; }
 | 
			
		||||
 | 
			
		||||
        public int? IR_SysWaitSignDocCount { get; set; }
 | 
			
		||||
        #endregion
 | 
			
		||||
 | 
			
		||||
        #region MIM
 | 
			
		||||
        public int? MIM_MedicalReviewCount { get; set; }
 | 
			
		||||
 | 
			
		||||
        public int? MIM_TrialWaitSignDocCount { get; set; }
 | 
			
		||||
 | 
			
		||||
        public int? MIM_SysWaitSignDocCount { get; set; }
 | 
			
		||||
        #endregion
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        public bool IsHaveSysDocNeedNeedSign { get; set; }
 | 
			
		||||
 | 
			
		||||
        public List<TrialDocNeedSign> TrialNeedSignList { get; set; }=new List<TrialDocNeedSign>();
 | 
			
		||||
       
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public class TrialDocNeedSign: TrialBaseInfoDto
 | 
			
		||||
    {
 | 
			
		||||
        public bool IsHaveTrialDocNeedSign { get; set; }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public class TrialUserToBeDoneDto
 | 
			
		||||
    {
 | 
			
		||||
        public string UserName { get; set; }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1028,7 +1028,7 @@ namespace IRaCIS.Core.Application
 | 
			
		|||
 | 
			
		||||
                    UrgentCount = g.Where(u => u.VisitTask.IsUrgent && u.LatestReplyUser.UserTypeEnum == UserTypeEnum.MIM).Count(),
 | 
			
		||||
 | 
			
		||||
                    ToBeReplyedCount = g.Where(u => u.LatestReplyUser.UserTypeEnum == UserTypeEnum.MIM).Count(),
 | 
			
		||||
                    ToBeReplyedCount = g.Where(u => u.LatestReplyUser.UserTypeEnum == UserTypeEnum.MIM && u.AuditState == MedicalReviewAuditState.Auditing).Count(),
 | 
			
		||||
 | 
			
		||||
                    #endregion
 | 
			
		||||
                    //UrgentCount = g.Where(u => u.VisitTask.IsUrgent
 | 
			
		||||
| 
						 | 
				
			
			@ -1174,6 +1174,242 @@ namespace IRaCIS.Core.Application
 | 
			
		|||
        #region 项目列表查询  +  待办详情
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        public async Task<UserToBeDoneRecord> GetUserTobeDoneRecord([FromServices] IRepository<SubjectVisit> _subjectVisitRepository,
 | 
			
		||||
            [FromServices] IRepository<VisitTaskReReading> _visitTaskReReadingRepository,
 | 
			
		||||
            [FromServices] IRepository<TaskMedicalReview> _taskMedicalReviewRepository,
 | 
			
		||||
            [FromServices]IRepository<ReadingQuestionCriterionTrial> _trialReadingCriterionRepository)
 | 
			
		||||
        {
 | 
			
		||||
            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;
 | 
			
		||||
            var isSPMOrCPM = _userInfo.UserTypeEnumInt == (int)UserTypeEnum.SPM || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.CPM;
 | 
			
		||||
            var isIR = _userInfo.UserTypeEnumInt == (int)UserTypeEnum.IndependentReviewer;
 | 
			
		||||
 | 
			
		||||
            var needSignTrialCount = await _trialRepository.Where(t => t.TrialStatusStr != StaticData.TrialState.TrialStopped)
 | 
			
		||||
                .Where(c => c.TrialDocumentList.Where(t => t.IsDeleted == false && t.NeedConfirmedUserTypeList.Any(t => t.NeedConfirmUserTypeId == _userInfo.UserTypeId) 
 | 
			
		||||
                && !t.TrialDocConfirmedUserList.Any(t => t.ConfirmUserId == _userInfo.Id && t.ConfirmTime != null)).Count() > 0).CountAsync();
 | 
			
		||||
 | 
			
		||||
            var needSignSysDocCont = await _systemDocumentRepository
 | 
			
		||||
                        .Where(t => t.IsDeleted == false || (t.IsDeleted == true && t.SystemDocConfirmedUserList.Any(t => t.ConfirmUserId == _userInfo.Id && t.ConfirmTime != null)))
 | 
			
		||||
                        .SelectMany(t => t.NeedConfirmedUserTypeList)
 | 
			
		||||
                        .CountAsync(t => t.NeedConfirmUserTypeId == _userInfo.UserTypeId);
 | 
			
		||||
 | 
			
		||||
            var siteSurveyCount = await _trialRepository
 | 
			
		||||
                    .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.Id))
 | 
			
		||||
                    .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)
 | 
			
		||||
                    .CountAsync();
 | 
			
		||||
 | 
			
		||||
            var trialNeedSignList = new List<TrialDocNeedSign>();
 | 
			
		||||
 | 
			
		||||
            if (!_userInfo.IsAdmin)
 | 
			
		||||
            {
 | 
			
		||||
                trialNeedSignList = await _trialRepository.Where(t => t.TrialStatusStr != StaticData.TrialState.TrialStopped)
 | 
			
		||||
                    .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.Id))
 | 
			
		||||
                    .WhereIf(!_userInfo.IsAdmin, c => c.TrialDocumentList.Where(t => t.IsDeleted == false && t.NeedConfirmedUserTypeList.Any(t => t.NeedConfirmUserTypeId == _userInfo.UserTypeId) &&
 | 
			
		||||
                    !t.TrialDocConfirmedUserList.Any(t => t.ConfirmUserId == _userInfo.Id && t.ConfirmTime != null)).Count() > 0)
 | 
			
		||||
                    .Select(t=>new TrialDocNeedSign()
 | 
			
		||||
                    {
 | 
			
		||||
                        TrialId=t.Id,
 | 
			
		||||
                        TrialCode=t.TrialCode,
 | 
			
		||||
                        ExperimentName=t.ExperimentName,
 | 
			
		||||
                        ResearchProgramNo=t.ResearchProgramNo,
 | 
			
		||||
                        IsHaveTrialDocNeedSign=true
 | 
			
		||||
                    }).ToListAsync();
 | 
			
		||||
                                
 | 
			
		||||
            }    
 | 
			
		||||
 | 
			
		||||
         
 | 
			
		||||
 | 
			
		||||
            var record = new UserToBeDoneRecord()
 | 
			
		||||
            {
 | 
			
		||||
                #region sign document
 | 
			
		||||
 | 
			
		||||
                IsHaveSysDocNeedNeedSign = needSignSysDocCont > 0,
 | 
			
		||||
                TrialNeedSignList= trialNeedSignList,
 | 
			
		||||
 | 
			
		||||
                PM_SysWaitSignDocCount = isPM ? needSignSysDocCont : 0,
 | 
			
		||||
                PM_TrialWaitSignDocCount = isPM ? needSignTrialCount : 0,
 | 
			
		||||
 | 
			
		||||
                CRC_SysWaitSignDocCount = isCRC ? needSignSysDocCont : 0,
 | 
			
		||||
                CRC_TrialWaitSignDocCount = isCRC ? needSignTrialCount : 0,
 | 
			
		||||
 | 
			
		||||
                SPM_SysWaitSignDocCount = isSPMOrCPM ? needSignSysDocCont : 0,
 | 
			
		||||
                SPM_TrialWaitSignDocCount = isSPMOrCPM ? needSignTrialCount : 0,
 | 
			
		||||
 | 
			
		||||
                IQC_SysWaitSignDocCount = isIQC ? needSignSysDocCont : 0,
 | 
			
		||||
                IQC_TrialWaitSignDocCount = isIQC ? needSignTrialCount : 0,
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
                IR_SysWaitSignDocCount = isIR ? needSignSysDocCont : 0,
 | 
			
		||||
                IR_TrialWaitSignDocCount = isIR ? needSignTrialCount : 0,
 | 
			
		||||
 | 
			
		||||
                MIM_SysWaitSignDocCount = isMIM ? needSignSysDocCont : 0,
 | 
			
		||||
                MIM_TrialWaitSignDocCount = isMIM ? needSignTrialCount : 0,
 | 
			
		||||
 | 
			
		||||
                #endregion
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
                #region PM
 | 
			
		||||
 | 
			
		||||
                PM_SiteSurveryCount = isPM ? siteSurveyCount : 0,
 | 
			
		||||
 | 
			
		||||
                PM_CheckCount = isPM ? await _trialRepository
 | 
			
		||||
                .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.Id))
 | 
			
		||||
                .Where(u => u.SubjectVisitList.Any(t => t.CheckState == CheckStateEnum.ToCheck)).CountAsync() : 0,
 | 
			
		||||
 | 
			
		||||
                PM_ReviewerSelectCount = isPM ? await _trialRepository
 | 
			
		||||
                .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.Id))
 | 
			
		||||
                .Where(t => t.EnrollList.Where(u => u.EnrollStatus == EnrollStatus.InviteIntoGroup).Count() > 0).CountAsync() : 0,
 | 
			
		||||
 | 
			
		||||
                PM_ReReadingApprovalCount = isPM ? await _visitTaskReReadingRepository
 | 
			
		||||
                .Where(t => t.OriginalReReadingTask.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id))
 | 
			
		||||
                .Where(t => t.OriginalReReadingTask.ReReadingApplyState == ReReadingApplyState.DocotorHaveApplyed)
 | 
			
		||||
                .GroupBy(t => t.OriginalReReadingTask.TrialId)
 | 
			
		||||
                 .Select(g => new ReReadingApplyToBeDoneDto()
 | 
			
		||||
                 {
 | 
			
		||||
                     TrialId = g.Key,
 | 
			
		||||
                     ToBeApprovalCount = g.Count(),
 | 
			
		||||
 | 
			
		||||
                 }).Where(x => x.ToBeApprovalCount > 0).CountAsync() : 0,
 | 
			
		||||
 | 
			
		||||
                PM_ClinicalDataCount = isPM ? await _trialRepository
 | 
			
		||||
                .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.Id))
 | 
			
		||||
                .Where(t => t.ReadModuleList.Where(u => u.IsCRCConfirm && !u.IsPMConfirm).Count() > 0).CountAsync() : 0,
 | 
			
		||||
 | 
			
		||||
                #endregion
 | 
			
		||||
 | 
			
		||||
                #region CRC
 | 
			
		||||
 | 
			
		||||
                CRC_ImageSubmitCount = isCRC ? await _trialRepository
 | 
			
		||||
                .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.Id) && (t.IsUrgent || t.IsSubjectExpeditedView || t.IsEnrollementQualificationConfirm || t.IsPDProgressView))
 | 
			
		||||
                .Where(t => t.SubjectVisitList.Where(c => c.TrialSite.CRCUserList.Any(u => u.UserId == _userInfo.Id)).Where(u => u.SubmitState == SubmitStateEnum.ToSubmit).Count() > 0).CountAsync() : 0,
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
                CRC_ImageQuestionCount = isCRC ? await _trialRepository
 | 
			
		||||
                .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.Id))
 | 
			
		||||
                .Where(t => t.SubjectVisitList.Where(c => c.TrialSite.CRCUserList.Any(u => u.UserId == _userInfo.Id)).SelectMany(c => c.QCChallengeList)
 | 
			
		||||
                .Where(u => u.IsClosed == false && (u.LatestReplyUser.UserTypeEnum == UserTypeEnum.IQC || u.LatestReplyUserId == null)).Count() > 0).CountAsync() : 0,
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
                CRC_CheckQuestionCount = isCRC ? await _trialRepository
 | 
			
		||||
                .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.Id))
 | 
			
		||||
                .Where(t => t.SubjectVisitList.Where(c => c.TrialSite.CRCUserList.Any(u => u.UserId == _userInfo.Id))
 | 
			
		||||
                .Where(u => u.CheckState == CheckStateEnum.CVIng && u.CheckChallengeState == CheckChanllengeTypeEnum.PMWaitCRCReply).Count() > 0).CountAsync() : 0,
 | 
			
		||||
 | 
			
		||||
                CRC_ImageReUploadCount = isCRC ? await _trialRepository
 | 
			
		||||
                .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.Id))
 | 
			
		||||
                .Where(t => t.SubjectVisitList
 | 
			
		||||
                .Where(c => c.TrialSite.CRCUserList.Any(u => u.UserId == _userInfo.Id))
 | 
			
		||||
                .Where(u => (u.SubmitState == SubmitStateEnum.ToSubmit && u.IsPMBackOrReReading) || (u.IsQCConfirmedReupload)).Count() > 0).CountAsync() : 0,
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
                #endregion
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
                #region SPM
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
                SPM_SiteSurveryCount = isSPMOrCPM ? siteSurveyCount : 0,
 | 
			
		||||
 | 
			
		||||
                SPM_ReviewerApprovalCount = isSPMOrCPM ? await _trialRepository
 | 
			
		||||
                .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.Id))
 | 
			
		||||
                .Where(t => t.EnrollList.Where(u => u.EnrollStatus == EnrollStatus.HasCommittedToCRO).Count() > 0).CountAsync() : 0,
 | 
			
		||||
 | 
			
		||||
                SPM_ReReadingApprovalCount = isSPMOrCPM ? await _visitTaskReReadingRepository
 | 
			
		||||
                .Where(t => t.OriginalReReadingTask.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id))
 | 
			
		||||
                .Where(t => t.OriginalReReadingTask.ReReadingApplyState == ReReadingApplyState.TrialGroupHaveApplyed)
 | 
			
		||||
                .GroupBy(t => t.OriginalReReadingTask.TrialId)
 | 
			
		||||
                .Select(g => new ReReadingApplyToBeDoneDto()
 | 
			
		||||
                {
 | 
			
		||||
                    TrialId = g.Key,
 | 
			
		||||
                    ToBeApprovalCount = g.Count(),
 | 
			
		||||
 | 
			
		||||
                }).Where(x => x.ToBeApprovalCount > 0).CountAsync() : 0,
 | 
			
		||||
 | 
			
		||||
                #endregion
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
                #region IQC
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
                IQC_IamgeQCCount = isIQC ? await _trialRepository
 | 
			
		||||
                .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.Id))
 | 
			
		||||
                .Where(t => t.QCProcessEnum != TrialQCProcess.NotAudit)
 | 
			
		||||
                .Select(t => new
 | 
			
		||||
                {
 | 
			
		||||
                    //待领取量
 | 
			
		||||
                    ToBeClaimedCount = t.SubjectVisitList.Where(t => t.SubmitState == SubmitStateEnum.Submitted && t.AuditState != AuditStateEnum.QCPassed)
 | 
			
		||||
                    .Where(u => u.CurrentActionUserId == null && (u.PreliminaryAuditUserId == null || (u.PreliminaryAuditUserId != _userInfo.Id && u.ReviewAuditUserId == null))).Count(),
 | 
			
		||||
 | 
			
		||||
                    //待审核通过,统计从已领取到QC提交之间的      已领取 待审核 审核中   (审核完成  领取人就会清理 所以只用查询当前领取人是自己的就好了)
 | 
			
		||||
                    ToBeReviewedCount = t.SubjectVisitList.Where(u => u.CurrentActionUserId == _userInfo.Id).Count()
 | 
			
		||||
 | 
			
		||||
                }).Where(x => x.ToBeClaimedCount + x.ToBeReviewedCount > 0).CountAsync() : 0,
 | 
			
		||||
 | 
			
		||||
                IQC_QCQuestionCount = isIQC ? await _trialRepository
 | 
			
		||||
                .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.Id))
 | 
			
		||||
                .Where(t => t.SubjectVisitList.SelectMany(c => c.QCChallengeList)
 | 
			
		||||
                .Where(u => u.CreateUserId == _userInfo.Id && u.IsClosed == false && u.LatestReplyUser.UserTypeEnum == UserTypeEnum.ClinicalResearchCoordinator).Count() > 0).CountAsync() : 0,
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
                #endregion
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
                #region IR
 | 
			
		||||
 | 
			
		||||
                IR_IamgeWaitReadingCount = isIR ? await _trialReadingCriterionRepository.Where(t => t.IsConfirm == true && t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id))
 | 
			
		||||
                .Where(c => c.VisitTaskList.Where(t => t.DoctorUserId == _userInfo.Id && t.ReadingTaskState != ReadingTaskState.HaveSigned && t.TaskState == TaskState.Effect)
 | 
			
		||||
                          // 前序 不存在 未一致性核查未通过的
 | 
			
		||||
                          .Where(t => !t.Subject.SubjectVisitList.Any(sv => sv.CheckState != CheckStateEnum.CVPassed && t.VisitTaskNum > sv.VisitNum))
 | 
			
		||||
                          //前序 不存在  未生成任务的访视
 | 
			
		||||
                          //.WhereIf(g.Key.IsAutoCreate == false, t => !t.Subject.SubjectCriteriaEvaluationVisitFilterList.Where(d => d.TrialReadingCriterionId == t.TrialReadingCriterionId).Any(f => f.IsGeneratedTask == false && t.VisitTaskNum > f.SubjectVisit.VisitNum))
 | 
			
		||||
                          .Where(t => c.IsAutoCreate ? !t.Subject.SubjectCriteriaEvaluationVisitFilterList.Where(d => d.TrialReadingCriterionId == t.TrialReadingCriterionId).Any(f => f.IsGeneratedTask == false && t.VisitTaskNum > f.SubjectVisit.VisitNum) : true)
 | 
			
		||||
 | 
			
		||||
                          .Where(y => y.IsFrontTaskNeedSignButNotSign == false && (y.IsNeedClinicalDataSign == false || y.IsClinicalDataSign == true))
 | 
			
		||||
                          .Count() > 0).CountAsync() : 0,
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
                IR_MedicalReviewCount = isIR ? await _taskMedicalReviewRepository
 | 
			
		||||
                    .Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id))
 | 
			
		||||
                   .Where(t => t.IsClosedDialog == false && t.VisitTask.TaskState == TaskState.Effect && t.IsInvalid == false && t.MedicalManagerUserId == _userInfo.Id)
 | 
			
		||||
                   .GroupBy(t => t.TrialId)
 | 
			
		||||
                   .Select(g => new MedicalCommentsToBeDoneDto()
 | 
			
		||||
                   {
 | 
			
		||||
                       TrialId = g.Key,
 | 
			
		||||
                       ToBeReplyedCount = g.Where(u => u.LatestReplyUser.UserTypeEnum == UserTypeEnum.MIM && u.AuditState == MedicalReviewAuditState.Auditing).Count(),
 | 
			
		||||
 | 
			
		||||
                   }).Where(t => t.ToBeReviewedCount + t.ToBeReplyedCount > 0).CountAsync() : 0,
 | 
			
		||||
 | 
			
		||||
                #endregion
 | 
			
		||||
 | 
			
		||||
                #region MIM
 | 
			
		||||
 | 
			
		||||
                MIM_MedicalReviewCount = isMIM ? await _taskMedicalReviewRepository
 | 
			
		||||
                    .Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id))
 | 
			
		||||
                   .Where(t => t.IsClosedDialog == false && t.VisitTask.TaskState == TaskState.Effect && t.IsInvalid == false && t.MedicalManagerUserId == _userInfo.Id)
 | 
			
		||||
                   .GroupBy(t => t.TrialId)
 | 
			
		||||
                   .Select(g => new MedicalCommentsToBeDoneDto()
 | 
			
		||||
                   {
 | 
			
		||||
                       TrialId = g.Key,
 | 
			
		||||
 | 
			
		||||
                       ToBeReplyedCount = g.Where(u => u.LatestReplyUser.UserTypeEnum == UserTypeEnum.IndependentReviewer && u.AuditState == MedicalReviewAuditState.Auditing).Count(),
 | 
			
		||||
 | 
			
		||||
                       ToBeReviewedCount = g.Where(u => u.AuditState != MedicalReviewAuditState.HaveSigned && u.LatestReplyUser.UserTypeEnum != UserTypeEnum.IndependentReviewer).Count()
 | 
			
		||||
 | 
			
		||||
                   }).Where(t => t.ToBeReviewedCount + t.ToBeReplyedCount > 0).CountAsync() : 0,
 | 
			
		||||
 | 
			
		||||
                #endregion
 | 
			
		||||
 | 
			
		||||
            };
 | 
			
		||||
 | 
			
		||||
            return record;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        [HttpPost]
 | 
			
		||||
        public async Task<IResponseOutput<PageOutput<TrialToBeDoneDto>>> GetTrialToBeDoneList(TrialToBeDoneQuery inQuery,
 | 
			
		||||
              [FromServices] IRepository<TaskMedicalReview> _taskMedicalReviewRepository)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue