diff --git a/IRaCIS.Core.API/Controllers/InspectionController.cs b/IRaCIS.Core.API/Controllers/InspectionController.cs index 88c449a4e..7f2cddbbf 100644 --- a/IRaCIS.Core.API/Controllers/InspectionController.cs +++ b/IRaCIS.Core.API/Controllers/InspectionController.cs @@ -7,6 +7,7 @@ using IRaCIS.Core.Application.Contracts; using IRaCIS.Core.Application.Image.QA; using IRaCIS.Core.Application.Interfaces; +using IRaCIS.Core.Application.Service; using IRaCIS.Core.Application.Service.Inspection.DTO; using IRaCIS.Core.Application.Service.Inspection.Interface; using IRaCIS.Core.Application.Service.Reading.Dto; @@ -383,5 +384,20 @@ namespace IRaCIS.Core.API.Controllers } + /// + /// 重阅同意 + /// + /// + [HttpPost, Route("Inspection/VisitTask/ConfirmReReading")] + [UnitOfWork] + + public async Task ConfirmReReading(DataInspectionDto opt , [FromServices] IVisitTaskHelpeService _visitTaskCommonService,[FromServices] IVisitTaskService _visitTaskService) + { + var singId = await _inspectionService.RecordSing(opt.SignInfo); + var result = await _visitTaskService.ConfirmReReading(opt.Data, _visitTaskCommonService); + await _inspectionService.CompletedSign(singId, result); + return result; + } + } } diff --git a/IRaCIS.Core.API/IRaCIS.Core.API.xml b/IRaCIS.Core.API/IRaCIS.Core.API.xml index 6a2b02bcd..b8e6bcbcc 100644 --- a/IRaCIS.Core.API/IRaCIS.Core.API.xml +++ b/IRaCIS.Core.API/IRaCIS.Core.API.xml @@ -194,6 +194,12 @@ + + + 重阅同意 + + + 流式上传 直接返回 diff --git a/IRaCIS.Core.Application/Service/Allocation/Interface/IVisitTaskService.cs b/IRaCIS.Core.Application/Service/Allocation/Interface/IVisitTaskService.cs index 5050515cb..db79af969 100644 --- a/IRaCIS.Core.Application/Service/Allocation/Interface/IVisitTaskService.cs +++ b/IRaCIS.Core.Application/Service/Allocation/Interface/IVisitTaskService.cs @@ -6,11 +6,14 @@ using IRaCIS.Core.Application.ViewModel; +using Microsoft.AspNetCore.Mvc; namespace IRaCIS.Core.Application.Service { public interface IVisitTaskService { Task ApplyReReading(ApplyReReadingCommand applyReReadingCommand); + + Task ConfirmReReading(ConfirmReReadingCommand agreeReReadingCommand, [FromServices] IVisitTaskHelpeService _visitTaskCommonService); } } \ No newline at end of file diff --git a/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs b/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs index 7272bbf03..9a970866a 100644 --- a/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs +++ b/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs @@ -1227,6 +1227,19 @@ namespace IRaCIS.Core.Application.Service.Allocation foreach (var influenceTask in influenceTaskList) { + //处理申请的任务 + if (influenceTask.Id == origenalTask.Id) + { + ReReadingTaskTrackingDeal(influenceTask, agreeReReadingCommand); + + influenceTaskList.ForEach(t => + { + //记录实际影像的任务 + + influenceTask.TaskInfluenceList.Add(new TaskInfluence() { InfluenceTaskId = t.Id }); + }); + } + //申请的访视 要不是重阅重置,要不就是失效 不会存在取消分配 if (influenceTask.ReadingCategory == ReadingCategory.Visit && influenceTask.VisitTaskNum != origenalTask.VisitTaskNum) { @@ -1246,6 +1259,93 @@ namespace IRaCIS.Core.Application.Service.Allocation influenceTask.TaskAllocationState = TaskAllocationState.NotAllocate; } } + //另外一个人当前访视 + else + { + if (influenceTask.ReadingTaskState == ReadingTaskState.HaveSigned) + { + influenceTask.TaskState = TaskState.HaveReturned; + } + else + { + influenceTask.TaskState = TaskState.Adbandon; + } + + } + } + #endregion + } + //无序阅片 没有 全局 肿瘤学 + else + { + + #region old + + + ////阅片任务产生了裁判 + //if (origenalTask.JudgeVisitTaskId != null) + //{ + + // //裁判任务是否已阅片完成 + // var judgeTask = await _visitTaskRepository.FirstOrDefaultAsync(t => t.Id == origenalTask.JudgeVisitTaskId); + + // if (judgeTask.ReadingTaskState == ReadingTaskState.HaveSigned) + // { + // judgeTask.TaskState = TaskState.HaveReturned; + // } + // //裁判任务未完 + // else + // { + // judgeTask.TaskState = TaskState.Adbandon; + // } + + //} + + ////不管是否触发裁判 阅片任务退回,待影像重传后重新分 配给原阅片人 + + //if (trialConfig.ReadingType == ReadingMethod.Double) + //{ + // //考虑该访视 另外一个阅片人的任务也同时退回 + + // var otherTask = await _visitTaskRepository.FirstOrDefaultAsync(t => t.SourceSubjectVisitId == origenalTask.SourceSubjectVisitId && t.Id != origenalTask.Id && t.TaskState == TaskState.Effect); + + // if (otherTask.ReadingTaskState == ReadingTaskState.HaveSigned) + // { + // otherTask.TaskState = TaskState.HaveReturned; + // } + // else + // { + // otherTask.TaskState = TaskState.Adbandon; + // } + + //} + + #endregion + + // 1.当前任务及裁判任务 + // 2.影响所有阅片人的任务 + + var judegTaskNum = origenalTask.VisitTaskNum + ReadingCommon.TaskNumDic[ReadingCategory.Judge]; + + filterExpression = filterExpression.And(t => t.VisitTaskNum == origenalTask.VisitTaskNum || t.VisitTaskNum == judegTaskNum); + + + var influenceTaskList = await _visitTaskRepository.Where(filterExpression, true).ToListAsync(); + + foreach (var influenceTask in influenceTaskList) + { + //处理申请的任务 + if (influenceTask.Id == origenalTask.Id) + { + ReReadingTaskTrackingDeal(influenceTask, agreeReReadingCommand); + + influenceTaskList.ForEach(t => + { + //记录实际影像的任务 + + influenceTask.TaskInfluenceList.Add(new TaskInfluence() { InfluenceTaskId = t.Id }); + }); + } else { if (influenceTask.ReadingTaskState == ReadingTaskState.HaveSigned) @@ -1257,56 +1357,8 @@ namespace IRaCIS.Core.Application.Service.Allocation influenceTask.TaskState = TaskState.Adbandon; } } - - } - #endregion - - - } - //无序阅片 没有 全局 肿瘤学 - else - { - //阅片任务产生了裁判 - if (origenalTask.JudgeVisitTaskId != null) - { - - //裁判任务是否已阅片完成 - var judgeTask = await _visitTaskRepository.FirstOrDefaultAsync(t => t.Id == origenalTask.JudgeVisitTaskId); - - if (judgeTask.ReadingTaskState == ReadingTaskState.HaveSigned) - { - judgeTask.TaskState = TaskState.HaveReturned; - } - //裁判任务未完 - else - { - judgeTask.TaskState = TaskState.Adbandon; - } - - } - - //不管是否触发裁判 阅片任务退回,待影像重传后重新分 配给原阅片人 - - if (trialConfig.ReadingType == ReadingMethod.Double) - { - //考虑该访视 另外一个阅片人的任务也同时退回 - - var otherTask = await _visitTaskRepository.FirstOrDefaultAsync(t => t.SourceSubjectVisitId == origenalTask.SourceSubjectVisitId && t.Id != origenalTask.Id && t.TaskState == TaskState.Effect); - - if (otherTask.ReadingTaskState == ReadingTaskState.HaveSigned) - { - otherTask.TaskState = TaskState.HaveReturned; - } - else - { - otherTask.TaskState = TaskState.Adbandon; - } - - } - - } @@ -1380,6 +1432,13 @@ namespace IRaCIS.Core.Application.Service.Allocation if (influenceTask.Id == origenalTask.Id) { ReReadingTaskTrackingDeal(influenceTask, agreeReReadingCommand); + + influenceTaskList.ForEach(t => + { + //记录实际影像的任务 + + influenceTask.TaskInfluenceList.Add(new TaskInfluence() { InfluenceTaskId = t.Id }); + }); } //处理其他任务 else @@ -1462,6 +1521,14 @@ namespace IRaCIS.Core.Application.Service.Allocation if (influenceTask.Id == origenalTask.Id) { ReReadingTaskTrackingDeal(influenceTask, agreeReReadingCommand); + + influenceTaskList.ForEach(t => + { + //记录实际影像的任务 + + influenceTask.TaskInfluenceList.Add(new TaskInfluence() { InfluenceTaskId = t.Id }); + }); + } else { @@ -1762,6 +1829,15 @@ namespace IRaCIS.Core.Application.Service.Allocation { influenceTask.TaskState = TaskState.Adbandon; } + + influenceTaskList.ForEach(t => + { + //记录实际影像的任务 + + influenceTask.TaskInfluenceList.Add(new TaskInfluence() { InfluenceTaskId = t.Id }); + }); + + } } @@ -1809,6 +1885,17 @@ namespace IRaCIS.Core.Application.Service.Allocation { visitTask.TaskState = TaskState.Adbandon; } + + //同意的访视 + if (visitTask.Id == task.Id) + { + currentVisitList.ForEach(t => + { + //记录实际影像的任务 + + visitTask.TaskInfluenceList.Add(new TaskInfluence() { InfluenceTaskId = t.Id }); + }); + } } } diff --git a/IRaCIS.Core.Domain/Allocation/TaskInfluence.cs b/IRaCIS.Core.Domain/Allocation/TaskInfluence.cs new file mode 100644 index 000000000..4de0093cd --- /dev/null +++ b/IRaCIS.Core.Domain/Allocation/TaskInfluence.cs @@ -0,0 +1,36 @@ + +//-------------------------------------------------------------------- +// 此代码由T4模板自动生成 byzhouhang 20210918 +// 生成时间 2022-07-21 13:44:02 +// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。 +using System; +using IRaCIS.Core.Domain.Share; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +namespace IRaCIS.Core.Domain.Models +{ + /// + ///TaskInfluence + /// + [Table("TaskInfluence")] + public class TaskInfluence : Entity, IAuditAdd + { + + + + public Guid CreateUserId { get; set; } + + + public DateTime CreateTime { get; set; } + + + public Guid OriginalTaskId { get; set; } + + public VisitTask OriginalTask { get; set; } + + + public Guid InfluenceTaskId { get; set; } + + } + +} diff --git a/IRaCIS.Core.Domain/Allocation/VisitTask.cs b/IRaCIS.Core.Domain/Allocation/VisitTask.cs index 1f45a8ba6..13c5ff0bc 100644 --- a/IRaCIS.Core.Domain/Allocation/VisitTask.cs +++ b/IRaCIS.Core.Domain/Allocation/VisitTask.cs @@ -108,10 +108,7 @@ namespace IRaCIS.Core.Domain.Models public Subject Subject { get; set; } - public List ReadingTaskQuestionAnswerList { get; set; } = new List(); - //对于裁判项而言,触发裁判的列表 - public List JudgeVisitList { get; set; } public List TaskMedicalReviewList { get; set; } @@ -162,6 +159,10 @@ namespace IRaCIS.Core.Domain.Models #region 裁判任务特有 + + //对于裁判任务而言,触发裁判的列表 + public List JudgeVisitList { get; set; } + /// /// 裁判结果的备注 /// @@ -202,6 +203,11 @@ namespace IRaCIS.Core.Domain.Models #endregion + public List ReadingTaskQuestionAnswerList { get; set; } = new List(); + + + //重阅或者退回影像的记录中间表 + public List TaskInfluenceList { get; set; } = new List(); } diff --git a/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs b/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs index a2fc022bb..8fd2f230e 100644 --- a/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs +++ b/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs @@ -106,6 +106,9 @@ namespace IRaCIS.Core.Infra.EFCore modelBuilder.Entity().HasOne(t => t.Subject).WithMany(s=>s.SubjectVisitTaskList).HasForeignKey(t => t.SubjectId); + modelBuilder.Entity().HasMany(t => t.TaskInfluenceList).WithOne(s => s.OriginalTask).HasForeignKey(t => t.OriginalTaskId); + + modelBuilder.Entity().HasMany(t => t.ChildList).WithOne(t => t.Parent); @@ -614,6 +617,7 @@ namespace IRaCIS.Core.Infra.EFCore public virtual DbSet TaskConsistentRule { get; set; } + public virtual DbSet TaskInfluence { get; set; } diff --git a/IRaCIS.Core.Test/DbHelper.ttinclude b/IRaCIS.Core.Test/DbHelper.ttinclude index df1dd619b..7729b9af3 100644 --- a/IRaCIS.Core.Test/DbHelper.ttinclude +++ b/IRaCIS.Core.Test/DbHelper.ttinclude @@ -4,7 +4,7 @@ public static readonly string ConnectionString = "Server=123.56.94.154,1433\\MSSQLSERVER;Database=IRaCIS_New_Tet;User ID=sa;Password=dev123456DEV;TrustServerCertificate=true"; public static readonly string DbDatabase = "IRaCIS_New_Tet"; //ַ,ƴ - public static readonly string TableName = "ReadingGlobalTaskInfo"; + public static readonly string TableName = "TaskInfluence"; //ļ service Ƿҳ } #>