*/ public function toArray(Request $request = null): array { $lists = []; $this->resource = xmlArrayToListByKey($this->resource, 'ITEM'); foreach ($this->resource['ITEM'] as $v) { $lists[] = [ 'fee_date' => $v['FYRQ'], 'item_id' => $v['XMXH'], 'item_code' => $v['XMBH'], 'item_name' => $v['XMMC'], 'price' => (float) $v['JG'], 'quantity' => $v['MCYL'], 'total_price' => $v['JE'], 'package_name' => $v['ZTMC'], 'self_pay_ratio' => $v['ZFBL'], 'self_pay_fee' => (float) $v['ZFJE'], 'prescription_id' => $v['CFID'], 'unit' => $v['UNIT'], 'prescription_type' => $v['CFTYPE'], 'dept_id' => $v['BQDM'], 'dept_name' => $v['BQMC'], 'doctor_id' => $v['YSGH'], 'doctor_name' => $v['YSMC'], // 冗余字段 'national_catalog_code' => $v['GJMLBM'] ?: '', 'single_dose' => $v['YCJL'] ?: '', 'frequency' => $v['YPYF'] ?: '', 'medication_days' => $v['YYTS'] ?: '', 'administration_route' => $v['GYTJ'] ?: '', 'hospital_approval_flag' => $v['HOSP_APPR_FLAG'] ?: '', 'chinese_medicine_usage' => $v['TCMDRUG_USED_WAY'] ?: '', 'external_inspection_flag' => $v['ETIP_FLAG'] ?: '', 'external_inspection_hospital_code' => $v['ETIP_HOSP_CODE'] ?: '', 'discharge_medication_flag' => $v['DSCG_TKDRUG_FLAG'] ?: '', 'maternity_fee_flag' => $v['MATN_FEE_FLAG'] ?: '', 'external_purchase_prescription_flag' => $v['RX_CIRC_FLAG'] ?: '', ]; } return $lists; } }