修改一版
							parent
							
								
									c9a8b8083a
								
							
						
					
					
						commit
						e92979388c
					
				|  | @ -822,11 +822,41 @@ | |||
|             访视ID | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="P:IRaCIS.Core.Application.Service.Reading.Dto.PreviewTheReadingListInDto.ReadingPeriodSetId"> | ||||
|         <member name="P:IRaCIS.Core.Application.Service.Reading.Dto.PreviewTheReadingListDto.ReadingPeriodSetId"> | ||||
|             <summary> | ||||
|             阅片期ID | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="P:IRaCIS.Core.Application.Service.Reading.Dto.PreviewTheReadingListInDto.SiteIds"> | ||||
|             <summary> | ||||
|             中心ID | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="P:IRaCIS.Core.Application.Service.Reading.Dto.PreviewTheReadingListInDto.TrialId"> | ||||
|             <summary> | ||||
|             项目ID | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="P:IRaCIS.Core.Application.Service.Reading.Dto.PreviewTheReadingListInDto.ExpirationDate"> | ||||
|             <summary> | ||||
|             截止日期 | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="P:IRaCIS.Core.Application.Service.Reading.Dto.PreviewTheReadingListInDto.ExpirationVisitNum"> | ||||
|             <summary> | ||||
|             截止访视 | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="P:IRaCIS.Core.Application.Service.Reading.Dto.PreviewTheReadingListInDto.VisitStageId"> | ||||
|             <summary> | ||||
|             访视计划ID | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="P:IRaCIS.Core.Application.Service.Reading.Dto.PreviewTheReadingListInDto.ReadingPeriodName"> | ||||
|             <summary> | ||||
|             阅片期名称 | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="T:IRaCIS.Core.Application.Service.Reading.Dto.PreviewTheReadingListOutDto"> | ||||
|             <summary> | ||||
|             获取影像阅片预览的Dto | ||||
|  | @ -3145,7 +3175,7 @@ | |||
|             <param name="inDto"></param> | ||||
|             <returns></returns> | ||||
|         </member> | ||||
|         <member name="M:IRaCIS.Application.Services.ReadingPeriodSetService.GetPreviewTheReadingPlanList(IRaCIS.Core.Application.Service.Reading.Dto.PreviewTheReadingListInDto)"> | ||||
|         <member name="M:IRaCIS.Application.Services.ReadingPeriodSetService.GetPreviewTheReadingPlanList(IRaCIS.Core.Application.Service.Reading.Dto.PreviewTheReadingListDto)"> | ||||
|             <summary> | ||||
|             获取选中的计划 | ||||
|             </summary> | ||||
|  |  | |||
|  | @ -42,7 +42,10 @@ namespace IRaCIS.Core.Application.Service.Inspection | |||
|                         join site in _repository.GetQueryable<Site>().IgnoreQueryFilters() on data.SiteId equals site.Id into sitetemp | ||||
|                         from leftsite in sitetemp.DefaultIfEmpty() | ||||
| 
 | ||||
|                         | ||||
|                        // join trialSite in _repository.GetQueryable<TrialSite>().IgnoreQueryFilters() on new { SiteId=data.SiteId,tria }  equals new { SiteId= trialSite.SiteId }into sitetemp | ||||
|                        // from leftsite in sitetemp.DefaultIfEmpty() | ||||
| 
 | ||||
| 
 | ||||
|                         join subject in _repository.GetQueryable<Subject>().IgnoreQueryFilters() on data.SubjectId equals subject.Id into subtemp | ||||
|                         from leftsubject in subtemp.DefaultIfEmpty() | ||||
|                         join subjectVisit in _repository.GetQueryable<SubjectVisit>().IgnoreQueryFilters() on data.SubjectVisitId equals subjectVisit.Id into subjectVisittemp | ||||
|  |  | |||
|  | @ -51,6 +51,8 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto | |||
| 
 | ||||
|         public  List<Guid> SiteIds { get; set; }  = new List<Guid>(); | ||||
| 
 | ||||
|         public  List<Guid> SubjectVisitIds { get; set; } = new List<Guid>(); | ||||
| 
 | ||||
|     } | ||||
| 
 | ||||
| 
 | ||||
|  | @ -68,13 +70,50 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto | |||
|         public List<Guid> SubjectVisitIds { get; set; } | ||||
|     } | ||||
| 
 | ||||
|     public class PreviewTheReadingListInDto:PageInput | ||||
|     public class PreviewTheReadingListDto : PageInput | ||||
|     { | ||||
|         /// <summary> | ||||
|         /// 阅片期ID | ||||
|         /// </summary> | ||||
| 
 | ||||
|         public Guid ReadingPeriodSetId { get; set; } | ||||
|     } | ||||
| 
 | ||||
