From 935b498ab5f2b4effad4969db83882bccea3667b Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Wed, 25 Sep 2024 15:49:43 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=8A=E4=BC=A0?= =?UTF-8?q?=E9=AA=8C=E8=AF=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Service/ImageAndDoc/DownloadAndUploadService.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/IRaCIS.Core.Application/Service/ImageAndDoc/DownloadAndUploadService.cs b/IRaCIS.Core.Application/Service/ImageAndDoc/DownloadAndUploadService.cs index 1fd4b224e..a620f9913 100644 --- a/IRaCIS.Core.Application/Service/ImageAndDoc/DownloadAndUploadService.cs +++ b/IRaCIS.Core.Application/Service/ImageAndDoc/DownloadAndUploadService.cs @@ -253,11 +253,14 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc public async Task> VerifyIRStudyAllowUpload(TaskStudyAchivePreConfirmCommand inCommand, [FromServices] IRepository _dicomStudyRepository) { + var currentUploadSubjectVisitId = inCommand.VisitTaskId == null ? null : _visitTaskRepository.Where(t => t.Id == inCommand.VisitTaskId).Select(t => t.SourceSubjectVisitId).FirstOrDefault(); + //重阅任务排除 var notAllowedUidList1 = _taskStudyRepository.Where(t => t.TrialId == inCommand.TrialId && t.VisitTask.TaskState == TaskState.Effect && inCommand.StudyInstanceUidList.Contains(t.StudyInstanceUid)).Select(t => new { t.StudyInstanceUid, t.SubjectId, + SubjectVisitId = t.VisitTask.SourceSubjectVisitId, SubejectCode = t.VisitTask.IsAnalysisCreate ? t.VisitTask.BlindSubjectCode : t.Subject.Code, VisitTaskId = (Guid?)t.VisitTaskId }).ToList(); @@ -266,6 +269,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc { t.StudyInstanceUid, t.SubjectId, + SubjectVisitId = (Guid?)t.SubjectVisitId, SubejectCode = t.Subject.Code, VisitTaskId = (Guid?)null }).ToList(); @@ -283,12 +287,13 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc //同一个subject 同一份影响 if (findStudy.SubejectCode == inCommand.SubjectCode && findStudy.SubjectId == inCommand.SubjectId) { + //上传给后处理其他访视了 if (inCommand.VisitTaskId != null && findStudy.VisitTaskId != null && findStudy.VisitTaskId != inCommand.VisitTaskId) { result.Add(new TaskStudyArchiveConfirmResult() { StudyInstanceUid = studyUid, IsAllowReUpload = false, IsAllowUpload = false }); } - //在原始crc 里面上传了 - else if (inCommand.VisitTaskId != null && findStudy.VisitTaskId == null) + //在原始crc 里面上传了,并且不是当前访视 + else if (inCommand.VisitTaskId != null && findStudy.VisitTaskId == null && findStudy.SubjectVisitId!= currentUploadSubjectVisitId) { result.Add(new TaskStudyArchiveConfirmResult() { StudyInstanceUid = studyUid, IsAllowReUpload = false, IsAllowUpload = false }); } From 1d5c274e38c14027437b5f236bbfc9d200829cf3 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Wed, 25 Sep 2024 16:47:50 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=8F=82=E6=95=B0?= =?UTF-8?q?=E5=BF=85=E4=BC=A0=E4=B8=8E=E5=90=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ImageAndDoc/DTO/UnionStudyViewDodel.cs | 6 +-- .../ImageAndDoc/DownloadAndUploadService.cs | 39 +++++++++++++++++-- 2 files changed, 37 insertions(+), 8 deletions(-) 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 }); } From f46bbea98e29d5528708318f446e071f37681ea6 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Wed, 25 Sep 2024 17:10:01 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E5=8F=97=E8=AF=95=E8=80=85=E9=9A=8F?= =?UTF-8?q?=E6=9C=BA=E9=9A=8F=E6=9C=BA=E6=8E=92=E5=BA=8F=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ImageAndDoc/DownloadAndUploadService.cs | 4 +- .../ReadingImageTaskService.cs | 37 +++++++++++-------- 2 files changed, 24 insertions(+), 17 deletions(-) diff --git a/IRaCIS.Core.Application/Service/ImageAndDoc/DownloadAndUploadService.cs b/IRaCIS.Core.Application/Service/ImageAndDoc/DownloadAndUploadService.cs index 51b3081f7..8fbcfdefe 100644 --- a/IRaCIS.Core.Application/Service/ImageAndDoc/DownloadAndUploadService.cs +++ b/IRaCIS.Core.Application/Service/ImageAndDoc/DownloadAndUploadService.cs @@ -23,7 +23,10 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc public interface IDownloadAndUploadService { Task PackageAndAnonymizImage(Guid trialId, Guid subjectVisitId, bool isDicom, bool isAnonymize = true); + + Task SubejctRandomReadingTaskNameDeal(Guid subjectId, Guid trialReadingCriterionId); } + [ApiExplorerSettings(GroupName = "Trial")] public class DownloadAndUploadService( IRepository _systemAnonymizationRepository, @@ -77,7 +80,6 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc && t.ReadingTaskState != ReadingTaskState.HaveSigned && t.ReadingCategory == ReadingCategory.Visit && t.TaskBlindName != "Timepoint").Select(t => new { t.TaskBlindName, t.SourceSubjectVisitId, t.SouceReadModuleId }).ToListAsync(); - //随机赋值编号 比如要处理5个任务,实例化一个包含1-5的数组,每次随机取出一个 List availableNumbers = Enumerable.Range(haveDealedTaskList.Count + haveFinishedTaskCount + 1, needDealTaskList.Count).ToList(); Random rng = new Random(); diff --git a/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs b/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs index fe67ccc8d..acf0fc037 100644 --- a/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs +++ b/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs @@ -2,6 +2,7 @@ using IRaCIS.Core.Application.Filter; using IRaCIS.Core.Application.Helper; using IRaCIS.Core.Application.Interfaces; +using IRaCIS.Core.Application.Service.ImageAndDoc; using IRaCIS.Core.Application.Service.Reading.Dto; using IRaCIS.Core.Application.Service.ReadingCalculate.Interface; using IRaCIS.Core.Application.ViewModel; @@ -44,24 +45,21 @@ namespace IRaCIS.Core.Application.Service IRepository _dicomInstanceRepository, IRepository _organInfoRepository, IRepository _trialDocumentRepository, - IRepository _userRepository, ILuganoCalculateService _luganoCalculateService, IRepository _readingCustomTagRepository, IRepository _readingTaskQuestionMarkRepository, - IRepository _readingCriterionDictionaryRepository, IRepository _readingTrialCriterionDictionaryRepository, - IRepository _tumorAssessmentRepository, IRepository _readingTableAnswerRowInfoRepository, IRepository _readingTableQuestionSystemRepository, IRepository _readingTableQuestionTrialRepository, IRepository _readingTaskQuestionAnswerRepository, IRepository _readingQuestionCriterionTrialRepository, - IRepository _readingQuestionCriterionSystemRepository, IRepository _readingQuestionSystem, IRepository _noneDicomStudyFileSystem, IGeneralCalculateService _generalCalculateService, IRepository _readingQuestionTrialRepository, IRepository _taskStudyRepository, + IDownloadAndUploadService _downloadAndUploadService, ITrialEmailNoticeConfigService _trialEmailNoticeConfigService) : BaseService, IReadingImageTaskService { @@ -783,7 +781,7 @@ namespace IRaCIS.Core.Application.Service var criterionIdInfo = await _readingQuestionCriterionTrialRepository.Where(x => x.Id == trialReadingCriterionId).FirstNotNullAsync(); - var groupIds = await _readingQuestionTrialRepository.Where(x => x.ReadingQuestionCriterionTrialId == trialReadingCriterionId&& x.Type == ReadingQestionType.Table || x.Type == ReadingQestionType.BasicTable).Select(x => x.GroupId).Distinct().ToListAsync(); + var groupIds = await _readingQuestionTrialRepository.Where(x => x.ReadingQuestionCriterionTrialId == trialReadingCriterionId && x.Type == ReadingQestionType.Table || x.Type == ReadingQestionType.BasicTable).Select(x => x.GroupId).Distinct().ToListAsync(); var questionIds = await _readingQuestionTrialRepository .Where(x => x.IsShowInDicom) @@ -792,10 +790,10 @@ namespace IRaCIS.Core.Application.Service //排除表格问题 以及在表格问题分组的外层问题 var questions = await _readingQuestionTrialRepository - .Where(x=> !questionIds.Contains(x.Id)) + .Where(x => !questionIds.Contains(x.Id)) .WhereIf(questionClassify != null, x => x.QuestionClassify == questionClassify) - - .Where( x => x.IsShowInDicom && x.ReadingQuestionCriterionTrialId == trialReadingCriterionId && x.Type != ReadingQestionType.Table && x.Type != ReadingQestionType.BasicTable) + + .Where(x => x.IsShowInDicom && x.ReadingQuestionCriterionTrialId == trialReadingCriterionId && x.Type != ReadingQestionType.Table && x.Type != ReadingQestionType.BasicTable) .ProjectTo(_mapper.ConfigurationProvider, new { @@ -1085,7 +1083,7 @@ namespace IRaCIS.Core.Application.Service var criterionInfo = await _readingQuestionCriterionTrialRepository.Where(x => x.Id == inDto.TrialReadingCriterionId).FirstNotNullAsync(); var qusetionList = await _readingQuestionTrialRepository - .Where(x=>x.IsShowInDicom) + .Where(x => x.IsShowInDicom) .WhereIf(inDto.QuestionClassify != null, x => x.QuestionClassify == inDto.QuestionClassify) .Where(x => x.ReadingQuestionCriterionTrialId == inDto.TrialReadingCriterionId).ProjectTo(_mapper.ConfigurationProvider, new { @@ -2606,10 +2604,10 @@ namespace IRaCIS.Core.Application.Service public async Task VerifyVisitTaskQuestions(VerifyVisitTaskQuestionsInDto inDto) { //验证后处理影像必须传 - if (_visitTaskRepository.Any(t => t.Id==inDto.VisitTaskId && t.TrialReadingCriterion.ImageUploadEnum != ReadingImageUpload.None)) + if (_visitTaskRepository.Any(t => t.Id == inDto.VisitTaskId && t.TrialReadingCriterion.ImageUploadEnum != ReadingImageUpload.None)) { if (!_taskStudyRepository.Any(t => t.VisitTaskId == inDto.VisitTaskId)) - { + { return ResponseOutput.NotOk(_localizer["ReadingImage_BackImageNotExist"]); } } @@ -2827,6 +2825,8 @@ namespace IRaCIS.Core.Application.Service } else if (inDto.SubjectId != null && trialReadingCriterion.IsReadingTaskViewInOrder == ReadingOrder.SubjectRandom) { + await _downloadAndUploadService.SubejctRandomReadingTaskNameDeal((Guid)inDto.SubjectId, (Guid)trialReadingCriterionId); + var subjectTaskList = (await _visitTaskService.GetSubjectReadingIQueryable(new GetReadingIQueryableInDto() { TrialId = inDto.TrialId, @@ -2848,17 +2848,22 @@ namespace IRaCIS.Core.Application.Service // 排除跳过的 List remainingItems = taskList.Select(x => x.Id).Except(cacheSkipIds).ToList(); - taskList = taskList.Where(x => remainingItems.Contains(x.Id)).ToList(); + //受试者随机固定排序 + taskList = taskList.Where(x => remainingItems.Contains(x.Id)).OrderBy(t=>t.TaskBlindName).ToList(); + if (taskList.Count() == 0) { throw new BusinessValidationFailedException(_localizer["ReadingImage_TaskFinish"], ApiResponseCodeEnum.CloseCurrentWindows); } - Random random = new Random(); - //返回的范围是 0- taskList.Count-1 - int randomIndex = random.Next(taskList.Count); + #region 随机废弃 + //Random random = new Random(); + ////返回的范围是 0- taskList.Count-1 + //int randomIndex = random.Next(taskList.Count); - var visitTaskId = taskList[randomIndex].Id; + //var visitTaskId = taskList[randomIndex].Id; + #endregion + var visitTaskId = taskList[0].Id; task = await _visitTaskRepository.Where(x => x.Id == visitTaskId).Select(x => new GetReadingTaskDto() { From ff71e925ca1953d2139660c7c5cb6279f2d5723d Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Wed, 25 Sep 2024 17:34:57 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- IRaCIS.Core.Application/IRaCIS.Core.Application.xml | 2 +- .../Service/ImageAndDoc/DownloadAndUploadService.cs | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml index 461c2f746..df93ce8e4 100644 --- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml +++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml @@ -11445,7 +11445,7 @@ - + IR影像阅片 diff --git a/IRaCIS.Core.Application/Service/ImageAndDoc/DownloadAndUploadService.cs b/IRaCIS.Core.Application/Service/ImageAndDoc/DownloadAndUploadService.cs index 8fbcfdefe..0fcf86880 100644 --- a/IRaCIS.Core.Application/Service/ImageAndDoc/DownloadAndUploadService.cs +++ b/IRaCIS.Core.Application/Service/ImageAndDoc/DownloadAndUploadService.cs @@ -150,7 +150,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc - var query = _visitTaskRepository.Where(t => t.SubjectId == inQuery.SubjectId && t.TrialReadingCriterionId == inQuery.TrialReadingCriterionId && t.SourceSubjectVisitId != null + var query = _visitTaskRepository.Where(t => t.SubjectId == subjectId && t.TrialReadingCriterionId == inQuery.TrialReadingCriterionId && t.SourceSubjectVisitId != null && t.DoctorUserId == _userInfo.Id && t.TaskState == TaskState.Effect) //满足 有序,或者随机只看到当前任务的dicom 非dicom检查 .WhereIf(criterionInfo.IsReadingTaskViewInOrder != ReadingOrder.SubjectRandom && inQuery.VisitTaskId != null, t => t.Id == inQuery.VisitTaskId) @@ -210,6 +210,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc }).ToList() }) ; + //var test = await query.ToListAsync(); var list = await query.Where(t => t.SubjectCode == subjectCode).ToListAsync(); From 328a8549c662472eea5253ec623d1fd08fcdf24d Mon Sep 17 00:00:00 2001 From: hang <87227557@qq.com> Date: Thu, 26 Sep 2024 00:15:08 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E5=90=8C=E6=AD=A5=E9=95=BF=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- IRaCIS.Core.Domain/Common/SystemBasicData.cs | 2 ++ IRaCIS.Core.Domain/QC/QCChallenge.cs | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/IRaCIS.Core.Domain/Common/SystemBasicData.cs b/IRaCIS.Core.Domain/Common/SystemBasicData.cs index ae58959fb..9e9a22d63 100644 --- a/IRaCIS.Core.Domain/Common/SystemBasicData.cs +++ b/IRaCIS.Core.Domain/Common/SystemBasicData.cs @@ -14,6 +14,7 @@ public class SystemBasicData : BaseFullAuditEntity #endregion public string Name { get; set; } = string.Empty; + [StringLength(1000)] public string Value { get; set; } = string.Empty; public string Description { get; set; } = string.Empty; @@ -23,6 +24,7 @@ public class SystemBasicData : BaseFullAuditEntity public string Code { get; set; } = string.Empty; public Guid? ParentId { get; set; } + [StringLength(1000)] public string ValueCN { get; set; } = string.Empty; public bool IsEnable { get; set; } diff --git a/IRaCIS.Core.Domain/QC/QCChallenge.cs b/IRaCIS.Core.Domain/QC/QCChallenge.cs index ab538294b..ef7aee7e7 100644 --- a/IRaCIS.Core.Domain/QC/QCChallenge.cs +++ b/IRaCIS.Core.Domain/QC/QCChallenge.cs @@ -51,7 +51,7 @@ public class QCChallenge : BaseAddAuditEntity public string ClosedUser { get; set; } = string.Empty; public QCChallengeCloseEnum CloseResonEnum { get; set; } - [StringLength(1000)] + [StringLength(1200)] public string Content { get; set; } = string.Empty; [StringLength(1000)]