Доработка наблюдения в отчете дежурного

This commit is contained in:
brusnitsyn
2026-07-13 13:17:12 +09:00
parent afdb60241d
commit cc9bd2ce6d
2 changed files with 21 additions and 5 deletions

View File

@@ -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;

View File

@@ -18,12 +18,12 @@
<p class="label">Плановые: {{ $planned['count'] }}</p>
@foreach ($planned['patients'] as $i => $p)
<p class="patient">{{ $i + 1 }}. {{ $p['full_name'] }} {{ $p['age'] }}.@if ($p['diagnosis']) Д/З: {{ $p['diagnosis'] }}.@endif id = {{ $p['migration_id'] }}</p>
<p class="patient">{{ $i + 1 }}. {{ $p['full_name'] }} {{ $p['age'] }}.@if ($p['diagnosis']) Д/З: {{ $p['diagnosis'] }}.@endif</p>
@endforeach
<p class="label">Экстренные: {{ $urgent['count'] }}</p>
@foreach ($urgent['patients'] as $i => $p)
<p class="patient">{{ $i + 1 }}. {{ $p['full_name'] }} {{ $p['age'] }}.@if ($p['diagnosis']) Д/З: {{ $p['diagnosis'] }}.@endif id = {{ $p['migration_id'] }}</p>
<p class="patient">{{ $i + 1 }}. {{ $p['full_name'] }} {{ $p['age'] }}.@if ($p['diagnosis']) Д/З: {{ $p['diagnosis'] }}.@endif</p>
@endforeach
<p class="label">В отделении состоит: {{ $inDepartment }}</p>
@@ -43,7 +43,10 @@
<p class="patient">{{ $i + 1 }}. {{ $p['full_name'] }} {{ $p['age'] }}.@if ($p['diagnosis']) {{ $p['diagnosis'] }}.@endif</p>
@endforeach
<p class="label">Под наблюдением: {{ $observableCount }}</p>
<p class="label">Под наблюдением: {{ $observables['count'] }}</p>
@foreach ($observables['patients'] as $i => $p)
<p class="patient">{{ $i + 1 }}. {{ $p['full_name'] }} {{ $p['age'] }}.@if ($p['diagnosis']) {{ $p['diagnosis'] }}.@endif<br>@if ($p['observable_reason']) {{ $p['observable_reason'] }}.@endif</p>
@endforeach
<p class="label">Летальные исходы: {{ $deceased['count'] > 0 ? '' : 'не было.' }}</p>
@foreach ($deceased['patients'] as $i => $p)