Работа над журналом для ст. мед сестер
This commit is contained in:
@@ -135,6 +135,11 @@ class StatisticsService
|
||||
$bedDaysSum = 0;
|
||||
$avgBedDays = 0;
|
||||
$preoperativeSum = 0;
|
||||
$preoperativePatientCount = 0;
|
||||
$preoperativeTotalRecords = 0;
|
||||
$preoperativePatientRecords = 0;
|
||||
$preoperativeAverageSum = 0;
|
||||
$preoperativeAverageCount = 0;
|
||||
|
||||
if (isset($metrics[$deptId])) {
|
||||
foreach ($metrics[$deptId] as $item) {
|
||||
@@ -153,10 +158,24 @@ class StatisticsService
|
||||
16 => $unwanted = (int) $value,
|
||||
25 => $bedDaysSum += $value,
|
||||
19 => $lethalitySum = $value,
|
||||
21 => $preoperativeAverageSum += $value,
|
||||
26 => $preoperativeSum += $value,
|
||||
27 => $preoperativePatientCount += (int) $value,
|
||||
// 24 => $completePlanProgress = (int)$value,
|
||||
default => null
|
||||
};
|
||||
|
||||
if ((int) $item->rf_metrika_item_id === 21) {
|
||||
$preoperativeAverageCount += (int) $item->records_count;
|
||||
}
|
||||
|
||||
if ((int) $item->rf_metrika_item_id === 26) {
|
||||
$preoperativeTotalRecords += (int) $item->records_count;
|
||||
}
|
||||
|
||||
if ((int) $item->rf_metrika_item_id === 27) {
|
||||
$preoperativePatientRecords += (int) $item->records_count;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -170,10 +189,15 @@ class StatisticsService
|
||||
$percentLoaded = $bedsCount > 0 ? round($currentCount * 100 / $bedsCount) : 0;
|
||||
|
||||
// Средний койко-день
|
||||
$avgBedDays = $outcome > 0 ? round($bedDaysSum / $outcome, 2) : 0;
|
||||
$avgBedDays = $outcome > 0 ? round($bedDaysSum / $outcome, 1) : 0;
|
||||
|
||||
// Предоперационный койко-день
|
||||
$preoperativeValue =
|
||||
$canUsePreoperativeTotals = $preoperativePatientCount > 0
|
||||
&& $preoperativeTotalRecords > 0
|
||||
&& $preoperativePatientRecords >= $preoperativeTotalRecords;
|
||||
$preoperativeValue = $canUsePreoperativeTotals
|
||||
? round($preoperativeSum / $preoperativePatientCount, 1)
|
||||
: ($preoperativeAverageCount > 0 ? round($preoperativeAverageSum / $preoperativeAverageCount, 1) : 0);
|
||||
|
||||
// Летальность
|
||||
$lethality = $outcome > 0 ? round(($deceased / $outcome) * 100, 2) : 0;
|
||||
@@ -203,8 +227,14 @@ class StatisticsService
|
||||
'countStaff' => $staff,
|
||||
'countObservable' => $observable,
|
||||
'countUnwanted' => $unwanted,
|
||||
|
||||
'averageBedDays' => $avgBedDays,
|
||||
'bedDaysSum' => $bedDaysSum,
|
||||
|
||||
'preoperativeDays' => $preoperativeValue,
|
||||
'preoperativeSum' => $preoperativeSum,
|
||||
'preoperativePatientCount' => $preoperativePatientCount,
|
||||
|
||||
'progressPlanOfYear' => $periodPlan,
|
||||
'percentPlanOfYear' => $percentPlanOfYear,
|
||||
'lethality' => $lethality,
|
||||
@@ -248,6 +278,11 @@ class StatisticsService
|
||||
'deceased_sum' => 0,
|
||||
'percentLoadedBeds_total' => 0,
|
||||
'percentLoadedBeds_count' => 0,
|
||||
'bedDaysSum' => 0,
|
||||
|
||||
'preoperativeSum' => 0,
|
||||
'preoperativePatientCount' => 0,
|
||||
|
||||
'staff_sum' => 0,
|
||||
'observable_sum' => 0,
|
||||
'unwanted_sum' => 0,
|
||||
@@ -272,6 +307,9 @@ class StatisticsService
|
||||
$totals['deceased_sum'] += $data['deceased'];
|
||||
$totals['percentLoadedBeds_total'] += $data['percentLoadedBeds'];
|
||||
$totals['percentLoadedBeds_count']++;
|
||||
$totals['bedDaysSum'] += $data['bedDaysSum'];
|
||||
$totals['preoperativeSum'] += $data['preoperativeSum'];
|
||||
$totals['preoperativePatientCount'] += $data['preoperativePatientCount'];
|
||||
$totals['staff_sum'] += $data['countStaff'];
|
||||
$totals['observable_sum'] += $data['countObservable'];
|
||||
$totals['unwanted_sum'] += $data['countUnwanted'];
|
||||
@@ -325,11 +363,13 @@ class StatisticsService
|
||||
*/
|
||||
private function createTotalRow(string $type, array $total, bool $isGrandTotal): array
|
||||
{
|
||||
if ($total['preoperativePatientCount'] === 0) $total['preoperativePatientCount'] = 1;
|
||||
if ($total['outcome_sum'] === 0) $total['outcome_sum'] = 1;
|
||||
return [
|
||||
'isTotalRow' => ! $isGrandTotal,
|
||||
'isGrandTotal' => $isGrandTotal,
|
||||
'department' => $isGrandTotal ? 'ОБЩИЕ ИТОГИ:' : 'ИТОГО:',
|
||||
'beds' => '—',
|
||||
'beds' => $total['beds_sum'],
|
||||
'recipients' => [
|
||||
'all' => $total['recipients_all_sum'],
|
||||
'plan' => $total['recipients_plan_sum'],
|
||||
@@ -344,9 +384,9 @@ class StatisticsService
|
||||
'emergency' => $total['emergency_surgical_sum'],
|
||||
],
|
||||
'deceased' => $total['deceased_sum'],
|
||||
'averageBedDays' => '—',
|
||||
'preoperativeDays' => '—',
|
||||
'lethality' => '—',
|
||||
'averageBedDays' => round($total['bedDaysSum'] / $total['outcome_sum'], 1),
|
||||
'preoperativeDays' => round($total['preoperativeSum'] / $total['preoperativePatientCount'] < 0 ?? 1, 1),
|
||||
'lethality' => round(($total['deceased_sum'] / $total['outcome_sum']) * 100, 2),
|
||||
'type' => $type,
|
||||
'departments_count' => $total['departments_count'],
|
||||
'countStaff' => $total['staff_sum'],
|
||||
|
||||
Reference in New Issue
Block a user