Обновление шаблонадежурного

This commit is contained in:
brusnitsyn
2026-07-09 17:12:36 +09:00
parent b902fcf5b7
commit fc33be3926
2 changed files with 20 additions and 19 deletions

View File

@@ -9,12 +9,6 @@ use Illuminate\Support\Collection;
class DutyReportExport
{
private const RU_MONTHS = [
1 => 'январь', 2 => 'февраль', 3 => 'март', 4 => 'апрель',
5 => 'май', 6 => 'июнь', 7 => 'июль', 8 => 'август',
9 => 'сентябрь', 10 => 'октябрь', 11 => 'ноябрь', 12 => 'декабрь',
];
public function __construct(
protected array $patients,
protected array $dateRange,
@@ -29,12 +23,13 @@ class DutyReportExport
public function toViewData(): array
{
$patients = collect($this->patients);
$startDate = Carbon::parse($this->dateRange[0]);
$endDate = Carbon::parse($this->dateRange[1]);
return [
'title' => sprintf('%s «%s»', $this->reportName, $this->department->name_full ?? $this->department->name_short),
'day' => $endDate->format('d'),
'month' => self::RU_MONTHS[(int) $endDate->format('n')],
'day' => $startDate->format('d'),
'month' => $startDate->locale('ru')->getTranslatedMonthName('Do MMMM'),
'year' => $endDate->format('Y'),
'planned' => $this->urgencyGroup($patients, 'planned'),
'urgent' => $this->urgencyGroup($patients, 'urgent'),
@@ -97,6 +92,7 @@ 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') ?? '')
];
}