diff --git a/IRaCIS.Core.API/Controllers/InspectionController.cs b/IRaCIS.Core.API/Controllers/InspectionController.cs index 88534140b..f9798cd6b 100644 --- a/IRaCIS.Core.API/Controllers/InspectionController.cs +++ b/IRaCIS.Core.API/Controllers/InspectionController.cs @@ -351,6 +351,23 @@ namespace IRaCIS.Core.API.Controllers return result; } + /// + /// 提交阅片裁判表单 + /// + /// + /// + [HttpPost, Route("Inspection/ReadingImageTask/SubmitJudgeForm")] + [TrialGlobalLimit("AfterStopCannNotOpt")] + + [UnitOfWork] + + public async Task SubmitJudgeForm(DataInspectionDto opt) + { + var singid = await _inspectionService.RecordSing(opt.SignInfo); + var result = await _iReadingImageTaskService.SubmitJudgeForm(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 6ab71cbf2..52d141259 100644 --- a/IRaCIS.Core.Application/Service/Reading/Dto/ReadingImageTaskViewModel.cs +++ b/IRaCIS.Core.Application/Service/Reading/Dto/ReadingImageTaskViewModel.cs @@ -2512,6 +2512,10 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto [NotDefault] public Guid VisitTaskId { get; set; } + public string JudgeResultRemark { get; set; } = string.Empty; + + public List JudgeResultImagePathList { get; set; } = new List(); + public List QuestionList { get; set; } = new List(); } diff --git a/IRaCIS.Core.Application/Service/Reading/Interface/IReadingImageTaskService.cs b/IRaCIS.Core.Application/Service/Reading/Interface/IReadingImageTaskService.cs index db9ca1114..dc3a3874d 100644 --- a/IRaCIS.Core.Application/Service/Reading/Interface/IReadingImageTaskService.cs +++ b/IRaCIS.Core.Application/Service/Reading/Interface/IReadingImageTaskService.cs @@ -15,6 +15,7 @@ namespace IRaCIS.Core.Application.Contracts Task TriggerJudgeQuestion(Guid visitTaskId); Task SubmitVisitTaskQuestions(SubmitVisitTaskQuestionsInDto inDto); + Task SubmitJudgeForm(SetJudgeFormInDto inDto); Task SubmitJudgeVisitTaskResult(SaveJudgeVisitTaskResult inDto); Task GetOncologyReadingInfo(GetOncologyReadingInfoInDto inDto); diff --git a/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingJudgeTaskService.cs b/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingJudgeTaskService.cs index 9c6460738..5852b444d 100644 --- a/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingJudgeTaskService.cs +++ b/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingJudgeTaskService.cs @@ -195,6 +195,21 @@ namespace IRaCIS.Core.Application.Service /// [HttpPost] public async Task SetJudgeForm(SetJudgeFormInDto inDto) + { + + await SaveJudgeForm(inDto); + await _visitTaskRepository.UpdatePartialFromQueryAsync(inDto.VisitTaskId, x => new VisitTask() + { + JudgeResultRemark = inDto.JudgeResultRemark, + JudgeResultImagePath = string.Join(',', inDto.JudgeResultImagePathList), + + }); + + return ResponseOutput.Result(await _readingTaskQuestionAnswerRepository.SaveChangesAsync()); + } + + + private async Task SaveJudgeForm(SetJudgeFormInDto inDto) { var taskInfo = await _visitTaskRepository.Where(x => x.Id == inDto.VisitTaskId).FirstNotNullAsync(); var judgeRule = await _readingQuestionCriterionTrialRepository.Where(x => x.Id == taskInfo.TrialReadingCriterionId).Select(x => x.JudgeRuleEnum).FirstNotNullAsync(); @@ -216,12 +231,38 @@ namespace IRaCIS.Core.Application.Service }).ToList()); } - return ResponseOutput.Result(await _readingTaskQuestionAnswerRepository.SaveChangesAsync()); } + /// + /// 提交裁判表单 + /// + /// + /// + [HttpPost] + public async Task SubmitJudgeForm(SetJudgeFormInDto inDto) + { + + await SaveJudgeForm(inDto); + await _visitTaskRepository.UpdatePartialFromQueryAsync(inDto.VisitTaskId, x => new VisitTask() + { + JudgeResultRemark = inDto.JudgeResultRemark, + ReadingTaskState = ReadingTaskState.HaveSigned, + SignTime=DateTime.Now, + JudgeResultImagePath = string.Join(',', inDto.JudgeResultImagePathList), + + }); + await _readingTaskQuestionAnswerRepository.SaveChangesAsync(); + + await SignatureAfter(inDto.VisitTaskId); + return ResponseOutput.Ok(); + } + + private async Task> GetJudgeDisplayQuestions(Guid trialReadingCriterionId, decimal visitNum, JudgeRule judgeRule) { - var questionList = await _readingQuestionTrialRepository.Where(x => x.ReadingQuestionCriterionTrialId == trialReadingCriterionId && x.IsJudgeQuestion).OrderBy(x => x.ShowOrder).ToListAsync(); + var questionList = await _readingQuestionTrialRepository.Where(x => x.ReadingQuestionCriterionTrialId == trialReadingCriterionId && x.IsJudgeQuestion) + .Where(x=>x.ShowQuestion== ShowQuestion.Show) + .OrderBy(x => x.ShowOrder).ToListAsync(); var questionIds = questionList.Select(x => x.Id).ToList(); var visitJudgeRules = judgeRule == JudgeRule.Difference ? await _readingQuestionVisitJudgeRuleRepository.Where(x => questionIds.Contains(x.ReadingQuestionId) && (x.VisitNum == visitNum || x.VisitNum == -1)).ToListAsync() @@ -620,8 +661,15 @@ namespace IRaCIS.Core.Application.Service }); var result = await _visitTaskRepository.SaveChangesAsync(); + await SignatureAfter(inDto.VisitTaskId); + + return ResponseOutput.Ok(result); + } + + private async Task SignatureAfter(Guid visitTaskId) + { // 需要判断是否添加肿瘤学任务 - var taskInfo = await _visitTaskRepository.Where(x => x.JudgeVisitTaskId == inDto.VisitTaskId).Include(x => x.TrialReadingCriterion).FirstNotNullAsync(); + var taskInfo = await _visitTaskRepository.Where(x => x.JudgeVisitTaskId == visitTaskId).Include(x => x.TrialReadingCriterion).FirstNotNullAsync(); if (taskInfo.ReadingCategory == ReadingCategory.Visit) { @@ -658,11 +706,9 @@ namespace IRaCIS.Core.Application.Service // 创建任务关联关系 - await this.CreateTaskRelated(inDto.VisitTaskId); + await this.CreateTaskRelated(visitTaskId); - await SafeMailHelper.Run(async () => await _trialEmailNoticeConfigService.BaseBusinessScenarioSendEmailAsync(inDto.VisitTaskId)); - - return ResponseOutput.Ok(result); + await SafeMailHelper.Run(async () => await _trialEmailNoticeConfigService.BaseBusinessScenarioSendEmailAsync(visitTaskId)); } ///