diff --git a/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingGlobalTaskService.cs b/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingGlobalTaskService.cs index 499dae0f4..d44a0f8ea 100644 --- a/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingGlobalTaskService.cs +++ b/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingGlobalTaskService.cs @@ -11,6 +11,8 @@ using Newtonsoft.Json; using IRaCIS.Core.Application.Service; using IRaCIS.Core.Application.ViewModel; using IRaCIS.Core.Application.Filter; +using System.Linq.Dynamic.Core; +using NPOI.SS.Formula.Functions; namespace IRaCIS.Application.Services { @@ -164,9 +166,15 @@ namespace IRaCIS.Application.Services ReadingTaskState = taskInfo.ReadingTaskState, }; - result.OtherGlobalTaskId = await _visitTaskRepository.Where(x => x.SouceReadModuleId == taskInfo.SouceReadModuleId && x.IsAnalysisCreate == taskInfo.IsAnalysisCreate + + + var otherGlobalTask = await _visitTaskRepository.Where(x => x.SouceReadModuleId == taskInfo.SouceReadModuleId && x.IsAnalysisCreate == taskInfo.IsAnalysisCreate && x.IsSelfAnalysis == taskInfo.IsSelfAnalysis && x.TaskState == TaskState.Effect && x.DoctorUserId != taskInfo.DoctorUserId - ).Select(x => x.Id).FirstOrDefaultAsync(); + ).FirstOrDefaultAsync(); + if (otherGlobalTask != null) + { + result.OtherGlobalTaskId = otherGlobalTask.Id; + } result.TaskBlindName = taskInfo.TaskBlindName; if (taskInfo.IsAnalysisCreate)