diff --git a/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs b/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs index 6fbcb8fa0..528cb5472 100644 --- a/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs +++ b/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs @@ -7,7 +7,6 @@ using Panda.DynamicWebApi.Attributes; using AutoMapper; using IRaCIS.Core.Application.Contracts; using IRaCIS.Core.Infrastructure; -using Newtonsoft.Json; using IRaCIS.Core.Application.Service; using IRaCIS.Core.Application.ViewModel; @@ -347,81 +346,9 @@ namespace IRaCIS.Application.Services #endregion - #region 表格问题相关 + #region 访视任务 - Dicom 阅片 表格问题相关查询 - - /// - /// 删除表格行数据 - /// - /// - /// - [HttpPost] - public async Task DeleteReadingRowAnswer(DeleteReadingRowAnswerInDto inDto) - { - - var deleteRowInfo = await _readingTableAnswerRowInfoRepository.Where(x => x.VisitTaskId == inDto.VisitTaskId && x.RowIndex == inDto.RowIndex && x.QuestionId == inDto.QuestionId).FirstNotNullAsync(); - if (deleteRowInfo==null) - { - return ResponseOutput.Ok(true); - } - - - if(await _readingTableAnswerRowInfoRepository.AnyAsync(x=>x.SplitRowId== deleteRowInfo.Id&&x.MergeRowId==deleteRowInfo.Id)) - { - throw new BusinessValidationFailedException($"当前病灶分裂出其他病灶或者其他病灶合并到了当前病灶,删除失败"); - } - - await _readingTableQuestionAnswerRepository.DeleteFromQueryAsync(x => x.VisitTaskId == inDto.VisitTaskId && x.RowIndex == inDto.RowIndex && x.QuestionId == inDto.QuestionId); - await _readingTableAnswerRowInfoRepository.DeleteFromQueryAsync(x => x.VisitTaskId == inDto.VisitTaskId && x.RowIndex == inDto.RowIndex && x.QuestionId == inDto.QuestionId); - await _readingTableAnswerRowInfoRepository.SaveChangesAsync(); - - - var rowInfoList = await _readingTableAnswerRowInfoRepository.Where(x => x.VisitTaskId == inDto.VisitTaskId && x.QuestionId == inDto.QuestionId).OrderBy(x => x.RowIndex).ToListAsync(); - - var index = 1; - foreach (var item in rowInfoList.Where(x=>x.RowIndex%1==0)) - { - - - - await _readingTableQuestionAnswerRepository.BatchUpdateNoTrackingAsync(x => x.VisitTaskId == inDto.VisitTaskId && x.RowIndex == item.RowIndex && x.QuestionId == inDto.QuestionId, x => new ReadingTableQuestionAnswer() - { - RowIndex = index - }); - - - await _readingTableAnswerRowInfoRepository.BatchUpdateNoTrackingAsync(x => x.VisitTaskId == inDto.VisitTaskId && x.RowIndex == item.RowIndex && x.QuestionId == inDto.QuestionId, x => new ReadingTableAnswerRowInfo() - { - RowIndex = index - }); - - - - var spiltList = rowInfoList.Where(x => x.RowIndex % 1 != 0 && x.RowIndex > item.RowIndex && x.RowIndex < Math.Floor(item.RowIndex + 1)).OrderBy(x=>x.RowIndex).ToList(); - - decimal spiltindex = 0.01M; - foreach (var spiltitem in spiltList) - { - await _readingTableQuestionAnswerRepository.BatchUpdateNoTrackingAsync(x => x.VisitTaskId == inDto.VisitTaskId && x.RowIndex == spiltitem.RowIndex && x.QuestionId == inDto.QuestionId, x => new ReadingTableQuestionAnswer() - { - RowIndex = index+spiltindex - }); - - - await _readingTableAnswerRowInfoRepository.BatchUpdateNoTrackingAsync(x => x.VisitTaskId == inDto.VisitTaskId && x.RowIndex == spiltitem.RowIndex && x.QuestionId == inDto.QuestionId, x => new ReadingTableAnswerRowInfo() - { - RowIndex = index+spiltindex - }); - - spiltindex += 0.01M; - } - index++; - } - - return ResponseOutput.Ok(true); - } - /// /// 获取DIcom阅片问题答案 /// @@ -780,9 +707,6 @@ namespace IRaCIS.Application.Services }); ; } - - - /// /// 获取子元素 /// @@ -868,7 +792,7 @@ namespace IRaCIS.Application.Services #endregion - #region 访视任务 - Dicom 阅片 + #region 访视任务 - Dicom 阅片 提交、修改 /// /// 修改Dicom阅片问题 @@ -899,6 +823,78 @@ namespace IRaCIS.Application.Services } + /// + /// 删除表格行数据 + /// + /// + /// + [HttpPost] + public async Task DeleteReadingRowAnswer(DeleteReadingRowAnswerInDto inDto) + { + + var deleteRowInfo = await _readingTableAnswerRowInfoRepository.Where(x => x.VisitTaskId == inDto.VisitTaskId && x.RowIndex == inDto.RowIndex && x.QuestionId == inDto.QuestionId).FirstNotNullAsync(); + if (deleteRowInfo == null) + { + return ResponseOutput.Ok(true); + } + + + if (await _readingTableAnswerRowInfoRepository.AnyAsync(x => x.SplitRowId == deleteRowInfo.Id && x.MergeRowId == deleteRowInfo.Id)) + { + throw new BusinessValidationFailedException($"当前病灶分裂出其他病灶或者其他病灶合并到了当前病灶,删除失败"); + } + + await _readingTableQuestionAnswerRepository.DeleteFromQueryAsync(x => x.VisitTaskId == inDto.VisitTaskId && x.RowIndex == inDto.RowIndex && x.QuestionId == inDto.QuestionId); + await _readingTableAnswerRowInfoRepository.DeleteFromQueryAsync(x => x.VisitTaskId == inDto.VisitTaskId && x.RowIndex == inDto.RowIndex && x.QuestionId == inDto.QuestionId); + await _readingTableAnswerRowInfoRepository.SaveChangesAsync(); + + + var rowInfoList = await _readingTableAnswerRowInfoRepository.Where(x => x.VisitTaskId == inDto.VisitTaskId && x.QuestionId == inDto.QuestionId).OrderBy(x => x.RowIndex).ToListAsync(); + + var index = 1; + foreach (var item in rowInfoList.Where(x => x.RowIndex % 1 == 0)) + { + + + + await _readingTableQuestionAnswerRepository.BatchUpdateNoTrackingAsync(x => x.VisitTaskId == inDto.VisitTaskId && x.RowIndex == item.RowIndex && x.QuestionId == inDto.QuestionId, x => new ReadingTableQuestionAnswer() + { + RowIndex = index + }); + + + await _readingTableAnswerRowInfoRepository.BatchUpdateNoTrackingAsync(x => x.VisitTaskId == inDto.VisitTaskId && x.RowIndex == item.RowIndex && x.QuestionId == inDto.QuestionId, x => new ReadingTableAnswerRowInfo() + { + RowIndex = index + }); + + + + var spiltList = rowInfoList.Where(x => x.RowIndex % 1 != 0 && x.RowIndex > item.RowIndex && x.RowIndex < Math.Floor(item.RowIndex + 1)).OrderBy(x => x.RowIndex).ToList(); + + decimal spiltindex = 0.01M; + foreach (var spiltitem in spiltList) + { + await _readingTableQuestionAnswerRepository.BatchUpdateNoTrackingAsync(x => x.VisitTaskId == inDto.VisitTaskId && x.RowIndex == spiltitem.RowIndex && x.QuestionId == inDto.QuestionId, x => new ReadingTableQuestionAnswer() + { + RowIndex = index + spiltindex + }); + + + await _readingTableAnswerRowInfoRepository.BatchUpdateNoTrackingAsync(x => x.VisitTaskId == inDto.VisitTaskId && x.RowIndex == spiltitem.RowIndex && x.QuestionId == inDto.QuestionId, x => new ReadingTableAnswerRowInfo() + { + RowIndex = index + spiltindex + }); + + spiltindex += 0.01M; + } + index++; + } + + return ResponseOutput.Ok(true); + } + + /// /// 提交表格问题答案 病灶 ///