diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml index 67e4e5dd1..07a7b8470 100644 --- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml +++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml @@ -4148,6 +4148,20 @@ + + + 获取项目标准的裁判问题 + + + + + + + 设置裁判问题的答案分组 + + + + 获取项目的阅片问题 diff --git a/IRaCIS.Core.Application/Service/Reading/Dto/ReadingImageTaskViewModel.cs b/IRaCIS.Core.Application/Service/Reading/Dto/ReadingImageTaskViewModel.cs index 569dc267c..ff453edc0 100644 --- a/IRaCIS.Core.Application/Service/Reading/Dto/ReadingImageTaskViewModel.cs +++ b/IRaCIS.Core.Application/Service/Reading/Dto/ReadingImageTaskViewModel.cs @@ -67,7 +67,7 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto [NotDefault] - public string AnswerGroup { get; set; } + public List AnswerGroup { get; set; } } public class GetTrialCriterionJudgeQuestionListOutDto diff --git a/IRaCIS.Core.Application/Service/Reading/ReadingImageTaskService.cs b/IRaCIS.Core.Application/Service/Reading/ReadingImageTaskService.cs index fedd57ad6..a10fa7f3f 100644 --- a/IRaCIS.Core.Application/Service/Reading/ReadingImageTaskService.cs +++ b/IRaCIS.Core.Application/Service/Reading/ReadingImageTaskService.cs @@ -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 /// /// [HttpPost] - public async Task> GetTrialReadingQuestion(GetTrialReadingQuestionInDto inDto) + public async Task<(List, 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); - } - - /// /// 提交问题 /// @@ -284,7 +289,6 @@ namespace IRaCIS.Application.Services }); var result = await _visitTaskRepository.SaveChangesAsync(); return ResponseOutput.Ok(result); - }