From 1a4ca6e36b90ac79c5694133635e6a4f88084640 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Wed, 11 Jun 2025 09:27:18 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=BF=9B=E5=85=A5?= =?UTF-8?q?=E9=98=85=E7=89=87=E4=B8=AD=E7=A8=BD=E6=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../IRaCIS.Core.Application.xml | 2 +- .../ReadingGlobalTaskService.cs | 8 +- .../Common/AuditingData.cs | 94 +++++++++++-------- .../Repository/ICommandRepository.cs | 8 +- .../Repository/Repository.cs | 32 +++++++ 5 files changed, 96 insertions(+), 48 deletions(-) diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml index d6a5a3351..bfab7b26a 100644 --- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml +++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml @@ -2523,7 +2523,7 @@ - + 获取Description diff --git a/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingGlobalTaskService.cs b/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingGlobalTaskService.cs index 0c126a36a..aa1e0d22c 100644 --- a/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingGlobalTaskService.cs +++ b/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingGlobalTaskService.cs @@ -54,7 +54,7 @@ namespace IRaCIS.Core.Application.Service /// /// [HttpPost] - [TrialGlobalLimit( "AfterStopCannNotOpt" )] + [TrialGlobalLimit("AfterStopCannNotOpt")] public async Task BatchSubmitGlobalReadingInfo(BatchSubmitGlobalReadingInfo inDto) { await VerifyTaskIsSign(inDto.GlobalTaskId); @@ -94,7 +94,7 @@ namespace IRaCIS.Core.Application.Service })).ToList(); await _readingGlobalTaskInfoRepository.AddRangeAsync(answers); - await _visitTaskRepository.UpdatePartialFromQueryAsync(t => t.Id == inDto.GlobalTaskId, u => new VisitTask() { ReadingTaskState = ReadingTaskState.Reading }); + await _visitTaskRepository.UpdatePartialFromEFAutoAsync(inDto.GlobalTaskId, u => new VisitTask() { ReadingTaskState = ReadingTaskState.Reading }); var result = await _readingGlobalTaskInfoRepository.SaveChangesAsync(); return ResponseOutput.Ok(result); } @@ -107,7 +107,7 @@ namespace IRaCIS.Core.Application.Service /// /// [HttpPost] - [TrialGlobalLimit( "AfterStopCannNotOpt" )] + [TrialGlobalLimit("AfterStopCannNotOpt")] public async Task SaveGlobalReadingInfo(SaveGlobalReadingInfoInDto inDto) { await VerifyTaskIsSign(inDto.GlobalTaskId); @@ -301,7 +301,7 @@ namespace IRaCIS.Core.Application.Service LimitEdit = y.LimitEdit, MaxAnswerLength = y.MaxAnswerLength, FileType = y.FileType, - Unit=y.Unit, + Unit = y.Unit, QuestionGenre = y.QuestionGenre, ShowOrder = y.ShowOrder, DictionaryCode = y.DictionaryCode, diff --git a/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs b/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs index 37ebd17ce..bdf87a24d 100644 --- a/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs +++ b/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs @@ -3556,51 +3556,63 @@ namespace IRaCIS.Core.Infra.EFCore.Common break; + case "ReadingImageTask/SubmitVisitTaskQuestions": + + //访视任务-- 非Dicom 阅片 + if (entity.ReadingTaskState != ReadingTaskState.HaveSigned) + { + //提交访视任务的时候 会多次更新同一个记录 只记录最后一次 + return; + } + + break; + + //Dicom 阅片 签名 + case "ReadingImageTask/SubmitDicomVisitTask": + + //跳转阅片结果需要该参数 + var subjectCode = _dbContext.Subject.Where(t => t.Id == entity.SubjectId).Select(t => t.Code).First(); + + obj.SubjectCode = subjectCode; + + break; + } + #region 裁判、肿瘤学、全局 都是通用的 + + //裁判任务 结果的保存 和签名提交 + if (entity.JudgeResultTaskId != null && (_userInfo.RequestUrl == "ReadingImageTask/SaveJudgeVisitTaskResult" || _userInfo.RequestUrl == "ReadingImageTask/SubmitJudgeVisitTaskResult")) + { + + var visitTaskNum = entity.VisitTaskNum - ReadingCommon.TaskNumDic[ReadingCategory.Judge]; + var list = await _dbContext.VisitTask.Where(t => t.TaskState == TaskState.Effect && t.SubjectId == entity.SubjectId && t.VisitTaskNum == visitTaskNum && t.JudgeVisitTaskId == entity.Id && t.TrialReadingCriterionId == entity.TrialReadingCriterionId).Select(t => new { t.Id, t.DoctorUser.FullName, t.ArmEnum }).OrderBy(t => t.ArmEnum).ToListAsync(); + + + var r1 = list.Where(t => t.ArmEnum == Arm.DoubleReadingArm1).FirstOrDefault(); + var r2 = list.Where(t => t.ArmEnum == Arm.DoubleReadingArm2).FirstOrDefault(); + + obj.R1 = r1.FullName; + obj.R2 = r2.FullName; + obj.SelectResult = r1.Id == entity.JudgeResultTaskId ? "R1" : "R2"; + } + + #endregion + + //增加进入阅片中的稽查 + + if (entity.ReadingTaskState == ReadingTaskState.Reading) + { + if(_dbContext.VisitTask.Where(t => t.Id == entity.Id).Any(t => t.ReadingTaskState== ReadingTaskState.WaitReading)) + { + isDistinctionInterface = false; + extraIdentification = "/ChangeToReading"; + } + } + + } - //访视任务-- 非Dicom 阅片 - if (_userInfo.RequestUrl == "ReadingImageTask/SubmitVisitTaskQuestions" && entity.ReadingTaskState != ReadingTaskState.HaveSigned && type == AuditOpt.Update) - { - //提交访视任务的时候 会多次更新同一个记录 只记录最后一次 - return; - } - - - - //Dicom 阅片 签名 - if (_userInfo.RequestUrl == "ReadingImageTask/SubmitDicomVisitTask") - { - //跳转阅片结果需要该参数 - var subjectCode = _dbContext.Subject.Where(t => t.Id == entity.SubjectId).Select(t => t.Code).First(); - - obj.SubjectCode = subjectCode; - } - - #region 裁判、肿瘤学、全局 都是通用的 - - //裁判任务 结果的保存 和签名提交 - if (entity.JudgeResultTaskId != null && (_userInfo.RequestUrl == "ReadingImageTask/SaveJudgeVisitTaskResult" || _userInfo.RequestUrl == "ReadingImageTask/SubmitJudgeVisitTaskResult")) - { - - var visitTaskNum = entity.VisitTaskNum - ReadingCommon.TaskNumDic[ReadingCategory.Judge]; - var list = await _dbContext.VisitTask.Where(t => t.TaskState == TaskState.Effect && t.SubjectId == entity.SubjectId && t.VisitTaskNum == visitTaskNum && t.JudgeVisitTaskId == entity.Id && t.TrialReadingCriterionId == entity.TrialReadingCriterionId).Select(t => new { t.Id, t.DoctorUser.FullName, t.ArmEnum }).OrderBy(t => t.ArmEnum).ToListAsync(); - - - var r1 = list.Where(t => t.ArmEnum == Arm.DoubleReadingArm1).FirstOrDefault(); - var r2 = list.Where(t => t.ArmEnum == Arm.DoubleReadingArm2).FirstOrDefault(); - - obj.R1 = r1.FullName; - obj.R2 = r2.FullName; - obj.SelectResult = r1.Id == entity.JudgeResultTaskId ? "R1" : "R2"; - } - - - #endregion - - - #region 通过链接跳转 2022 12-19 diff --git a/IRaCIS.Core.Infra.EFCore/Repository/ICommandRepository.cs b/IRaCIS.Core.Infra.EFCore/Repository/ICommandRepository.cs index 4de2f0c46..8675e78ff 100644 --- a/IRaCIS.Core.Infra.EFCore/Repository/ICommandRepository.cs +++ b/IRaCIS.Core.Infra.EFCore/Repository/ICommandRepository.cs @@ -35,15 +35,19 @@ namespace IRaCIS.Core.Infra.EFCore Task UpdateAsync(TEntity entity, Expression> updateFactory, bool autoSave = false, CancellationToken cancellationToken = default); - /// EF跟踪方式 会去数据库查询完整的实体,再更新部分字段 + /// EF跟踪方式 会去数据库查询完整的实体,再更新部分字段 一定会产生更新sql Task UpdatePartialFromQueryAsync(Guid id, Expression> updateFactory, bool autoSave = false, CancellationToken cancellationToken = default); - /// 稽查用这个 EF跟踪方式 先查询出来所有实体,再更新部分字段 + /// 稽查用这个 EF跟踪方式 先查询出来所有实体,再更新部分字段 一定会产生更新sql Task UpdatePartialFromQueryAsync(Expression> updateFilter, Expression> updateFactory, bool autoSave = false, bool ignoreQueryFilter = false, CancellationToken cancellationToken = default); + /// EF跟踪方式 会去数据库查询完整的实体,再更新部分字段 根据是否修改了字段ef 自动判断是否生成sql + Task UpdatePartialFromEFAutoAsync(Guid id, Expression> updateFactory, + bool autoSave = false, CancellationToken cancellationToken = default); + #endregion diff --git a/IRaCIS.Core.Infra.EFCore/Repository/Repository.cs b/IRaCIS.Core.Infra.EFCore/Repository/Repository.cs index 741686c83..d424e4077 100644 --- a/IRaCIS.Core.Infra.EFCore/Repository/Repository.cs +++ b/IRaCIS.Core.Infra.EFCore/Repository/Repository.cs @@ -8,6 +8,7 @@ using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.ChangeTracking; using Microsoft.EntityFrameworkCore.Query; using Microsoft.Extensions.Localization; +using System.Reflection; namespace IRaCIS.Core.Infra.EFCore { @@ -167,6 +168,36 @@ namespace IRaCIS.Core.Infra.EFCore return searchEntity; } + public async Task UpdatePartialFromEFAutoAsync(Guid id, Expression> updateFactory, + bool autoSave = false, CancellationToken cancellationToken = default) + { + var searchEntity = await _dbSet.FindAsync(id); + + if (searchEntity == null) + { + throw new BusinessValidationFailedException(I18n.T("Repository_UpdateError")); + } + + var list = ((MemberInitExpression)updateFactory.Body).Bindings.Select(mb => mb.Member.Name) + .Select(propName => typeof(TEntity).GetProperty(propName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)).ToList(); + + Func func = updateFactory.Compile(); + + TEntity applyObj = func(searchEntity); + + foreach (PropertyInfo prop in list) + { + object value = prop.GetValue(applyObj); + prop.SetValue(searchEntity, value); + } + + await SaveChangesAsync(autoSave); + + return searchEntity; + } + + + public async Task UpdatePartialFromQueryAsync(Expression> updateFilter, Expression> updateFactory, bool autoSave = false, bool ignoreQueryFilter = false, CancellationToken cancellationToken = default) @@ -191,6 +222,7 @@ namespace IRaCIS.Core.Infra.EFCore + /// EF跟踪方式 删除 public async Task DeleteAsync(TEntity entity, bool autoSave = false, CancellationToken cancellationToken = default) { From 97c882b0b2992ca694ade1ead8b751695b5a4352 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Wed, 11 Jun 2025 09:33:24 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E8=82=BF=E7=98=A4=E5=AD=A6=E7=A8=BD?= =?UTF-8?q?=E6=9F=A5=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Reading/ReadingImageTask/ReadingOncologyTaskService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingOncologyTaskService.cs b/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingOncologyTaskService.cs index e6be23459..24955193a 100644 --- a/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingOncologyTaskService.cs +++ b/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingOncologyTaskService.cs @@ -346,7 +346,7 @@ namespace IRaCIS.Core.Application.Service var relatedVisitTaskIds = JsonConvert.SerializeObject(relatedVisitTaskIdList); // 这里先保存 签名的时候 会统一创建关系 - await _visitTaskRepository.UpdatePartialFromQueryAsync(t => t.Id == inDto.OncologyTaskId, u => new VisitTask() + await _visitTaskRepository.BatchUpdateNoTrackingAsync(t => t.Id == inDto.OncologyTaskId, u => new VisitTask() { RelatedVisitTaskIds = relatedVisitTaskIds }); From 302658d467163af432b9ed19b4596d7668cd69f6 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Wed, 11 Jun 2025 13:46:13 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=BD=B1=E5=93=8D?= =?UTF-8?q?=E5=AF=BC=E5=87=BA=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Service/ImageAndDoc/DTO/UnionStudyViewDodel.cs | 3 +++ .../Service/ImageAndDoc/DownloadAndUploadService.cs | 12 +++++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/IRaCIS.Core.Application/Service/ImageAndDoc/DTO/UnionStudyViewDodel.cs b/IRaCIS.Core.Application/Service/ImageAndDoc/DTO/UnionStudyViewDodel.cs index 81af79674..e325616c4 100644 --- a/IRaCIS.Core.Application/Service/ImageAndDoc/DTO/UnionStudyViewDodel.cs +++ b/IRaCIS.Core.Application/Service/ImageAndDoc/DTO/UnionStudyViewDodel.cs @@ -602,6 +602,9 @@ namespace IRaCIS.Core.Application.Contracts ? $"{TotalImageSize.Value / 1024d / 1024d:F3} MB" : "0.000 MB"; + public bool IsHaveDicom { get; set; } + + public bool IsHaveNoneDicom { get; set; } #region 废弃,为了字段排序 //public int TotalStudyCount => DicomStudyCount + NoneDicomStudyCount; diff --git a/IRaCIS.Core.Application/Service/ImageAndDoc/DownloadAndUploadService.cs b/IRaCIS.Core.Application/Service/ImageAndDoc/DownloadAndUploadService.cs index 5557ae305..2c4f63afa 100644 --- a/IRaCIS.Core.Application/Service/ImageAndDoc/DownloadAndUploadService.cs +++ b/IRaCIS.Core.Application/Service/ImageAndDoc/DownloadAndUploadService.cs @@ -1179,6 +1179,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc .Select(t => new TrialVisitImageStatView() { TrialId = t.TrialId, + SubjectVisitId = t.Id, SubjectCode = t.Subject.Code, TrialSiteCode = t.TrialSite.TrialSiteCode, TrialSiteId = t.TrialSiteId, @@ -1187,6 +1188,10 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc EarliestScanDate = t.EarliestScanDate, LatestScanDate = t.LatestScanDate, + IsHaveDicom = t.StudyList.Any(), + + IsHaveNoneDicom = t.NoneDicomStudyList.Any(), + TotalStudyCount = t.StudyList.Count() + t.NoneDicomStudyList.Count(), @@ -1206,7 +1211,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc }); - var pagelist = await query.ToPagedListAsync(inQuery); + var pagelist = await query.Where(t => t.TotalImageCount > 0).ToPagedListAsync(inQuery); return ResponseOutput.Ok(pagelist); } @@ -1225,8 +1230,9 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc { SubjectId = g.Key, VisitCount = g.Count(), - ImageSize = g.Sum(t => t.NoneDicomStudyList.SelectMany(t => t.NoneDicomFileList).Sum(t => t.FileSize) - + g.Sum(t => t.StudyList.SelectMany(t => t.InstanceList).Sum(t => t.FileSize))) + ImageSize = g.SelectMany(t => t.NoneDicomStudyList).SelectMany(t => t.NoneDicomFileList).Sum(t => t.FileSize) + + + g.SelectMany(t => t.StudyList).SelectMany(t => t.InstanceList).Sum(t => t.FileSize) }) .ToList(); From 8610a627ea9baecdb8e3084015ab1fb496076066 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Wed, 11 Jun 2025 14:03:50 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=AF=BC=E5=87=BA?= =?UTF-8?q?=E5=BD=B1=E5=93=8D=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Service/ImageAndDoc/DownloadAndUploadService.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/IRaCIS.Core.Application/Service/ImageAndDoc/DownloadAndUploadService.cs b/IRaCIS.Core.Application/Service/ImageAndDoc/DownloadAndUploadService.cs index 2c4f63afa..122fca6e0 100644 --- a/IRaCIS.Core.Application/Service/ImageAndDoc/DownloadAndUploadService.cs +++ b/IRaCIS.Core.Application/Service/ImageAndDoc/DownloadAndUploadService.cs @@ -1269,9 +1269,9 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc SubjectCode = t.Subject.Code, VisitName = (string?)t.SourceSubjectVisit.VisitName, - QuestionMarkPictureList = t.ReadingTaskQuestionMarkList.SelectMany(c => new List() { c.PicturePath, c.OtherPicturePath }).ToList(), + QuestionMarkPictureList = t.ReadingTaskQuestionMarkList.Select(c => new { c.PicturePath, c.OtherPicturePath }).ToList(), - TableQuestionRowPictureList = t.LesionList.SelectMany(c => new List() { c.PicturePath, c.OtherPicturePath }).ToList(), + TableQuestionRowPictureList = t.LesionList.Select(c => new { c.PicturePath, c.OtherPicturePath }).ToList(), IsJudgeSelect = t.JudgeResultTaskId == t.Id From a7ad22ed28fd2ff737d1830916a6db7034726b3e Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Wed, 11 Jun 2025 14:35:56 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=85=B3=E9=94=AE?= =?UTF-8?q?=E5=9B=BE=E4=B8=8B=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Service/ImageAndDoc/DownloadAndUploadService.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/IRaCIS.Core.Application/Service/ImageAndDoc/DownloadAndUploadService.cs b/IRaCIS.Core.Application/Service/ImageAndDoc/DownloadAndUploadService.cs index 122fca6e0..4a0254850 100644 --- a/IRaCIS.Core.Application/Service/ImageAndDoc/DownloadAndUploadService.cs +++ b/IRaCIS.Core.Application/Service/ImageAndDoc/DownloadAndUploadService.cs @@ -1269,6 +1269,8 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc SubjectCode = t.Subject.Code, VisitName = (string?)t.SourceSubjectVisit.VisitName, + ArmEnum= t.ArmEnum, + QuestionMarkPictureList = t.ReadingTaskQuestionMarkList.Select(c => new { c.PicturePath, c.OtherPicturePath }).ToList(), TableQuestionRowPictureList = t.LesionList.Select(c => new { c.PicturePath, c.OtherPicturePath }).ToList(), @@ -1277,7 +1279,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc IsJudgeSelect = t.JudgeResultTaskId == t.Id - }).FirstOrDefault(); + }).ToList(); return ResponseOutput.Ok(downloadInfo); }