From fb48249178467b98b9621ea0083fce5661312c1f Mon Sep 17 00:00:00 2001 From: Brusnitsyn Date: Mon, 6 Jul 2026 11:20:21 +0000 Subject: [PATCH] =?UTF-8?q?=D0=92=D1=8B=D0=B4=D0=B0=D1=87=D0=B0=20=D0=BF?= =?UTF-8?q?=D0=B0=D1=86=D0=B8=D0=BD=D0=B5=D1=82=D0=BE=D0=B2=20=D0=BD=D0=B0?= =?UTF-8?q?=20=D1=81=D1=83=D1=82=D0=BA=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Exports/DutyReportExport.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/app/Exports/DutyReportExport.php b/app/Exports/DutyReportExport.php index 87b3425..04b39ba 100644 --- a/app/Exports/DutyReportExport.php +++ b/app/Exports/DutyReportExport.php @@ -49,8 +49,9 @@ class DutyReportExport private function urgencyGroup(Collection $patients, string $flag): array { + // Поступившие именно в этот отчётный период (сутки), а не все, кто вообще сейчас в отделении $filtered = $patients - ->where('period_flags.current_at_end', true) + ->where('period_flags.recipient', true) ->where("period_flags.{$flag}", true) ->values(); @@ -62,8 +63,12 @@ class DutyReportExport private function operationsGroup(Collection $patients, array $urgentStatuses): array { + // latest_migration.operations уже ограничены периодом (start_date в рамках суток), + // в отличие от верхнеуровневого operations, у которого нижняя граница не задана $filtered = $patients->filter(function (array $p) use ($urgentStatuses) { - return collect($p['operations'] ?? [])->whereIn('urgent_status', $urgentStatuses)->isNotEmpty(); + return collect(data_get($p, 'latest_migration.operations', [])) + ->whereIn('urgent_status', $urgentStatuses) + ->isNotEmpty(); })->values(); return [