reportService->getReportStatistics($department, $user, $dateRange); $reportInfo = $this->reportService->getCurrentReportInfo($department, $user, $dateRange); $recipientPlanOfYear = $this->reportService->getRecipientPlanOfYear($department, $dateRange); return [ 'department' => [ 'department_name' => $department->name_full, 'department_id' => $department->department_id, 'beds' => $department->beds, 'percentLoadedBeds' => ($statistics['beds'] ?? 0) > 0 ? round((($statistics['currentCount'] ?? 0) * 100) / $statistics['beds']) : 0, 'recipientPlanOfYear' => $recipientPlanOfYear['plan'], 'progressPlanOfYear' => $recipientPlanOfYear['progress'], ...$statistics, ], 'dates' => [ 'startAt' => $dateRange->startTimestamp(), 'endAt' => $dateRange->endTimestamp(), ], 'report' => $reportInfo, 'metrikaItems' => MetrikaItem::whereIn('metrika_item_id', [3, 7, 8, 17])->get(), 'patients' => [], 'userId' => $reportInfo['userId'], 'userName' => $reportInfo['userName'], ]; } }