From 674cd139eaa60f5cd82ee33c378944e844ae8a97 Mon Sep 17 00:00:00 2001 From: "{872297557@qq.com}" <872297557@qq.com> Date: Thu, 5 Jan 2023 16:16:06 +0800 Subject: [PATCH] =?UTF-8?q?AIR=20=E5=A2=9E=E5=8A=A0=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../IRaCIS.Core.Application.xml | 2 +- .../Allocation/DTO/VisitTaskViewModel.cs | 14 ++++ .../Service/Allocation/VisitTaskService.cs | 65 +++++++++---------- IRaCIS.Core.Domain.Share/User/UserType.cs | 8 ++- 4 files changed, 54 insertions(+), 35 deletions(-) diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml index 292419d36..560a6027b 100644 --- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml +++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml @@ -1274,7 +1274,7 @@ - 将上一次的病灶信息添加到这一次 + 将上一次的访视病灶添加到这一次 diff --git a/IRaCIS.Core.Application/Service/Allocation/DTO/VisitTaskViewModel.cs b/IRaCIS.Core.Application/Service/Allocation/DTO/VisitTaskViewModel.cs index 752ca4329..e1ad5572f 100644 --- a/IRaCIS.Core.Application/Service/Allocation/DTO/VisitTaskViewModel.cs +++ b/IRaCIS.Core.Application/Service/Allocation/DTO/VisitTaskViewModel.cs @@ -688,6 +688,20 @@ namespace IRaCIS.Core.Application.ViewModel } + + public class AIRReReadingCommand + { + [NotDefault] + public Guid TrialId { get; set; } + + [NotDefault] + public Guid SubjectId { get; set; } + + [NotDefault] + public Guid TrialReadingCriterionId { get; set; } + } + + public class ApplyReReadingCommand { diff --git a/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs b/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs index 539b06c0a..7ce547cf3 100644 --- a/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs +++ b/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs @@ -1044,6 +1044,36 @@ namespace IRaCIS.Core.Application.Service.Allocation + [HttpPost] + [UnitOfWork] + public async Task AIRReReading(AIRReReadingCommand command, [FromServices] IVisitTaskHelpeService _visitTaskCommonService) + { + var task= await _visitTaskRepository.Where(t => t.TrialId == command.TrialId && t.SubjectId == command.SubjectId && t.TrialReadingCriterionId == command.TrialReadingCriterionId + && t.TaskState == TaskState.Effect && t.ReadingCategory == ReadingCategory.Visit && t.SourceSubjectVisit.IsBaseLine == true && t.DoctorUserId == _userInfo.Id).FirstOrDefaultAsync(); + + + if (task == null) + { + return ResponseOutput.NotOk("基线任务未阅完,不允许重阅基线任务"); + } + + await ApplyReReading(new ApplyReReadingCommand() { IsCopyFollowForms = false, IsCopyOrigenalForms = false, TaskIdList = new List() { task.Id }, TrialId = command.TrialId, RequestReReadingReason = "AIR自动重阅基线", RequestReReadingType = RequestReReadingType.DocotorApply }); + + + var requestRecord = await _visitTaskReReadingRepository.Where(t => t.OriginalReReadingTaskId == task.Id && t.RequestReReadingUserId == _userInfo.Id && t.RequestReReadingReason == "AIR自动重阅基线").OrderByDescending(t => t.CreateTime).FirstOrDefaultAsync(); + + await ConfirmReReading(new ConfirmReReadingCommand() + { + TrialId = command.TrialId, + RequestReReadingResultEnum = RequestReReadingResult.Agree, + ConfirmReReadingList = new List() { new ConfirmReReadingDTO() { Id = requestRecord.Id, OriginalReReadingTaskId = task.Id } } + }, _visitTaskCommonService); + + return ResponseOutput.Ok(); + + } + + /// /// 申请重阅 1:IR 2:PM @@ -1062,8 +1092,6 @@ namespace IRaCIS.Core.Application.Service.Allocation var trialReadingCriterionId = taskList.First()!.TrialReadingCriterionId; - //var trialConfig = (await _trialRepository.Where(t => t.Id == applyReReadingCommand.TrialId).Select(t => new { TrialId = t.Id, t.ReadingType, t.IsReadingTaskViewInOrder }).FirstOrDefaultAsync()).IfNullThrowException(); - var criterionConfig = (await _trialReadingCriterionRepository.Where(x => x.Id == trialReadingCriterionId).Select(x => new { x.ReadingTool, x.IsReadingTaskViewInOrder }).FirstOrDefaultAsync()).IfNullThrowException(); foreach (var task in taskList) @@ -1197,7 +1225,7 @@ namespace IRaCIS.Core.Application.Service.Allocation RequestReReadingReason = applyReReadingCommand.RequestReReadingReason, RequestReReadingType = applyReReadingCommand.RequestReReadingType, - }); ; + }); } @@ -1275,22 +1303,10 @@ namespace IRaCIS.Core.Application.Service.Allocation public async Task ConfirmReReading(ConfirmReReadingCommand agreeReReadingCommand, [FromServices] IVisitTaskHelpeService _visitTaskCommonService) { - var trialId = agreeReReadingCommand.TrialId; - //var trialConfig = (await _trialRepository.Where(t => t.Id == trialId).Select(t => new { TrialId = t.Id, t.IsReadingTaskViewInOrder, t.ReadingType }).FirstOrDefaultAsync()).IfNullThrowException(); - - foreach (var item in agreeReReadingCommand.ConfirmReReadingList) { - //var origenalTask = (await _visitTaskRepository.Where(t => item.OriginalReReadingTaskId == t.Id, true).FirstOrDefaultAsync()).IfNullThrowException(); - - ////更新原始任务 当前任务处理 - //origenalTask.ReReadingApplyState = agreeReReadingCommand.RequestReReadingResultEnum == RequestReReadingResult.Agree ? ReReadingApplyState.Agree : ReReadingApplyState.Reject; - //origenalTask.TaskState = agreeReReadingCommand.RequestReReadingResultEnum == RequestReReadingResult.Agree ? TaskState.HaveReturned : origenalTask.TaskState; - - - var origenalTask = (await _visitTaskRepository.Where(t => item.OriginalReReadingTaskId == t.Id).FirstOrDefaultAsync()).IfNullThrowException(); @@ -1304,7 +1320,6 @@ namespace IRaCIS.Core.Application.Service.Allocation var criterionConfig = await _trialReadingCriterionRepository.Where(x => x.Id == origenalTask.TrialReadingCriterionId).Select(x => new { x.ReadingTool, x.IsReadingTaskViewInOrder }).FirstOrDefaultAsync(); - //更新申请信息 var visitTaskReReadingAppply = await _visitTaskReReadingRepository.FirstOrDefaultAsync(t => t.Id == item.Id); visitTaskReReadingAppply.RequestReReadingConfirmUserId = _userInfo.Id; @@ -1312,22 +1327,6 @@ namespace IRaCIS.Core.Application.Service.Allocation visitTaskReReadingAppply.RequestReReadingRejectReason = agreeReReadingCommand.RequestReReadingRejectReason; - //// 当前访视之前 已有任务申请 - //if (trialConfig.IsReadingTaskViewInOrder) - //{ - - // var query = _visitTaskReReadingRepository.Where(t => t.OriginalReReadingTask.SubjectId == origenalTask.SubjectId && t.OriginalReReadingTask.TaskState == TaskState.Effect && t.OriginalReReadingTask.ReadingCategory == ReadingCategory.Visit - // && t.OriginalReReadingTask.ReadingTaskState == ReadingTaskState.HaveSigned && t.OriginalReReadingTask.VisitTaskNum > origenalTask.VisitTaskNum && t.RequestReReadingResultEnum == RequestReReadingResult.Default) - // .Where(t => t.OriginalReReadingTask.IsAnalysisCreate == origenalTask.IsAnalysisCreate); - - // if (await query.AnyAsync()) - // { - // return ResponseOutput.NotOk("当前为有序阅片,当前访视之后,也申请了重阅 必须从后向前处理"); - - // } - //} - - Expression> filterExpression = t => t.TrialId == trialId && t.SubjectId == origenalTask.SubjectId && t.TaskState == TaskState.Effect && t.TaskAllocationState == TaskAllocationState.Allocated; //是否是一致性分析任务 正常申请 会影响一致性分析任务 @@ -1518,7 +1517,7 @@ namespace IRaCIS.Core.Application.Service.Allocation } //IR申请 PM 审批 注意这里有一致性分析的申请同意 不会回退访视,在此要生成影响的访视任务 - else if (visitTaskReReadingAppply.RequestReReadingType == RequestReReadingType.DocotorApply && _userInfo.UserTypeEnumInt == (int)UserTypeEnum.ProjectManager) + else if (visitTaskReReadingAppply.RequestReReadingType == RequestReReadingType.DocotorApply && (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ProjectManager ||_userInfo.UserTypeEnumInt==(int)UserTypeEnum.AIR)) { #region 两个IR 申请同一访视,其他人的申请记录也设置为同意 diff --git a/IRaCIS.Core.Domain.Share/User/UserType.cs b/IRaCIS.Core.Domain.Share/User/UserType.cs index 944c5fe7e..10c1e767d 100644 --- a/IRaCIS.Core.Domain.Share/User/UserType.cs +++ b/IRaCIS.Core.Domain.Share/User/UserType.cs @@ -55,9 +55,15 @@ CMM=19, + + AIR=21, + //医生用户类型暂不处理 - ShareImage = 15, + ShareImage = 125, + + + Undefined=0