Работа над журналом для ст. мед сестер

This commit is contained in:
brusnitsyn
2026-05-04 17:11:16 +09:00
parent f107ebd167
commit 7a58812072
61 changed files with 3532 additions and 1163 deletions

View File

@@ -226,13 +226,16 @@ class RecalculatePreoperativeMetric extends Command
$count = 0;
foreach ($operations as $op) {
$days = Carbon::parse($op->first_admission)
->diffInDays(Carbon::parse($op->first_operation));
$admittedAt = Carbon::parse($op->first_admission);
$operationAt = Carbon::parse($op->first_operation);
if ($days >= 0) {
$totalDays += $days;
$count++;
if ($operationAt->lt($admittedAt)) {
continue;
}
$totalDays += $admittedAt->copy()->startOfDay()
->diffInDays($operationAt->copy()->startOfDay());
$count++;
}
$avgDays = $count > 0 ? round($totalDays / $count, 1) : 0;