(int)$model->id, "medical_record_id" => $model->prescription_id, 'medical_record' => $model->medical_record()->with(['department_category'])->select(['doctor', 'hospital', 'chief_complaint', 'chinese_tra_diagnosis', 'department'])->first(), "name" => $model->name, "drug_type" => $model->drug_type, "eat_type" => $model->eat_type, "number" => $model->number, "advice_type" => $model->advice_type, "advice_frequency" => $model->advice_frequency, "advice_frequency_text" => Prescription::$frequencyMap[$model->advice_frequency], "one_consumption" => $model->one_consumption, "use_unit" => $model->use_unit, "advice" => $model->advice, "drugs" => $model->drugs, "patient_id" => $model->patient_id, "patient" => $model->patient()->select(['name', 'sex', 'birth_date'])->first(), "status" => $model->status, 'created_at' => $model->created_at->format(Carbon::DEFAULT_TO_STRING_FORMAT), 'updated_at' => $model->updated_at->format(Carbon::DEFAULT_TO_STRING_FORMAT) ]; } }