修改一版
This commit is contained in:
@@ -67,7 +67,7 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
||||
|
||||
|
||||
[NotDefault]
|
||||
public string AnswerGroup { get; set; }
|
||||
public List<string> AnswerGroup { get; set; }
|
||||
}
|
||||
|
||||
public class GetTrialCriterionJudgeQuestionListOutDto
|
||||
|
||||
@@ -13,6 +13,7 @@ using IRaCIS.Core.Infra.EFCore.Common;
|
||||
using Panda.DynamicWebApi.Attributes;
|
||||
using AutoMapper;
|
||||
using IRaCIS.Core.Application.Contracts;
|
||||
using IRaCIS.Core.Infrastructure;
|
||||
|
||||
namespace IRaCIS.Application.Services
|
||||
{
|
||||
@@ -60,13 +61,17 @@ namespace IRaCIS.Application.Services
|
||||
GetReadingTaskDto? task = new GetReadingTaskDto();
|
||||
if (subjectId != null)
|
||||
{
|
||||
task = await _visitTaskRepository.Where(x => x.TrialId == trialId && x.ReadingTaskState != ReadingTaskState.HaveSigned && x.SubjectId == subjectId.Value).Select(x => new GetReadingTaskDto()
|
||||
task = await _visitTaskRepository.Where(x => x.TrialId == trialId && x.ReadingTaskState != ReadingTaskState.HaveSigned && x.SubjectId == subjectId.Value).Select(x => new GetReadingTaskDto()
|
||||
{
|
||||
VisistTaskId=x.Id,
|
||||
ReadingCategory = x.ReadingCategory,
|
||||
VisistId = x.ReadingCategory == ReadingCategory.Visit ? x.SourceSubjectVisitId.Value : x.ReadModule.SubjectVisitId,
|
||||
VisitNum = x.ReadingCategory == ReadingCategory.Visit ? x.SubjectVisit.VisitNum : x.ReadModule.VisitNum
|
||||
}).OrderBy(x => x.VisitNum).ThenBy(x => x.ReadingCategory).FirstOrDefaultAsync();
|
||||
if (task == null)
|
||||
{
|
||||
throw new BusinessValidationFailedException("任务都已经完成");
|
||||
}
|
||||
task.SubjectId = subjectId.Value;
|
||||
|
||||
|
||||
@@ -80,7 +85,10 @@ namespace IRaCIS.Application.Services
|
||||
VisistId = x.ReadingCategory == ReadingCategory.Visit ? x.SourceSubjectVisitId.Value : x.ReadModule.SubjectVisitId,
|
||||
VisitNum = x.ReadingCategory == ReadingCategory.Visit ? x.SubjectVisit.VisitNum : x.ReadModule.VisitNum
|
||||
}).FirstOrDefaultAsync();
|
||||
|
||||
if (task == null)
|
||||
{
|
||||
throw new BusinessValidationFailedException("任务都已经完成");
|
||||
}
|
||||
task.SubjectId = await _subjectVisitRepository.Where(x => x.Id == task.VisistId).Select(x => x.SubjectId).FirstOrDefaultAsync();
|
||||
}
|
||||
|
||||
@@ -171,8 +179,8 @@ namespace IRaCIS.Application.Services
|
||||
{
|
||||
await _readingQuestionTrialRepository.UpdatePartialFromQueryAsync(inDto.ReadingQuestionTrialId, x => new ReadingQuestionTrial()
|
||||
{
|
||||
AnswerGroup = inDto.AnswerGroup
|
||||
});
|
||||
AnswerGroup = inDto.AnswerGroup.ToString()
|
||||
}) ;
|
||||
|
||||
var result = await _readingQuestionTrialRepository.SaveChangesAsync();
|
||||
|
||||
@@ -185,9 +193,11 @@ namespace IRaCIS.Application.Services
|
||||
/// <param name="inDto"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<List<GetTrialReadingQuestionOutDto>> GetTrialReadingQuestion(GetTrialReadingQuestionInDto inDto)
|
||||
public async Task<(List<GetTrialReadingQuestionOutDto>, TaskState)> GetTrialReadingQuestion(GetTrialReadingQuestionInDto inDto)
|
||||
{
|
||||
var query= from data in _readingQuestionTrialRepository.Where(x => x.ReadingQuestionCriterionTrialId==inDto.ReadingQuestionCriterionTrialId )
|
||||
|
||||
var readingTaskState = await _visitTaskRepository.Where(x => x.Id == inDto.VisitTaskId).Select(x => x.TaskState).FirstOrDefaultAsync();
|
||||
var query= from data in _readingQuestionTrialRepository.Where(x => x.ReadingQuestionCriterionTrialId==inDto.ReadingQuestionCriterionTrialId )
|
||||
join questionAnswer in _readingTaskQuestionAnswerRepository.Where(x=>x.VisitTaskId==inDto.VisitTaskId) on data.Id equals questionAnswer.ReadingQuestionTrialId into questionAnswerTemp
|
||||
from leftquestionAnswer in questionAnswerTemp.DefaultIfEmpty()
|
||||
select new GetTrialReadingQuestionOutDto()
|
||||
@@ -215,7 +225,7 @@ namespace IRaCIS.Application.Services
|
||||
{
|
||||
FindChildQuestion(x, qusetionList);
|
||||
});
|
||||
return groupList;
|
||||
return (groupList, readingTaskState);
|
||||
}
|
||||
|
||||
|
||||
@@ -258,17 +268,12 @@ namespace IRaCIS.Application.Services
|
||||
TrialId = inDto.TrialId
|
||||
}).ToList();
|
||||
await _readingTaskQuestionAnswerRepository.AddRangeAsync(readingTaskAnswerList);
|
||||
|
||||
|
||||
var result = await _visitTaskRepository.SaveChangesAsync();
|
||||
return ResponseOutput.Ok(result);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 提交问题
|
||||
/// </summary>
|
||||
@@ -284,7 +289,6 @@ namespace IRaCIS.Application.Services
|
||||
});
|
||||
var result = await _visitTaskRepository.SaveChangesAsync();
|
||||
return ResponseOutput.Ok(result);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user