*/ public function toArray(Request $request = null): array { $lists = []; foreach ($this->resource['response'] as $v) { $lists[] = [ 'category' => $v['visitType'], 'visit_date' => date('Y-m-d', strtotime($v['visitDate'])), 'diagnosis' => $v['outpatientDiagnosis'], 'dept_id' => $v['treatmentDepartment'], 'dept_name' => $v['departmentName'], 'reg_id' => $v['regId'], 'prescription_id' => $v['prescriptionId'], 'total_prescription_amount' => (float) $v['prescriptionAmount'], 'single_prescription_amount' => (float) $v['singleAmount'], 'doctor_name' => $v['doctorName'], 'remark' => $v['remarks'], 'is_self_pay' => $v['isexpense'], 'prescription_number' => $v['nrescriptionNumber'], 'exec_address' => $v['takeMedicine'] ?: '', 'visit_no' => $v['visitNumber'], ]; } return $lists; } }