Compare commits

..

No commits in common. "abe77916a374e9e5e2ef7732fd38231a5e58f87e" and "8dec77f30a1bb82f467126d07893ea652c05e3d1" have entirely different histories.

2 changed files with 16 additions and 45 deletions

View File

@ -22,17 +22,9 @@ namespace IRaCIS.Core.Application.ViewModel
}
public class GetSplitPPdOutDto
{
public Guid RowId { get; set; }
public decimal AllPPD { get; set; }
}
public class GetSplitPPdInDto
public class GetSplitPPdInDto
{
public Guid VisitTaskId { get; set; }
public Guid RowId { get; set; }
}
public class ReadingTaskQuestionAnswerDto : ReadingTaskQuestionAnswer

View File

@ -998,47 +998,26 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
}
/// <summary>
/// 获取分裂病灶的PPd之和 不包括当前的主病灶
/// </summary>
/// <returns></returns>
[HttpPost]
public async Task<List<GetSplitPPdOutDto>> GetSplitPPdSum(GetSplitPPdInDto inDto)
public async Task<decimal> GetSplitPPdSum(GetSplitPPdInDto inDto)
{
List<GetSplitPPdOutDto> result = new List<GetSplitPPdOutDto>();
var taskInfo = await _visitTaskRepository.Where(x => x.Id == inDto.VisitTaskId).FirstNotNullAsync();
var targetQuestion = await _readingQuestionTrialRepository.Where(x => x.ReadingQuestionCriterionTrialId == taskInfo.TrialReadingCriterionId && x.LesionType == LesionType.TargetLesion).FirstOrDefaultAsync();
if (targetQuestion != null)
{
var ppdAnswerList = await _readingTableQuestionAnswerRepository.Where(x =>
x.VisitTaskId == inDto.VisitTaskId &&
x.ReadingTableQuestionTrial.QuestionMark == QuestionMark.PPD &&
x.QuestionId == targetQuestion.Id)
.Select(x => new {
x.RowId,
x.RowIndex,
x.Answer
}).ToListAsync();
var answerList = ppdAnswerList.Select(x => new {
x.RowId,
x.RowIndex,
Answer = x.Answer.IsNullOrEmptyReturn0()
}).ToList();
var maxRowIndex = answerList.Max(x => x.RowIndex);
for (int i = 1; i < maxRowIndex; i++)
{
result.Add(new GetSplitPPdOutDto()
{
RowId = answerList.Where(x => x.RowIndex == i).Select(x => x.RowId).FirstOrDefault(),
AllPPD = answerList.Where(x => x.RowIndex > i && x.RowIndex < (i + 1)).Sum(x => x.Answer),
});
}
}
return result;
var rowinfo = await _readingTableAnswerRowInfoRepository.Where(x => x.Id == inDto.RowId).FirstNotNullAsync();
var ppdAnswerList = await _readingTableQuestionAnswerRepository.Where(x =>
x.VisitTaskId == rowinfo.VisitTaskId &&
x.ReadingTableQuestionTrial.QuestionMark == QuestionMark.PPD &&
x.QuestionId == rowinfo.QuestionId &&
x.RowIndex > (int)Math.Floor(rowinfo.RowIndex) && x.RowIndex < ((int)Math.Floor(rowinfo.RowIndex) + 1)
).Select(x => x.Answer).ToListAsync();
var allPPd = ppdAnswerList.Select(x => x.IsNullOrEmptyReturn0()).Sum();
return allPPd;
}
#region 将上一次的访视病灶添加到这一次