修改
This commit is contained in:
@@ -1690,7 +1690,7 @@
|
||||
裁判结果的备注
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.SubmitTableQuestionInDto.TaskId">
|
||||
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.SubmitTableQuestionInDto.VisitTaskId">
|
||||
<summary>
|
||||
任务Id
|
||||
</summary>
|
||||
@@ -6969,7 +6969,7 @@
|
||||
<param name="inDto"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:IRaCIS.Application.Services.ReadingImageTaskService.FindChildQuestion(IRaCIS.Core.Application.Service.Reading.Dto.TrialReadQuestionData,System.Collections.Generic.List{IRaCIS.Core.Application.Service.Reading.Dto.TrialReadQuestionData},System.Collections.Generic.List{IRaCIS.Core.Domain.Models.ReadingTableQuestionTrial},System.Collections.Generic.List{IRaCIS.Core.Application.Service.Reading.Dto.ReadingTableQuestionAnswerInfo})">
|
||||
<member name="M:IRaCIS.Application.Services.ReadingImageTaskService.FindChildQuestion(IRaCIS.Core.Application.Service.Reading.Dto.TrialReadQuestionData,System.Collections.Generic.List{IRaCIS.Core.Application.Service.Reading.Dto.TrialReadQuestionData},System.Collections.Generic.List{IRaCIS.Core.Domain.Models.ReadingTableQuestionTrial},System.Collections.Generic.List{IRaCIS.Core.Application.Service.Reading.Dto.ReadingTableQuestionAnswerInfo},System.Collections.Generic.List{IRaCIS.Core.Domain.Models.ReadingTableAnswerRowInfo})">
|
||||
<summary>
|
||||
获取子元素
|
||||
</summary>
|
||||
|
||||
@@ -55,7 +55,7 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
||||
{
|
||||
public List<ReadingTableQuestionTrial> Questions { get; set; }
|
||||
|
||||
public List<Dictionary<Guid,string>> Answers { get; set; }
|
||||
public List<Dictionary<string,string>> Answers { get; set; }
|
||||
}
|
||||
|
||||
public class GetReadingQuestionAndAnswerInDto
|
||||
@@ -603,13 +603,15 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
||||
/// <summary>
|
||||
/// 任务Id
|
||||
/// </summary>
|
||||
public Guid TaskId { get; set; }
|
||||
public Guid VisitTaskId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 项目Id
|
||||
/// </summary>
|
||||
public Guid TrialId { get; set; }
|
||||
|
||||
public string MeasureData { get; set; }
|
||||
|
||||
|
||||
public List<SubmitTableQuestionInfo> AnswerList { get; set; }
|
||||
|
||||
@@ -742,6 +744,11 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
||||
|
||||
public class TableQuestionDataInfo
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public Guid Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 问题ID
|
||||
/// </summary>
|
||||
@@ -968,7 +975,7 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
||||
|
||||
|
||||
|
||||
public List<TableQuestionDataInfo> TableQuestions { get; set; }
|
||||
//public List<TableQuestionDataInfo> TableQuestions { get; set; }
|
||||
|
||||
public List<GetSystemReadingQuestionOutDto> Childrens { get; set; }
|
||||
}
|
||||
|
||||
@@ -41,6 +41,7 @@ namespace IRaCIS.Application.Services
|
||||
private readonly IRepository<ReadingCriterionPage> _readingCriterionPageRepository;
|
||||
private readonly IRepository<ReadingJudgeInfo> _readingJudgeInfoRepository;
|
||||
private readonly IRepository<ReadModule> _readModuleRepository;
|
||||
private readonly IRepository<ReadingTableAnswerRowInfo> _readingTableAnswerRowInfoRepository;
|
||||
private readonly IRepository<ReadingTableQuestionSystem> _readingTableQuestionSystemRepository;
|
||||
private readonly IRepository<ReadingTableQuestionTrial> _readingTableQuestionTrialRepository;
|
||||
private readonly IRepository<ReadingTaskQuestionAnswer> _readingTaskQuestionAnswerRepository;
|
||||
@@ -66,6 +67,7 @@ namespace IRaCIS.Application.Services
|
||||
IRepository<ReadingCriterionPage> readingCriterionPageRepository,
|
||||
IRepository<ReadingJudgeInfo> readingJudgeInfoRepository,
|
||||
IRepository<ReadModule> readModuleRepository,
|
||||
IRepository<ReadingTableAnswerRowInfo> readingTableAnswerRowInfoRepository,
|
||||
IRepository<ReadingTableQuestionSystem> readingTableQuestionSystemRepository,
|
||||
IRepository<ReadingTableQuestionTrial> readingTableQuestionTrialRepository,
|
||||
IRepository<ReadingTaskQuestionAnswer> readingTaskQuestionAnswerRepository,
|
||||
@@ -90,6 +92,7 @@ namespace IRaCIS.Application.Services
|
||||
this._readingCriterionPageRepository = readingCriterionPageRepository;
|
||||
this._readingJudgeInfoRepository = readingJudgeInfoRepository;
|
||||
this._readModuleRepository = readModuleRepository;
|
||||
this._readingTableAnswerRowInfoRepository = readingTableAnswerRowInfoRepository;
|
||||
this._readingTableQuestionSystemRepository = readingTableQuestionSystemRepository;
|
||||
this._readingTableQuestionTrialRepository = readingTableQuestionTrialRepository;
|
||||
this._readingTaskQuestionAnswerRepository = readingTaskQuestionAnswerRepository;
|
||||
@@ -148,8 +151,6 @@ namespace IRaCIS.Application.Services
|
||||
x.Answer = answers.Where(y => y.ReadingQuestionTrialId == x.Id).Select(x => x.Answer).FirstOrDefault() ?? string.Empty;
|
||||
});
|
||||
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
var formType = await _readingQuestionCriterionTrialRepository.Where(x => x.Id == criterion.Id).Select(x => x.FormType).FirstOrDefaultAsync();
|
||||
@@ -162,8 +163,9 @@ namespace IRaCIS.Application.Services
|
||||
|
||||
var tableAnswers = await _readingTableQuestionAnswerRepository
|
||||
.ProjectTo<ReadingTableQuestionAnswerInfo>(_mapper.ConfigurationProvider)
|
||||
.Where(x => x.TaskId == inDto.VisitTaskId).ToListAsync();
|
||||
|
||||
.Where(x => x.VisitTaskId == inDto.VisitTaskId).ToListAsync();
|
||||
|
||||
var tableAnsweRowInfos = await _readingTableAnswerRowInfoRepository.Where(x => x.VisitTaskId == inDto.VisitTaskId).ToListAsync();
|
||||
|
||||
if (formType == FormType.MultiplePage)
|
||||
{
|
||||
@@ -183,7 +185,7 @@ namespace IRaCIS.Application.Services
|
||||
var pageGroupList = newPageQusetionList.Where(x => x.Type == "group" || (x.ParentId == null && x.GroupName.IsNullOrEmpty())).ToList();
|
||||
pageGroupList.ForEach(x =>
|
||||
{
|
||||
this.FindChildQuestion(x, newPageQusetionList, tableQuestionList, tableAnswers);
|
||||
this.FindChildQuestion(x, newPageQusetionList, tableQuestionList, tableAnswers, tableAnsweRowInfos);
|
||||
});
|
||||
|
||||
page.Childrens = pageGroupList.Where(x => !(x.Type == "group" && x.Childrens.Count() == 0)).ToList();
|
||||
@@ -200,7 +202,7 @@ namespace IRaCIS.Application.Services
|
||||
groupList = qusetionList.Where(x => x.Type == "group" || (x.ParentId == null && x.GroupName.IsNullOrEmpty())).ToList();
|
||||
groupList.ForEach(x =>
|
||||
{
|
||||
this.FindChildQuestion(x, qusetionList, tableQuestionList, tableAnswers);
|
||||
this.FindChildQuestion(x, qusetionList, tableQuestionList, tableAnswers, tableAnsweRowInfos);
|
||||
});
|
||||
|
||||
groupList = groupList.Where(x => !(x.Type == "group" && x.Childrens.Count() == 0)).ToList();
|
||||
@@ -226,7 +228,7 @@ namespace IRaCIS.Application.Services
|
||||
/// <param name="item"></param>
|
||||
/// <param name="questionlists"></param>
|
||||
/// <param name="tableQuestionLists"></param>
|
||||
private void FindChildQuestion(TrialReadQuestionData item, List<TrialReadQuestionData> questionlists, List<ReadingTableQuestionTrial> tableQuestionLists,List<ReadingTableQuestionAnswerInfo> tableAnswers)
|
||||
private void FindChildQuestion(TrialReadQuestionData item, List<TrialReadQuestionData> questionlists, List<ReadingTableQuestionTrial> tableQuestionLists,List<ReadingTableQuestionAnswerInfo> tableAnswers,List<ReadingTableAnswerRowInfo> tableAnsweRowInfos)
|
||||
{
|
||||
item.Childrens = questionlists.Where(x => x.ParentId == item.Id || (item.Type == "group" && x.Type != "group" && x.ParentId == null && x.GroupName == item.GroupName)).ToList();
|
||||
item.TableQuestions = new TrialReadTableQuestion();
|
||||
@@ -234,17 +236,20 @@ namespace IRaCIS.Application.Services
|
||||
item.TableQuestions.Questions = tableQuestionLists.Where(x => x.ReadingQuestionId == item.Id).OrderBy(x=>x.ShowOrder).ToList();
|
||||
var thisAnswer = tableAnswers.Where(x => x.QuestionId == item.Id).ToList();
|
||||
var orders = thisAnswer.Select(x => x.RowIndex).Distinct().OrderBy(x => x).ToList();
|
||||
item.TableQuestions.Answers = new List<Dictionary<Guid, string>>();
|
||||
item.TableQuestions.Answers = new List<Dictionary<string, string>>();
|
||||
orders.ForEach(x =>
|
||||
{
|
||||
Dictionary<Guid, string> answers = new Dictionary<Guid, string>();
|
||||
Dictionary<string, string> answers = new Dictionary<string, string>();
|
||||
var rowAnswer = thisAnswer.Where(y => y.RowIndex == x).OrderBy(y => y.ShowOrder).ToList();
|
||||
rowAnswer.ForEach(z =>
|
||||
{
|
||||
|
||||
answers.Add(z.TableQuestionId, z.Answer);
|
||||
answers.Add(z.TableQuestionId.ToString(), z.Answer);
|
||||
});
|
||||
|
||||
var rowInfo = tableAnsweRowInfos.Where(y => y.RowIndex == x && y.QuestionId == item.Id).FirstOrDefault();
|
||||
|
||||
answers.Add("MeasureData", rowInfo==null?string.Empty:rowInfo.MeasureData);
|
||||
|
||||
item.TableQuestions.Answers.Add(answers);
|
||||
});
|
||||
|
||||
@@ -252,7 +257,7 @@ namespace IRaCIS.Application.Services
|
||||
{
|
||||
item.Childrens.ForEach(x =>
|
||||
{
|
||||
this.FindChildQuestion(x, questionlists, tableQuestionLists, tableAnswers);
|
||||
this.FindChildQuestion(x, questionlists, tableQuestionLists, tableAnswers, tableAnsweRowInfos);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1039,7 +1044,23 @@ namespace IRaCIS.Application.Services
|
||||
public void FindSystemChildQuestion(GetSystemReadingQuestionOutDto item, List<GetSystemReadingQuestionOutDto> questionlists,List<TableQuestionDataInfo> tableQuestions)
|
||||
{
|
||||
item.Childrens = questionlists.Where(x => x.ParentId == item.Id || (item.Type == "group" && x.Type != "group" && x.ParentId == null && x.GroupName == item.GroupName)).ToList();
|
||||
item.TableQuestions = tableQuestions.Where(x => x.ReadingQuestionId == item.Id).ToList();
|
||||
|
||||
|
||||
|
||||
|
||||
item.Childrens.AddRange(tableQuestions.Where(x => x.ReadingQuestionId == item.Id).Select(x => new GetSystemReadingQuestionOutDto
|
||||
{
|
||||
Childrens = new List<GetSystemReadingQuestionOutDto>(),
|
||||
ShowOrder = x.ShowOrder,
|
||||
GroupName = String.Empty,
|
||||
Id = x.Id,
|
||||
ImageCount = 0,
|
||||
ParentId = item.Id,
|
||||
QuestionName = x.QuestionName,
|
||||
Remark = x.Remark,
|
||||
|
||||
}));
|
||||
|
||||
if (item.Childrens != null && item.Childrens.Count != 0)
|
||||
{
|
||||
item.Childrens.ForEach(x =>
|
||||
@@ -1373,7 +1394,8 @@ namespace IRaCIS.Application.Services
|
||||
[HttpPost]
|
||||
public async Task<IResponseOutput> SubmitTableQuestion(SubmitTableQuestionInDto inDto)
|
||||
{
|
||||
await _readingTableQuestionAnswerRepository.BatchDeleteNoTrackingAsync(x => x.TaskId == inDto.TaskId && x.QuestionId == inDto.QuestionId && x.TrialId == inDto.TrialId);
|
||||
await _readingTableQuestionAnswerRepository.BatchDeleteNoTrackingAsync(x => x.VisitTaskId == inDto.VisitTaskId && x.QuestionId == inDto.QuestionId && x.TrialId == inDto.TrialId && x.RowIndex == inDto.RowIndex);
|
||||
await _readingTableAnswerRowInfoRepository.BatchDeleteNoTrackingAsync(x => x.VisitTaskId == inDto.VisitTaskId && x.QuestionId == inDto.QuestionId && x.TrialId == inDto.TrialId && x.RowIndex == inDto.RowIndex);
|
||||
List<ReadingTableQuestionAnswer> answerList = inDto.AnswerList.Select(x => new ReadingTableQuestionAnswer()
|
||||
{
|
||||
Answer=x.Answer,
|
||||
@@ -1382,8 +1404,20 @@ namespace IRaCIS.Application.Services
|
||||
QuestionId=inDto.QuestionId,
|
||||
TableQuestionId=x.TableQuestionId,
|
||||
RowIndex=inDto.RowIndex,
|
||||
TaskId=inDto.TaskId
|
||||
VisitTaskId = inDto.VisitTaskId
|
||||
}).ToList();
|
||||
|
||||
await _readingTableAnswerRowInfoRepository.AddAsync(new ReadingTableAnswerRowInfo()
|
||||
{
|
||||
Id = NewId.NextGuid(),
|
||||
TrialId = inDto.TrialId,
|
||||
QuestionId = inDto.QuestionId,
|
||||
MeasureData = inDto.MeasureData,
|
||||
RowIndex = inDto.RowIndex,
|
||||
VisitTaskId = inDto.VisitTaskId,
|
||||
|
||||
|
||||
});
|
||||
await _readingTableQuestionAnswerRepository.AddRangeAsync(answerList);
|
||||
await _readingTableQuestionAnswerRepository.SaveChangesAsync();
|
||||
return ResponseOutput.Ok(true);
|
||||
|
||||
Reference in New Issue
Block a user