Работа над журналом для ст. мед сестер
This commit is contained in:
@@ -74,16 +74,21 @@ class PreoperativeDaysCalculator extends BaseMetricService implements MetricCalc
|
||||
}
|
||||
|
||||
$op = $operations[$historyId];
|
||||
$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) {
|
||||
if (! isset($results[$deptId])) {
|
||||
$results[$deptId] = ['total' => 0, 'count' => 0];
|
||||
}
|
||||
$results[$deptId]['total'] += $days;
|
||||
$results[$deptId]['count']++;
|
||||
if ($operationAt->lt($admittedAt)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$days = $admittedAt->copy()->startOfDay()
|
||||
->diffInDays($operationAt->copy()->startOfDay());
|
||||
|
||||
if (! isset($results[$deptId])) {
|
||||
$results[$deptId] = ['total' => 0, 'count' => 0];
|
||||
}
|
||||
$results[$deptId]['total'] += $days;
|
||||
$results[$deptId]['count']++;
|
||||
}
|
||||
|
||||
// Усредняем по отделениям
|
||||
|
||||
Reference in New Issue
Block a user