这是我的功能:
function addr($dfcode)
{
return sql::results("select
A.CODE_,
case when b.id is null then a.ADDRESS1 else b.addr1 as Address1,
case when b.id is null then a.ADDRESS2 else b.addr2 as Address2,
case when b.id is null then a.CITY else b.city as City,
case when b.id is null then a.STATE_ else b.state as State,
case when b.id is null then a.ZIP else b.zip as Zip,
case when b.id is null then a.PHONE else b.phone as Phone,
case when b.id is null then a.FAX else b.fax as Fax
from ARE.ADS.DFE a
left outer join (
select
*
from ent.dbo.patient_data a
inner join ent.dbo.doctor_alt_address b on a.doctor_address_id = b.id
where a.CODE_ =" . $this->patient->hex . "
and b.doctor_id =" . hexstr($dfcode) . "
)b on a.CODE_ = b.doctor_id
where a.CODE_=" . hexstr($dfcode));
}
我需要将上述函数数组合并到 foreach 循环中。我不确定如何做到这一点,而且我对 array_merge 真的很陌生。下面我正在提取构建表格所需的所有医生信息。
上面是医生有一个备用地址的情况,如果在数组中合并,如果 a.doctor_address_id = b.id 来自上述标准,则需要使用该地址。
$p->customForm()->log_creation($docname);
$doctor = new \CRM\Doctor($p->customForm()->dfcode($docname));
foreach ($doctor->getVars() as $k => $v)
{
$data['doctor_'. $k] = $v;
}
foreach ($patient->get_data() as $k=>$v)
{
if (is_string($v) || is_numeric($v))
$data["patient_" . $k] = strtoupper($v);
}
我希望这不会令人困惑,任何帮助将不胜感激。我也希望不要含糊其辞。谢谢你。
$data 的 var_dump
Array
(
[employee] => person
[date] => 05/08/2013
[datetime] => 05/08/2013 9:41:15 AM
[department] => stuff
[employee_ext] => 7457
[employee_email] =>
[barcode] => *NZS01*
[doctor_df_code] => 09HQ
[doctor_npi] => 1111111111
[doctor_dea] => B4574
[doctor_upin] =>
[doctor_license] =>
[doctor_phone] => (111)111-1111
[doctor_fax] => (000)000-0000
[doctor_fname] => UNDEFINED
[doctor_lname] => UNDEFINED
[doctor_title] =>
[doctor_intake_rx_caller_id] =>
[doctor_costco_rx_caller_id] =>
[doctor_reorder_rx_caller_id] =>
[doctor_address1] => 24 CABELL st
[doctor_address2] => SUITE 10
[doctor_city] => places
[doctor_state] => CA
[doctor_zip] => 91111
[doctor_active_events] =>
[doctor_dont_call] => 0
[doctor_dont_fax] => 1
)
这是 addr() 的打印变量
Array
(
[0] => Array
(
[CODE_] => 09HQ
[doctor_address1] => alternate addy
[doctor_address2] => 45854
[doctor_city] => different city
[doctor_state] => CA
[doctor_zip] => 963545
[doctor_phone] => (619)111-2548
[doctor_fax] => (157)123-4569
)
)
如果有备用地址,我需要用数组合并 addr() 覆盖它