Работа над журналом для ст. мед сестер
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user