|     public class PreviewTheReadingListInDto : PageInput | ||||
|     { | ||||
|       | ||||
| 
 | ||||
|         /// <summary> | ||||
|         /// 中心ID | ||||
|         /// </summary> | ||||
|         public List<Guid> SiteIds { get; set; } = new List<Guid>(); | ||||
| 
 | ||||
|         /// <summary> | ||||
|         /// 项目ID | ||||
|         /// </summary> | ||||
|         public Guid TrialId { get; set; } | ||||
| 
 | ||||
|         /// <summary> | ||||
| 		/// 截止日期 | ||||
| 		/// </summary> | ||||
| 		public DateTime? ExpirationDate { get; set; } | ||||
| 
 | ||||
|         /// <summary> | ||||
|         /// 截止访视 | ||||
|         /// </summary> | ||||
|         public decimal? ExpirationVisitNum { get; set; } | ||||
| 
 | ||||
|         /// <summary> | ||||
|         /// 访视计划ID | ||||
|         /// </summary> | ||||
|         public Guid? VisitStageId { get; set; } | ||||
| 
 | ||||
|         /// <summary> | ||||
|         /// 阅片期名称 | ||||
|         /// </summary> | ||||
|         public string ReadingPeriodName { get; set; } | ||||
| 
 | ||||
| 
 | ||||
|     }  | ||||
| 
 | ||||
|     /// <summary> | ||||
|  | @ -123,7 +162,7 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto | |||
|         /// 阅片期ID | ||||
|         /// </summary> | ||||
| 
 | ||||
|         public Guid ReadingPeriodSetId { get; set; } | ||||
|         public Guid? ReadingPeriodSetId { get; set; } | ||||
| 
 | ||||
|         /// <summary> | ||||
|         /// 阅片期名称 | ||||
|  | @ -208,6 +247,7 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto | |||
|         /// 计划条数 | ||||
|         /// </summary> | ||||
|         public int PlanCount { get; set; } | ||||
| 
 | ||||
|     } | ||||
| 
 | ||||
|     public class SetReadingPeriodSetEffect | ||||
|  |  | |||
|  | @ -58,19 +58,33 @@ namespace IRaCIS.Application.Services | |||
|                     TrialId =entity.TrialId, | ||||
|                     SiteId = x, | ||||
|                 }).ToList(); | ||||
| 
 | ||||
