diff --git a/IRaCIS.Core.Application/Service/ImageAndDoc/DTO/UnionStudyViewDodel.cs b/IRaCIS.Core.Application/Service/ImageAndDoc/DTO/UnionStudyViewDodel.cs index 804a7d83e..c9835af4a 100644 --- a/IRaCIS.Core.Application/Service/ImageAndDoc/DTO/UnionStudyViewDodel.cs +++ b/IRaCIS.Core.Application/Service/ImageAndDoc/DTO/UnionStudyViewDodel.cs @@ -409,14 +409,12 @@ namespace IRaCIS.Core.Application.Contracts public class IRUploadStudyQuery : SortInput { - [NotDefault] - public Guid SubjectId { get; set; } + public Guid? SubjectId { get; set; } [NotDefault] public Guid TrialReadingCriterionId { get; set; } - [NotDefault] - public string SubjectCode { get; set; } + public string? SubjectCode { get; set; } public Guid? VisitTaskId { get; set; } } diff --git a/IRaCIS.Core.Application/Service/ImageAndDoc/DownloadAndUploadService.cs b/IRaCIS.Core.Application/Service/ImageAndDoc/DownloadAndUploadService.cs index a620f9913..51b3081f7 100644 --- a/IRaCIS.Core.Application/Service/ImageAndDoc/DownloadAndUploadService.cs +++ b/IRaCIS.Core.Application/Service/ImageAndDoc/DownloadAndUploadService.cs @@ -111,11 +111,42 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc [HttpPost] public async Task>> GetSubjectImageUploadList(IRUploadStudyQuery inQuery) { - await SubejctRandomReadingTaskNameDeal(inQuery.SubjectId, inQuery.TrialReadingCriterionId); //要根据标准阅片顺序,确定是否查询单个任务的,还是查询所有的 var criterionInfo = await _readingQuestionCriterionTrialRepository.Where(t => t.Id == inQuery.TrialReadingCriterionId) - .Select(t => new { t.IsReadingTaskViewInOrder }).FirstNotNullAsync(); + .Select(t => new { t.IsReadingTaskViewInOrder }).FirstNotNullAsync(); + + var subjectCode = string.Empty; + var subjectId = inQuery.SubjectId; + + if (criterionInfo.IsReadingTaskViewInOrder == ReadingOrder.Random) + { + if (inQuery.VisitTaskId == null) + { + throw new Exception("无序阅片,前端参数传递错误"); + } + //考虑到一致性分析,必须要这个编号进行过滤 + var taskInfo = _visitTaskRepository.Where(t => t.Id == inQuery.VisitTaskId).Select(t => new { + SubjectCode= t.IsAnalysisCreate ? t.BlindSubjectCode : t.Subject.Code, + SubjectId= t.SubjectId, + }).FirstOrDefault(); + subjectId = taskInfo.SubjectId; + subjectCode = taskInfo.SubjectCode; + } + else + { + if (inQuery.SubjectId == null || inQuery.SubjectCode == null) + { + throw new Exception("有序阅片,前端参数传递错误"); + } + + //考虑到一致性分析,必须要这个编号进行过滤 + subjectCode = inQuery.SubjectCode; + } + + await SubejctRandomReadingTaskNameDeal((Guid)subjectId, inQuery.TrialReadingCriterionId); + + var query = _visitTaskRepository.Where(t => t.SubjectId == inQuery.SubjectId && t.TrialReadingCriterionId == inQuery.TrialReadingCriterionId && t.SourceSubjectVisitId != null && t.DoctorUserId == _userInfo.Id && t.TaskState == TaskState.Effect) @@ -178,7 +209,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc }) ; - var list = await query.Where(t => t.SubjectCode == inQuery.SubjectCode).ToListAsync(); + var list = await query.Where(t => t.SubjectCode == subjectCode).ToListAsync(); return ResponseOutput.Ok(list); @@ -293,7 +324,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc result.Add(new TaskStudyArchiveConfirmResult() { StudyInstanceUid = studyUid, IsAllowReUpload = false, IsAllowUpload = false }); } //在原始crc 里面上传了,并且不是当前访视 - else if (inCommand.VisitTaskId != null && findStudy.VisitTaskId == null && findStudy.SubjectVisitId!= currentUploadSubjectVisitId) + else if (inCommand.VisitTaskId != null && findStudy.VisitTaskId == null && findStudy.SubjectVisitId != currentUploadSubjectVisitId) { result.Add(new TaskStudyArchiveConfirmResult() { StudyInstanceUid = studyUid, IsAllowReUpload = false, IsAllowUpload = false }); }