From 1617de2fc1db69d811836f38975bc8a1d545fdce Mon Sep 17 00:00:00 2001
From: he <109787524@qq.com>
Date: Fri, 31 Oct 2025 13:49:13 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Reading/Dto/ReadingPeriodSetViewModel.cs | 79 +++++++++++++++++++
.../ReadingPeriod/ReadingPeriodSetService.cs | 69 +++++++++++++++-
2 files changed, 146 insertions(+), 2 deletions(-)
diff --git a/IRaCIS.Core.Application/Service/Reading/Dto/ReadingPeriodSetViewModel.cs b/IRaCIS.Core.Application/Service/Reading/Dto/ReadingPeriodSetViewModel.cs
index 549387b8a..4517b43d6 100644
--- a/IRaCIS.Core.Application/Service/Reading/Dto/ReadingPeriodSetViewModel.cs
+++ b/IRaCIS.Core.Application/Service/Reading/Dto/ReadingPeriodSetViewModel.cs
@@ -79,8 +79,59 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
public Guid ReadingPeriodSetId { get; set; }
}
+ public class IsChangeReadingPlanInDto
+ {
+
+ public Guid? Id { get; set; }
+
+ ///
+ /// 阅片范围
+ ///
+ public ReadingScopeEnum ReadingScope { get; set; }
+
+ ///
+ /// 中心ID
+ ///
+ public List SiteIds { get; set; } = new List();
+
+ ///
+ /// 项目ID
+ ///
+ public Guid TrialId { get; set; }
+
+ ///
+ /// 截止日期
+ ///
+ public DateTime? ExpirationDate { get; set; }
+
+ ///
+ /// 截止访视
+ ///
+ public decimal? ExpirationVisitNum { get; set; }
+
+ ///
+ /// 访视计划ID
+ ///
+ public Guid? VisitStageId { get; set; }
+
+ ///
+ /// 阅片期名称
+ ///
+ public string ReadingPeriodName { get; set; }
+
+ ///
+ /// 类型
+ ///
+ public ReadingSetType ReadingSetType { get; set; }
+
+ public Guid? TrialReadingCriterionId { get; set; }
+ }
+
public class PreviewTheReadingListInDto : PageInput
{
+
+ public Guid? Id { get; set; }
+
///
/// 阅片范围
///
@@ -123,7 +174,25 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
public Guid? TrialReadingCriterionId { get; set; }
+ ///
+ /// 中心Id
+ ///
+ public Guid? SiteId { get; set; }
+ ///
+ /// 受试者Code
+ ///
+ public string SubjectCode { get; set; }=string.Empty;
+
+ ///
+ /// 是否加入阅片计划
+ ///
+ public bool? IsJoin { get; set; }
+
+ ///
+ /// 是否生成阅片计划
+ ///
+ public bool? IsGenerate { get; set; }
}
@@ -185,6 +254,16 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
public DateTime? EffectOfTime { get; set; }
+ ///
+ /// 是否加入阅片计划
+ ///
+ public bool? IsJoin { get; set; }
+
+ ///
+ /// 是否生成阅片计划
+ ///
+ public bool? IsGenerate { get; set; }
+
}
public class ReadingPeriodSetView
diff --git a/IRaCIS.Core.Application/Service/Reading/ReadingPeriod/ReadingPeriodSetService.cs b/IRaCIS.Core.Application/Service/Reading/ReadingPeriod/ReadingPeriodSetService.cs
index d8883cdc0..c50712231 100644
--- a/IRaCIS.Core.Application/Service/Reading/ReadingPeriod/ReadingPeriodSetService.cs
+++ b/IRaCIS.Core.Application/Service/Reading/ReadingPeriod/ReadingPeriodSetService.cs
@@ -466,8 +466,38 @@ namespace IRaCIS.Core.Application.Service
return result;
}
+ ///
+ /// 判断是否修改了阅片期计划的参数
+ ///
+ ///
+ public async Task IsChangeReadingPlan(IsChangeReadingPlanInDto inDto)
+ {
+ if (inDto.Id == null)
+ {
+ return false;
+ }
+ else
+ {
+ var periodSet = await _readingPeriodSetRepository.Where(x => x.Id == inDto.Id).Include(x => x.ReadingPeriodSites).FirstNotNullAsync();
+ var notChange = inDto.ExpirationDate == periodSet.ExpirationDate &&
+ inDto.ReadingScope == periodSet.ReadingScope &&
+ inDto.TrialId == periodSet.TrialId &&
+ inDto.ExpirationDate == periodSet.ExpirationDate &&
+ inDto.ExpirationVisitNum == periodSet.ExpirationVisitNum &&
+ inDto.VisitStageId == inDto.VisitStageId &&
+ inDto.ReadingSetType == inDto.ReadingSetType &&
+ inDto.TrialReadingCriterionId == inDto.TrialReadingCriterionId &&
+ inDto.SiteIds.Count == periodSet.ReadingPeriodSites.Count(x => inDto.SiteIds.Contains(x.TrialSiteId));
+
+ return !notChange;
+
+
+
+ }
+ }
+
///
/// 获取影像阅片的预览 // 需要清除之前已经选中的 (增加标准搜索,已修改)
///
@@ -475,6 +505,29 @@ namespace IRaCIS.Core.Application.Service
[HttpPost]
public async Task> GetPreviewTheReadingList(PreviewTheReadingListInDto inDto)
{
+
+ // 这里还需要获取到之前已经添加的
+ var isChangeReadingPlan = await IsChangeReadingPlan(new IsChangeReadingPlanInDto()
+ {
+ Id = inDto.Id,
+ ExpirationDate = inDto.ExpirationDate,
+ ReadingScope = inDto.ReadingScope,
+ TrialId = inDto.TrialId,
+ ExpirationVisitNum = inDto.ExpirationVisitNum,
+ VisitStageId = inDto.VisitStageId,
+ ReadingSetType = inDto.ReadingSetType,
+ TrialReadingCriterionId = inDto.TrialReadingCriterionId,
+ SiteIds = inDto.SiteIds,
+ });
+
+ List isChooseVisitIds = new List();
+
+ if (isChangeReadingPlan)
+ {
+ isChooseVisitIds= await _readingPeriodPlanRepository.Where(x => x.ReadingPeriodSetId == inDto.Id).Select(x => x.SubjectVisitId).ToListAsync();
+ }
+
+ var isTakeEffect = await _readingPeriodSetRepository.Where(x => x.Id == inDto.Id).Select(x => x.IsTakeEffect).FirstOrDefaultAsync();
var readModulequery = _readModuleRepository.AsQueryable();
// 当前项目 最晚拍片日期不为null 中心筛选
@@ -485,10 +538,20 @@ namespace IRaCIS.Core.Application.Service
// 已经存在的访视 需要排除
var existsBubjectVisitsQuery = _readModuleRepository.Where(y => y.ReadingSetType == inDto.ReadingSetType && y.TrialId == inDto.TrialId && y.TrialReadingCriterionId == inDto.TrialReadingCriterionId).Select(x => x.SubjectVisitId);
- visitQuery = visitQuery.Where(x => !existsBubjectVisitsQuery.Contains(x.Id))
+ visitQuery = visitQuery
+
+ .Where(x => !existsBubjectVisitsQuery.Contains(x.Id))
.WhereIf(inDto.ExpirationDate != null, x => x.LatestScanDate < inDto.ExpirationDate.Value.AddDays(1))
.WhereIf(inDto.ExpirationVisitNum != null, x => x.VisitNum == inDto.ExpirationVisitNum)
- .WhereIf(inDto.ReadingSetType == ReadingSetType.TumorReading, x => readModulequery.Where(y => y.SubjectVisitId == x.Id && y.ReadingSetType == ReadingSetType.ImageReading).Count() > 0);
+ .WhereIf(inDto.ReadingSetType == ReadingSetType.TumorReading, x => readModulequery.Where(y => y.SubjectVisitId == x.Id && y.ReadingSetType == ReadingSetType.ImageReading).Count() > 0)
+ .WhereIf(inDto.SiteId != null,x=> x.Subject.TrialSiteId==inDto.SiteId)
+ .WhereIf(inDto.SubjectCode.IsNotNullOrEmpty(), x =>x.Subject.Code.Contains(inDto.SubjectCode))
+ .WhereIf(inDto.IsJoin != null && inDto.IsJoin.Value, x => isChooseVisitIds.Contains(x.Id))
+ .WhereIf(inDto.IsGenerate != null && inDto.IsGenerate.Value, x => isChooseVisitIds.Contains(x.Id)&& isTakeEffect== ReadingPeriodStatus.TakeEffect)
+ ;
+
+ //.Where(x => isChooseVisitIds.Contains(x.Id));
+
var subjectIdlist = await visitQuery.OrderBy(x => x.SubjectId).Select(x => x.SubjectId).Distinct().Skip((inDto.PageIndex - 1) * inDto.PageSize).Take(inDto.PageSize).ToListAsync();
@@ -526,6 +589,8 @@ namespace IRaCIS.Core.Application.Service
SubjectCode = x.Subject.Code,
SubjectId = x.SubjectId,
SubjectVisitName = x.VisitName,
+ IsJoin= isChooseVisitIds.Contains(x.Id),
+ IsGenerate= isChooseVisitIds.Contains(x.Id)&& isTakeEffect== ReadingPeriodStatus.TakeEffect,
}).ToList(),
PageSize = inDto.PageSize,
PageIndex = inDto.PageIndex,