Доработка наблюдения в отчете дежурного
This commit is contained in:
@@ -37,7 +37,7 @@ class DutyReportExport
|
||||
'plannedOperations' => $this->operationsGroup($patients, [6]),
|
||||
'urgentOperations' => $this->operationsGroup($patients, [4, 5]),
|
||||
'reanimation' => $this->flagGroup($patients, 'in_reanimation'),
|
||||
'observableCount' => $patients->where('in_observable', true)->count(),
|
||||
'observables' => $this->observableGroup($patients),
|
||||
'deceased' => $this->flagGroup($patients, 'period_flags.deceased'),
|
||||
];
|
||||
}
|
||||
@@ -92,10 +92,23 @@ class DutyReportExport
|
||||
'full_name' => $patient['full_name'],
|
||||
'age' => $age !== null ? "{$age} ".$this->pluralizeAge($age) : '',
|
||||
'diagnosis' => $withDiagnosis ? (data_get($patient, 'latest_migration.diagnosis_name') ?? '') : null,
|
||||
'migration_id' => (data_get($patient, 'latest_migration.original_id') ?? '')
|
||||
'migration_id' => (data_get($patient, 'latest_migration.original_id') ?? ''),
|
||||
'observable_reason' => (data_get($patient, 'observable.observable_reason') ?? '')
|
||||
];
|
||||
}
|
||||
|
||||
private function observableGroup(Collection $patients): array
|
||||
{
|
||||
// Поступившие именно в этот отчётный период (сутки), а не все, кто вообще сейчас в отделении
|
||||
$filtered = $patients
|
||||
->where('in_observable', true)
|
||||
->values();
|
||||
|
||||
return [
|
||||
'count' => $filtered->count(),
|
||||
'patients' => $filtered->map(fn (array $p) => $this->presentPatient($p))->all(),
|
||||
];
|
||||
}
|
||||
private function pluralizeAge(int $age): string
|
||||
{
|
||||
$mod100 = $age % 100;
|
||||
|
||||
Reference in New Issue
Block a user