diff --git a/IRaCIS.Core.Application/Service/Reading/ReadingCriterion/ReadingCriterionService.cs b/IRaCIS.Core.Application/Service/Reading/ReadingCriterion/ReadingCriterionService.cs index 342e8d88c..efd53d8c2 100644 --- a/IRaCIS.Core.Application/Service/Reading/ReadingCriterion/ReadingCriterionService.cs +++ b/IRaCIS.Core.Application/Service/Reading/ReadingCriterion/ReadingCriterionService.cs @@ -334,6 +334,62 @@ namespace IRaCIS.Core.Application.Service.RC #endregion + + #region 全局评估类型 肿瘤学评估类型 + + + /// + /// 获取标准字典 + /// + /// + /// + [HttpPost] + public async Task> GetAssessType(GetAssessTypeInDto inDto) + { + List result = await _readingCriterionDictionaryRepository.Where(x => x.CriterionId == inDto.CriterionId + && x.ParentCode == inDto.ParentCode + ) + .Select(x => new GetAssessTypeOutDto() + { + Id = x.Id, + DictionaryId = x.DictionaryId, + ChildGroup = x.Dictionary.ChildGroup, + Code = x.Dictionary.Code, + Description = x.Dictionary.Description, + ShowOrder = x.Dictionary.ShowOrder, + ParentCode = x.Dictionary.Parent.Code, + Value = x.Dictionary.Value, + ValueCN = x.Dictionary.ValueCN + }).OrderBy(x => x.ParentCode).ThenBy(x => x.ShowOrder).ToListAsync(); + return result; + } + + + /// + /// 设置标准字典(系统用) + /// + /// + /// + [HttpPost] + public async Task SetAssessType(SetAssessTypeInDto inDto) + { + await _readingCriterionDictionaryRepository.BatchDeleteNoTrackingAsync(x => x.CriterionId == inDto.CriterionId && x.ParentCode == inDto.ParentCode); + + await _readingCriterionDictionaryRepository.AddRangeAsync(inDto.DictionaryIds.Select(x => new ReadingCriterionDictionary() + { + CriterionId = inDto.CriterionId, + DictionaryId = x, + IsSystemCriterion = true, + ParentCode = inDto.ParentCode + })); + + await _readingCriterionDictionaryRepository.SaveChangesAsync(); + + return ResponseOutput.Ok(true); + } + + #endregion + /// /// 添加系统数据到项目里面 /// diff --git a/IRaCIS.Core.Application/Service/Reading/ReadingQuestionService.cs b/IRaCIS.Core.Application/Service/Reading/ReadingCriterion/ReadingQuestionService.cs similarity index 75% rename from IRaCIS.Core.Application/Service/Reading/ReadingQuestionService.cs rename to IRaCIS.Core.Application/Service/Reading/ReadingCriterion/ReadingQuestionService.cs index 0bfa45b43..235e5c605 100644 --- a/IRaCIS.Core.Application/Service/Reading/ReadingQuestionService.cs +++ b/IRaCIS.Core.Application/Service/Reading/ReadingCriterion/ReadingQuestionService.cs @@ -73,60 +73,6 @@ namespace IRaCIS.Application.Services this._previousPDFRepository = previousPDFRepository; } - #region 全局评估类型 肿瘤学评估类型 - - - /// - /// 获取标准字典 - /// - /// - /// - [HttpPost] - public async Task> GetAssessType(GetAssessTypeInDto inDto) - { - List result = await _readingCriterionDictionaryRepository.Where(x => x.CriterionId == inDto.CriterionId - &&x.ParentCode==inDto.ParentCode - ) - .Select(x => new GetAssessTypeOutDto() - { - Id = x.Id, - DictionaryId = x.DictionaryId, - ChildGroup = x.Dictionary.ChildGroup, - Code = x.Dictionary.Code, - Description = x.Dictionary.Description, - ShowOrder = x.Dictionary.ShowOrder, - ParentCode = x.Dictionary.Parent.Code, - Value = x.Dictionary.Value, - ValueCN = x.Dictionary.ValueCN - }).OrderBy(x => x.ParentCode).ThenBy(x => x.ShowOrder).ToListAsync(); - return result; - } - - - /// - /// 设置标准字典(系统用) - /// - /// - /// - [HttpPost] - public async Task SetAssessType(SetAssessTypeInDto inDto) - { - await _readingCriterionDictionaryRepository.BatchDeleteNoTrackingAsync(x => x.CriterionId == inDto.CriterionId && x.ParentCode == inDto.ParentCode); - - await _readingCriterionDictionaryRepository.AddRangeAsync(inDto.DictionaryIds.Select(x => new ReadingCriterionDictionary() - { - CriterionId = inDto.CriterionId, - DictionaryId = x, - IsSystemCriterion = true, - ParentCode = inDto.ParentCode - })); - - await _readingCriterionDictionaryRepository.SaveChangesAsync(); - - return ResponseOutput.Ok(true); - } - - #endregion @@ -1189,374 +1135,5 @@ namespace IRaCIS.Application.Services #endregion - #region 移动到其他服务 废弃 - - //#region 项目阅片标准问题分页 - - ///// - ///// 新增修改项目标准分页 - ///// - ///// - ///// - //[HttpPost] - //public async Task AddOrUpdateReadingCriterionPage(ReadingCriterionPageAddOrEdit addOrEditReadingCriterionPage) - //{ - - // var entity = await _readingCriterionPageRepository.InsertOrUpdateAsync(addOrEditReadingCriterionPage, true); - // return ResponseOutput.Ok(entity.Id.ToString()); - - //} - - ///// - ///// 删除标准分页 - ///// - ///// - ///// - //[HttpDelete("{Id:guid}")] - //public async Task DeleteReadingCriterionPage(Guid Id) - //{ - // var success = await _readingCriterionPageRepository.DeleteFromQueryAsync(t => t.Id == Id, true); - // return ResponseOutput.Ok(); - //} - - - //#endregion - - //#region 疗效对照表 - - ///// - ///// 获取疗效对照 - ///// - ///// - //[HttpPost] - //public async Task> GetTumorAssessmentList(GetTumorAssessmentListInDto inDto) - //{ - // var result = await _tumorAssessmentRepository - // .Where(x => x.CriterionId == inDto.CriterionId) - // .WhereIf(inDto.OverallEfficacy != null, x => x.OverallEfficacy == inDto.OverallEfficacy) - // .WhereIf(inDto.TargetLesion != null, x => x.TargetLesion == inDto.TargetLesion) - // .WhereIf(inDto.NonTargetLesions != null, x => x.NonTargetLesions == inDto.NonTargetLesions) - // .WhereIf(inDto.NewLesion != null, x => x.NewLesion == inDto.NewLesion) - // .ProjectTo(_mapper.ConfigurationProvider).ToListAsync(); - // return result; - //} - - ///// - ///// 获取疗效对照 - ///// - ///// - //[HttpPost] - //public async Task> GetTumorAssessmentPageList(GetTumorAssessmentListInDto inQuery) - //{ - // var query = _tumorAssessmentRepository - // .Where(x => x.CriterionId == inQuery.CriterionId) - // .WhereIf(inQuery.OverallEfficacy != null, x => x.OverallEfficacy == inQuery.OverallEfficacy) - // .WhereIf(inQuery.TargetLesion != null, x => x.TargetLesion == inQuery.TargetLesion) - // .WhereIf(inQuery.NonTargetLesions != null, x => x.NonTargetLesions == inQuery.NonTargetLesions) - // .WhereIf(inQuery.NewLesion != null, x => x.NewLesion == inQuery.NewLesion) - // .ProjectTo(_mapper.ConfigurationProvider); - - // return await query.ToPagedListAsync(inQuery.PageIndex, inQuery.PageSize, string.IsNullOrWhiteSpace(inQuery.SortField) ? nameof(TumorAssessmentView.Id) : inQuery.SortField, inQuery.Asc); - //} - - - ///// - ///// 新增修改疗效对照 - ///// - ///// - ///// - //[HttpPost] - //public async Task AddOrUpdateTumorAssessment(AddOrUpdateTumorAssessmentInDto indto) - //{ - - // var entity = await _tumorAssessmentRepository.InsertOrUpdateAsync(indto, true); - - // return ResponseOutput.Ok(entity.Id.ToString()); - - //} - - ///// - ///// 删除疗效对照 - ///// - ///// - ///// - //[HttpDelete("{Id:guid}")] - //public async Task DeleteTumorAssessment(Guid Id) - //{ - // await _tumorAssessmentRepository.DeleteFromQueryAsync(t => t.Id == Id); - // var success = await _tumorAssessmentRepository.SaveChangesAsync(); - // return ResponseOutput.Result(success); - //} - - //#endregion - - - - //#region 系统标准 - ///// - ///// 获取获取系统阅片标准下拉 - ///// - ///// - //[HttpPost] - //public async Task> GetSystemCriterionList() - //{ - // List result = await _readingQuestionCriterionSystemRepository.Select(x => new GetSystemCriterionListOutDto() - // { - - // CriterionId = x.Id, - // CriterionName = x.CriterionName, - - // }).ToListAsync(); - - // return result; - //} - - ///// - ///// 获取系统问题标准 - ///// - ///// - //[HttpPost] - //public async Task> GetReadingQuestionCriterionSystemList(ReadingQuestionCriterionSystemViewInDto inDto) - //{ - // //await AddSystemQuestionCriterion(); - // var query = _readingQuestionCriterionSystemRepository.AsQueryable() - // .WhereIf(!inDto.CriterionName.IsNullOrEmpty(), x => x.CriterionName.Contains(inDto.CriterionName)) - // .ProjectTo(_mapper.ConfigurationProvider); - - // return await query.ToPagedListAsync(inDto.PageIndex, inDto.PageSize, inDto.SortField.IsNullOrEmpty() ? nameof(ReadingQuestionCriterionSystemView.ShowOrder) : inDto.SortField, - // inDto.Asc); - //} - - ///// - ///// 获取系统问题标准下拉 - ///// - ///// - //[HttpPost] - //public async Task> GetSystemCriterionSelectList() - //{ - // var criterionList = await _readingQuestionCriterionSystemRepository.AsQueryable() - // .OrderBy(x => x.ShowOrder) - // .Select(x => new GetSystemCriterionSelectDto() - // { - // Id = x.Id, - // CriterionName = x.CriterionName, - - // }).ToListAsync(); - // return criterionList; - //} - - ///// - ///// 新增修改系统问题标准 - ///// - ///// - ///// - //[HttpPost] - //public async Task AddOrUpdateReadingQuestionCriterionSystem(AddOrUpdateReadingQuestionCriterionSystemInDto indto) - //{ - // var entity = await _readingQuestionCriterionSystemRepository.InsertOrUpdateAsync(indto, true); - - // if (indto.Id != null) - // { - // await _readingQuestionCriterionTrialRepository.BatchUpdateNoTrackingAsync(x => x.ReadingQuestionCriterionSystemId == indto.Id, x => new ReadingQuestionCriterionTrial() - // { - // CriterionName = indto.CriterionName, - // CriterionType = indto.CriterionType, - - // }); - // } - // return ResponseOutput.Ok(entity.Id.ToString()); - //} - - ///// - ///// 删除系统问题标准 - ///// - ///// - ///// - //[HttpDelete("{id:guid}")] - //public async Task DeleteReadingQuestionCriterionSystem(Guid id) - //{ - - - // if (await _readingQuestionCriterionTrialRepository.AnyAsync(x => x.IsConfirm && x.ReadingQuestionCriterionSystemId == id)) - // { - // throw new BusinessValidationFailedException("当前标准被引用过了,不可以删除"); - // } - - // await _readingQuestionCriterionSystemRepository.DeleteFromQueryAsync(t => t.Id == id); - // var success = await _readingQuestionCriterionSystemRepository.SaveChangesAsync(); - // return ResponseOutput.Result(success); - //} - - - - ///// - ///// 设置系统问题标准是否完成配置 - ///// - ///// - ///// - //public async Task SetSystemReadingQuestionCriterionIsCompleteConfig(SetSystemReadingQuestionCriterionIsIsCompleteConfig inDto) - //{ - - // if (!inDto.IsCompleteConfig) - // { - // var trialCriterionIds = await _readingQuestionCriterionTrialRepository.Where(x => x.ReadingQuestionCriterionSystemId == inDto.Id).Select(x => x.Id).ToListAsync(); - // if (await _readingTaskQuestionAnswer.AnyAsync(x => trialCriterionIds.Contains(x.ReadingQuestionCriterionTrialId))) - // { - // return ResponseOutput.NotOk("此标准在项目里面已被使用,操作失败"); - // } - // } - - // var systemCriterion = await _readingQuestionCriterionSystemRepository.Where(x => x.Id == inDto.Id).AsNoTracking().FirstOrDefaultAsync(); - - // var confirmTime = systemCriterion.ConfirmTime; - - // if (inDto.IsCompleteConfig) - // { - // confirmTime = DateTime.Now; - // } - - // await _readingQuestionCriterionSystemRepository.UpdatePartialFromQueryAsync(inDto.Id, x => new ReadingQuestionCriterionSystem() - // { - // IsCompleteConfig = inDto.IsCompleteConfig, - // ConfirmTime = confirmTime, - // }); - - // if (inDto.IsCompleteConfig) - // { - // //await SynchronizeSystemCriterion(inDto.Id); - // } - // else - // { - // await _readingQuestionCriterionTrialRepository.BatchUpdateNoTrackingAsync(x => x.ReadingQuestionCriterionSystemId == inDto.Id, x => new ReadingQuestionCriterionTrial() - // { - // IsCompleteConfig = inDto.IsCompleteConfig - // }); - // } - // var result = await _readingQuestionCriterionSystemRepository.SaveChangesAsync(); - - // return ResponseOutput.Ok(result); - //} - - - //#endregion - - //#region 项目标准 - - ///// - ///// 获取项目裁判信息 - ///// - ///// - ///// - //[HttpPost] - //public async Task GetTrialJudgyInfo(GetTrialJudgyInfoInDto inDto) - //{ - // GetTrialJudgyInfoOutDto result = await _readingQuestionCriterionTrialRepository.Where(x => x.Id == inDto.TrialReadingCriterionId).Select(x => new GetTrialJudgyInfoOutDto - // { - // TrialId = x.TrialId, - // IsReadingTaskViewInOrder = x.IsReadingTaskViewInOrder, - // ArbitrationRule = x.ArbitrationRule, - // IsArbitrationReading = x.IsArbitrationReading - - // }).FirstNotNullAsync(); - - // return result; - //} - - ///// - ///// 新增修改项目问题标准(项目) - ///// - ///// - ///// - //[HttpPost] - //public async Task AddOrUpdateReadingQuestionCriterionTrial(AddOrUpdateReadingQuestionCriterionTrialInDto indto) - //{ - - // var entity = await _readingQuestionCriterionTrialRepository.InsertOrUpdateAsync(indto, true); - // return ResponseOutput.Ok(entity.Id.ToString()); - //} - - - - ///// - ///// 设置项目标准是否完成配置 - ///// - ///// - ///// - //public async Task SetTrialReadingQuestionCriterionIsIsCompleteConfig(SetSystemReadingQuestionCriterionIsIsCompleteConfig inDto) - //{ - // await _readingQuestionCriterionTrialRepository.UpdatePartialFromQueryAsync(inDto.Id, x => new ReadingQuestionCriterionTrial() - // { - // IsCompleteConfig = inDto.IsCompleteConfig - // }); - - // var result = await _readingQuestionCriterionTrialRepository.SaveChangesAsync(); - - // return ResponseOutput.Ok(result); - //} - - ///// - ///// 获取项目问题标准(项目) - ///// - ///// - //[HttpPost] - //public async Task> GetReadingQuestionCriterionTrialList(ReadingQuestionCriterionTrialViewInDto inDto) - //{ - // await AddSystemDataToTrila(inDto.TrialId); - // var query = _readingQuestionCriterionTrialRepository.AsQueryable() - // .Where(x => x.TrialId == inDto.TrialId) - // .Where(x => (x.ReadingQuestionCriterionSystemId != null && x.IsEnable) || x.ReadingQuestionCriterionSystemId == null) - // .WhereIf(!inDto.CriterionName.IsNullOrEmpty(), x => x.CriterionName.Contains(inDto.CriterionName)) - - // .ProjectTo(_mapper.ConfigurationProvider); - // return await query.ToPagedListAsync(inDto.PageIndex, inDto.PageSize, inDto.SortField.IsNullOrEmpty() ? nameof(ReadingQuestionCriterionTrialView.ShowOrder) : inDto.SortField, - // inDto.Asc); - //} - - ///// - ///// 删除项目问题标准(项目) - ///// - ///// - ///// - //[HttpDelete("{id:guid}")] - //public async Task DeleteReadingQuestionCriterionTrial(Guid id) - //{ - // await _readingQuestionCriterionTrialRepository.DeleteFromQueryAsync(t => t.Id == id); - // var success = await _readingQuestionCriterionTrialRepository.SaveChangesAsync(); - // return ResponseOutput.Result(success); - //} - - ///// - ///// 设置项目裁判信息 - ///// - ///// - ///// - //[HttpPost] - //public async Task SetTrialJudgyInfo(SetTrialJudgyInfoInDto inDto) - //{ - - // var trialCriterion = await _readingQuestionCriterionTrialRepository.Where(x => x.TrialId == inDto.TrialId && x.Id == inDto.TrialReadingCriterionId).FirstOrDefaultAsync(); - - // var judgeCount = await _readingQuestionTrialRepository.Where(x => x.ReadingQuestionCriterionTrialId == trialCriterion.Id && x.IsJudgeQuestion) - // .WhereIf(trialCriterion.FormType == FormType.SinglePage, x => x.ReadingCriterionPageId == null) - // .WhereIf(trialCriterion.FormType == FormType.MultiplePage, x => x.ReadingCriterionPageId != null).CountAsync(); - - // if (judgeCount == 0 && (inDto.ArbitrationRule == ArbitrationRule.Visit || inDto.ArbitrationRule == ArbitrationRule.Reading)) - // { - // throw new BusinessValidationFailedException("无裁判问题却有仲裁对象,操作失败"); - // } - // await _readingQuestionCriterionTrialRepository.UpdatePartialFromQueryAsync(inDto.TrialReadingCriterionId, x => new ReadingQuestionCriterionTrial() - // { - // ArbitrationRule = inDto.ArbitrationRule, - // //IsArbitrationReading = inDto.IsArbitrationReading, - // }); - - // var result = await _trialRepository.SaveChangesAsync(); - // return ResponseOutput.Ok(result); - //} - - - //#endregion - #endregion - } } \ No newline at end of file