diff --git a/IRaCIS.Core.API/IRaCIS.Core.API.xml b/IRaCIS.Core.API/IRaCIS.Core.API.xml index c22fa9ddf..88e1c7688 100644 --- a/IRaCIS.Core.API/IRaCIS.Core.API.xml +++ b/IRaCIS.Core.API/IRaCIS.Core.API.xml @@ -276,10 +276,18 @@ 下载项目临床数据文件 - + + + + 下载系统临床数据文件 + + + + + 上传项目签名文档 diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml index fd4050c87..ce09ce537 100644 --- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml +++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml @@ -2095,13 +2095,23 @@ + + + + + + + + + + - - + + diff --git a/IRaCIS.Core.Application/Service/Reading/ClinicalDataSetService.cs b/IRaCIS.Core.Application/Service/Reading/ClinicalDataSetService.cs index dc08982a8..f5bd8e64e 100644 --- a/IRaCIS.Core.Application/Service/Reading/ClinicalDataSetService.cs +++ b/IRaCIS.Core.Application/Service/Reading/ClinicalDataSetService.cs @@ -109,10 +109,13 @@ namespace IRaCIS.Application.Services private async Task AddTrialClinicalDataTrialSet(Guid trialId) { - var systemIds = await _clinicalDataSystemSetRepository.Select(x => x.Id).ToListAsync(); + var systemClinicalDataList = await _clinicalDataSystemSetRepository.AsQueryable().ToListAsync(); + var systemIds = systemClinicalDataList.Select(x => x.Id).ToList(); var trialSystemIds =await _clinicalDataTrialSetRepository.Where(x => x.TrialId == trialId && x.SystemClinicalDataSetId != null).Select(x => x.SystemClinicalDataSetId.Value).ToListAsync(); + //var needUpdateIds = systemIds.Intersect(trialSystemIds).ToList(); + var needAddids = systemIds.Except(trialSystemIds).ToList(); - var systemDataList =await _clinicalDataSystemSetRepository.Where(x => needAddids.Contains(x.Id)).ToListAsync(); + var systemDataList = systemClinicalDataList.Where(x => needAddids.Contains(x.Id)).ToList(); List dataSets = systemDataList.Select(x => new ClinicalDataTrialSet() { Id= NewId.NextGuid(), @@ -126,7 +129,25 @@ namespace IRaCIS.Application.Services TrialId= trialId, }).ToList(); + await _clinicalDataTrialSetRepository.AddRangeAsync(dataSets); + + //var needUpdateitemList = await _clinicalDataTrialSetRepository.Where(x => x.TrialId == trialId && needUpdateIds.Contains(x.SystemClinicalDataSetId.Value)).ToListAsync(); + //foreach (var item in needUpdateitemList) + //{ + // var systemData = systemClinicalDataList.FirstOrDefault(x => x.Id == item.SystemClinicalDataSetId); + // await _clinicalDataTrialSetRepository.UpdatePartialNoQueryAsync(item.Id,x=>new ClinicalDataTrialSet() { + + // ClinicalDataSetName = systemData.ClinicalDataSetName, + // ClinicalDataLevel = systemData.ClinicalDataLevel, + // ClinicalUploadType = systemData.ClinicalUploadType, + // UploadRole = systemData.UploadRole, + // FileName = systemData.FileName, + // Path = systemData.Path, + // }); + //} + + var result= await _clinicalDataTrialSetRepository.SaveChangesAsync(); return ResponseOutput.Ok(result); } diff --git a/IRaCIS.Core.Application/Service/Reading/ReadModuleService.cs b/IRaCIS.Core.Application/Service/Reading/ReadModuleService.cs index ecc203f49..1b5bd4abe 100644 --- a/IRaCIS.Core.Application/Service/Reading/ReadModuleService.cs +++ b/IRaCIS.Core.Application/Service/Reading/ReadModuleService.cs @@ -11,6 +11,7 @@ using MassTransit; using Panda.DynamicWebApi.Attributes; using IRaCIS.Core.Application.Contracts; using IRaCIS.Core.Infra.EFCore.Common; +using System.Linq.Dynamic.Core; namespace IRaCIS.Application.Services { @@ -152,8 +153,9 @@ namespace IRaCIS.Application.Services { #region MyRegion - - var subjectQuery = _readModuleViewRepository.WhereIf(dto.TrialId != null, x => x.TrialId == dto.TrialId) + dto.SortField = dto.SortField.IsNullOrEmpty() ? "TrialSiteCode" : dto.SortField; + dto.SortField = dto.Asc ? dto.SortField : dto.SortField + " desc"; + var subjectQuery = _readModuleViewRepository.WhereIf(dto.TrialId != null, x => x.TrialId == dto.TrialId) .WhereIf(dto.SubjectId != null, x => x.SubjectId == 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) @@ -161,8 +163,12 @@ namespace IRaCIS.Application.Services .WhereIf(dto.ReadingStatus != null, x => x.ReadingStatus == dto.ReadingStatus) .WhereIf(dto.Name != null, x => x.Name.Contains(dto.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(); + var subjectIds = await subjectQuery.OrderBy(dto.SortField).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)).OrderBy(dto.SortField).ToListAsync(); List getReadList = ReadModuleViewList.GroupBy(x => new { x.SubjectId, x.SiteId, x.TrialSiteCode, x.SubjectCode }) .Select(x => new GetReadModuleDtoOut() { @@ -195,116 +201,6 @@ namespace IRaCIS.Application.Services }) ; #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) - - // .Select(x => new GetReadModuleDtoOut - // { - // 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(), - - - - - - // }); - - - - //if (dto.ModuleType != null) - //{ - // subjectQuery. - //} - //if (dto.Status != null) - //{ - // x.Data = x.Data.Where(y => y.Status == dto.Status).ToList(); - //} - - //if (dto.Name != null) - //{ - // x.Data = x.Data.Where(y => y.Name.Contains(y.Name)).ToList(); - //} - - - - - //var pageList = await subjectQuery.ToPagedListAsync(dto.PageIndex, dto.PageSize, dto.SortField == null || dto.SortField == string.Empty ? "SiteCode" : dto.SortField, - // dto.Asc); - - - - - //pageList.CurrentPageData.ForEach(x => - //{ - // var outplan = x.Data.FirstOrDefault(x => x.IsFinalVisit); - // if (outplan != null) - // { - // x.Data = x.Data.Where(y => y.VisitNum >= outplan.VisitNum).ToList(); - // } - //}); - - //var subjectIds = pageList.CurrentPageData.Select(x => x.SubjectId).ToList(); - - //var readModules = await _readModuleRepository.Where(x => subjectIds.Contains(x.SubjectId)).Include(x => x.SubjectVisit) - // .Include(x => x.ReadModuleModel).ToListAsync(); - - - //return (pageList, new - //{ - // MaxLength = pageList.CurrentPageData.ToList().Max(x => x.Data.Count) - //}); - #endregion - } diff --git a/IRaCIS.Core.Application/Service/Reading/ReadingClinicalDataService.cs b/IRaCIS.Core.Application/Service/Reading/ReadingClinicalDataService.cs index 99cc734cd..1431c2ae4 100644 --- a/IRaCIS.Core.Application/Service/Reading/ReadingClinicalDataService.cs +++ b/IRaCIS.Core.Application/Service/Reading/ReadingClinicalDataService.cs @@ -244,7 +244,7 @@ namespace IRaCIS.Application.Services var usedIdsQuery = _readingClinicalDataRepository.Where(x => x.ReadingId == inDto.ReadingId && x.Id != inDto.ReadingClinicalDataId).Select(x => x.ClinicalDataTrialSetId); List clinicalList = await _clinicalDataTrialSetRepository.Where(x=>x.TrialId==inDto.TrialId&&x.IsConfirm) .WhereIf(inDto.UploadRole!=null,x=>x.UploadRole==inDto.UploadRole) - .Where(x=> !usedIdsQuery.Contains(x.Id)) + .Where(x=> !usedIdsQuery.Contains(x.Id)) .WhereIf(inDto.IsVisit&&inDto.IsBaseLine,x=>x.ClinicalDataLevel == ClinicalLevel.Subject||x.ClinicalDataLevel== ClinicalLevel.SubjectVisit) .WhereIf(inDto.IsVisit&&! inDto.IsBaseLine, x => x.ClinicalDataLevel == ClinicalLevel.SubjectVisit) .WhereIf(!inDto.IsVisit, x => x.ClinicalDataLevel == ClinicalLevel.Read) diff --git a/IRaCIS.Core.Application/Service/Reading/ReadingQuestionService.cs b/IRaCIS.Core.Application/Service/Reading/ReadingQuestionService.cs index 3d9618fe7..ffe85b2bb 100644 --- a/IRaCIS.Core.Application/Service/Reading/ReadingQuestionService.cs +++ b/IRaCIS.Core.Application/Service/Reading/ReadingQuestionService.cs @@ -161,6 +161,12 @@ namespace IRaCIS.Application.Services if (inDto.IsCompleteConfig) { await UpdateTrialCriterion(inDto.Id); + }else + { + await _readingQuestionCriterionTrialRepository.BatchUpdateNoTrackingAsync(x=>x.ReadingQuestionCriterionSystemId== inDto.Id, x => new ReadingQuestionCriterionTrial() + { + IsCompleteConfig = inDto.IsCompleteConfig + }); } var result = await _readingQuestionCriterionSystemRepository.SaveChangesAsync(); @@ -373,11 +379,12 @@ namespace IRaCIS.Application.Services ParentTriggerValue = quesiton.ParentTriggerValue, QuestionName = quesiton.QuestionName, ReadingQuestionCriterionTrialId = ReadingQuestionCriterionTrialId, + ReadingQuestionSystemId= quesiton.Id, + SystemParentId=quesiton.ParentId, TrialId = trialId, AnswerGroup = string.Empty, Type = quesiton.Type, GroupName=quesiton.GroupName, - ReadingQuestionSystemId=x.Id, IsJudgeQuestion =quesiton.IsJudgeQuestion, Remark=quesiton.Remark, TypeValue = quesiton.TypeValue, @@ -411,6 +418,7 @@ namespace IRaCIS.Application.Services IsEnable = quesiton.IsEnable, IsRequired = quesiton.IsRequired, ParentId = newParentId, + SystemParentId = quesiton.ParentId, ReadingQuestionSystemId = x.Id, AnswerGroup = string.Empty, ParentTriggerValue = quesiton.ParentTriggerValue, diff --git a/IRaCIS.Core.Domain/Reading/ReadingQuestionTrial.cs b/IRaCIS.Core.Domain/Reading/ReadingQuestionTrial.cs index 26b4ddc41..d065d9b75 100644 --- a/IRaCIS.Core.Domain/Reading/ReadingQuestionTrial.cs +++ b/IRaCIS.Core.Domain/Reading/ReadingQuestionTrial.cs @@ -87,6 +87,11 @@ namespace IRaCIS.Core.Domain.Models /// public Guid? ReadingQuestionSystemId { get; set; } + /// + /// 系统标准的ParentId + /// + public Guid? SystemParentId { get; set; } + /// /// 答案分组 ///