diff --git a/IRaCIS.Core.Application/Service/QC/DTO/TrialQCQuestionConfigureViewModel.cs b/IRaCIS.Core.Application/Service/QC/DTO/TrialQCQuestionConfigureViewModel.cs index 0d83d094d..1903dcdd3 100644 --- a/IRaCIS.Core.Application/Service/QC/DTO/TrialQCQuestionConfigureViewModel.cs +++ b/IRaCIS.Core.Application/Service/QC/DTO/TrialQCQuestionConfigureViewModel.cs @@ -106,6 +106,13 @@ namespace IRaCIS.Core.Application.Contracts } + + public class BatchDeteteTrialQCQuestionInDto + { + public Guid TrialId { get; set; } + + public List Ids { get; set; } + } public class TrialQCQuestionConfigureBatchAdd { diff --git a/IRaCIS.Core.Application/Service/QC/TrialQCQuestionService.cs b/IRaCIS.Core.Application/Service/QC/TrialQCQuestionService.cs index 981fbcdd9..9d37c58d8 100644 --- a/IRaCIS.Core.Application/Service/QC/TrialQCQuestionService.cs +++ b/IRaCIS.Core.Application/Service/QC/TrialQCQuestionService.cs @@ -6,6 +6,7 @@ using IRaCIS.Core.Application.Auth; using IRaCIS.Core.Application.Filter; +using IRaCIS.Core.Application.ViewModel; using IRaCIS.Core.Infra.EFCore; using IRaCIS.Core.Infrastructure; using MassTransit; @@ -146,6 +147,34 @@ namespace IRaCIS.Core.Application.Contracts } } + + /// + /// 批量删除项目标准医学审核问题 + /// + /// + /// + [HttpPost] + public async Task BatchDeteteTrialQCQuestion(BatchDeteteTrialQCQuestionInDto inDto) + { + + var questionlist = await _trialQcQuestionRepository.Where(x => x.TrialId == inDto.TrialId).ToListAsync(); + + var count = inDto.Ids.Count(); + var childids = new List(); + while (count > 0) + { + childids = questionlist.Where(x => inDto.Ids.Contains(x.ParentId ?? default(Guid))).Select(x => x.Id).ToList(); + inDto.Ids.AddRange(childids); + count = childids.Count(); + + } + + await _trialQcQuestionRepository.BatchDeleteNoTrackingAsync(x => inDto.Ids.Contains(x.Id)); + //var result= await _readingMedicineTrialQuestionRepository.SaveChangesAsync(); + return ResponseOutput.Result(true); + } + + /// /// 批量添加 QC 问题 /// diff --git a/IRaCIS.Core.Application/Service/Reading/MedicalAudit/ReadingMedicineQuestionService.cs b/IRaCIS.Core.Application/Service/Reading/MedicalAudit/ReadingMedicineQuestionService.cs index 456eb480d..41fb5dd73 100644 --- a/IRaCIS.Core.Application/Service/Reading/MedicalAudit/ReadingMedicineQuestionService.cs +++ b/IRaCIS.Core.Application/Service/Reading/MedicalAudit/ReadingMedicineQuestionService.cs @@ -473,9 +473,22 @@ namespace IRaCIS.Core.Application.Service [HttpPost] public async Task BatchDeteteCriterionMedicineQuestion(BatchDeteteCriterionMedicineQuestionInDto inDto) { - await _readingMedicineTrialQuestionRepository.BatchDeleteNoTrackingAsync(x => inDto.Ids.Contains(x.Id)); - var result= await _readingMedicineTrialQuestionRepository.SaveChangesAsync(); - return ResponseOutput.Result(result); + + var questionlist =await _readingMedicineTrialQuestionRepository.Where(x => x.TrialReadingCriterionId == inDto.TrialReadingCriterionId).ToListAsync(); + + var count = inDto.Ids.Count(); + var childids = new List(); + while (count > 0) + { + childids = questionlist.Where(x => inDto.Ids.Contains(x.ParentId ?? default(Guid))).Select(x => x.Id).ToList(); + inDto.Ids.AddRange(childids); + count = childids.Count(); + + } + + await _readingMedicineTrialQuestionRepository.BatchDeleteNoTrackingAsync(x => inDto.Ids.Contains(x.Id)); + //var result= await _readingMedicineTrialQuestionRepository.SaveChangesAsync(); + return ResponseOutput.Result(true); }