39 lines
1.4 KiB
PHP
39 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace Modules\Internal\Transformers;
|
|
|
|
use Illuminate\Http\Resources\Json\JsonResource;
|
|
use Carbon\Carbon;
|
|
|
|
class ReportPhrResource extends JsonResource
|
|
{
|
|
/**
|
|
* Transform the resource into an array.
|
|
*
|
|
* @param \Illuminate\Http\Request
|
|
* @return array
|
|
*/
|
|
public function toArray($request)
|
|
{
|
|
$doctor_name = null;
|
|
|
|
if ($this->doctor && $this->doctor->user && $this->doctor->user->detail) {
|
|
$doctor_name = $this->doctor->user->detail->sTitlePrefix . ' ' . $this->doctor->user->fullname;
|
|
}
|
|
$data = [
|
|
'id' => $this->nID,
|
|
'healthcare' => $this->healthCare ? $this->healthCare->sHealthCare : null,
|
|
'patient_name' => $this->user ? $this->user->sFirstName : null,
|
|
'doctor_name' => $doctor_name,
|
|
'specialis' => $this->doctor ? $this->doctor->speciality->sSpesialis : null,
|
|
'date_consultation' => $this->summary ? Carbon::parse($this->dCreateOn)->format('Y-m-d H:i:s') : null ,
|
|
'subject' => $this->summary ? $this->summary->sSubjective : null,
|
|
'object' => $this->summary ? $this->summary->sObjective : null,
|
|
'assessment' => $this->summary ? $this->summary->sAssessment : null,
|
|
'plan' => $this->summary ? unserialize($this->summary->sPlan) : null,
|
|
];
|
|
|
|
return $data;
|
|
}
|
|
}
|