diff --git a/app/Services/StatisticsService.php b/app/Services/StatisticsService.php index b10fe24..c08afe3 100644 --- a/app/Services/StatisticsService.php +++ b/app/Services/StatisticsService.php @@ -303,6 +303,8 @@ class StatisticsService 'preoperativeSum' => 0, 'preoperativePatientCount' => 0, + 'percentLoaded' => 0, + 'staff_sum' => 0, 'observable_sum' => 0, 'unwanted_sum' => 0, @@ -385,12 +387,14 @@ class StatisticsService { $outcomeSum = $total['outcome_sum']; $preopPatients = $total['preoperativePatientCount']; + $consistSum = $total['consist_sum'] ?? 0; + $bedsSum = $total['beds_sum'] ?? 0; return [ 'isTotalRow' => ! $isGrandTotal, 'isGrandTotal' => $isGrandTotal, 'department' => $isGrandTotal ? 'ОБЩИЕ ИТОГИ:' : 'ИТОГО:', - 'beds' => $total['beds_sum'], + 'beds' => $bedsSum, 'recipients' => [ 'all' => $total['recipients_all_sum'], 'plan' => $total['recipients_plan_sum'], @@ -398,8 +402,10 @@ class StatisticsService 'transferred' => $total['recipients_transferred_sum'], ], 'outcome' => $outcomeSum, - 'consist' => $total['consist_sum'], - 'percentLoadedBeds' => '—', + 'consist' => $consistSum, + 'percentLoadedBeds' => $consistSum > 0 + ? round(($consistSum / $bedsSum) * 100) + : 0, // '—', 'surgical' => [ 'plan' => $total['plan_surgical_sum'], 'emergency' => $total['emergency_surgical_sum'],