diff --git a/app/Services/DutyMedicalHistoryService.php b/app/Services/DutyMedicalHistoryService.php index 74263f2..9160504 100644 --- a/app/Services/DutyMedicalHistoryService.php +++ b/app/Services/DutyMedicalHistoryService.php @@ -39,7 +39,7 @@ class DutyMedicalHistoryService // 1. Один запрос: получаем "сырые" данные (без вычисляемых статусов) $all = ReportDutyPatient::query() - ->when($reportIds, function ($query, $reportIds) { + ->when($reportIds !== null, function ($query) use ($reportIds) { return $query->whereIn('report_duty_id', $reportIds); }) ->whereHas('migrations', $periodMigrationFilter)