diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml index b1cd307ed..9193531bf 100644 --- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml +++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml @@ -735,6 +735,15 @@ + + + 重传申请导表 + + + + + + getSysDocumentConfirmList 系统文档培训查询 @@ -2169,7 +2178,7 @@ - + 指定资源Id,获取Dicom检查信息 Dicom检查的Id @@ -17582,7 +17591,7 @@ - + 指定资源Id,获取Dicom检查所属序列信息列表 Dicom检查的Id @@ -17981,7 +17990,7 @@ - + 获取下一个质控任务 diff --git a/IRaCIS.Core.Application/Service/Common/ExcelExportService.cs b/IRaCIS.Core.Application/Service/Common/ExcelExportService.cs index bf90ddaae..4fa795ad6 100644 --- a/IRaCIS.Core.Application/Service/Common/ExcelExportService.cs +++ b/IRaCIS.Core.Application/Service/Common/ExcelExportService.cs @@ -37,6 +37,7 @@ namespace IRaCIS.Core.Application.Service.Common IRepository _dicomStudyRepository, IRepository _qcChallengeRepository, IRepository _readModuleRepository, + IRepository _trialRepository, IRepository _noneDicomStudyRepository, IRepository _studyMonitorRepository, IRepository _commonDocumentRepository, @@ -398,6 +399,46 @@ namespace IRaCIS.Core.Application.Service.Common #region 导表查询 + /// + /// 重传申请导表 + /// + /// + /// + /// + /// + [HttpPost] + public async Task GetImageBackList_Export(ImageBackQueryDto inQuery, + [FromServices] IRepository _subjectVisitImageBackRecordReposiotry, [FromServices] IDictionaryService _dictionaryService) + { + var svExpression = QCCommon.GetSubjectVisitImageBackRecordFilter(inQuery.VisitPlanArray); + + var query = _subjectVisitImageBackRecordReposiotry.Where(t => t.SubjectVisit.TrialId == inQuery.TrialId) + .WhereIf(inQuery.TrialSiteId != null, t => t.SubjectVisit.TrialSiteId == inQuery.TrialSiteId) + .WhereIf(!string.IsNullOrEmpty(inQuery.SubjectCode), t => t.SubjectVisit.Subject.Code.Contains(inQuery.SubjectCode)) + .WhereIf(!string.IsNullOrEmpty(inQuery.VisitName), t => t.SubjectVisit.VisitName.Contains(inQuery.VisitName)) + .WhereIf(inQuery.VisitPlanArray != null && inQuery.VisitPlanArray?.Length > 0, svExpression) + .WhereIf(inQuery.CreateUserId != null, t => t.CreateUserId == inQuery.CreateUserId) + .WhereIf(inQuery.ApplyUserRole != null, t => t.ApplyUserRole == inQuery.ApplyUserRole) + .WhereIf(inQuery.ApplyBeginTime != null, t => t.CreateTime >= inQuery.ApplyBeginTime) + .WhereIf(inQuery.ApplyEndTime != null, t => t.CreateTime <= inQuery.ApplyEndTime) + .WhereIf(inQuery.ImageBackState != null, t => t.ImageBackState == inQuery.ImageBackState) + .WhereIf(inQuery.AuditBeginTime != null, t => t.AuditTime >= inQuery.AuditBeginTime) + .WhereIf(inQuery.AuditEndTime != null, t => t.AuditTime <= inQuery.AuditEndTime) + .ProjectTo(_mapper.ConfigurationProvider); + + var defalutSortArray = new string[] { nameof(ImageBackViewModel.IsUrgent) + " desc", nameof(ImageBackViewModel.SubjectCode), nameof(ImageBackViewModel.VisitNum) }; + + var list = await query.OrderByDescending(t=>t.IsUrgent).ThenBy(t=>t.SubjectCode).ThenBy(t=>t.VisitNum).ToListAsync(); + + var exportInfo = (await _trialRepository.Where(t => t.Id == inQuery.TrialId).IgnoreQueryFilters().ProjectTo(_mapper.ConfigurationProvider).FirstOrDefaultAsync()).IfNullThrowException(); + + exportInfo.List = ExportExcelConverterDate.ConvertToClientTimeInObject(list, _userInfo.TimeZoneId); + exportInfo.CurrentTime = ExportExcelConverterDate.DateTimeInternationalToString(DateTime.Now, _userInfo.TimeZoneId); + + return await ExcelExportHelper.DataExportAsync(StaticData.Export.TrialImageBackRecordList_Export, exportInfo, $"{exportInfo.ResearchProgramNo}", _commonDocumentRepository, _hostEnvironment, _dictionaryService, typeof(ImageBackViewModel)); + + } + ///getSysDocumentConfirmList 系统文档培训查询 /// [HttpPost] @@ -3109,7 +3150,7 @@ namespace IRaCIS.Core.Application.Service.Common { //遍历病灶的每个问题 - foreach (var lessionItem in lession.LessionAnswerList) + foreach (var lessionItem in lession.LessionAnswerList.OrderBy(t=>t.ShowOrder)) { var cloneItem = item.Clone(); diff --git a/IRaCIS.Core.Application/Service/ImageAndDoc/DownloadAndUploadService.cs b/IRaCIS.Core.Application/Service/ImageAndDoc/DownloadAndUploadService.cs index 73ff52173..c468fb52f 100644 --- a/IRaCIS.Core.Application/Service/ImageAndDoc/DownloadAndUploadService.cs +++ b/IRaCIS.Core.Application/Service/ImageAndDoc/DownloadAndUploadService.cs @@ -195,8 +195,8 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc Modalities = t.Modalities, SeriesCount = t.SeriesCount, - ReadingInstanceCount=t.InstanceList.Where(t=>t.IsReading && t.DicomSerie.IsReading).Count(), - ReadingSeriesCount= t.SeriesList.Where(t => t.IsReading).Count(), + ReadingInstanceCount = t.InstanceList.Where(t => t.IsReading && t.DicomSerie.IsReading).Count(), + ReadingSeriesCount = t.SeriesList.Where(t => t.IsReading).Count(), }).ToList(), UploadStudyList = u.TaskStudyList.Select(t => new StudyBasicInfo() @@ -731,7 +731,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc Path = t.Path }).ToList(), - ReadingFileCount= ns.FileCount, + ReadingFileCount = ns.FileCount, }; @@ -1126,7 +1126,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc HtmlPath = k.HtmlPath, Path = k.Path, InstanceNumber = k.InstanceNumber, - FileSize=k.FileSize, + FileSize = k.FileSize, }).ToList() }) }); @@ -1228,9 +1228,9 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc //DicomImageSize = t.StudyList.SelectMany(t => t.InstanceList).Sum(t => t.FileSize), //NoneDicomImageSize = t.NoneDicomStudyList.SelectMany(t => t.NoneDicomFileList).Sum(t => t.FileSize) }); + var defalutSortArray = new string[] { nameof(TrialVisitImageStatView.TrialSiteCode), nameof(QCCRCVisitViewModel.SubjectCode), nameof(QCCRCVisitViewModel.VisitNum) }; - - var pagelist = await query.Where(t => t.TotalImageCount > 0).ToPagedListAsync(inQuery); + var pagelist = await query.Where(t => t.TotalImageCount > 0).ToPagedListAsync(inQuery, defalutSortArray); return ResponseOutput.Ok(pagelist); } diff --git a/IRaCIS.Core.Application/Service/Management/DTO/UserModel.cs b/IRaCIS.Core.Application/Service/Management/DTO/UserModel.cs index 94228c00b..d711165cd 100644 --- a/IRaCIS.Core.Application/Service/Management/DTO/UserModel.cs +++ b/IRaCIS.Core.Application/Service/Management/DTO/UserModel.cs @@ -350,6 +350,8 @@ namespace IRaCIS.Application.Contracts public string ResearchProgramNo { get; set; } #endregion + + public int JoinedTrialCount { get; set; } } diff --git a/IRaCIS.Core.Application/Service/Management/_MapConfig.cs b/IRaCIS.Core.Application/Service/Management/_MapConfig.cs index 51fffdcc6..a307a3bdc 100644 --- a/IRaCIS.Core.Application/Service/Management/_MapConfig.cs +++ b/IRaCIS.Core.Application/Service/Management/_MapConfig.cs @@ -154,6 +154,7 @@ namespace IRaCIS.Core.Application.Service .ForMember(d => d.IdentityUserId, c => c.MapFrom(t => t.Id)); CreateMap() .ForMember(d => d.TrialCode, u => u.MapFrom(s => s.Trial.TrialCode)) + .ForMember(d => d.JoinedTrialCount, u => u.MapFrom(s => s.UserTrialList.Count())) .ForMember(d => d.ResearchProgramNo, u => u.MapFrom(s => s.Trial.ResearchProgramNo)); CreateMap().ReverseMap(); diff --git a/IRaCIS.Core.Application/Service/QC/DTO/QCListViewModel.cs b/IRaCIS.Core.Application/Service/QC/DTO/QCListViewModel.cs index 040431e29..ad95c2d6a 100644 --- a/IRaCIS.Core.Application/Service/QC/DTO/QCListViewModel.cs +++ b/IRaCIS.Core.Application/Service/QC/DTO/QCListViewModel.cs @@ -1397,6 +1397,8 @@ namespace IRaCIS.Core.Application.Contracts [Comment("自定义单位")] public string CustomUnit { get; set; } = string.Empty; + public int ShowOrder { get; set; } + #endregion @@ -1775,12 +1777,15 @@ namespace IRaCIS.Core.Application.Contracts public DateTime? AuditTime { get; set; } public Guid SubjectVisitId { get; set; } + [DictionaryTranslateAttribute("ImageBackApplyEnum")] public ImageBackApplyEnum ApplyUserRole { get; set; } + [DictionaryTranslateAttribute("ImageBackApplyEnum")] public ImageBackStateEnum ImageBackState { get; set; } public DateTime? SubmitTime { get; set; } + [DictionaryTranslateAttribute("YesOrNo")] public bool IsUrgent { get; set; } public string VisitName { get; set; } = string.Empty; @@ -1789,8 +1794,8 @@ namespace IRaCIS.Core.Application.Contracts public DateTime? LatestScanDate { get; set; } public decimal VisitNum { get; set; } - - + [DictionaryTranslateAttribute("Subject_Visit_Status")] + public SubjectStatus SubjectStatus { get; set; } public string SubjectCode { get; set; } = String.Empty; public String TrialSiteCode { get; set; } = String.Empty; diff --git a/IRaCIS.Core.Application/Service/QC/QCListService.cs b/IRaCIS.Core.Application/Service/QC/QCListService.cs index f9b7e58c6..d5ba73af0 100644 --- a/IRaCIS.Core.Application/Service/QC/QCListService.cs +++ b/IRaCIS.Core.Application/Service/QC/QCListService.cs @@ -58,7 +58,7 @@ namespace IRaCIS.Core.Application.Image.QA .WhereIf(inQuery.AuditEndTime != null, t => t.AuditTime <= inQuery.AuditEndTime) .ProjectTo(_mapper.ConfigurationProvider); - var defalutSortArray = new string[] { nameof(ImageBackViewModel.IsUrgent) + " desc", nameof(ImageBackViewModel.SubjectCode), nameof(ImageBackViewModel.VisitNum) }; + var defalutSortArray = new string[] { nameof(ImageBackViewModel.ImageBackState), nameof(ImageBackViewModel.CreateTime), nameof(ImageBackViewModel.SubjectCode), nameof(ImageBackViewModel.VisitNum) }; var pageList = await query.ToPagedListAsync(inQuery, defalutSortArray); return ResponseOutput.Ok(pageList); @@ -489,7 +489,8 @@ namespace IRaCIS.Core.Application.Image.QA var secondReviewTime = inDto.SecondReviewTime != null ? (DateTime)inDto.SecondReviewTime : trialConfirmTime == null ? DateTime.Now : (DateTime)trialConfirmTime; - if ((sv.AuditState == AuditStateEnum.QCPassed && inDto.CurrentQCEnum != CurrentQC.SecondReview) || (inDto.CurrentQCEnum == CurrentQC.SecondReview && secondReviewTime.AddSeconds(1) < trialConfirmTime)) + if ((sv.AuditState == AuditStateEnum.QCPassed && inDto.CurrentQCEnum != CurrentQC.SecondReview) || (inDto.CurrentQCEnum == CurrentQC.SecondReview && secondReviewTime.AddSeconds(1) < trialConfirmTime) + || (sv.AuditState >= AuditStateEnum.PrimaryQCPassed && inDto.CurrentQCEnum == CurrentQC.First)) //1QC通过时,这个时候看1qc答案 { //之前质控完的,+二次复核完的,都要从答案表中取 二次复核完的还需要加时间 @@ -717,7 +718,7 @@ namespace IRaCIS.Core.Application.Image.QA var qaChallengeQuery = _qcChallengeRepository.Where(t => t.SubjectVisitId == subjectVisitId && t.QCProcessEnum == trialQCProcess) .ProjectTo(_mapper.ConfigurationProvider, new { currentUserId = _userInfo.UserRoleId }); - var list = await qaChallengeQuery.OrderByDescending(t=>t.CreateTime).ToListAsync(); + var list = await qaChallengeQuery.OrderByDescending(t => t.CreateTime).ToListAsync(); //list.ForEach(t => t.DialogList.ToList().ForEach(u => u.IsCurrentUser = _userInfo.Id == u.CreateUserId)); diff --git a/IRaCIS.Core.Application/Service/QC/QCOperationService.cs b/IRaCIS.Core.Application/Service/QC/QCOperationService.cs index 796d06f8c..bbbe7157d 100644 --- a/IRaCIS.Core.Application/Service/QC/QCOperationService.cs +++ b/IRaCIS.Core.Application/Service/QC/QCOperationService.cs @@ -782,6 +782,16 @@ namespace IRaCIS.Core.Application.Image.QA //_mapper.Map(qcQuestionAnswerCommands, questionAnswerList); #endregion + //可能还有新增的问题 + + var needAddList = qcQuestionAnswerCommands.Where(t => t.Id == null).ToList(); + var addlist = _mapper.Map>(needAddList); + + + + addlist.ForEach(t => { t.TrialId = trialId; t.SubjectVisitId = subjectVisitId; t.CurrentQCEnum = currentQCType; t.QCProcessEnum = trialQCProcess; t.SecondReviewTime = currentQCType == CurrentQC.SecondReview ? trialConfirmTime : null; }); + + await _trialQCQuestionAnswerRepository.AddRangeAsync(addlist); return ResponseOutput.Ok(await _trialQCQuestionAnswerRepository.SaveChangesAsync()); @@ -1231,19 +1241,60 @@ namespace IRaCIS.Core.Application.Image.QA [HttpPost] public async Task CollectNextIQCQuality(GetNextIQCQualityInDto inDto) { - var nextIQCQuality = await this.GetNextIQCQuality(inDto); - if (nextIQCQuality.VisitId != null && nextIQCQuality.IsReceived == false) + var trialConfig = await _trialRepository + .Select(t => new { TrialId = t.Id, t.IsIQCAutoNextTask, t.IsIQCAutoTaskDistinguishType }) + .FirstOrDefaultAsync(t => t.TrialId == inDto.TrialId) + .IfNullThrowException(); + + var isDistinguishType = trialConfig.IsIQCAutoNextTask && trialConfig.IsIQCAutoTaskDistinguishType; + + + if (isDistinguishType == false) { - var visit = await _subjectVisitRepository.Where(x => x.Id == nextIQCQuality.VisitId).FirstNotNullAsync(); - if (!visit.IsTake) + //不区分任务类型,也要按照当前任务类型给,没找到,按照默认规则给任务 无质疑 普通质控任务 + + var nextIQCQuality = await this.GetNextIQCQuality(inDto, true); + + //没找到 + if (nextIQCQuality.VisitId == null) { - await ObtainOrCancelQCTask(inDto.TrialId, nextIQCQuality.VisitId.Value, true); + nextIQCQuality = await this.GetNextIQCQuality(inDto, false); + + if (nextIQCQuality.VisitId != null && nextIQCQuality.IsReceived == false) + { + var visit = await _subjectVisitRepository.Where(x => x.Id == nextIQCQuality.VisitId).FirstNotNullAsync(); + if (!visit.IsTake) + { + await ObtainOrCancelQCTask(inDto.TrialId, nextIQCQuality.VisitId.Value, true); + } + + } } + return nextIQCQuality; + + } + else + { + //区分任务类型,那么按照当前任务类型给,没找到就结束 + var nextIQCQuality = await this.GetNextIQCQuality(inDto, true); + + if (nextIQCQuality.VisitId != null && nextIQCQuality.IsReceived == false) + { + var visit = await _subjectVisitRepository.Where(x => x.Id == nextIQCQuality.VisitId).FirstNotNullAsync(); + if (!visit.IsTake) + { + await ObtainOrCancelQCTask(inDto.TrialId, nextIQCQuality.VisitId.Value, true); + } + + } + + return nextIQCQuality; } - return nextIQCQuality; + + } @@ -1254,7 +1305,7 @@ namespace IRaCIS.Core.Application.Image.QA /// /// [HttpPost] - public async Task GetNextIQCQuality(GetNextIQCQualityInDto inDto) + public async Task GetNextIQCQuality(GetNextIQCQualityInDto inDto, bool isDistinguishType) { var trialConfig = await _trialRepository .Select(t => new { TrialId = t.Id, t.QCProcessEnum, t.IsImageConsistencyVerification, t.IsIQCAutoNextTask, t.IsIQCAutoTaskDistinguishType }) @@ -1263,16 +1314,18 @@ namespace IRaCIS.Core.Application.Image.QA //当前任务类型 是复核还是普通任务 - var isDistinguishType = trialConfig.IsIQCAutoNextTask && trialConfig.IsIQCAutoTaskDistinguishType; - //当前是否是复核任务,复核任务,那么下一个任务也是复核的任务 var isSecondReview = _subjectVisitRepository.Any(t => t.Id == inDto.SubjectVisitId && t.SecondReviewState == SecondReviewState.AuditPassed); + var ishaveQCChallenge = _subjectVisitRepository.Any(t => t.Id == inDto.SubjectVisitId && t.QCChallengeList.Any()); + var currentActionList = await _subjectVisitRepository.Where(x => x.TrialId == inDto.TrialId && x.CurrentActionUserId == _userInfo.UserRoleId) .Where(t => t.Subject.Status != SubjectStatus.EndOfVisit) - .WhereIf(isDistinguishType, t => isSecondReview == false ? t.SecondReviewState == SecondReviewState.None : t.SecondReviewState == SecondReviewState.WaitAudit) - .OrderByDescending(x => x.IsUrgent) - .ThenBy(x => x.Subject.Code).ThenBy(x => x.VisitNum).ToListAsync(); + .WhereIf(isDistinguishType, t => isSecondReview == true ? t.SecondReviewState == SecondReviewState.WaitAudit : t.SecondReviewState == SecondReviewState.None) + .WhereIf(isDistinguishType, t => ishaveQCChallenge == true ? t.QCChallengeList.Any() : !t.QCChallengeList.Any()) + .Select(t => new { t.IsUrgent, SubjectCode = t.Subject.Code, t.SubjectId, t.Id, t.VisitNum, IshaveQCChallenge = t.QCChallengeList.Any(), t.SecondReviewState }) + .OrderBy(t => t.IshaveQCChallenge).ThenBy(t => t.SecondReviewState).ThenBy(x => x.IsUrgent).ThenBy(x => x.SubjectCode).ThenBy(x => x.VisitNum).ToListAsync(); + if (currentActionList.Count() > 0) { @@ -1285,27 +1338,26 @@ namespace IRaCIS.Core.Application.Image.QA }; } - SubjectVisit? subjectVisit = null; - List? visitList = null; + switch (trialConfig.QCProcessEnum) { case TrialQCProcess.NotAudit: return new GetNextIQCQualityOutDto() { }; break; case TrialQCProcess.SingleAudit: - visitList = await _subjectVisitRepository - .Where(t => t.Subject.Status != SubjectStatus.EndOfVisit) - .WhereIf(isDistinguishType, t => isSecondReview == false ? t.SecondReviewState == SecondReviewState.None : t.SecondReviewState == SecondReviewState.WaitAudit) - .Where(x => !x.SubjectVisitImageBackRecordList.Any(t => t.ImageBackState == ImageBackStateEnum.None)) - .Where(x => x.SubmitState == SubmitStateEnum.Submitted && x.SecondReviewState == SecondReviewState.None - && x.TrialId == inDto.TrialId && x.PreliminaryAuditUserId != _userInfo.UserRoleId && (x.CurrentActionUserId == _userInfo.UserRoleId || (x.AuditState != AuditStateEnum.PrimaryQCPassed && !x.IsTake))) - .Where(x => x.QCChallengeList.Count() == 0 || x.QCChallengeList.Where(y => !y.IsClosed).OrderByDescending(x => x.CreateTime).FirstOrDefault().CreateUserId != _userInfo.UserRoleId) - .Include(x => x.Subject).ToListAsync(); + var visitList = await _subjectVisitRepository + .Where(t => t.Subject.Status != SubjectStatus.EndOfVisit) + .WhereIf(isDistinguishType, t => isSecondReview == true ? t.SecondReviewState == SecondReviewState.WaitAudit : t.SecondReviewState == SecondReviewState.None) + .WhereIf(isDistinguishType, t => ishaveQCChallenge == true ? t.QCChallengeList.Any() : !t.QCChallengeList.Any()) + .Where(x => !x.SubjectVisitImageBackRecordList.Any(t => t.ImageBackState == ImageBackStateEnum.None)) + .Where(x => x.SubmitState == SubmitStateEnum.Submitted && x.SecondReviewState == SecondReviewState.None + && x.TrialId == inDto.TrialId && x.PreliminaryAuditUserId != _userInfo.UserRoleId && (x.CurrentActionUserId == _userInfo.UserRoleId || (x.AuditState != AuditStateEnum.PrimaryQCPassed && !x.IsTake))) + .Where(x => x.QCChallengeList.Count() == 0 || x.QCChallengeList.Where(y => !y.IsClosed).OrderByDescending(x => x.CreateTime).FirstOrDefault().CreateUserId != _userInfo.UserRoleId) + .Select(t => new { t.IsUrgent, SubjectCode = t.Subject.Code, t.SubjectId, t.Id, t.VisitNum, IshaveQCChallenge = t.QCChallengeList.Any(), t.SecondReviewState }) + .OrderBy(t => t.IshaveQCChallenge).ThenBy(t => t.SecondReviewState).ThenBy(x => x.IsUrgent).ThenBy(x => x.SubjectCode).ThenBy(x => x.VisitNum).ToListAsync(); - subjectVisit = visitList.Where(x => x.SubjectId == inDto.SubjectId) + var subjectVisit = visitList.Where(x => x.SubjectId == inDto.SubjectId).OrderBy(x => x.VisitNum).FirstOrDefault(); - - .OrderBy(x => x.VisitNum).FirstOrDefault(); if (subjectVisit != null) { return new GetNextIQCQualityOutDto() @@ -1315,7 +1367,7 @@ namespace IRaCIS.Core.Application.Image.QA }; } - subjectVisit = visitList.OrderBy(x => x.Subject.Code).ThenBy(x => x.VisitNum).FirstOrDefault(); + subjectVisit = visitList.OrderBy(x => x.SubjectCode).ThenBy(x => x.VisitNum).FirstOrDefault(); if (subjectVisit != null) { return new GetNextIQCQualityOutDto() @@ -1333,13 +1385,18 @@ namespace IRaCIS.Core.Application.Image.QA visitList = await _subjectVisitRepository .Where(t => t.Subject.Status != SubjectStatus.EndOfVisit) - .WhereIf(isDistinguishType, t => isSecondReview == false ? t.SecondReviewState == SecondReviewState.None : t.SecondReviewState == SecondReviewState.WaitAudit) + .WhereIf(isDistinguishType, t => isSecondReview == true ? t.SecondReviewState == SecondReviewState.WaitAudit : t.SecondReviewState == SecondReviewState.None) + .WhereIf(isDistinguishType, t => ishaveQCChallenge == true ? t.QCChallengeList.Any() : !t.QCChallengeList.Any()) .Where(x => !x.SubjectVisitImageBackRecordList.Any(t => t.ImageBackState == ImageBackStateEnum.None)) .Where(x => x.SubmitState == SubmitStateEnum.Submitted && x.TrialId == inDto.TrialId && ((x.CurrentActionUserId == _userInfo.UserRoleId) || (!x.IsTake && x.AuditState != AuditStateEnum.QCPassed && (x.PreliminaryAuditUserId != _userInfo.UserRoleId))) ) .Where(x => x.QCChallengeList.Count() == 0 || x.QCChallengeList.Where(y => !y.IsClosed).OrderByDescending(x => x.CreateTime).FirstOrDefault().CreateUserId != _userInfo.UserRoleId) - .Include(x => x.Subject).ToListAsync(); + .Select(t => new { t.IsUrgent, SubjectCode = t.Subject.Code, t.SubjectId, t.Id, t.VisitNum, IshaveQCChallenge = t.QCChallengeList.Any(), t.SecondReviewState }) + .OrderBy(t => t.IshaveQCChallenge).ThenBy(t => t.SecondReviewState).ThenBy(x => x.IsUrgent).ThenBy(x => x.SubjectCode).ThenBy(x => x.VisitNum).ToListAsync(); + + subjectVisit = visitList.Where(x => x.SubjectId == inDto.SubjectId).OrderBy(x => x.VisitNum).FirstOrDefault(); + if (subjectVisit != null) { return new GetNextIQCQualityOutDto() @@ -1349,7 +1406,7 @@ namespace IRaCIS.Core.Application.Image.QA }; } - subjectVisit = visitList.OrderBy(x => x.Subject.Code).ThenBy(x => x.VisitNum).FirstOrDefault(); + subjectVisit = visitList.OrderBy(x => x.SubjectCode).ThenBy(x => x.VisitNum).FirstOrDefault(); if (subjectVisit != null) { return new GetNextIQCQualityOutDto() @@ -2310,7 +2367,7 @@ namespace IRaCIS.Core.Application.Image.QA sv.AuditState = AuditStateEnum.ToAudit; - sv.CurrentActionUserExpireTime =null; + sv.CurrentActionUserExpireTime = null; sv.CurrentActionUserId = null; sv.IsTake = false; @@ -2477,6 +2534,12 @@ namespace IRaCIS.Core.Application.Image.QA throw new BusinessValidationFailedException(_localizer["QCOperation_InvalidTransferStatus"]); } + if (sv.SecondReviewState == SecondReviewState.WaitAudit) + { + //复核的时候不允许申请重传 + throw new BusinessValidationFailedException(_localizer["QCOperation_SecondReviewNoReUpload"]); + } + if (qcChallenge.ReuploadEnum == QCChanllengeReuploadEnum.CRCReuploaded) { diff --git a/IRaCIS.Core.Application/Service/QC/_MapConfig.cs b/IRaCIS.Core.Application/Service/QC/_MapConfig.cs index 2754f2f4e..8c8ae3bed 100644 --- a/IRaCIS.Core.Application/Service/QC/_MapConfig.cs +++ b/IRaCIS.Core.Application/Service/QC/_MapConfig.cs @@ -303,9 +303,9 @@ namespace IRaCIS.Core.Application.Service .ForMember(o => o.LessionAnswerList, t => t.MapFrom(u => u.LesionAnswerList.Where(c => c.ReadingTableQuestionTrial.ExportResultStr.Contains(((int)readingExportType).ToString())))); CreateMap() - //.ForMember(o => o.LessionCode, t => t.MapFrom(u => u.Lesion.RowMark)) - //.ForMember(o => o.LessionType, t => t.MapFrom(u => (int?)u.ReadingQuestionTrial.LesionType)) - + //.ForMember(o => o.LessionCode, t => t.MapFrom(u => u.Lesion.RowMark)) + //.ForMember(o => o.LessionType, t => t.MapFrom(u => (int?)u.ReadingQuestionTrial.LesionType)) + .ForMember(o => o.ShowOrder, t => t.MapFrom(u => u.ReadingTableQuestionTrial.ShowOrder)) .ForMember(o => o.CustomUnit, t => t.MapFrom(u => u.ReadingTableQuestionTrial.CustomUnit)) .ForMember(o => o.Unit, t => t.MapFrom(u => u.ReadingTableQuestionTrial.Unit)) .ForMember(o => o.TableQuesionId, t => t.MapFrom(u => u.ReadingTableQuestionTrial.Id)) @@ -756,6 +756,7 @@ namespace IRaCIS.Core.Application.Service CreateMap() .ForMember(d => d.SubjectCode, u => u.MapFrom(s => s.SubjectVisit.Subject.Code)) + .ForMember(d => d.SubjectStatus, u => u.MapFrom(s => s.SubjectVisit.Subject.Status)) .ForMember(d => d.IsSubjectQuit, u => u.MapFrom(s => s.SubjectVisit.Subject.IsSubjectQuit)) .ForMember(d => d.VisitNum, u => u.MapFrom(t => t.SubjectVisit.VisitNum)) .ForMember(d => d.TrialSiteCode, u => u.MapFrom(s => s.SubjectVisit.TrialSite.TrialSiteCode)) diff --git a/IRaCIS.Core.Infrastructure/_IRaCIS/_Config/_StaticData.cs b/IRaCIS.Core.Infrastructure/_IRaCIS/_Config/_StaticData.cs index 3cb388af0..b63956c40 100644 --- a/IRaCIS.Core.Infrastructure/_IRaCIS/_Config/_StaticData.cs +++ b/IRaCIS.Core.Infrastructure/_IRaCIS/_Config/_StaticData.cs @@ -302,6 +302,8 @@ public static class StaticData public const string TrialQCResult_Export = "TrialQCResult_Export"; + public const string TrialImageBackRecordList_Export = "TrialImageBackRecordList_Export"; + }