From 0a581db6d1dc064be1c00974d1cdfa648c5818c8 Mon Sep 17 00:00:00 2001
From: he <109787524@qq.com>
Date: Tue, 3 Sep 2024 17:07:31 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../ReadingTaskQuestionService.cs | 77 ++++---------------
1 file changed, 16 insertions(+), 61 deletions(-)
diff --git a/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingTaskQuestionService.cs b/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingTaskQuestionService.cs
index e7d0f29e6..1af3c7979 100644
--- a/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingTaskQuestionService.cs
+++ b/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingTaskQuestionService.cs
@@ -47,78 +47,33 @@ namespace IRaCIS.Application.Services
///
///
[HttpPost]
- public async Task<(GetTrialReadingQuestionPageDto, object)> GetTrialReadingQuestion(GetTrialReadingQuestionInDto inDto)
+ public async Task<(GetReadingTableQuestionOutDto, object)> GetTrialReadingQuestion(GetTrialReadingQuestionInDto inDto)
{
- if (inDto.VisitTaskId != null)
- {
- //await AddDefaultValueToTask(inDto.VisitTaskId.Value);
- }
-
- var result = new GetTrialReadingQuestionPageDto();
var readingTaskState = await _visitTaskRepository.Where(x => x.Id == inDto.VisitTaskId).Select(x => x.ReadingTaskState).FirstOrDefaultAsync();
-
-
- var qusetionList = await GetReadingAnswerView(inDto.ReadingQuestionCriterionTrialId, inDto.VisitTaskId);
-
var formType = await _readingQuestionCriterionTrialRepository.Where(x => x.Id == inDto.ReadingQuestionCriterionTrialId).Select(x => x.FormType).FirstOrDefaultAsync();
- var groupList = new List();
-
- var qusetionIds = qusetionList.Select(x => x.Id).ToList();
- var tableQuestionList = await _readingTableQuestionTrialRepository.Where(x => qusetionIds.Contains(x.ReadingQuestionId))
- .ProjectTo(_mapper.ConfigurationProvider,x=>new {
-
- isEn_Us=_userInfo.IsEn_Us
-
- }).OrderBy(x => x.ShowOrder).ToListAsync();
if (inDto.FormType != null)
{
formType = inDto.FormType.Value;
}
+ var tableAnswers = await _readingTableQuestionAnswerRepository
+ .ProjectTo(_mapper.ConfigurationProvider)
+ .Where(x => x.VisitTaskId == inDto.VisitTaskId).ToListAsync();
- if (formType == FormType.MultiplePage)
+ var tableAnsweRowInfos = await _readingTableAnswerRowInfoRepository.Where(x => x.VisitTaskId == inDto.VisitTaskId).ProjectTo(_mapper.ConfigurationProvider).ToListAsync();
+
+ var organIds = tableAnsweRowInfos.Where(x => x.OrganInfoId != null).Select(x => x.OrganInfoId).Distinct().ToList();
+ var organList = await _organInfoRepository.Where(x => organIds.Contains(x.Id)).ToListAsync();
+ var result=await GetReadingTableQuestion(new GetReadingTableQuestionOrAnswerInDto()
{
- qusetionList = qusetionList.Where(x => x.ReadingCriterionPageId != null).ToList();
- var readingCriterionPageIds = qusetionList.OrderBy(x => x.PageShowOrder).Select(x => x.ReadingCriterionPageId).Distinct().ToList();
- foreach (var item in readingCriterionPageIds)
- {
- var newPageQusetionList = qusetionList.Where(x => x.ReadingCriterionPageId == item).ToList();
- var firstData = newPageQusetionList.FirstOrDefault();
- var page = new GetTrialReadingQuestionOutDto()
- {
- PageName = firstData!.PageName,
- IsPage = true,
- IsPublicPage = firstData.IsPublicPage,
- };
- var pageGroupList = newPageQusetionList.Where(x => x.Type == ReadingQestionType.Group || (x.ParentId == null && x.GroupName.IsNullOrEmpty())).ToList();
- pageGroupList.ForEach(x =>
- {
- this.FindChildQuestion(x, newPageQusetionList, tableQuestionList);
- });
+ TrialReadingCriterionId = inDto.ReadingQuestionCriterionTrialId,
+ TaskId = inDto.VisitTaskId,
+ TableAnswers = tableAnswers,
+ TableAnsweRowInfos = tableAnsweRowInfos,
+ OrganInfos = organList,
+ QuestionClassify = null,
- page.Childrens = pageGroupList.Where(x => !(x.Type == ReadingQestionType.Group && x.Childrens.Count() == 0)).ToList();
- groupList.Add(page);
- }
-
- result.PublicPage = groupList.Where(x => x.IsPublicPage!.Value).ToList();
- result.MultiPage = groupList.Where(x => !x.IsPublicPage!.Value).ToList();
- }
- else
- {
- qusetionList = qusetionList.Where(x => x.ReadingCriterionPageId == null).ToList();
-
- groupList = qusetionList.Where(x => x.Type == ReadingQestionType.Group || (x.ParentId == null && x.GroupId==null)).ToList();
- groupList.ForEach(x =>
- {
- this.FindChildQuestion(x, qusetionList, tableQuestionList);
- });
-
- groupList = groupList.Where(x => !(x.Type == ReadingQestionType.Group && x.Childrens.Count() == 0)).ToList();
-
- result.SinglePage = groupList;
-
-
- }
+ });
return (result, new