diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml index 626acf394..46e926e87 100644 --- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml +++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml @@ -722,6 +722,11 @@ 数据 + + + Id(阅片期Id 或者 访视ID) + + 项目Id @@ -3163,6 +3168,13 @@ 生成的阅片模块(在大列表上展示的) 阅片期 + + + 获取读片计划列表 byZhouhang + + + + 获取读片模块 diff --git a/IRaCIS.Core.Application/Service/QC/DTO/TrialQCQuestionConfigureViewModel.cs b/IRaCIS.Core.Application/Service/QC/DTO/TrialQCQuestionConfigureViewModel.cs index 83fee8e93..f5e0e3e58 100644 --- a/IRaCIS.Core.Application/Service/QC/DTO/TrialQCQuestionConfigureViewModel.cs +++ b/IRaCIS.Core.Application/Service/QC/DTO/TrialQCQuestionConfigureViewModel.cs @@ -65,6 +65,10 @@ namespace IRaCIS.Core.Application.Contracts /// TypeValue public string Type { get; set; }=String.Empty; + public bool? IsEnable { get; set; } + + public bool? IsRequired { get; set; } + } diff --git a/IRaCIS.Core.Application/Service/QC/TrialQCQuestionService.cs b/IRaCIS.Core.Application/Service/QC/TrialQCQuestionService.cs index 280fb9a8e..04d1c8aef 100644 --- a/IRaCIS.Core.Application/Service/QC/TrialQCQuestionService.cs +++ b/IRaCIS.Core.Application/Service/QC/TrialQCQuestionService.cs @@ -34,6 +34,10 @@ namespace IRaCIS.Core.Application.Contracts var trialQCQuestionQueryable = _trialQcQuestionRepository.Where(t => t.TrialId == queryTrialQCQuestionConfigure.TrialId) .WhereIf(!string.IsNullOrWhiteSpace(queryTrialQCQuestionConfigure.QuestionName), t => t.QuestionName.Contains(queryTrialQCQuestionConfigure.QuestionName)) .WhereIf(!string.IsNullOrWhiteSpace(queryTrialQCQuestionConfigure.Type), t => t.Type.Contains(queryTrialQCQuestionConfigure.Type)) + .WhereIf(queryTrialQCQuestionConfigure.IsEnable!=null, t => t.IsEnable== queryTrialQCQuestionConfigure.IsEnable) + .WhereIf(queryTrialQCQuestionConfigure.IsRequired != null, t => t.IsRequired == queryTrialQCQuestionConfigure.IsRequired) + + .ProjectTo(_mapper.ConfigurationProvider); var list = await trialQCQuestionQueryable.OrderBy(t => t.ShowOrder).ToListAsync(); diff --git a/IRaCIS.Core.Application/Service/Reading/Dto/GetReadModuleDto.cs b/IRaCIS.Core.Application/Service/Reading/Dto/GetReadModuleDto.cs index 9756242bc..cd715e7ea 100644 --- a/IRaCIS.Core.Application/Service/Reading/Dto/GetReadModuleDto.cs +++ b/IRaCIS.Core.Application/Service/Reading/Dto/GetReadModuleDto.cs @@ -8,7 +8,7 @@ using System.Threading.Tasks; namespace IRaCIS.Core.Application.Service.Reading.Dto { - public class GetReadModuleDto:PageInput + public class GetReadModuleDto : PageInput { public Guid? TrialId { get; set; } @@ -43,11 +43,11 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto public class GetSubjectReadVisitsOutDto { - public Guid SubjectVisitId { get; set; } + public Guid SubjectVisitId { get; set; } - public decimal VisitNum { get; set; } + public decimal VisitNum { get; set; } - public string VisitName { get; set; } + public string VisitName { get; set; } } @@ -100,7 +100,7 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto } - public class ReadModuleAddOrEdit: ReadModule + public class ReadModuleAddOrEdit : ReadModule { public new Guid? Id { get; set; } @@ -128,11 +128,11 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto public class GetReadModuleSingleIndto { - public Guid Id { get; set; } + public Guid Id { get; set; } public Guid SubjectId { get; set; } - + } @@ -172,7 +172,7 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto public ReadModuleEnum? Status { get; set; } } - public class GetReadModuleOutDto + public class GetReadModuleOutDto { /// @@ -300,7 +300,7 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto } - + public class GetReadModuleResultDto { /// @@ -328,8 +328,8 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto /// public List CurrentPageData { get; set; } } - - + + //public class GetReadModuleDtoOut public class GetReadModuleDtoOut @@ -347,4 +347,72 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto public List Data { get; set; } } + + + + public class ReadPlanView + { + public string SubjectCode { get; set; } + + public string TrialSiteCode { get; set; } + + public string SiteCode { get; set; } + + public Guid SiteId { get; set; } + + public Guid SubjectId { get; set; } + + + public List SubjectVisitPlanList { get; set; } + + public List ReadMoudlePlanList { get; set; } + } + + public class ReadMoudleView + { + + } + + public class SubjectVisitPlanView + { + /// + /// Id(阅片期Id 或者 访视ID) + /// + public Guid Id { get; set; } + + public string Name { get; set; } + + public Guid SubjectId { get; set; } + + public ModuleTypeEnum ModuleType { get; set; } + + public ReadModuleEnum? Status { get; set; } + + public bool? IsUrgent { get; set; } + + public Guid SubjectVisitId { get; set; } + + public string SubjectVisitName { get; set; } + + + public DateTime CreateTime { get; set; } + + + public bool IsFinalVisit { get; set; } = false; + + public Guid? OutPlanPreviousVisitId { get; set; } + + public string OutPlanPreviousVisitName { get; set; } + + public Guid? SiteId { get; set; } + + public bool IsVisit { get; set; } = true; + + public decimal? VisitNum { get; set; } + + + public PDStateEnum PDState { get; set; } + + public bool IsEnrollmentConfirm { get; set; } = false; + } } diff --git a/IRaCIS.Core.Application/Service/Reading/ReadModuleService.cs b/IRaCIS.Core.Application/Service/Reading/ReadModuleService.cs index b444b83dd..1d0f4f9e5 100644 --- a/IRaCIS.Core.Application/Service/Reading/ReadModuleService.cs +++ b/IRaCIS.Core.Application/Service/Reading/ReadModuleService.cs @@ -56,6 +56,86 @@ namespace IRaCIS.Application.Services } + /// + /// 获取读片计划列表 byZhouhang + /// + /// + /// + public async Task<(PageOutput, object)> GetReadPlanList(GetReadModuleDto dto) + { + var subjectQuery = _subjectRepository + .WhereIf(dto.TrialId != null, x => x.TrialId == dto.TrialId) + .WhereIf(dto.SubjectId != null, x => x.Id == dto.SubjectId) + .WhereIf(dto.TrialSiteCode != null, x => x.TrialSite.TrialSiteCode == dto.TrialSiteCode) + .WhereIf(dto.SubjectCode != null, x => x.Code == dto.SubjectCode) + .Select(x => new ReadPlanView + { + TrialSiteCode = x.TrialSite.TrialSiteCode, + SiteCode = x.TrialSite.TrialSiteCode, + SiteId = x.SiteId, + SubjectCode = x.Code, + SubjectId = x.Id, + + //Data = x.SubjectVisitList.OrderByDescending(y => y.VisitNum).Select(y => new GetReadModuleOutDto() + //{ + // Id = y.Id, //id + // Name = y.VisitName, + // ModuleType = y.InPlan ? ModuleTypeEnum.InPlanSubjectVisit : ModuleTypeEnum.OutPlanSubjectVisit, // 模块类型 + // IsUrgent = x.IsUrgent, // 是否加急 + // SubjectVisitId = y.Id, // 访视ID + // SubjectVisitName = y.VisitName, // 访视名称 + // Status = ReadingCommon.GetVisitSubmitStateEnum(y), // 状态 + // CreateTime = y.CreateTime, // 创建时间 + // SubjectCode = y.Subject.Code, // 受试者code + // TrialSiteCode = x.TrialSite.TrialSiteCode, // 中心Code + // VisitNum = y.VisitNum, + + // IsFinalVisit = y.IsFinalVisit, // 是否为末次评估 + // OutPlanPreviousVisitId = y.OutPlanPreviousVisitId, // 上一访视 + // OutPlanPreviousVisitName = y.OutPlanPreviousVisit.VisitName, // 上一访视名称 + // SiteId = x.Site.Id, // 中心ID + // IsVisit = true, // 是否为访视 + // PDState = y.PDState, // PD 进展 + // IsEnrollmentConfirm = y.IsEnrollmentConfirm, // 入组 + // SubjectId = x.Id, + //}).ToList(), + + //ReadModuleData = x.ReadModuleList.Select( + // z => new GetReadModuleOutDto() + // { + // CreateTime = z.CreateTime, + // Id = z.Id, + // Name = z.ModuleName, + // SubjectId = x.Id, + // ModuleType = z.ModuleType, + // Status = ReadingCommon.GetVisitSubmitStateEnum(z.SubjectVisit), + // SubjectCode = x.Code, + // TrialSiteCode = x.TrialSite.TrialSiteCode, + // SubjectVisitId = z.SubjectVisitId, + // SubjectVisitName = z.SubjectVisit.VisitName, // 截止访视名称 + // CutOffVisitId = z.SubjectVisitId, // 截止访视 + // CutOffVisitName = z.SubjectVisit.VisitName, // 截止访视名称 + // ReadModuleId = z.ReadModuleId, + // ReadModuleName = z.ReadModuleModel.ModuleName, + // IsUrgent = z.IsUrgent + // }).ToList(), + + }); + + var pageList = await subjectQuery.ToPagedListAsync(dto.PageIndex, dto.PageSize, dto.SortField == null || dto.SortField == string.Empty ? "SiteCode" : dto.SortField, + dto.Asc); + + return (pageList, new + { + MaxLength = pageList.CurrentPageData.ToList().Count() + }); + } + + + + + + /// /// 获取读片模块 /// @@ -63,16 +143,18 @@ namespace IRaCIS.Application.Services public async Task<(PageOutput,object)> GetReadModuleList(GetReadModuleDto dto) { - var subjectQuery = _readModuleViewRepository.WhereIf(dto.TrialId != null, x => x.TrialId == dto.TrialId) - .WhereIf(dto.SubjectId != null, x => x.Id == dto.SubjectId) - .WhereIf(dto.TrialSiteCode != null && dto.TrialSiteCode!=String.Empty, x => x.TrialSiteCode == dto.TrialSiteCode) - .WhereIf(dto.SubjectCode != null && dto.SubjectCode != String.Empty, x => x.SubjectCode == dto.SubjectCode) - .WhereIf(dto.ModuleType != null, x => x.ModuleType == dto.ModuleType) - .WhereIf(dto.Status != null, x => x.Status == dto.Status) - .WhereIf(dto.Name != null, x => x.Name.Contains(x.Name)).OrderBy(x=>x.SiteCode); + #region MyRegion - var subjectIds =await subjectQuery.Select(x => x.SubjectId).Distinct().Skip((dto.PageIndex - 1) * dto.PageSize).Take(dto.PageSize).ToListAsync(); - List ReadModuleViewList =await subjectQuery.Where(x => subjectIds.Contains(x.SubjectId)).ToListAsync(); + var subjectQuery = _readModuleViewRepository.WhereIf(dto.TrialId != null, x => x.TrialId == dto.TrialId) + .WhereIf(dto.SubjectId != null, x => x.Id == dto.SubjectId) + .WhereIf(dto.TrialSiteCode != null && dto.TrialSiteCode != String.Empty, x => x.TrialSiteCode == dto.TrialSiteCode) + .WhereIf(dto.SubjectCode != null && dto.SubjectCode != String.Empty, x => x.SubjectCode == dto.SubjectCode) + .WhereIf(dto.ModuleType != null, x => x.ModuleType == dto.ModuleType) + .WhereIf(dto.Status != null, x => x.Status == dto.Status) + .WhereIf(dto.Name != null, x => x.Name.Contains(x.Name)).OrderBy(x => x.SiteCode); + + var subjectIds = await subjectQuery.Select(x => x.SubjectId).Distinct().Skip((dto.PageIndex - 1) * dto.PageSize).Take(dto.PageSize).ToListAsync(); + List ReadModuleViewList = await subjectQuery.Where(x => subjectIds.Contains(x.SubjectId)).ToListAsync(); List getReadList = ReadModuleViewList.GroupBy(x => new { x.SubjectId, x.SiteId, x.TrialSiteCode, x.SubjectCode }) .Select(x => new GetReadModuleDtoOut() { @@ -90,11 +172,12 @@ namespace IRaCIS.Application.Services PageSize = dto.PageSize, CurrentPageData = getReadList, PageIndex = dto.PageIndex, - TotalCount =await subjectQuery.Select(x => x.SubjectId).Distinct().CountAsync(), + TotalCount = await subjectQuery.Select(x => x.SubjectId).Distinct().CountAsync(), }; var maxcount = 0; - pageOutput.CurrentPageData.ForEach(x => { + pageOutput.CurrentPageData.ForEach(x => + { maxcount = maxcount < x.Data.Count ? x.Data.Count : maxcount; }); @@ -103,12 +186,13 @@ namespace IRaCIS.Application.Services MaxLength = maxcount }); + #endregion + #region 用导航属性写的 有问题 //var subjectQuery = _subjectRepository.WhereIf(dto.TrialId != null, x => x.TrialId == dto.TrialId) - // .WhereIf(dto.SubjectId != null, x => x.Id == dto.SubjectId) - // .Include(x => x.SubjectVisitList).Include(x => x.Site).Include(x => x.TrialSite) - // .WhereIf(dto.TrialSiteCode != null, x => x.TrialSite.TrialSiteCode == dto.TrialSiteCode) - // .WhereIf(dto.SubjectCode != null, x => x.Code == dto.SubjectCode) + // .WhereIf(dto.SubjectId != null, x => x.Id == dto.SubjectId).Include(x => x.SubjectVisitList).Include(x => x.Site).Include(x => x.TrialSite) + // .WhereIf(dto.TrialSiteCode != null, x => x.TrialSite.TrialSiteCode == dto.TrialSiteCode) + // .WhereIf(dto.SubjectCode != null, x => x.Code == dto.SubjectCode) // .Select(x => new GetReadModuleDtoOut // { @@ -120,25 +204,25 @@ namespace IRaCIS.Application.Services // Data = x.SubjectVisitList.OrderByDescending(y => y.VisitNum).Select(y => new GetReadModuleOutDto() // { // Id = y.Id, //id - // Name = y.VisitName, + // Name = y.VisitName, // ModuleType = y.InPlan ? ModuleTypeEnum.InPlanSubjectVisit : ModuleTypeEnum.OutPlanSubjectVisit, // 模块类型 - // IsUrgent = x.IsUrgent, // 是否加急 - // SubjectVisitId = y.Id, // 访视ID - // SubjectVisitName = y.VisitName, // 访视名称 - // Status = ReadingCommon.GetVisitSubmitStateEnum(y), // 状态 - // CreateTime = y.CreateTime, // 创建时间 - // SubjectCode = y.Subject.Code, // 受试者code - // TrialSiteCode = x.TrialSite.TrialSiteCode, // 中心Code - // VisitNum = y.VisitNum, + // IsUrgent = x.IsUrgent, // 是否加急 + // SubjectVisitId = y.Id, // 访视ID + // SubjectVisitName = y.VisitName, // 访视名称 + // Status = ReadingCommon.GetVisitSubmitStateEnum(y), // 状态 + // CreateTime = y.CreateTime, // 创建时间 + // SubjectCode = y.Subject.Code, // 受试者code + // TrialSiteCode = x.TrialSite.TrialSiteCode, // 中心Code + // VisitNum = y.VisitNum, // IsFinalVisit = y.IsFinalVisit, // 是否为末次评估 - // OutPlanPreviousVisitId = y.OutPlanPreviousVisitId, // 上一访视 - // OutPlanPreviousVisitName = y.OutPlanPreviousVisit.VisitName, // 上一访视名称 - // SiteId = x.Site.Id, // 中心ID - // IsVisit = true, // 是否为访视 - // PDState = y.PDState, // PD 进展 - // IsEnrollmentConfirm = y.IsEnrollmentConfirm, // 入组 - // SubjectId = x.Id, + // OutPlanPreviousVisitId = y.OutPlanPreviousVisitId, // 上一访视 + // OutPlanPreviousVisitName = y.OutPlanPreviousVisit.VisitName, // 上一访视名称 + // SiteId = x.Site.Id, // 中心ID + // IsVisit = true, // 是否为访视 + // PDState = y.PDState, // PD 进展 + // IsEnrollmentConfirm = y.IsEnrollmentConfirm, // 入组 + // SubjectId = x.Id, // }).ToList(), // ReadModuleData = x.ReadModuleList.Select( @@ -154,9 +238,9 @@ namespace IRaCIS.Application.Services // TrialSiteCode = x.TrialSite.TrialSiteCode, // SubjectVisitId = z.SubjectVisitId, // SubjectVisitName = z.SubjectVisit.VisitName, // 截止访视名称 - // CutOffVisitId = z.SubjectVisitId, // 截止访视 - // CutOffVisitName = z.SubjectVisit.VisitName, // 截止访视名称 - // ReadModuleId = z.ReadModuleId, + // CutOffVisitId = z.SubjectVisitId, // 截止访视 + // CutOffVisitName = z.SubjectVisit.VisitName, // 截止访视名称 + // ReadModuleId = z.ReadModuleId, // ReadModuleName = z.ReadModuleModel.ModuleName, // IsUrgent = z.IsUrgent // }).ToList(), @@ -206,37 +290,6 @@ namespace IRaCIS.Application.Services //var readModules = await _readModuleRepository.Where(x => subjectIds.Contains(x.SubjectId)).Include(x => x.SubjectVisit) // .Include(x => x.ReadModuleModel).ToListAsync(); - ////pageList.CurrentPageData.ForEach(x => { - //// x.Data.AddRange(readModules.Where(y => y.SubjectId == x.SubjectId).Select( - //// y => new GetReadModuleOutDto() - //// { - //// CreateTime = y.CreateTime, - //// Id = y.Id, - //// Name=y.ModuleName, - //// SubjectId=x.SubjectId, - //// ModuleType=y.ModuleType, - //// Status= ReadingCommon.GetVisitSubmitStateEnum(y.SubjectVisit), - //// SubjectCode= x.SubjectCode, - //// TrialSiteCode = x.TrialSiteCode, - //// SubjectVisitId= y.SubjectVisitId, - //// SubjectVisitName=y.SubjectVisit?.VisitName, // 截止访视名称 - //// CutOffVisitId = y.SubjectVisitId, // 截止访视 - //// CutOffVisitName = y.SubjectVisit?.VisitName, // 截止访视名称 - //// ReadModuleId=y.ReadModuleId, - //// ReadModuleName=y.ReadModuleModel?.ModuleName, - //// IsUrgent = y.IsUrgent - - //// })); - - //// x.Data= x.Data.OrderBy(y => y.ModuleType).ThenBy(x=>x.VisitNum).ToList(); - ////}); - - //pageList.CurrentPageData.ForEach(x => { - - //}); - - - //return (pageList, new //{