From b33fb79718382615bd9c75835d2757e51c9a75ed Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Fri, 14 Aug 2026 14:32:17 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9C=80=E6=96=B0=E7=9A=84=E8=B0=83=E7=A0=94?= =?UTF-8?q?=E8=A1=A8=E8=BF=87=E6=BB=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SiteSurvey/TrialSiteSurveyService.cs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs index f82748440..4d0d46e97 100644 --- a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs +++ b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs @@ -1489,7 +1489,16 @@ namespace IRaCIS.Core.Application.Contracts [HttpPost] public async Task GetSiteSurveyEquipmentList(SiteSurveyEquipmentQuery inQuery) { + + //找到该中心最新的调研记录 + var groupSelectIdQuery = + _trialSiteSurveyRepository.Where(t => t.TrialId == inQuery.TrialId) + .WhereIf(inQuery.TrialSiteId != null, t => t.TrialSiteId == inQuery.TrialSiteId) + .GroupBy(t => t.TrialSiteId) + .Select(g => g.OrderByDescending(u => u.CreateTime).Select(t => t.Id).First()); + var pageList = await _trialSiteEquipmentSurveyRepository.Where(t => t.TrialSiteSurvey.TrialId == inQuery.TrialId).IgnoreQueryFilters() + .Where(t => groupSelectIdQuery.Contains(t.TrialSiteSurveyId)) .WhereIf(inQuery.IsDeleted != null, t => t.TrialSiteSurvey.IsDeleted == inQuery.IsDeleted) .WhereIf(inQuery.State != null, t => t.TrialSiteSurvey.State == inQuery.State) .WhereIf(inQuery.TrialSiteId != null, t => t.TrialSiteSurvey.TrialSiteId == inQuery.TrialSiteId) @@ -1513,7 +1522,16 @@ namespace IRaCIS.Core.Application.Contracts [HttpPost] public async Task GetSiteSurveyInfoList(SiteSurveyInfoQuery inQuery) { + + //找到该中心最新的调研记录 + var groupSelectIdQuery = + _trialSiteSurveyRepository.Where(t => t.TrialId == inQuery.TrialId) + .WhereIf(inQuery.TrialSiteId != null, t => t.TrialSiteId == inQuery.TrialSiteId) + .GroupBy(t => t.TrialSiteId) + .Select(g => g.OrderByDescending(u => u.CreateTime).Select(t => t.Id).First()); + var pageList = await _trialSiteSurveyRepository.Where(t => t.TrialId == inQuery.TrialId).IgnoreQueryFilters() + .Where(t => groupSelectIdQuery.Contains(t.Id)) .WhereIf(inQuery.IsDeleted != null, t => t.IsDeleted == inQuery.IsDeleted) .WhereIf(inQuery.State != null, t => t.State == inQuery.State) .WhereIf(inQuery.TrialSiteId != null, t => t.TrialSiteId == inQuery.TrialSiteId)