From 029a288be243d5b351958dbdc6a849e48e840fa0 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Thu, 30 May 2024 10:34:59 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=A4=9A=E5=B8=A7=E7=9A=84?= =?UTF-8?q?=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../IRaCIS.Core.Application.xml | 5 ++ .../ImageAndDoc/DTO/DicomSeriesModel.cs | 13 ---- .../Service/ImageAndDoc/StudyService.cs | 34 ++++++---- .../Service/Visit/SubjectVisitService.cs | 63 ++++++------------- 4 files changed, 46 insertions(+), 69 deletions(-) diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml index 4b080d099..30c0af574 100644 --- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml +++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml @@ -5761,6 +5761,11 @@ 裁判百分比或绝对值的相差值 + + + 类型 + + 裁判百分比或绝对值的相差值匹配规则 diff --git a/IRaCIS.Core.Application/Service/ImageAndDoc/DTO/DicomSeriesModel.cs b/IRaCIS.Core.Application/Service/ImageAndDoc/DTO/DicomSeriesModel.cs index ac26eb872..5af6aa683 100644 --- a/IRaCIS.Core.Application/Service/ImageAndDoc/DTO/DicomSeriesModel.cs +++ b/IRaCIS.Core.Application/Service/ImageAndDoc/DTO/DicomSeriesModel.cs @@ -42,22 +42,9 @@ namespace IRaCIS.Core.Application.Contracts.Dicom.DTO public bool IsExistMutiFrames => InstanceInfoList.Any(t => t.NumberOfFrames > 1); - #region 以后废弃 - - public List InstanceList { get; set; } = new List(); - - public List InstancePathList { get; set; } = new List(); - - public List InstanceHtmlPathList { get; set; } - - - //存放在instance 上面 public string WindowCenter { get; set; } = string.Empty; public string WindowWidth { get; set; } = string.Empty; - #endregion - - public string ImageResizePath { get; set; } } diff --git a/IRaCIS.Core.Application/Service/ImageAndDoc/StudyService.cs b/IRaCIS.Core.Application/Service/ImageAndDoc/StudyService.cs index 5af850f70..0dbe8e997 100644 --- a/IRaCIS.Core.Application/Service/ImageAndDoc/StudyService.cs +++ b/IRaCIS.Core.Application/Service/ImageAndDoc/StudyService.cs @@ -157,8 +157,8 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc studyMonitor.UploadFinishedTime = DateTime.Now; studyMonitor.ArchiveFinishedTime = DateTime.Now; studyMonitor.FailedFileCount = incommand.FailedFileCount; - studyMonitor.IsSuccess = incommand.FailedFileCount==0; - studyMonitor.RecordPath=incommand.RecordPath; + studyMonitor.IsSuccess = incommand.FailedFileCount == 0; + studyMonitor.RecordPath = incommand.RecordPath; //上传 if (studyMonitor.IsDicomReUpload == false) @@ -192,6 +192,16 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc study.SubjectId = incommand.SubjectId; study.SubjectVisitId = incommand.SubjectVisitId; + //如果因为意外情况,连续点击两次,导致第一次插入了,第二次进来也会插入,在此判断一下 + var findStudy = _dicomstudyRepository.FirstOrDefaultAsync(t => t.Id == study.Id); + + if (findStudy != null) + { + //直接返回 + return ResponseOutput.Ok(); + } + + //特殊处理逻辑 study.Modalities = string.Join("、", incommand.Study.SeriesList.Select(t => t.Modality).Distinct()); @@ -469,9 +479,9 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc .WhereIf(studyQuery.SubjectId != null, t => t.SubjectId == studyQuery.SubjectId) .WhereIf(studyQuery.SubjectVisitId != null, t => t.SubjectId == studyQuery.SubjectVisitId) .WhereIf(studyQuery.SiteId != null, t => t.SiteId == studyQuery.SiteId) - .WhereIf(studyQuery.IsDicom != null, t => t.IsDicom == studyQuery.IsDicom ) - .WhereIf(!string.IsNullOrWhiteSpace(studyQuery.Uploader), t => t.Uploader.UserName.Contains(studyQuery.Uploader)) - .WhereIf(studyQuery.IsSuccess != null, t => t.IsSuccess == studyQuery.IsSuccess) + .WhereIf(studyQuery.IsDicom != null, t => t.IsDicom == studyQuery.IsDicom) + .WhereIf(!string.IsNullOrWhiteSpace(studyQuery.Uploader), t => t.Uploader.UserName.Contains(studyQuery.Uploader)) + .WhereIf(studyQuery.IsSuccess != null, t => t.IsSuccess == studyQuery.IsSuccess) .WhereIf(!string.IsNullOrWhiteSpace(studyQuery.StudyCode), t => t.StudyCode.Contains(studyQuery.StudyCode)) .Select(t => new UnionStudyMonitorModel() { @@ -505,7 +515,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc ArchiveFinishedTime = t.ArchiveFinishedTime, - RecordPath=t.RecordPath, + RecordPath = t.RecordPath, IsDicomReUpload = t.IsDicomReUpload, StudyId = t.Id, @@ -727,15 +737,15 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc StudyInstanceUid = t.StudyInstanceUid }).ToList(), - UploadStudyList = u.TaskStudyList.Select(t => new + UploadStudyList = u.TaskStudyList.Select(t => new { Id = t.Id, StudyInstanceUid = t.StudyInstanceUid, - SeriesList=t.SeriesList.Select(t => new UploadedSeries() + SeriesList = t.SeriesList.Select(t => new UploadedSeries() { SeriesId = t.Id, SeriesInstanceUid = t.SeriesInstanceUid, SOPInstanceUIDList = t.InstanceList.Select(c => c.SopInstanceUid).ToList() }).ToList() - + }).ToList() }); @@ -777,12 +787,12 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc if (findOriginStudy == null) { - throw new BusinessValidationFailedException("该检查不属于该受试者,请核查") ; + throw new BusinessValidationFailedException("该检查不属于该受试者,请核查"); } else { - if(findOriginStudy.UploadStudyList.Any(t=>t.StudyInstanceUid == studyInstanceUid)) + if (findOriginStudy.UploadStudyList.Any(t => t.StudyInstanceUid == studyInstanceUid)) { result.AllowReUpload = true; result.AllowUpload = false; @@ -897,7 +907,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc var result = new VerifyStudyUploadResult(); - if (_provider.Exists($"StudyUid_{trialId}_{studyInstanceUid}") && _provider.Get($"StudyUid_{trialId}_{studyInstanceUid}").Value!=_userInfo.Id) + if (_provider.Exists($"StudyUid_{trialId}_{studyInstanceUid}") && _provider.Get($"StudyUid_{trialId}_{studyInstanceUid}").Value != _userInfo.Id) { result.AllowUpload = false; diff --git a/IRaCIS.Core.Application/Service/Visit/SubjectVisitService.cs b/IRaCIS.Core.Application/Service/Visit/SubjectVisitService.cs index ca4a346a1..f2388af05 100644 --- a/IRaCIS.Core.Application/Service/Visit/SubjectVisitService.cs +++ b/IRaCIS.Core.Application/Service/Visit/SubjectVisitService.cs @@ -321,34 +321,22 @@ namespace IRaCIS.Core.Application.Services DicomSeriesDTO series = await _repository.Where(s => s.Id == inDto.SeriesId).ProjectTo(_mapper.ConfigurationProvider).FirstNotNullAsync(); var instanceList = await _repository.Where(t => t.SeriesId == inDto.SeriesId) - .Select(t => new { t.SeriesId, t.StudyId, t.Id, t.InstanceNumber, t.Path, t.NumberOfFrames, t.WindowCenter, t.WindowWidth, t.HtmlPath, t.SliceLocation }).ToListAsync(); - series.InstanceList = instanceList.Where(t => t.SeriesId == series.Id).OrderByDescending(t => t.SliceLocation).ThenBy(t => t.InstanceNumber).Select(k => k.Id).ToList(); + .Select(t => new { t.SeriesId, t.StudyId, t.Id, t.InstanceNumber, t.Path, t.NumberOfFrames, t.WindowCenter, t.WindowWidth, t.HtmlPath, t.SliceLocation }).ToListAsync(); - series.InstanceHtmlPathList = instanceList.Where(t => t.SeriesId == series.Id && t.HtmlPath != string.Empty).OrderBy(t => t.InstanceNumber).Select(k => k.HtmlPath).ToList(); - //处理多帧 - series.InstancePathList = instanceList.Where(s => s.SeriesId == series.Id).OrderBy(t => t.InstanceNumber) - .SelectMany(u => - { + series.InstanceInfoList = instanceList.Where(t => t.SeriesId == series.Id).OrderBy(t => t.InstanceNumber).Select(k => + new InstanceBasicInfo() + { + Id = k.Id, + NumberOfFrames = k.NumberOfFrames, + HtmlPath = k.HtmlPath, + Path = k.Path, + InstanceNumber = k.InstanceNumber, - if (u.NumberOfFrames > 1) - { - var pathList = new List(); + }).ToList(); - for (int i = 1; i <= u.NumberOfFrames; i++) - { - pathList.Add(u.Path + "?frame=" + (i - 1)); - } - return pathList; - } - else - { - return new List { u.Path }; - } - }) - .ToList(); series.WindowWidth = instanceList.FirstOrDefault()!.WindowWidth; series.WindowCenter = instanceList.FirstOrDefault()!.WindowCenter; @@ -442,33 +430,20 @@ namespace IRaCIS.Core.Application.Services { list.ForEach(series => { - series.InstanceList = instanceList.Where(t => t.SeriesId == series.Id).OrderBy(t => t.InstanceNumber).Select(k => k.Id).ToList(); - series.InstanceHtmlPathList = instanceList.Where(t => t.SeriesId == series.Id && t.HtmlPath != string.Empty).OrderBy(t => t.InstanceNumber).Select(k => k.HtmlPath).ToList(); + series.InstanceInfoList = instanceList.Where(t => t.SeriesId == series.Id).OrderBy(t => t.InstanceNumber).Select(k => + new InstanceBasicInfo() + { + Id = k.Id, + NumberOfFrames = k.NumberOfFrames, + HtmlPath = k.HtmlPath, + Path = k.Path, + InstanceNumber = k.InstanceNumber, - //处理多帧 - series.InstancePathList = instanceList.Where(s => s.SeriesId == series.Id).OrderBy(t => t.InstanceNumber) - .SelectMany(u => - { + }).ToList(); - if (u.NumberOfFrames > 1) - { - var pathList = new List(); - for (int i = 1; i <= u.NumberOfFrames; i++) - { - pathList.Add(u.Path + "?frame=" + (i - 1)); - } - return pathList; - } - else - { - return new List { u.Path }; - - } - }) - .ToList(); series.WindowWidth = instanceList.FirstOrDefault()!.WindowWidth; series.WindowCenter = instanceList.FirstOrDefault()!.WindowCenter;