Uat_Study
he 2022-09-23 17:35:01 +08:00
parent 57d3ea9ff1
commit b5af2d62ee
1 changed files with 3 additions and 1 deletions

View File

@ -117,7 +117,7 @@ namespace IRaCIS.Application.Services
public async Task SplitLesion(SplitLesionInDto inDto)
{
await this.VerifyIsBaseLineTask(inDto.VisitTaskId);
var rowAnswer = await _readingTableAnswerRowInfoRepository.Where(x =>x.Id==inDto.RowId).FirstNotNullAsync();
var rowAnswer = await _readingTableAnswerRowInfoRepository.Where(x =>x.Id==inDto.RowId).AsNoTracking().FirstNotNullAsync();
var tableAnswers = await _readingTableQuestionAnswerRepository.Where(x => x.VisitTaskId == inDto.VisitTaskId && x.RowIndex == rowAnswer.RowIndex && x.QuestionId == inDto.QuestionId).Include(x=>x.ReadingTableQuestionTrial).ToListAsync();
var maxRowIndex = await _readingTableAnswerRowInfoRepository.Where(x => x.VisitTaskId == inDto.VisitTaskId && x.QuestionId == inDto.QuestionId&&x.RowIndex< Math.Floor(rowAnswer.RowIndex+1)).OrderByDescending(x => x.RowIndex).Select(x => x.RowIndex).FirstOrDefaultAsync();
var newRowIndex = maxRowIndex + (decimal)0.01;
@ -139,7 +139,9 @@ namespace IRaCIS.Application.Services
x.Id = NewId.NextGuid();
x.RowIndex = newRowIndex;
x.VisitTaskId = inDto.VisitTaskId;
x.RowId = rowAnswer.Id;
x.Answer = needRemoveMark.Contains(x.ReadingTableQuestionTrial.QuestionMark) ? string.Empty : x.Answer;
x.ReadingTableQuestionTrial = null;
});
await _readingTableAnswerRowInfoRepository.AddAsync(rowAnswer);
await _readingTableQuestionAnswerRepository.AddRangeAsync(tableAnswers);