This commit is contained in:
he
2023-01-16 10:41:07 +08:00
parent cae80eeeba
commit 0655d5bdb0
7 changed files with 46 additions and 15 deletions
@@ -1284,12 +1284,27 @@ namespace IRaCIS.Application.Services
var tableQuestions = await _readingTableQuestionTrialRepository.Where(x => tableQuestionIds.Contains(x.Id) && x.MaxRowCount != null && x.MaxRowCount != 0).ToListAsync();
List<QuestionMark?> questionMarks = new List<QuestionMark?>()
{
QuestionMark.Part,
QuestionMark.Organ,
};
foreach (var item in tableQuestions)
{
var answer = inDto.AnswerList.Where(x => x.TableQuestionId == item.Id).Select(x => x.Answer).FirstOrDefault();
if (!answer.IsNullOrEmpty())
{
var rowCount = await _readingTableQuestionAnswerRepository.Where(x => x.VisitTaskId == inDto.VisitTaskId && x.TableQuestionId == item.Id && ((x.RowIndex % 1) == 0) && x.Answer == answer && x.RowIndex != inDto.RowIndex).CountAsync();
var rowCount = 0;
if (questionMarks.Contains(item.QuestionMark))
{
rowCount = await _readingTableAnswerRowInfoRepository.Where(x => x.VisitTaskId == inDto.VisitTaskId && x.QuestionId == inDto.QuestionId && ((x.RowIndex % 1) == 0) && x.OrganInfoId == inDto.OrganInfoId && x.OrganInfoId != null && x.RowIndex != inDto.RowIndex).CountAsync();
}
else
{
rowCount = await _readingTableQuestionAnswerRepository.Where(x => x.VisitTaskId == inDto.VisitTaskId && x.TableQuestionId == item.Id && ((x.RowIndex % 1) == 0) && x.Answer == answer && x.RowIndex != inDto.RowIndex).CountAsync();
}
if (rowCount > item.MaxRowCount.Value - 1)
{