Профиль хирургии
This commit is contained in:
29
app/Http/Resources/Api/OperationsResource.php
Normal file
29
app/Http/Resources/Api/OperationsResource.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources\Api;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
use Illuminate\Support\Carbon;
|
||||
|
||||
class OperationsResource extends JsonResource
|
||||
{
|
||||
/**
|
||||
* Transform the resource into an array.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
return [
|
||||
'id' => $this->SurgicalOperationID,
|
||||
'num' => $this->Num,
|
||||
'description' => trim($this->Description),
|
||||
'startAt' => $this->Date,
|
||||
'endAt' => $this->DataEnd,
|
||||
'duration' => $this->Date && $this->DataEnd ?
|
||||
Carbon::parse($this->Date)->diffInMinutes(Carbon::parse($this->DataEnd)) : null,
|
||||
'service' => $this->serviceMedical,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -20,10 +20,14 @@ class FormattedPatientResource extends JsonResource
|
||||
return [
|
||||
'id' => $this->MedicalHistoryID,
|
||||
'num' => $this->num,
|
||||
'mkb.ds' => $this->migrations->first()->diagnosis->first()?->mkb?->DS,
|
||||
'mkb' => [
|
||||
'ds' => $this->outcomeMigration->first()->mainDiagnosis?->mkb?->DS,
|
||||
'name' => $this->outcomeMigration->first()->mainDiagnosis?->mkb?->NAME
|
||||
],
|
||||
'operations' => $this->surgicalOperations->map(function ($operation) {
|
||||
return [
|
||||
'code' => $operation->serviceMedical->ServiceMedicalCode
|
||||
'code' => $operation->serviceMedical->ServiceMedicalCode,
|
||||
'name' => $operation->serviceMedical->ServiceMedicalName,
|
||||
];
|
||||
}),
|
||||
'fullname' => Str::ucwords(Str::lower("$this->FAMILY $this->Name $this->OT")),
|
||||
|
||||
Reference in New Issue
Block a user