*/ public function toArray(Request $request = null): array { $this->resource = xmlArrayToListByKey($this->resource, 'ITEM'); $lists = []; foreach ($this->resource['ITEM'] as $v) { $lists[] = [ 'category' => $v['JZLB'], 'visit_date' => $v['JZRQ'], 'diagnosis' => $v['CYZD'], 'dept_id' => $v['BQDM'], 'dept_name' => $v['BQMC'], 'reg_id' => $v['REGID'], 'prescription_id' => $v['CFID'], 'total_prescription_amount' => (float) $v['YLFYZE'], 'single_prescription_amount' => (float) $v['CFFYJE'] ?? 0, 'doctor_id' => $v['YSGH'], 'doctor_name' => $v['YSMC'], 'remark' => $v['BZ'], 'is_self_pay' => $v['ZFCF'], 'visit_no' => $v['JZXH'], 'prescription_number' => $v['CHHM'] ?: '', 'prescription_type' => $v['CFTYPE'] ?: '', 'exec_address' => $v['YFMC'] ?: '', 'medical_type' => $v['MED_TYPE'] ?: '', 'disease_code' => $v['DISE_CODG'] ?: '', 'disease_name' => $v['DISE_NAME'] ?: '', 'settlement_method' => $v['PSN_SETLWAY'] ?: '', 'out_of_area_flag' => $v['OUT_FLAG'] ?: '' ]; } return $lists; } }