Merge branch 'Test_IRC_Net8' of http://192.168.3.68:2000/XCKJ/irc-netcore-api into Test_IRC_Net8
continuous-integration/drone/push Build is passing Details

IRC_NewDev
hang 2024-01-31 13:34:57 +08:00
commit b52d8785bb
2 changed files with 45 additions and 16 deletions

View File

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

View File

@ -997,27 +997,48 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
}
}
/// <summary>
/// 获取分裂病灶的PPd之和 不包括当前的主病灶
/// </summary>
/// <returns></returns>
[HttpPost]
public async Task<decimal> GetSplitPPdSum(GetSplitPPdInDto inDto)
public async Task<List<GetSplitPPdOutDto>> GetSplitPPdSum(GetSplitPPdInDto inDto)
{
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;
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;
}
#region 将上一次的访视病灶添加到这一次