fixing add prescription
This commit is contained in:
@@ -5,6 +5,8 @@ namespace Modules\Internal\Transformers;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
use App\Helpers\Helper;
|
||||
use App\Models\Prescription;
|
||||
use App\Models\PrescriptionItem;
|
||||
|
||||
class LivechatResource extends JsonResource
|
||||
{
|
||||
@@ -16,6 +18,12 @@ class LivechatResource extends JsonResource
|
||||
*/
|
||||
public function toArray($request)
|
||||
{
|
||||
$prescription = Prescription::where('livechat_id', $this->nID)->first();
|
||||
$diagnosis = $prescription ? $prescription->icd_code : '';
|
||||
$hospital = $prescription ? $prescription->organization_id : '';
|
||||
|
||||
$prescriptionItem = $prescription ? PrescriptionItem::where('prescription_id', $prescription->id)->get() : [];
|
||||
|
||||
$livechat = [
|
||||
'id' => $this->nID,
|
||||
'doctor_name' => isset($this->doctor->user->sFirstName) ? $this->doctor->user->detail->sTitlePrefix . '. ' . $this->doctor->user->sFirstName . ' ' . $this->doctor->user->sLastName . ' ' . $this->doctor->user->detail->sTitleSuffix : null,
|
||||
@@ -36,6 +44,9 @@ class LivechatResource extends JsonResource
|
||||
'appointment_media' => $this->appointment->sMedia ?? null,
|
||||
'status_chat' => $this->status_name ?? null,
|
||||
'payment_method' => $this->appointment->payment_method ?? null,
|
||||
'diagnosis' => $diagnosis,
|
||||
'hospital' => $hospital,
|
||||
'medicine' => $prescriptionItem
|
||||
];
|
||||
|
||||
$start_time = $this->dStartTime;
|
||||
|
||||
Reference in New Issue
Block a user