* добавил получение выбывших * фильтрация выбывших по результатам лечения * добавил подсказку при наведении на операции * добавил вывод причины наблюдения * добавил вкладки для выбывших * изменил связь и сохранение пациентов на контроле * добавил возможность редактирования причины контроля * полное изменение окна с нежелательными событиями * исправил просмотр причины контроля * работа над окном редактирования причины контроля в таблице * визуальное выделение умерших и проведенных операций * добавил выбор даты для роли врач * центрирование блоков статистики * разделение выполненных операций на срочность * поправил метод определения текущего дня для роли врач * функция блокировки при выборе другой даты для роли врач
46 lines
1.7 KiB
PHP
46 lines
1.7 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Resources\Mis;
|
|
|
|
use App\Models\MisSurgicalOperation;
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Http\Resources\Json\JsonResource;
|
|
use Illuminate\Support\Carbon;
|
|
use Illuminate\Support\Str;
|
|
|
|
class FormattedPatientResource extends JsonResource
|
|
{
|
|
/**
|
|
* Transform the resource into an array.
|
|
*
|
|
* @return array<string, mixed>
|
|
*/
|
|
public function toArray(Request $request): array
|
|
{
|
|
return [
|
|
'id' => $this->MedicalHistoryID,
|
|
'num' => $this->num,
|
|
'mkb' => $this->whenLoaded('migrations', function () {
|
|
return [
|
|
'ds' => $this->migrations()->first()->diagnosis()->first()?->mkb()->first()->DS ?? null,
|
|
'name' => $this->migrations()->first()->diagnosis()->first()?->mkb()->first()->NAME ?? null,
|
|
];
|
|
}),
|
|
'operations' => $this->whenLoaded('surgicalOperations', function () {
|
|
return $this->operationOnBranch($this->misStationarBranchId, $this->startDate, $this->endDate)
|
|
->get()
|
|
->map(function (MisSurgicalOperation $operation) {
|
|
return [
|
|
'code' => $operation->serviceMedical->ServiceMedicalCode ?? null,
|
|
];
|
|
});
|
|
}),
|
|
'fullname' => Str::ucwords(Str::lower("$this->FAMILY $this->Name $this->OT")),
|
|
'age' => Carbon::parse($this->BD)->diff(Carbon::now())->format('%y'),
|
|
'birth_date' => Carbon::parse($this->BD)->format('d.m.Y'),
|
|
'outcome_type' => $this->when($this->outcome_type, $this->outcome_type),
|
|
'comment' => $this->when($this->comment, $this->comment)
|
|
];
|
|
}
|
|
}
|