これが私の機能です:
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
)
)
代替アドレスがある場合は、配列 merge addr() で上書きする必要があります