diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml index eccd5759d..efb3f7d5d 100644 --- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml +++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml @@ -2572,6 +2572,11 @@ 字典code + + + 默认值 + + 类型 diff --git a/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs b/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs index ad17cefae..5e9953b2e 100644 --- a/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs +++ b/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs @@ -578,13 +578,14 @@ namespace IRaCIS.Application.Services orders.ForEach(x => { Dictionary answers = new Dictionary(); - var rowAnswer = thisAnswer.Where(y => y.RowIndex == x).OrderBy(y => y.ShowOrder).ToList(); + var rowInfo = tableAnsweRowInfos.Where(y => y.RowIndex == x && y.QuestionId == item.Id).FirstOrDefault(); + var rowAnswer = thisAnswer.Where(y => y.RowId == rowInfo.Id).OrderBy(y => y.ShowOrder).ToList(); rowAnswer.ForEach(z => { answers.Add(z.TableQuestionId.ToString(), z.Answer); }); - var rowInfo = tableAnsweRowInfos.Where(y => y.RowIndex == x && y.QuestionId == item.Id).FirstOrDefault(); + answers.Add("BlindName", rowInfo.BlindName); answers.Add("IsDicomReading", rowInfo.IsDicomReading.ToString()); @@ -781,6 +782,7 @@ namespace IRaCIS.Application.Services throw new BusinessValidationFailedException($"当前病灶分裂出其他病灶或者其他病灶合并到了当前病灶,删除失败"); } + var index = await _readingCalculateService.GetDeleteLesionStatrIndex(inDto); await _readingTableQuestionAnswerRepository.DeleteFromQueryAsync(x => x.RowId == inDto.RowId); await _readingTableAnswerRowInfoRepository.DeleteFromQueryAsync(x => x.Id == inDto.RowId); await _readingTableAnswerRowInfoRepository.SaveChangesAsync(); @@ -788,27 +790,18 @@ namespace IRaCIS.Application.Services 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) { @@ -816,8 +809,6 @@ namespace IRaCIS.Application.Services { 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 diff --git a/IRaCIS.Core.Application/Service/ReadingCalculate/Interface/ICriterionCalculateService.cs b/IRaCIS.Core.Application/Service/ReadingCalculate/Interface/ICriterionCalculateService.cs index 2f4d57a81..bda18fd44 100644 --- a/IRaCIS.Core.Application/Service/ReadingCalculate/Interface/ICriterionCalculateService.cs +++ b/IRaCIS.Core.Application/Service/ReadingCalculate/Interface/ICriterionCalculateService.cs @@ -46,6 +46,12 @@ namespace IRaCIS.Core.Application.Service /// Task GetReadingReportEvaluation(GetReadingReportEvaluationInDto indto); + /// + /// 删除病灶获取起始病灶序号 + /// + /// + Task GetDeleteLesionStatrIndex(DeleteReadingRowAnswerInDto inDto); + } } diff --git a/IRaCIS.Core.Application/Service/ReadingCalculate/Interface/IReadingCalculateService.cs b/IRaCIS.Core.Application/Service/ReadingCalculate/Interface/IReadingCalculateService.cs index 238c2d647..ffe22c606 100644 --- a/IRaCIS.Core.Application/Service/ReadingCalculate/Interface/IReadingCalculateService.cs +++ b/IRaCIS.Core.Application/Service/ReadingCalculate/Interface/IReadingCalculateService.cs @@ -44,5 +44,12 @@ namespace IRaCIS.Core.Application.Service /// /// Task GetReadingReportEvaluation(GetReadingReportEvaluationInDto indto); + + + /// + /// 删除病灶获取起始病灶序号 + /// + /// + Task GetDeleteLesionStatrIndex(DeleteReadingRowAnswerInDto inDto); } } diff --git a/IRaCIS.Core.Application/Service/ReadingCalculate/PCWG3CalculateService.cs b/IRaCIS.Core.Application/Service/ReadingCalculate/PCWG3CalculateService.cs index 5a4bf1f12..14f5c4809 100644 --- a/IRaCIS.Core.Application/Service/ReadingCalculate/PCWG3CalculateService.cs +++ b/IRaCIS.Core.Application/Service/ReadingCalculate/PCWG3CalculateService.cs @@ -55,6 +55,29 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate private List siteVisitForTumorList = null; + + #region 删除病灶获取起始病灶序号 + /// + /// 删除病灶获取起始病灶序号 + /// + /// + public async Task GetDeleteLesionStatrIndex(DeleteReadingRowAnswerInDto inDto) + { + var rowInfo = await _readingTableAnswerRowInfoRepository.Where(x => x.Id == inDto.RowId).Include(x => x.ReadingQuestionTrial).FirstNotNullAsync(); + if (rowInfo.ReadingQuestionTrial.LesionType == LesionType.NewLesions) + { + var minIndex= await _readingTableAnswerRowInfoRepository.Where(x => x.QuestionId == rowInfo.QuestionId && x.VisitTaskId == inDto.VisitTaskId).OrderBy(x => x.RowIndex).Select(x=>x.RowIndex).FirstOrDefaultAsync(); + return (int)minIndex; + } + else + { + return 1; + } + + + } + #endregion + #region 获取阅片报告 /// /// 获取阅片报告 @@ -265,6 +288,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate x.SubjectId == taskinfo.SubjectId && x.ReadingTaskState == ReadingTaskState.HaveSigned && x.VisitTaskNum < taskinfo.VisitTaskNum && x.TaskState == TaskState.Effect && x.ArmEnum == taskinfo.ArmEnum ).OrderByDescending(x => x.VisitTaskNum).Select(x => x.Id).FirstOrDefaultAsync(); + // 上一次的表格答案 var copyTableAnswers = await _readingTableQuestionAnswerRepository.Where(x => x.VisitTaskId == LastVisitTaskId ).Select(x => new CopyTableAnswerDto() { @@ -277,6 +301,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate TrialId = x.TrialId }).ToListAsync(); + // 上一次的行信息 var tableRowAnswers = await _readingTableAnswerRowInfoRepository.Where(x => x.VisitTaskId == LastVisitTaskId).ProjectTo(_mapper.ConfigurationProvider).ToListAsync(); tableRowAnswers.ForEach(x => @@ -317,9 +342,16 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate try { + // 新病灶外层问题 var newLesionQuestion = await _readingQuestionTrialRepository.Where(x => x.LesionType == LesionType.NewLesions && x.ReadingQuestionCriterionTrialId == taskinfo.TrialReadingCriterionId).FirstNotNullAsync(); + + // 既往病灶外层问题 var alwaysNewLesionsQuestion = await _readingQuestionTrialRepository.Where(x => x.LesionType == LesionType.AlwaysNewLesions && x.ReadingQuestionCriterionTrialId == taskinfo.TrialReadingCriterionId).FirstNotNullAsync(); + + // 新病灶表格问题 var newLesionTableQuestions = await _readingTableQuestionTrialRepository.Where(x => x.ReadingQuestionId == newLesionQuestion.Id).ToListAsync(); + + // 既往病灶表格问题 var alwaysNewLesionsTableQuestions = await _readingTableQuestionTrialRepository.Where(x => x.ReadingQuestionId == alwaysNewLesionsQuestion.Id).ToListAsync(); Dictionary alwaysTableQuestionIdDic = new Dictionary(); diff --git a/IRaCIS.Core.Application/Service/ReadingCalculate/RECIST1Point1CalculateService.cs b/IRaCIS.Core.Application/Service/ReadingCalculate/RECIST1Point1CalculateService.cs index 6c3454321..70dcbb2d7 100644 --- a/IRaCIS.Core.Application/Service/ReadingCalculate/RECIST1Point1CalculateService.cs +++ b/IRaCIS.Core.Application/Service/ReadingCalculate/RECIST1Point1CalculateService.cs @@ -64,6 +64,16 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate private decimal? sODData; #endregion + #region 删除病灶获取起始病灶序号 + /// + /// 删除病灶获取起始病灶序号(RECIST1Point1 固定是1) + /// + /// + public async Task GetDeleteLesionStatrIndex(DeleteReadingRowAnswerInDto inDto) + { + return 1; + } + #endregion #region 获取阅片报告 /// diff --git a/IRaCIS.Core.Application/Service/ReadingCalculate/ReadingCalculateService.cs b/IRaCIS.Core.Application/Service/ReadingCalculate/ReadingCalculateService.cs index 9bb4065ff..17bb9e04e 100644 --- a/IRaCIS.Core.Application/Service/ReadingCalculate/ReadingCalculateService.cs +++ b/IRaCIS.Core.Application/Service/ReadingCalculate/ReadingCalculateService.cs @@ -192,6 +192,25 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate return new GetReadingReportEvaluationOutDto(); } } + + + /// + /// 删除病灶获取起始病灶序号 + /// + /// + public async Task GetDeleteLesionStatrIndex(DeleteReadingRowAnswerInDto inDto) + { + var service = await this.GetService(inDto.VisitTaskId); + + if (service != null) + { + return await service.GetDeleteLesionStatrIndex(inDto); + } + else + { + return 1; + } + } }