* переписал функции прототипов в сервисы

* оптимизация доставки контента до клиента
* переписал запросы выборок
* убрал из подсчета переведенных
* добавил сохранение метрикам для вывода в дашборд
This commit is contained in:
brusnitsyn
2026-02-04 17:05:13 +09:00
parent 9ee33bc517
commit eab78a0291
16 changed files with 1644 additions and 737 deletions

View File

@@ -20,21 +20,12 @@ class FormattedPatientResource extends JsonResource
return [
'id' => $this->MedicalHistoryID,
'num' => $this->num,
'mkb' => $this->whenLoaded('migrations', function () {
'mkb.ds' => $this->migrations->first()->diagnosis->first()?->mkb?->DS,
'operations' => $this->surgicalOperations->map(function ($operation) {
return [
'ds' => $this->migrations()->first()->diagnosis()->first()?->mkb()->first()->DS ?? null,
'name' => $this->migrations()->first()->diagnosis()->first()?->mkb()->first()->NAME ?? null,
'code' => $operation->serviceMedical->ServiceMedicalCode
];
}),
'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'),