|                 entity.ReadingPeriodPlanList = addOrEditReadingPeriodSet.SubjectVisitIds.Select(x => new ReadingPeriodPlan | ||||
|                 { | ||||
|                     ReadingPeriodSetId = entity.Id, | ||||
|                     SubjectVisitId=x, | ||||
|                 }).ToList(); | ||||
|                 await _readingPeriodSetRepository.AddAsync(entity, true); | ||||
|                 return ResponseOutput.Ok(entity.Id); | ||||
|             } | ||||
|             else | ||||
|             { | ||||
|                 var entity = (await _readingPeriodSetRepository.Where(t => t.Id == addOrEditReadingPeriodSet.Id, true).Include(t => t.ReadingPeriodSites).FirstOrDefaultAsync()).IfNullThrowException(); | ||||
|                 var entity = (await _readingPeriodSetRepository.Where(t => t.Id == addOrEditReadingPeriodSet.Id, true).Include(t => t.ReadingPeriodSites).Include(x=>x.ReadingPeriodPlanList).FirstOrDefaultAsync()).IfNullThrowException(); | ||||
|                 _mapper.Map(addOrEditReadingPeriodSet, entity); | ||||
| 
 | ||||
|                 entity.ReadingPeriodSites = addOrEditReadingPeriodSet.SiteIds.Select(x => new ReadingPeriodSite() | ||||
|                 { | ||||
|                     ReadingPeriodSetId = entity.Id, | ||||
|                     TrialId = entity.TrialId, | ||||
|                     SiteId = x, | ||||
|                 }).ToList(); | ||||
| 
 | ||||
|                 entity.ReadingPeriodPlanList = addOrEditReadingPeriodSet.SubjectVisitIds.Select(x => new ReadingPeriodPlan | ||||
|                 { | ||||
|                     ReadingPeriodSetId = entity.Id, | ||||
|                     SubjectVisitId = x, | ||||
|                 }).ToList(); | ||||
| 
 | ||||
|                 var success = await _readingPeriodSetRepository.SaveChangesAsync(); | ||||
|                 return ResponseOutput.Ok(entity.Id); | ||||
| 
 | ||||
|  | @ -84,20 +98,24 @@ namespace IRaCIS.Application.Services | |||
|         [HttpPost] | ||||
|         public async Task<PageOutput<PreviewTheReadingListOutDto>> GetPreviewTheReadingList(PreviewTheReadingListInDto inDto) | ||||
|         { | ||||
|             if (await _readingPeriodPlanRepository.AnyAsync(x => x.ReadingPeriodSetId == inDto.ReadingPeriodSetId)) | ||||
|             //if (await _readingPeriodPlanRepository.AnyAsync(x => x.ReadingPeriodSetId == inDto.ReadingPeriodSetId)) | ||||
|             //{ | ||||
|             //    await _readingPeriodPlanRepository.DeleteFromQueryAsync(x => x.ReadingPeriodSetId == inDto.ReadingPeriodSetId); | ||||
|             //    await _readingPeriodPlanRepository.SaveChangesAsync(); | ||||
|             //} | ||||
| 
 | ||||
| 
 | ||||
|             //var readSet = (await _readingPeriodSetRepository.Where(x => x.Id == inDto.ReadingPeriodSetId).Include(x => x.ReadingPeriodSites).FirstOrDefaultAsync()).IfNullThrowException(); | ||||
| 
 | ||||
| 
 | ||||
|             var visitQuery = _subjectVisitRepository.Where(x => x.TrialId == inDto.TrialId && x.InPlan&&x.LatestScanDate!=null); | ||||
|             if (inDto.SiteIds.Count!=0) | ||||
|             { | ||||
|                 await _readingPeriodPlanRepository.DeleteFromQueryAsync(x => x.ReadingPeriodSetId == inDto.ReadingPeriodSetId); | ||||
|                 await _readingPeriodPlanRepository.SaveChangesAsync(); | ||||
|                | ||||
|                 visitQuery = visitQuery.Where(x => inDto.SiteIds.Contains(x.SiteId)); | ||||
|             } | ||||
|             var readSet = (await _readingPeriodSetRepository.Where(x => x.Id == inDto.ReadingPeriodSetId).Include(x => x.ReadingPeriodSites).FirstOrDefaultAsync()).IfNullThrowException(); | ||||
|             var visitQuery = _subjectVisitRepository.Where(x => x.TrialId == readSet.TrialId && x.InPlan&&x.LatestScanDate!=null); | ||||
|             if (readSet.ReadingScope == ReadingScopeEnum.Site) | ||||
|             { | ||||
|                 var siteIds = readSet.ReadingPeriodSites.Select(x => x.SiteId); | ||||
|                 visitQuery = visitQuery.Where(x => siteIds.Contains(x.SiteId)); | ||||
|             } | ||||
|             visitQuery = visitQuery.WhereIf(readSet.ExpirationDate != null, x => x.LatestScanDate <= readSet.ExpirationDate.Value) | ||||
|                 .WhereIf(readSet.ExpirationVisitNum != null, x => x.VisitNum == readSet.ExpirationVisitNum); | ||||
|             visitQuery = visitQuery.WhereIf(inDto.ExpirationDate != null, x => x.LatestScanDate <= inDto.ExpirationDate.Value) | ||||
|                 .WhereIf(inDto.ExpirationVisitNum != null, x => x.VisitNum == inDto.ExpirationVisitNum); | ||||
|             var subjectIdlist = await visitQuery.OrderBy(x => x.SubjectId).Select(x => x.SubjectId).Distinct().Skip((inDto.PageIndex - 1) * inDto.PageSize).Take(inDto.PageSize).ToListAsync(); | ||||
|             var totalCount = visitQuery.Select(x => x.SubjectId).Distinct().Count(); | ||||
|             var  visitlist=   await visitQuery.Include(x=>x.Subject).Include(x=>x.TrialSite).Where(x => subjectIdlist.Contains(x.SubjectId)).ToListAsync(); | ||||
|  | @ -134,12 +152,12 @@ namespace IRaCIS.Application.Services | |||
|                 //Where(x => _readModuleRepository.Where(y => y.ReadingSetType == readSet.ReadingSetType && x.Id == y.SubjectVisitId).Count() == 0) | ||||
|                 .Select(x => new PreviewTheReadingListOutDto | ||||
|                 { | ||||
|                     ExpirationDate = readSet.ExpirationDate, | ||||
|                     ExpirationDate = inDto.ExpirationDate, | ||||
|                     SubjectVisitId = x.Id, | ||||
|                     TrialSiteCode = x.TrialSite.TrialSiteCode, | ||||
|                     LatestScanDate = x.LatestScanDate, | ||||
|                     ReadingPeriodName = readSet.ReadingPeriodName, | ||||
|                     ReadingPeriodSetId = readSet.Id, | ||||
|                     ReadingPeriodName = inDto.ReadingPeriodName, | ||||
|                     //ReadingPeriodSetId = readSet.Id, | ||||
|                     SubjectCode = x.Subject.Code, | ||||
|                     SubjectId = x.SubjectId, | ||||
|                     SubjectVisitName = x.VisitName, | ||||
|  | @ -182,7 +200,7 @@ namespace IRaCIS.Application.Services | |||
|         /// <param name="inDto"></param> | ||||
|         /// <returns></returns> | ||||
|         [HttpPost] | ||||
|         public async Task<PageOutput<PreviewTheReadingListOutDto>> GetPreviewTheReadingPlanList(PreviewTheReadingListInDto inDto) | ||||
|         public async Task<PageOutput<PreviewTheReadingListOutDto>> GetPreviewTheReadingPlanList(PreviewTheReadingListDto inDto) | ||||
|         { | ||||
|             var plans = _readingPeriodPlanRepository.Where(x => x.ReadingPeriodSetId == inDto.ReadingPeriodSetId).Include(x => x.SubjectVisit).Include(x => x.SubjectVisit.TrialSite).Include(x => x.SubjectVisit.Subject) | ||||
|                  .Include(x => x.ReadingPeriodSet).Select(x => new PreviewTheReadingListOutDto | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue