From 284cf6e6a41fa4fae64ab1c7d1672072e4df0c4f Mon Sep 17 00:00:00 2001 From: he <10978375@qq.com> Date: Thu, 23 Jun 2022 15:24:31 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=80=E7=89=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/InspectionController.cs | 16 ++++ .../Reading/Dto/ReadingImageTaskViewModel.cs | 24 ++++- .../Interface/IReadingImageTaskService.cs | 2 + .../Reading/ReadingImageTaskService.cs | 94 ++++++++++++++++++- IRaCIS.Core.Domain/Allocation/VisitTask.cs | 6 +- 5 files changed, 137 insertions(+), 5 deletions(-) diff --git a/IRaCIS.Core.API/Controllers/InspectionController.cs b/IRaCIS.Core.API/Controllers/InspectionController.cs index ee240c0ea..e9b53ceaa 100644 --- a/IRaCIS.Core.API/Controllers/InspectionController.cs +++ b/IRaCIS.Core.API/Controllers/InspectionController.cs @@ -116,6 +116,22 @@ namespace IRaCIS.Core.API.Controllers } + /// + /// 提交阅片裁判问题 + /// + /// + /// + [HttpPost, Route("Inspection/ReadingImageTask/SubmitJudgeVisitTaskResult")] + [UnitOfWork] + public async Task SubmitJudgeVisitTaskResult(DataInspectionDto opt) + { + var singid = await _inspectionService.RecordSing(opt.SignInfo); + var result = await _iReadingImageTaskService.SubmitJudgeVisitTaskResult(opt.Data); + await _inspectionService.CompletedSign(singid, result); + return result; + } + + /// /// 配置 基础逻辑信息并确认 /// diff --git a/IRaCIS.Core.Application/Service/Reading/Dto/ReadingImageTaskViewModel.cs b/IRaCIS.Core.Application/Service/Reading/Dto/ReadingImageTaskViewModel.cs index 443113e39..75b040a56 100644 --- a/IRaCIS.Core.Application/Service/Reading/Dto/ReadingImageTaskViewModel.cs +++ b/IRaCIS.Core.Application/Service/Reading/Dto/ReadingImageTaskViewModel.cs @@ -128,9 +128,31 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto { public Guid? JudgeResultTaskId { get; set; } - //public List + public List VisitTaskInfoList { get; set; } + + public ReadingTaskState ReadingTaskState { get; set; } } + public class SaveJudgeVisitTaskResult + { + public Guid VisitTaskId { get; set; } + + public Guid JudgeResultTaskId { get; set; } + } + + public class GetJudgeReadingInfo + { + public Guid VisitTaskId { get; set; } + } + + public class JudgeReadingInfoDto + { + public Guid VisitTaskId { get; set; } + + + public List TaskReadingQuestionList { get; set; } +} + public class GetTrialReadingQuestionInDto { [NotDefault] diff --git a/IRaCIS.Core.Application/Service/Reading/Interface/IReadingImageTaskService.cs b/IRaCIS.Core.Application/Service/Reading/Interface/IReadingImageTaskService.cs index 1b1c4e6dd..d49df31c7 100644 --- a/IRaCIS.Core.Application/Service/Reading/Interface/IReadingImageTaskService.cs +++ b/IRaCIS.Core.Application/Service/Reading/Interface/IReadingImageTaskService.cs @@ -12,5 +12,7 @@ namespace IRaCIS.Core.Application.Contracts public interface IReadingImageTaskService { Task SubmitVisitTaskQuestions(SubmitVisitTaskQuestionsInDto inDto); + + Task SubmitJudgeVisitTaskResult(SaveJudgeVisitTaskResult inDto) } } \ No newline at end of file diff --git a/IRaCIS.Core.Application/Service/Reading/ReadingImageTaskService.cs b/IRaCIS.Core.Application/Service/Reading/ReadingImageTaskService.cs index 996fe6ff7..8541af15e 100644 --- a/IRaCIS.Core.Application/Service/Reading/ReadingImageTaskService.cs +++ b/IRaCIS.Core.Application/Service/Reading/ReadingImageTaskService.cs @@ -275,13 +275,103 @@ namespace IRaCIS.Application.Services }); } + /// + /// 获取阅片任务和答案 + /// + /// + private async Task> GetTaskAndAnswer(Guid visitTaskId) + { + var taskQuery=from questionAnswer in _readingTaskQuestionAnswerRepository.Where(x=>x.VisitTaskId== visitTaskId) + join trialQuestion in _readingQuestionTrialRepository.AsQueryable() on questionAnswer.ReadingQuestionTrialId equals trialQuestion.Id + select new GetTrialReadingQuestionOutDto() + { + ReadingQuestionTrialId = trialQuestion.Id, + ReadingQuestionCriterionTrialId = trialQuestion.ReadingQuestionCriterionTrialId, + TrialId = trialQuestion.TrialId, + Type = trialQuestion.Type, + ParentTriggerValue = trialQuestion.ParentTriggerValue, + GroupName = trialQuestion.GroupName, + QuestionName = trialQuestion.QuestionName, + IsRequired = trialQuestion.IsRequired, + ShowOrder = trialQuestion.ShowOrder, + ParentId = trialQuestion.ParentId, + TypeValue = trialQuestion.TypeValue, + Answer = questionAnswer.Answer + }; + var qusetionList = await taskQuery.OrderBy(x => x.ShowOrder).ToListAsync(); + List groupList = qusetionList.Where(x => x.ParentId == null).ToList(); + groupList.ForEach(x => + { + FindChildQuestion(x, qusetionList); + }); + + return groupList; + } + /// /// 获取裁判阅片任务信息 /// /// - public async Task GetJudgeReadingInfo() + [HttpPost] + public async Task GetJudgeReadingInfo(GetJudgeReadingInfo inDto) { - + var visitTask = await _visitTaskRepository.Where(x => x.Id == inDto.VisitTaskId).Select(x => new + { + x.ReadingTaskState, + x.JudgeResultTaskId, + }).FirstOrDefaultAsync(); + GetJudgeReadingInfoOutDto judgeInfo = new GetJudgeReadingInfoOutDto() + { + ReadingTaskState = visitTask.ReadingTaskState, + JudgeResultTaskId = visitTask.JudgeResultTaskId, + VisitTaskInfoList = new List() + }; + var visitIds = await _visitTaskRepository.Where(x => x.JudgeVisitTaskId == inDto.VisitTaskId).Select(x => x.Id).ToListAsync(); + foreach (var item in visitIds) + { + var taskReadingQuestionList = await this.GetTaskAndAnswer(item); + judgeInfo.VisitTaskInfoList.Add( + new JudgeReadingInfoDto() + { + VisitTaskId = item, + TaskReadingQuestionList = taskReadingQuestionList, + }); + } + return judgeInfo; + } + + /// + /// 保存裁判问题 + /// + /// + /// + [HttpPost] + public async Task SaveJudgeVisitTaskResult(SaveJudgeVisitTaskResult inDto) + { + await _visitTaskRepository.UpdatePartialFromQueryAsync(inDto.VisitTaskId, x => new VisitTask() + { + JudgeResultTaskId = inDto.JudgeResultTaskId + }); + var result=await _visitTaskRepository.SaveChangesAsync(); + return ResponseOutput.Ok(result); + } + + /// + /// 提交裁判问题 + /// + /// + /// + [NonDynamicMethod] + public async Task SubmitJudgeVisitTaskResult(SaveJudgeVisitTaskResult inDto) + { + await _visitTaskRepository.UpdatePartialFromQueryAsync(inDto.VisitTaskId, x => new VisitTask() + { + JudgeResultTaskId = inDto.JudgeResultTaskId, + ReadingTaskState = ReadingTaskState.HaveSigned, + SignTime = DateTime.Now, + }); + var result = await _visitTaskRepository.SaveChangesAsync(); + return ResponseOutput.Ok(result); } /// diff --git a/IRaCIS.Core.Domain/Allocation/VisitTask.cs b/IRaCIS.Core.Domain/Allocation/VisitTask.cs index 8add719fe..bde676aac 100644 --- a/IRaCIS.Core.Domain/Allocation/VisitTask.cs +++ b/IRaCIS.Core.Domain/Allocation/VisitTask.cs @@ -188,10 +188,12 @@ namespace IRaCIS.Core.Domain.Models public SubjectUser SujectArm { get; set; } + /// + /// 裁判结果的任务ID + /// + public Guid? JudgeResultTaskId { get; set; } - - //建议完成时间 //public int SuggesteDays { get; set; } }