当前位置: 首页>>代码示例>>PHP>>正文


PHP updatePatientData函数代码示例

本文整理汇总了PHP中updatePatientData函数的典型用法代码示例。如果您正苦于以下问题:PHP updatePatientData函数的具体用法?PHP updatePatientData怎么用?PHP updatePatientData使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了updatePatientData函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: batch_despatch

 public static function batch_despatch($var, $func, $data_credentials)
 {
     global $pid;
     if (UserService::valid($data_credentials)) {
         require_once "../../library/invoice_summary.inc.php";
         require_once "../../library/options.inc.php";
         require_once "../../library/acl.inc";
         require_once "../../library/patient.inc";
         if ($func == 'ar_responsible_party') {
             $patient_id = $pid;
             $encounter_id = $var['encounter'];
             $x['ar_responsible_party'] = ar_responsible_party($patient_id, $encounter_id);
             return UserService::function_return_to_xml($x);
         } elseif ($func == 'getInsuranceData') {
             $type = $var['type'];
             $given = $var['given'];
             $x = getInsuranceData($pid, $type, $given);
             return UserService::function_return_to_xml($x);
         } elseif ($func == 'generate_select_list') {
             $tag_name = $var['tag_name'];
             $list_id = $var['list_id'];
             $currvalue = $var['currvalue'];
             $title = $var['title'];
             $empty_name = $var['empty_name'];
             $class = $var['class'];
             $onchange = $var['onchange'];
             $x['generate_select_list'] = generate_select_list($tag_name, $list_id, $currvalue, $title, $empty_name, $class, $onchange);
             return UserService::function_return_to_xml($x);
         } elseif ($func == 'xl_layout_label') {
             $constant = $var['constant'];
             $x['xl_layout_label'] = xl_layout_label($constant);
             return UserService::function_return_to_xml($x);
         } elseif ($func == 'generate_form_field') {
             $frow = $var['frow'];
             $currvalue = $var['currvalue'];
             ob_start();
             generate_form_field($frow, $currvalue);
             $x['generate_form_field'] = ob_get_contents();
             ob_end_clean();
             return UserService::function_return_to_xml($x);
         } elseif ($func == 'getInsuranceProviders') {
             $i = $var['i'];
             $provider = $var['provider'];
             $insurancei = getInsuranceProviders();
             $x = $insurancei;
             return $x;
         } elseif ($func == 'get_layout_form_value') {
             $frow = $var['frow'];
             $_POST = $var['post_array'];
             $x['get_layout_form_value'] = get_layout_form_value($frow);
             return UserService::function_return_to_xml($x);
         } elseif ($func == 'updatePatientData') {
             $patient_data = $var['patient_data'];
             $create = $var['create'];
             updatePatientData($pid, $patient_data, $create);
             $x['ok'] = 'ok';
             return UserService::function_return_to_xml($x);
         } elseif ($func == 'updateEmployerData') {
             $employer_data = $var['employer_data'];
             $create = $var['create'];
             updateEmployerData($pid, $employer_data, $create);
             $x['ok'] = 'ok';
             return UserService::function_return_to_xml($x);
         } elseif ($func == 'newHistoryData') {
             newHistoryData($pid);
             $x['ok'] = 'ok';
             return UserService::function_return_to_xml($x);
         } elseif ($func == 'newInsuranceData') {
             $_POST = $var[0];
             foreach ($var as $key => $value) {
                 if ($key >= 3) {
                     $var[$key] = formData($value);
                 }
                 if ($key >= 1) {
                     $parameters[$key] = $var[$key];
                 }
             }
             $parameters[12] = fixDate($parameters[12]);
             $parameters[27] = fixDate($parameters[27]);
             call_user_func_array('newInsuranceData', $parameters);
             $x['ok'] = 'ok';
             return UserService::function_return_to_xml($x);
         } elseif ($func == 'generate_layout_validation') {
             $form_id = $var['form_id'];
             ob_start();
             generate_layout_validation($form_id);
             $x = ob_get_clean();
             return $x;
         }
     } else {
         throw new SoapFault("Server", "credentials failed");
     }
 }
开发者ID:jatin-52,项目名称:erm,代码行数:93,代码来源:server_side.php

示例2: get_layout_form_value

            $newdata[$table][$field_id] = get_layout_form_value($frow);
        }
    }
    if (empty($ptid)) {
        $tmp = sqlQuery("SELECT MAX(pid)+1 AS pid FROM patient_data");
        $ptid = empty($tmp['pid']) ? 1 : intval($tmp['pid']);
        if (empty($newdata['patient_data']['pubpid'])) {
            // pubpid for new patient defaults to pid.
            $newdata['patient_data']['pubpid'] = "{$ptid}";
        }
        updatePatientData($ptid, $newdata['patient_data'], true);
        updateEmployerData($ptid, $newdata['employer_data'], true);
        newHistoryData($ptid);
    } else {
        $newdata['patient_data']['id'] = $_POST['db_id'];
        updatePatientData($ptid, $newdata['patient_data']);
    }
    // Finally, delete the request from the portal.
    $result = cms_portal_call(array('action' => 'delpost', 'postid' => $postid));
    if ($result['errmsg']) {
        die(text($result['errmsg']));
    }
    echo "<html><body><script language='JavaScript'>\n";
    echo "if (top.restoreSession) top.restoreSession(); else opener.top.restoreSession();\n";
    echo "document.location.href = 'list_requests.php';\n";
    echo "</script></body></html>\n";
    exit;
}
$db_id = 0;
if ($ptid) {
    $ptrow = getPatientData($ptid, "*");
开发者ID:mi-squared,项目名称:openemr,代码行数:31,代码来源:patient_form.php

示例3: update_audited_data

 public function update_audited_data($var)
 {
     $data_credentials = $var[0];
     $validtables = array("patient_data", "employer_data", "insurance_data", "history_data", "openemr_postcalendar_events");
     if (UserService::valid($data_credentials)) {
         $audit_master_id = $var['audit_master_id'];
         $res = sqlStatement("SELECT * FROM  audit_master  where id=? and  approval_status='1' and  type='3' ", array($audit_master_id));
         if (sqlNumRows($res) > 0) {
             return;
         }
         $res = sqlStatement("SELECT DISTINCT ad.table_name,am.id,am.pid FROM audit_master as am,audit_details as ad WHERE am.id=ad.audit_master_id and am.approval_status in ('1','4') and am.id=?", array($audit_master_id));
         $tablecnt = sqlNumRows($res);
         while ($row = sqlFetchArray($res)) {
             $pid = $row['pid'];
             $resfield = sqlStatement("SELECT * FROM audit_details WHERE audit_master_id=? AND table_name=?", array($audit_master_id, $row['table_name']));
             $table = $row['table_name'];
             $cnt = 0;
             foreach ($validtables as $value) {
                 //Update will execute if and only if all tables are validtables
                 if ($value == $table) {
                     $cnt++;
                 }
             }
             if ($cnt > 0) {
                 while ($rowfield = sqlFetchArray($resfield)) {
                     if ($table == 'patient_data') {
                         $newdata['patient_data'][$rowfield['field_name']] = $rowfield['field_value'];
                     }
                     if ($table == 'employer_data') {
                         $newdata['employer_data'][$rowfield['field_name']] = $rowfield['field_value'];
                     }
                     if ($table == 'insurance_data') {
                         $ins1_type = "primary";
                         $ins2_type = "secondary";
                         $ins3_type = "tertiary";
                         for ($i = 1; $i <= 3; $i++) {
                             $newdata[$rowfield['entry_identification']][$rowfield['field_name']] = $rowfield['field_value'];
                         }
                     }
                     if ($table == 'openemr_postcalendar_events') {
                         $newdata['openemr_postcalendar_events'][$rowfield['field_name']] = $rowfield['field_value'];
                     }
                 }
                 require_once "../../library/invoice_summary.inc.php";
                 require_once "../../library/options.inc.php";
                 require_once "../../library/acl.inc";
                 require_once "../../library/patient.inc";
                 if ($table == 'patient_data') {
                     $pdrow = sqlQuery("SELECT id from patient_data WHERE pid=?", array($pid));
                     $newdata['patient_data']['id'] = $pdrow['id'];
                     updatePatientData($pid, $newdata['patient_data']);
                 } elseif ($table == 'employer_data') {
                     updateEmployerData($pid, $newdata['employer_data']);
                 } elseif ($table == 'insurance_data') {
                     for ($i = 1; $i <= 3; $i++) {
                         newInsuranceData($pid, add_escape_custom($newdata[${ins . $i . _type}]['type']), add_escape_custom($newdata[${ins . $i . _type}]['provider']), add_escape_custom($newdata[${ins . $i . _type}]['policy_number']), add_escape_custom($newdata[${ins . $i . _type}]['group_number']), add_escape_custom($newdata[${ins . $i . _type}]['plan_name']), add_escape_custom($newdata[${ins . $i . _type}]['subscriber_lname']), add_escape_custom($newdata[${ins . $i . _type}]['subscriber_mname']), add_escape_custom($newdata[${ins . $i . _type}]['subscriber_fname']), add_escape_custom($newdata[${ins . $i . _type}]['subscriber_relationship']), add_escape_custom($newdata[${ins . $i . _type}]['subscriber_ss']), add_escape_custom($newdata[${ins . $i . _type}]['subscriber_DOB']), add_escape_custom($newdata[${ins . $i . _type}]['subscriber_street']), add_escape_custom($newdata[${ins . $i . _type}]['subscriber_postal_code']), add_escape_custom($newdata[${ins . $i . _type}]['subscriber_city']), add_escape_custom($newdata[${ins . $i . _type}]['subscriber_state']), add_escape_custom($newdata[${ins . $i . _type}]['subscriber_country']), add_escape_custom($newdata[${ins . $i . _type}]['subscriber_phone']), add_escape_custom($newdata[${ins . $i . _type}]['subscriber_employer']), add_escape_custom($newdata[${ins . $i . _type}]['subscriber_employer_street']), add_escape_custom($newdata[${ins . $i . _type}]['subscriber_employer_city']), add_escape_custom($newdata[${ins . $i . _type}]['subscriber_employer_postal_code']), add_escape_custom($newdata[${ins . $i . _type}]['subscriber_employer_state']), add_escape_custom($newdata[${ins . $i . _type}]['subscriber_employer_country']), add_escape_custom($newdata[${ins . $i . _type}]['copay']), add_escape_custom($newdata[${ins . $i . _type}]['subscriber_sex']), add_escape_custom($newdata[${ins . $i . _type}]['date']), add_escape_custom($newdata[${ins . $i . _type}]['accept_assignment']));
                     }
                 } elseif ($table == 'openemr_postcalendar_events') {
                     sqlInsert("INSERT INTO openemr_postcalendar_events ( " . "pc_pid,pc_title,pc_time,pc_hometext,pc_eventDate,pc_endDate,pc_startTime,pc_endTime,pc_duration,pc_catid,pc_eventstatus,pc_aid,pc_facility" . ") VALUES ( " . "'" . add_escape_custom($pid) . "', " . "'" . add_escape_custom($newdata['openemr_postcalendar_events']['pc_title']) . "', " . "NOW(), " . "'" . add_escape_custom($newdata['openemr_postcalendar_events']['pc_hometext']) . "', " . "'" . add_escape_custom($newdata['openemr_postcalendar_events']['pc_eventDate']) . "', " . "'" . add_escape_custom($newdata['openemr_postcalendar_events']['pc_endDate']) . "', " . "'" . add_escape_custom($newdata['openemr_postcalendar_events']['pc_startTime']) . "', " . "'" . add_escape_custom($newdata['openemr_postcalendar_events']['pc_endTime']) . "', " . "'" . add_escape_custom($newdata['openemr_postcalendar_events']['pc_duration']) . "', " . "'" . add_escape_custom($newdata['openemr_postcalendar_events']['pc_catid']) . "', " . "1, " . "'" . add_escape_custom($newdata['openemr_postcalendar_events']['pc_aid']) . "', " . "'" . add_escape_custom($newdata['openemr_postcalendar_events']['pc_facility']) . "')");
                 }
             } else {
                 throw new SoapFault("Server", "Table Not Supported error message");
             }
         }
     } else {
         throw new SoapFault("Server", "credentials failed");
     }
 }
开发者ID:kgenaidy,项目名称:openemr,代码行数:68,代码来源:server_audit.php

示例4: isset

$s_plan_name = $_POST['s_plan_name'];
$s_subscriber_relationship = $_POST['s_subscriber_relationship'];
$s_insurance_id = $_POST['s_insurance_id'];
$o_insurance_company = $_POST['o_provider'];
$o_subscriber_employer_status = $_POST['o_subscriber_employer'];
$o_group_number = $_POST['o_group_number'];
$o_plan_name = $_POST['o_plan_name'];
$o_subscriber_relationship = $_POST['o_subscriber_relationship'];
$o_insurance_id = $_POST['o_insurance_id'];
$image_data = isset($_POST['image_data']) ? $_POST['image_data'] : '';
if ($userId = validateToken($token)) {
    $user = getUsername($userId);
    $acl_allow = acl_check('patients', 'demo', $user);
    if ($acl_allow) {
        $postData = array('id' => $id, 'title' => $title, 'fname' => $firstname, 'lname' => $lastname, 'mname' => $middlename, 'sex' => $sex, 'status' => $status, 'drivers_license' => $drivers_lincense, 'contact_relationship' => $contact_relationship, 'phone_biz' => $phone_biz, 'phone_cell' => $phone_cell, 'phone_contact' => $phone_contact, 'phone_home' => $phone_home, 'DOB' => $dob, 'language' => $language, 'financial' => $financial, 'street' => $street, 'postal_code' => $postal_code, 'city' => $city, 'state' => $state, 'country_code' => $country_code, 'ss' => $ss, 'occupation' => $occupation, 'email' => $email, 'race' => $race, 'ethnicity' => $ethnicity, 'usertext1' => $usertext1, 'genericname1' => $nickname, 'mothersname' => $mothersname, 'guardiansname' => $guardiansname);
        updatePatientData($patientId, $postData, $create = false);
        $primary_insurace_data = getInsuranceData($patientId);
        $secondary_insurace_data = getInsuranceData($patientId, 'secondary');
        $other_insurace_data = getInsuranceData($patientId, 'tertiary');
        $p_insurace_data = array('provider' => $p_insurance_company, 'group_number' => $p_group_number, 'plan_name' => $p_plan_name, 'subscriber_employer' => $p_subscriber_employer_status, 'subscriber_relationship' => $p_subscriber_relationship, 'policy_number' => $p_insurance_id);
        if ($primary_insurace_data) {
            updateInsuranceData($primary_insurace_data['id'], $p_insurace_data);
        } else {
            newInsuranceData($patientId, $type = "primary", $p_insurance_company, $policy_number = $p_insurance_id, $group_number = $p_group_number, $plan_name = $p_plan_name, $subscriber_lname = "", $subscriber_mname = "", $subscriber_fname = "", $subscriber_relationship = $p_subscriber_relationship, $subscriber_ss = "", $subscriber_DOB = "", $subscriber_street = "", $subscriber_postal_code = "", $subscriber_city = "", $subscriber_state = "", $subscriber_country = "", $subscriber_phone = "", $subscriber_employer = $p_subscriber_employer_status, $subscriber_employer_street = "", $subscriber_employer_city = "", $subscriber_employer_postal_code = "", $subscriber_employer_state = "", $subscriber_employer_country = "", $copay = "", $subscriber_sex = "", $effective_date = "0000-00-00", $accept_assignment = "TRUE");
        }
        $s_insurace_data = array('provider' => $s_insurance_company, 'group_number' => $s_group_number, 'plan_name' => $s_plan_name, 'subscriber_employer' => $s_subscriber_employer_status, 'subscriber_relationship' => $s_subscriber_relationship, 'policy_number' => $s_insurance_id);
        if ($secondary_insurace_data) {
            updateInsuranceData($secondary_insurace_data['id'], $s_insurace_data);
        } else {
            newInsuranceData($patientId, $type = "secondary", $s_insurance_company, $policy_number = $s_insurance_id, $group_number = $s_group_number, $plan_name = $s_plan_name, $subscriber_lname = "", $subscriber_mname = "", $subscriber_fname = "", $subscriber_relationship = $s_subscriber_relationship, $subscriber_ss = "", $subscriber_DOB = "", $subscriber_street = "", $subscriber_postal_code = "", $subscriber_city = "", $subscriber_state = "", $subscriber_country = "", $subscriber_phone = "", $subscriber_employer = $s_subscriber_employer_status, $subscriber_employer_street = "", $subscriber_employer_city = "", $subscriber_employer_postal_code = "", $subscriber_employer_state = "", $subscriber_employer_country = "", $copay = "", $subscriber_sex = "", $effective_date = "0000-00-00", $accept_assignment = "TRUE");
        }
开发者ID:bharathi26,项目名称:openemr,代码行数:31,代码来源:updatepatient.php

示例5: create_skeleton_patient

/**
 * Create a patient using whatever patient_data attributes are provided.
 */
function create_skeleton_patient($patient_data)
{
    $employer_data = array();
    $tmp = sqlQuery("SELECT MAX(pid)+1 AS pid FROM patient_data");
    $ptid = empty($tmp['pid']) ? 1 : intval($tmp['pid']);
    if (!isset($patient_data['pubpid'])) {
        $patient_data['pubpid'] = $ptid;
    }
    updatePatientData($ptid, $patient_data, true);
    updateEmployerData($ptid, $employer_data, true);
    newHistoryData($ptid);
    return $ptid;
}
开发者ID:mi-squared,项目名称:openemr,代码行数:16,代码来源:receive_hl7_results.inc.php

示例6: substr

    $data_type = $frow['data_type'];
    $field_id = $frow['field_id'];
    // $value     = '';
    $colname = $field_id;
    $tblname = 'patient_data';
    if (strpos($field_id, 'em_') === 0) {
        $colname = substr($field_id, 3);
        $tblname = 'employer_data';
    }
    $value = get_layout_form_value($frow);
    if ($field_id == 'pubpid' && empty($value)) {
        $value = $pid;
    }
    $newdata[$tblname][$colname] = $value;
}
updatePatientData($pid, $newdata['patient_data'], true);
updateEmployerData($pid, $newdata['employer_data'], true);
$i1dob = fixDate(formData("i1subscriber_DOB"));
$i1date = fixDate(formData("i1effective_date"));
// sqlStatement("unlock tables");
// end table lock
newHistoryData($pid);
newInsuranceData($pid, "primary", formData("i1provider"), formData("i1policy_number"), formData("i1group_number"), formData("i1plan_name"), formData("i1subscriber_lname"), formData("i1subscriber_mname"), formData("i1subscriber_fname"), formData("form_i1subscriber_relationship"), formData("i1subscriber_ss"), $i1dob, formData("i1subscriber_street"), formData("i1subscriber_postal_code"), formData("i1subscriber_city"), formData("form_i1subscriber_state"), formData("form_i1subscriber_country"), formData("i1subscriber_phone"), formData("i1subscriber_employer"), formData("i1subscriber_employer_street"), formData("i1subscriber_employer_city"), formData("i1subscriber_employer_postal_code"), formData("form_i1subscriber_employer_state"), formData("form_i1subscriber_employer_country"), formData('i1copay'), formData('form_i1subscriber_sex'), $i1date, formData('i1accept_assignment'));
$i2dob = fixDate(formData("i2subscriber_DOB"));
$i2date = fixDate(formData("i2effective_date"));
newInsuranceData($pid, "secondary", formData("i2provider"), formData("i2policy_number"), formData("i2group_number"), formData("i2plan_name"), formData("i2subscriber_lname"), formData("i2subscriber_mname"), formData("i2subscriber_fname"), formData("form_i2subscriber_relationship"), formData("i2subscriber_ss"), $i2dob, formData("i2subscriber_street"), formData("i2subscriber_postal_code"), formData("i2subscriber_city"), formData("form_i2subscriber_state"), formData("form_i2subscriber_country"), formData("i2subscriber_phone"), formData("i2subscriber_employer"), formData("i2subscriber_employer_street"), formData("i2subscriber_employer_city"), formData("i2subscriber_employer_postal_code"), formData("form_i2subscriber_employer_state"), formData("form_i2subscriber_employer_country"), formData('i2copay'), formData('form_i2subscriber_sex'), $i2date, formData('i2accept_assignment'));
$i3dob = fixDate(formData("i3subscriber_DOB"));
$i3date = fixDate(formData("i3effective_date"));
newInsuranceData($pid, "tertiary", formData("i3provider"), formData("i3policy_number"), formData("i3group_number"), formData("i3plan_name"), formData("i3subscriber_lname"), formData("i3subscriber_mname"), formData("i3subscriber_fname"), formData("form_i3subscriber_relationship"), formData("i3subscriber_ss"), $i3dob, formData("i3subscriber_street"), formData("i3subscriber_postal_code"), formData("i3subscriber_city"), formData("form_i3subscriber_state"), formData("form_i3subscriber_country"), formData("i3subscriber_phone"), formData("i3subscriber_employer"), formData("i3subscriber_employer_street"), formData("i3subscriber_employer_city"), formData("i3subscriber_employer_postal_code"), formData("form_i3subscriber_employer_state"), formData("form_i3subscriber_employer_country"), formData('i3copay'), formData('form_i3subscriber_sex'), $i3date, formData('i3accept_assignment'));
?>
<html>
开发者ID:juggernautsei,项目名称:openemr,代码行数:31,代码来源:new_comprehensive_save.php

示例7: insert_patient

 public function insert_patient($audit_master_id)
 {
     $pid = 0;
     $appTable = new ApplicationTable();
     $pres = $appTable->zQuery("SELECT IFNULL(MAX(pid)+1,1) AS pid FROM patient_data", array());
     foreach ($pres as $prow) {
         $pid = $prow['pid'];
     }
     $res = $appTable->zQuery("SELECT DISTINCT ad.table_name,entry_identification FROM audit_master as am,audit_details as ad WHERE am.id=ad.audit_master_id AND am.approval_status = '1' AND am.id=? AND am.type=11 ORDER BY ad.id", array($audit_master_id));
     $tablecnt = $res->count();
     foreach ($res as $row) {
         $resfield = $appTable->zQuery("SELECT * FROM audit_details WHERE audit_master_id=? AND table_name=? AND entry_identification=?", array($audit_master_id, $row['table_name'], $row['entry_identification']));
         $table = $row['table_name'];
         $newdata = array();
         foreach ($resfield as $rowfield) {
             if ($table == 'patient_data') {
                 if ($rowfield['field_name'] == 'DOB') {
                     $newdata['patient_data'][$rowfield['field_name']] = substr($rowfield['field_value'], 0, 10);
                 } else {
                     $newdata['patient_data'][$rowfield['field_name']] = $rowfield['field_value'];
                 }
             } elseif ($table == 'lists1') {
                 $newdata['lists1'][$rowfield['field_name']] = $rowfield['field_value'];
             } elseif ($table == 'lists2') {
                 $newdata['lists2'][$rowfield['field_name']] = $rowfield['field_value'];
             } elseif ($table == 'prescriptions') {
                 $newdata['prescriptions'][$rowfield['field_name']] = $rowfield['field_value'];
             } elseif ($table == 'immunizations') {
                 $newdata['immunizations'][$rowfield['field_name']] = $rowfield['field_value'];
             } elseif ($table == 'procedure_result') {
                 $newdata['procedure_result'][$rowfield['field_name']] = $rowfield['field_value'];
             } elseif ($table == 'procedure_type') {
                 $newdata['procedure_type'][$rowfield['field_name']] = $rowfield['field_value'];
             } elseif ($table == 'misc_address_book') {
                 $newdata['misc_address_book'][$rowfield['field_name']] = $rowfield['field_value'];
             } elseif ($table == 'documents') {
                 $newdata['documents'][$rowfield['field_name']] = $rowfield['field_value'];
             }
         }
         if ($table == 'patient_data') {
             updatePatientData($pid, $newdata['patient_data'], true);
         } elseif ($table == 'lists1') {
             $query_insert = "INSERT INTO lists(pid, diagnosis, activity, title, type, date) VALUES (?,?,?,?,?,?)";
             $appTable->zQuery($query_insert, array($pid, $newdata['lists1']['diagnosis'], $newdata['lists1']['activity'], $newdata['lists1']['title'], 'medical_problem', $newdata['lists1']['date']));
         } elseif ($table == 'lists2' && $newdata['lists2']['diagnosis'] != '') {
             $query_insert = "INSERT INTO lists(pid,date,type,title,diagnosis,reaction) VALUES (?,?,?,?,?,?)";
             $appTable->zQuery($query_insert, array($pid, $newdata['lists2']['date'], $newdata['lists2']['type'], $newdata['lists2']['title'], $newdata['lists2']['diagnosis'], $newdata['lists2']['reaction']));
         } elseif ($table == 'prescriptions' && $newdata['prescriptions']['drug'] != '') {
             $query_insert = "INSERT INTO prescriptions(patient_id,date_added,active,drug,size,form,quantity) VALUES (?,?,?,?,?,?,?)";
             $appTable->zQuery($query_insert, array($pid, $newdata['prescriptions']['date_added'], $newdata['prescriptions']['active'], $newdata['prescriptions']['drug'], $newdata['prescriptions']['size'], $newdata['prescriptions']['form'], $newdata['prescriptions']['quantity']));
         } elseif ($table == 'immunizations') {
             $query_insert = "INSERT INTO immunizations(patient_id,administered_date,note) VALUES (?,?,?)";
             $appTable->zQuery($query_insert, array($pid, $newdata['immunizations']['administered_date'], $newdata['immunizations']['note']));
         } elseif ($table == 'documents') {
             $appTable->zQuery("UPDATE documents SET foreign_id = ? WHERE id =? ", array($pid, $newdata['documents']['id']));
         }
     }
     $appTable->zQuery("UPDATE audit_master SET approval_status=2 WHERE id=?", array($audit_master_id));
     $appTable->zQuery("UPDATE documents SET audit_master_approval_status=2 WHERE audit_master_id=?", array($audit_master_id));
 }
开发者ID:juggernautsei,项目名称:openemr,代码行数:60,代码来源:CcrTable.php

示例8: insert_patient

 public function insert_patient($audit_master_id, $document_id)
 {
     require_once dirname(__FILE__) . "/../../../../../../../../library/patient.inc";
     $pid = 0;
     $j = 1;
     $k = 1;
     $q = 1;
     $y = 1;
     $a = 1;
     $b = 1;
     $c = 1;
     $d = 1;
     $e = 1;
     $f = 1;
     $g = 1;
     $arr_procedure_res = array();
     $arr_encounter = array();
     $arr_vitals = array();
     $arr_procedures = array();
     $arr_immunization = array();
     $arr_prescriptions = array();
     $arr_allergies = array();
     $arr_med_pblm = array();
     $arr_care_plan = array();
     $arr_functional_cognitive_status = array();
     $arr_referral = array();
     $appTable = new ApplicationTable();
     $pres = $appTable->zQuery("SELECT IFNULL(MAX(pid)+1,1) AS pid \n                                     FROM patient_data");
     foreach ($pres as $prow) {
         $pid = $prow['pid'];
     }
     $res = $appTable->zQuery("SELECT DISTINCT ad.table_name,\n                                            entry_identification \n                                     FROM audit_master as am,audit_details as ad \n                                     WHERE am.id=ad.audit_master_id AND \n                                     am.approval_status = '1' AND \n                                     am.id=? AND am.type=12 \n                                     ORDER BY ad.id", array($audit_master_id));
     $tablecnt = $res->count();
     foreach ($res as $row) {
         $resfield = $appTable->zQuery("SELECT * \n                                     FROM audit_details \n                                     WHERE audit_master_id=? AND \n                                     table_name=? AND \n                                     entry_identification=?", array($audit_master_id, $row['table_name'], $row['entry_identification']));
         $table = $row['table_name'];
         $newdata = array();
         foreach ($resfield as $rowfield) {
             if ($table == 'patient_data') {
                 if ($rowfield['field_name'] == 'DOB') {
                     $dob = $this->formatDate($rowfield['field_value'], 1);
                     $newdata['patient_data'][$rowfield['field_name']] = $dob;
                 } else {
                     if ($rowfield['field_name'] == 'religion') {
                         $religion_option_id = $this->getOptionId('religious_affiliation', $rowfield['field_value'], '');
                         $newdata['patient_data'][$rowfield['field_name']] = $religion_option_id;
                     } elseif ($rowfield['field_name'] == 'race') {
                         $race_option_id = $this->getOptionId('race', $rowfield['field_value'], '');
                         $newdata['patient_data'][$rowfield['field_name']] = $race_option_id;
                     } elseif ($rowfield['field_name'] == 'ethnicity') {
                         $ethnicity_option_id = $this->getOptionId('ethnicity', $rowfield['field_value'], '');
                         $newdata['patient_data'][$rowfield['field_name']] = $ethnicity_option_id;
                     } else {
                         $newdata['patient_data'][$rowfield['field_name']] = $rowfield['field_value'];
                     }
                 }
             } elseif ($table == 'immunization') {
                 $newdata['immunization'][$rowfield['field_name']] = $rowfield['field_value'];
             } elseif ($table == 'lists3') {
                 $newdata['lists3'][$rowfield['field_name']] = $rowfield['field_value'];
             } elseif ($table == 'lists1') {
                 $newdata['lists1'][$rowfield['field_name']] = $rowfield['field_value'];
             } elseif ($table == 'lists2') {
                 $newdata['lists2'][$rowfield['field_name']] = $rowfield['field_value'];
             } elseif ($table == 'vital_sign') {
                 $newdata['vital_sign'][$rowfield['field_name']] = $rowfield['field_value'];
             } elseif ($table == 'social_history') {
                 $newdata['social_history'][$rowfield['field_name']] = $rowfield['field_value'];
             } elseif ($table == 'encounter') {
                 $newdata['encounter'][$rowfield['field_name']] = $rowfield['field_value'];
             } elseif ($table == 'procedure_result') {
                 $newdata['procedure_result'][$rowfield['field_name']] = $rowfield['field_value'];
             } elseif ($table == 'procedure') {
                 $newdata['procedure'][$rowfield['field_name']] = $rowfield['field_value'];
             } elseif ($table == 'care_plan') {
                 $newdata['care_plan'][$rowfield['field_name']] = $rowfield['field_value'];
             } elseif ($table == 'functional_cognitive_status') {
                 $newdata['functional_cognitive_status'][$rowfield['field_name']] = $rowfield['field_value'];
             } elseif ($table == 'referral') {
                 $newdata['referral'][$rowfield['field_name']] = $rowfield['field_value'];
             }
         }
         if ($table == 'patient_data') {
             updatePatientData($pid, $newdata['patient_data'], true);
         } elseif ($table == 'immunization') {
             $arr_immunization['immunization'][$a]['extension'] = $newdata['immunization']['extension'];
             $arr_immunization['immunization'][$a]['root'] = $newdata['immunization']['root'];
             $arr_immunization['immunization'][$a]['administered_date'] = $newdata['immunization']['administered_date'];
             $arr_immunization['immunization'][$a]['route_code'] = $newdata['immunization']['route_code'];
             $arr_immunization['immunization'][$a]['route_code_text'] = $newdata['immunization']['route_code_text'];
             $arr_immunization['immunization'][$a]['cvx_code_text'] = $newdata['immunization']['cvx_code_text'];
             $arr_immunization['immunization'][$a]['cvx_code'] = $newdata['immunization']['cvx_code'];
             $arr_immunization['immunization'][$a]['amount_administered'] = $newdata['immunization']['amount_administered'];
             $arr_immunization['immunization'][$a]['amount_administered_unit'] = $newdata['immunization']['amount_administered_unit'];
             $arr_immunization['immunization'][$a]['manufacturer'] = $newdata['immunization']['manufacturer'];
             $arr_immunization['immunization'][$a]['completion_status'] = $newdata['immunization']['completion_status'];
             $arr_immunization['immunization'][$a]['provider_npi'] = $newdata['immunization']['provider_npi'];
             $arr_immunization['immunization'][$a]['provider_name'] = $newdata['immunization']['provider_name'];
             $arr_immunization['immunization'][$a]['provider_address'] = $newdata['immunization']['provider_address'];
             $arr_immunization['immunization'][$a]['provider_city'] = $newdata['immunization']['provider_city'];
//.........这里部分代码省略.........
开发者ID:aaricpittman,项目名称:openemr,代码行数:101,代码来源:CarecoordinationTable.php

示例9: update_audited_data

 public function update_audited_data($var)
 {
     $data_credentials = $var[0];
     $last_insert_ids = array();
     $validtables = array("patient_data", "employer_data", "insurance_data", "history_data", "openemr_postcalendar_events", "ar_session", "documents_legal_master", "documents_legal_detail", "patient_access_offsite");
     if (UserService::valid($data_credentials)) {
         $audit_master_id = $var['audit_master_id'];
         $res = sqlStatement("SELECT DISTINCT ad.table_name,am.id,am.pid FROM audit_master as am,audit_details as ad WHERE am.id=ad.audit_master_id and am.approval_status in ('1','4') and am.id=? ORDER BY ad.id", array($audit_master_id));
         $tablecnt = sqlNumRows($res);
         while ($row = sqlFetchArray($res)) {
             if ($row['pid']) {
                 $pid = $row['pid'];
             }
             $resfield = sqlStatement("SELECT * FROM audit_details WHERE audit_master_id=? AND table_name=?", array($audit_master_id, $row['table_name']));
             $table = $row['table_name'];
             $cnt = 0;
             foreach ($validtables as $value) {
                 //Update will execute if and only if all tables are validtables
                 if ($value == $table) {
                     $cnt++;
                 }
             }
             if ($cnt > 0) {
                 while ($rowfield = sqlFetchArray($resfield)) {
                     if ($rowfield['field_name'] == 'pid') {
                         continue;
                     }
                     if ($table == 'patient_data') {
                         $newdata['patient_data'][$rowfield['field_name']] = $rowfield['field_value'];
                     }
                     if ($table == 'employer_data') {
                         $newdata['employer_data'][$rowfield['field_name']] = $rowfield['field_value'];
                     }
                     if ($table == 'insurance_data') {
                         $ins1_type = "primary";
                         $ins2_type = "secondary";
                         $ins3_type = "tertiary";
                         for ($i = 1; $i <= 3; $i++) {
                             $newdata[$rowfield['entry_identification']][$rowfield['field_name']] = $rowfield['field_value'];
                         }
                     }
                     if ($table == 'openemr_postcalendar_events') {
                         $newdata['openemr_postcalendar_events'][$rowfield['field_name']] = $rowfield['field_value'];
                     }
                     if ($table == 'ar_session') {
                         $newdata['ar_session'][$rowfield['field_name']] = $rowfield['field_value'];
                     }
                     if ($table == 'documents_legal_master') {
                         $newdata['documents_legal_master'][$rowfield['field_name']] = $rowfield['field_value'];
                     }
                     if ($table == 'documents_legal_detail') {
                         $newdata['documents_legal_detail'][$rowfield['field_name']] = $rowfield['field_value'];
                     }
                     if ($table == 'patient_access_offsite') {
                         $newdata['patient_access_offsite'][$rowfield['field_name']] = $rowfield['field_value'];
                         if ($rowfield['field_name'] == 'portal_pwd') {
                             $newdata['patient_access_offsite']['pass_id'] = $rowfield['id'];
                         }
                     }
                 }
                 require_once "../../library/invoice_summary.inc.php";
                 require_once "../../library/options.inc.php";
                 require_once "../../library/acl.inc";
                 require_once "../../library/patient.inc";
                 if ($table == 'patient_data') {
                     $pdrow = sqlQuery("SELECT id from patient_data WHERE pid=?", array($pid));
                     if ($pdrow['id']) {
                         $newdata['patient_data']['id'] = $pdrow['id'];
                         updatePatientData($pid, $newdata['patient_data']);
                     } else {
                         $prow = sqlQuery("SELECT IFNULL(MAX(pid)+1,1) AS pid FROM patient_data");
                         $pid = $prow['pid'];
                         $newdata['patient_data']['pubpid'] = $pid;
                         updatePatientData($pid, $newdata['patient_data'], true);
                     }
                 } elseif ($table == 'employer_data') {
                     updateEmployerData($pid, $newdata['employer_data']);
                 } elseif ($table == 'insurance_data') {
                     for ($i = 1; $i <= 3; $i++) {
                         newInsuranceData($pid, add_escape_custom($newdata[${ins . $i . _type}]['type']), add_escape_custom($newdata[${ins . $i . _type}]['provider']), add_escape_custom($newdata[${ins . $i . _type}]['policy_number']), add_escape_custom($newdata[${ins . $i . _type}]['group_number']), add_escape_custom($newdata[${ins . $i . _type}]['plan_name']), add_escape_custom($newdata[${ins . $i . _type}]['subscriber_lname']), add_escape_custom($newdata[${ins . $i . _type}]['subscriber_mname']), add_escape_custom($newdata[${ins . $i . _type}]['subscriber_fname']), add_escape_custom($newdata[${ins . $i . _type}]['subscriber_relationship']), add_escape_custom($newdata[${ins . $i . _type}]['subscriber_ss']), add_escape_custom($newdata[${ins . $i . _type}]['subscriber_DOB']), add_escape_custom($newdata[${ins . $i . _type}]['subscriber_street']), add_escape_custom($newdata[${ins . $i . _type}]['subscriber_postal_code']), add_escape_custom($newdata[${ins . $i . _type}]['subscriber_city']), add_escape_custom($newdata[${ins . $i . _type}]['subscriber_state']), add_escape_custom($newdata[${ins . $i . _type}]['subscriber_country']), add_escape_custom($newdata[${ins . $i . _type}]['subscriber_phone']), add_escape_custom($newdata[${ins . $i . _type}]['subscriber_employer']), add_escape_custom($newdata[${ins . $i . _type}]['subscriber_employer_street']), add_escape_custom($newdata[${ins . $i . _type}]['subscriber_employer_city']), add_escape_custom($newdata[${ins . $i . _type}]['subscriber_employer_postal_code']), add_escape_custom($newdata[${ins . $i . _type}]['subscriber_employer_state']), add_escape_custom($newdata[${ins . $i . _type}]['subscriber_employer_country']), add_escape_custom($newdata[${ins . $i . _type}]['copay']), add_escape_custom($newdata[${ins . $i . _type}]['subscriber_sex']), add_escape_custom($newdata[${ins . $i . _type}]['date']), add_escape_custom($newdata[${ins . $i . _type}]['accept_assignment']));
                     }
                 } elseif ($table == 'openemr_postcalendar_events') {
                     sqlInsert("INSERT INTO openemr_postcalendar_events ( " . "pc_pid,pc_title,pc_time,pc_hometext,pc_eventDate,pc_endDate,pc_startTime,pc_endTime,pc_duration,pc_catid,pc_eventstatus,pc_aid,pc_facility" . ") VALUES ( " . "'" . add_escape_custom($pid) . "', " . "'" . add_escape_custom($newdata['openemr_postcalendar_events']['pc_title']) . "', " . "NOW(), " . "'" . add_escape_custom($newdata['openemr_postcalendar_events']['pc_hometext']) . "', " . "'" . add_escape_custom($newdata['openemr_postcalendar_events']['pc_eventDate']) . "', " . "'" . add_escape_custom($newdata['openemr_postcalendar_events']['pc_endDate']) . "', " . "'" . add_escape_custom($newdata['openemr_postcalendar_events']['pc_startTime']) . "', " . "'" . add_escape_custom($newdata['openemr_postcalendar_events']['pc_endTime']) . "', " . "'" . add_escape_custom($newdata['openemr_postcalendar_events']['pc_duration']) . "', " . "'" . add_escape_custom($newdata['openemr_postcalendar_events']['pc_catid']) . "', " . "1, " . "'" . add_escape_custom($newdata['openemr_postcalendar_events']['pc_aid']) . "', " . "'" . add_escape_custom($newdata['openemr_postcalendar_events']['pc_facility']) . "')");
                 } elseif ($table == 'ar_session') {
                     sqlInsert("INSERT INTO ar_session ( " . "payer_id, user_id, reference, check_date, pay_total, modified_time, payment_type, description, post_to_date, patient_id, payment_method" . ") VALUES ( " . "'" . add_escape_custom($newdata['ar_session']['payer_id']) . "', " . "'" . add_escape_custom($newdata['ar_session']['user_id']) . "', " . "'" . add_escape_custom($newdata['ar_session']['reference']) . "', " . "NOW(), " . "'" . add_escape_custom($newdata['ar_session']['pay_total']) . "', " . "NOW(), " . "'" . add_escape_custom($newdata['ar_session']['payment_type']) . "', " . "'" . add_escape_custom($newdata['ar_session']['description']) . "', " . "NOW(), " . "'" . add_escape_custom($pid) . "', " . "'" . add_escape_custom($newdata['ar_session']['payment_method']) . "')");
                 } elseif ($table == 'documents_legal_master') {
                     $master_doc_id = sqlInsert("INSERT INTO documents_legal_master ( " . "dlm_category,dlm_subcategory,dlm_document_name,dlm_filepath,dlm_facility,dlm_provider,dlm_sign_height,dlm_sign_width,dlm_filename,dlm_effective_date,dlm_version,content,dlm_savedsign,dlm_review,dlm_upload_type" . ") VALUES ( " . "'" . add_escape_custom($newdata['documents_legal_master']['dlm_category']) . "', " . "'" . add_escape_custom($newdata['documents_legal_master']['dlm_subcategory']) . "', " . "'" . add_escape_custom($newdata['documents_legal_master']['dlm_document_name']) . "', " . "'" . add_escape_custom($newdata['documents_legal_master']['dlm_filepath'] . "/{$pid}") . "', " . "'" . add_escape_custom($newdata['documents_legal_master']['dlm_facility']) . "', " . "'" . add_escape_custom($newdata['documents_legal_master']['dlm_provider']) . "', " . "'" . add_escape_custom($newdata['documents_legal_master']['dlm_sign_height']) . "', " . "'" . add_escape_custom($newdata['documents_legal_master']['dlm_sign_width']) . "', " . "'" . add_escape_custom($newdata['documents_legal_master']['dlm_filename']) . "', " . "'" . add_escape_custom($newdata['documents_legal_master']['dlm_effective_date']) . "', " . "'" . add_escape_custom($newdata['documents_legal_master']['dlm_version']) . "', " . "'" . add_escape_custom($newdata['documents_legal_master']['content']) . "', " . "'" . add_escape_custom($newdata['documents_legal_master']['dlm_savedsign']) . "', " . "'" . add_escape_custom($newdata['documents_legal_master']['dlm_review']) . "', " . "'" . add_escape_custom($newdata['documents_legal_master']['dlm_upload_type']) . "')");
                     $last_insert_ids['dlm_id'] = $master_doc_id;
                 } elseif ($table == 'documents_legal_detail') {
                     if ($master_doc_id) {
                         $mdoc_id = $master_doc_id;
                     } else {
                         $mdoc_id = $newdata['documents_legal_detail']['dld_master_docid'];
                     }
                     $last_insert_ids['dld_id'] = sqlInsert("INSERT INTO documents_legal_detail ( " . "dld_pid,dld_facility,dld_provider,dld_encounter,dld_master_docid,dld_signed,dld_signed_time,dld_filepath,dld_filename,dld_signing_person,dld_sign_level,dld_content,dld_file_for_pdf_generation,dld_denial_reason,dld_moved,dld_patient_comments" . ") VALUES ( " . "'" . add_escape_custom($pid) . "', " . "'" . add_escape_custom($newdata['documents_legal_detail']['dld_facility']) . "', " . "'" . add_escape_custom($newdata['documents_legal_detail']['dld_provider']) . "', " . "'" . add_escape_custom($newdata['documents_legal_detail']['dld_encounter']) . "', " . "'" . add_escape_custom($mdoc_id) . "', " . "'" . add_escape_custom($newdata['documents_legal_detail']['dld_signed']) . "', " . "'" . add_escape_custom($newdata['documents_legal_detail']['dld_signed_time']) . "', " . "'" . add_escape_custom($newdata['documents_legal_detail']['dld_filepath']) . "', " . "'" . add_escape_custom($newdata['documents_legal_detail']['dld_filename']) . "', " . "'" . add_escape_custom($newdata['documents_legal_detail']['dld_signing_person']) . "', " . "'" . add_escape_custom($newdata['documents_legal_detail']['dld_sign_level']) . "', " . "'" . add_escape_custom($newdata['documents_legal_detail']['dld_content']) . "', " . "'" . add_escape_custom($newdata['documents_legal_detail']['dld_file_for_pdf_generation']) . "', " . "'" . add_escape_custom($newdata['documents_legal_detail']['dld_denial_reason']) . "', " . "'" . add_escape_custom($newdata['documents_legal_detail']['dld_moved']) . "', " . "'" . add_escape_custom($newdata['documents_legal_detail']['dld_patient_comments']) . "')");
                 } elseif ($table == 'patient_access_offsite') {
                     $query = sqlStatement("SELECT * FROM patient_access_offsite WHERE portal_username = '" . $newdata['patient_access_offsite']['portal_username'] . "'");
                     if (sqlNumRows($query) == 0) {
                         sqlInsert("INSERT INTO patient_access_offsite ( " . "pid,portal_username,portal_pwd,portal_pwd_status" . ") VALUES ( " . "'" . add_escape_custom($pid) . "', " . "'" . add_escape_custom($newdata['patient_access_offsite']['portal_username']) . "', " . "'" . add_escape_custom($newdata['patient_access_offsite']['portal_pwd']) . "', " . "0)");
                         sqlQuery("UPDATE audit_details SET field_value = ? WHERE id = ?", array($this->generatePassword(), $newdata['patient_access_offsite']['pass_id']));
//.........这里部分代码省略.........
开发者ID:mindfeederllc,项目名称:openemr,代码行数:101,代码来源:server_audit.php

示例10: getUsername

if ($userId = validateToken($token)) {
    $user = getUsername($userId);
    $acl_allow = acl_check('patients', 'demo', $user);
    if ($acl_allow) {
        $provider_id = $userId;
        $patientId = 1;
        $pid = 1;
        sqlStatement("lock tables patient_data read");
        $result = sqlQuery("select max(pid)+1 as pid from patient_data");
        sqlStatement("unlock tables");
        if ($result['pid'] > 1) {
            $patientId = $result['pid'];
            $pid = $result['pid'];
        }
        $postData = array('title' => $title, 'fname' => $firstname, 'lname' => $lastname, 'mname' => $middlename, 'sex' => $sex, 'status' => $status, 'drivers_license' => $drivers_lincense, 'contact_relationship' => $contact_relationship, 'phone_biz' => $phone_biz, 'phone_cell' => $phone_cell, 'phone_contact' => $phone_contact, 'phone_home' => $phone_home, 'DOB' => $dob, 'language' => $language, 'financial' => $financial, 'street' => $street, 'postal_code' => $postal_code, 'city' => $city, 'state' => $state, 'country_code' => $country_code, 'ss' => $ss, 'occupation' => $occupation, 'email' => $email, 'race' => $race, 'ethnicity' => $ethnicity, 'pubpid' => $pid, 'usertext1' => $usertext1, 'genericname1' => $nickname, 'mothersname' => $mothersname, 'guardiansname' => $guardiansname, 'providerID' => $provider_id, 'ref_providerID' => 0, 'financial_review' => '0000-00-00 00:00:00', 'hipaa_allowsms' => '', 'hipaa_allowemail' => '', 'deceased_date' => '0000-00-00 00:0');
        $p_id = updatePatientData($patientId, $postData, $create = true);
        if ($p_id) {
            $primary_insurace_data = getInsuranceData($p_id);
            $secondary_insurace_data = getInsuranceData($p_id, 'secondary');
            $other_insurace_data = getInsuranceData($p_id, 'tertiary');
            $p_insurace_data = array('provider' => $p_insurance_company, 'group_number' => $p_group_number, 'plan_name' => $p_plan_name, 'subscriber_employer' => $p_subscriber_employer_status, 'subscriber_relationship' => $p_subscriber_relationship, 'policy_number' => $p_insurance_id);
            if ($primary_insurace_data) {
                updateInsuranceData($primary_insurace_data['id'], $p_insurace_data);
            } else {
                newInsuranceData($patientId, $type = "primary", $p_insurance_company, $policy_number = $p_insurance_id, $group_number = $p_group_number, $plan_name = $p_plan_name, $subscriber_lname = "", $subscriber_mname = "", $subscriber_fname = "", $subscriber_relationship = $p_subscriber_relationship, $subscriber_ss = "", $subscriber_DOB = "", $subscriber_street = "", $subscriber_postal_code = "", $subscriber_city = "", $subscriber_state = "", $subscriber_country = "", $subscriber_phone = "", $subscriber_employer = $p_subscriber_employer_status, $subscriber_employer_street = "", $subscriber_employer_city = "", $subscriber_employer_postal_code = "", $subscriber_employer_state = "", $subscriber_employer_country = "", $copay = "", $subscriber_sex = "", $effective_date = "0000-00-00", $accept_assignment = "TRUE");
            }
            $s_insurace_data = array('provider' => $s_insurance_company, 'group_number' => $s_group_number, 'plan_name' => $s_plan_name, 'subscriber_employer' => $s_subscriber_employer_status, 'subscriber_relationship' => $s_subscriber_relationship, 'policy_number' => $s_insurance_id);
            if ($secondary_insurace_data) {
                updateInsuranceData($secondary_insurace_data['id'], $s_insurace_data);
            } else {
                newInsuranceData($p_id, $type = "secondary", $s_insurance_company, $policy_number = $s_insurance_id, $group_number = $s_group_number, $plan_name = $s_plan_name, $subscriber_lname = "", $subscriber_mname = "", $subscriber_fname = "", $subscriber_relationship = $s_subscriber_relationship, $subscriber_ss = "", $subscriber_DOB = "", $subscriber_street = "", $subscriber_postal_code = "", $subscriber_city = "", $subscriber_state = "", $subscriber_country = "", $subscriber_phone = "", $subscriber_employer = $s_subscriber_employer_status, $subscriber_employer_street = "", $subscriber_employer_city = "", $subscriber_employer_postal_code = "", $subscriber_employer_state = "", $subscriber_employer_country = "", $copay = "", $subscriber_sex = "", $effective_date = "0000-00-00", $accept_assignment = "TRUE");
开发者ID:bharathi26,项目名称:openemr,代码行数:31,代码来源:addpatient.php

示例11: insert_patient

function insert_patient($audit_master_id)
{
    $prow = sqlQuery("SELECT IFNULL(MAX(pid)+1,1) AS pid FROM patient_data");
    $pid = $prow['pid'];
    $res = sqlStatement("SELECT DISTINCT ad.table_name,entry_identification FROM audit_master as am,audit_details as ad WHERE am.id=ad.audit_master_id AND am.approval_status = '1' AND am.id=? AND am.type=11 ORDER BY ad.id", array($audit_master_id));
    $tablecnt = sqlNumRows($res);
    while ($row = sqlFetchArray($res)) {
        $resfield = sqlStatement("SELECT * FROM audit_details WHERE audit_master_id=? AND table_name=? AND entry_identification=?", array($audit_master_id, $row['table_name'], $row['entry_identification']));
        $table = $row['table_name'];
        $newdata = array();
        while ($rowfield = sqlFetchArray($resfield)) {
            if ($table == 'patient_data') {
                if ($rowfield['field_name'] == 'DOB') {
                    $newdata['patient_data'][$rowfield['field_name']] = substr($rowfield['field_value'], 0, 10);
                } else {
                    $newdata['patient_data'][$rowfield['field_name']] = $rowfield['field_value'];
                }
            } elseif ($table == 'lists1') {
                $newdata['lists1'][$rowfield['field_name']] = $rowfield['field_value'];
            } elseif ($table == 'lists2') {
                $newdata['lists2'][$rowfield['field_name']] = $rowfield['field_value'];
            } elseif ($table == 'prescriptions') {
                $newdata['prescriptions'][$rowfield['field_name']] = $rowfield['field_value'];
            } elseif ($table == 'immunizations') {
                $newdata['immunizations'][$rowfield['field_name']] = $rowfield['field_value'];
            } elseif ($table == 'procedure_result') {
                $newdata['procedure_result'][$rowfield['field_name']] = $rowfield['field_value'];
            } elseif ($table == 'procedure_type') {
                $newdata['procedure_type'][$rowfield['field_name']] = $rowfield['field_value'];
            } elseif ($table == 'misc_address_book') {
                $newdata['misc_address_book'][$rowfield['field_name']] = $rowfield['field_value'];
            } elseif ($table == 'documents') {
                $newdata['documents'][$rowfield['field_name']] = $rowfield['field_value'];
            }
        }
        if ($table == 'patient_data') {
            updatePatientData($pid, $newdata['patient_data'], true);
        } elseif ($table == 'lists1') {
            sqlInsert("INSERT INTO lists(" . "pid,diagnosis,activity" . ") VALUES (" . "'" . add_escape_custom($pid) . "'," . "'" . add_escape_custom($newdata['lists1']['diagnosis']) . "'," . "'" . add_escape_custom($newdata['lists1']['activity']) . "')");
        } elseif ($table == 'lists2') {
            sqlInsert("INSERT INTO lists(" . "pid,date,type,title,diagnosis,reaction" . ") VALUES (" . "'" . add_escape_custom($pid) . "'," . "'" . add_escape_custom($newdata['lists2']['date']) . "'," . "'" . add_escape_custom($newdata['lists2']['type']) . "'," . "'" . add_escape_custom($newdata['lists2']['title']) . "'," . "'" . add_escape_custom($newdata['lists2']['diagnosis']) . "'," . "'" . add_escape_custom($newdata['lists2']['reaction']) . "')");
        } elseif ($table == 'prescriptions') {
            sqlInsert("INSERT INTO prescriptions(" . "patient_id,date_added,active,drug,size,form,quantity" . ") VALUES (" . "'" . add_escape_custom($pid) . "'," . "'" . add_escape_custom($newdata['prescriptions']['date_added']) . "'," . "'" . add_escape_custom($newdata['prescriptions']['active']) . "'," . "'" . add_escape_custom($newdata['prescriptions']['drug']) . "'," . "'" . add_escape_custom($newdata['prescriptions']['size']) . "'," . "'" . add_escape_custom($newdata['prescriptions']['form']) . "'," . "'" . add_escape_custom($newdata['prescriptions']['quantity']) . "')");
        } elseif ($table == 'immunizations') {
            sqlInsert("INSERT INTO immunizations(" . "patient_id,administered_date,note" . ") VALUES (" . "'" . add_escape_custom($pid) . "'," . "'" . add_escape_custom($newdata['immunizations']['administered_date']) . "'," . "'" . add_escape_custom($newdata['immunizations']['note']) . "')");
        } elseif ($table == 'procedure_result') {
            /*sqlInsert("INSERT INTO procedure_result(".
            			"date,result,abnormal".
            			") VALUES (".
            			"'".add_escape_custom($newdata['procedure_result']['date'])."',".
            			"'".add_escape_custom($newdata['procedure_result']['result'])."',".
            			"'".add_escape_custom($newdata['procedure_result']['abnormal'])."')"
            		);*/
        } elseif ($table == 'procedure_type') {
            /*sqlInsert("INSERT INTO procedure_type(".
            			"name".
            			") VALUES (".
            			"'".add_escape_custom($newdata['procedure_type']['name'])."')"
            		);*/
        } elseif ($table == 'misc_address_book') {
            sqlInsert("INSERT INTO misc_address_book(" . "lname,fname,street,city,state,zip,phone" . ") VALUES (" . "'" . add_escape_custom($newdata['misc_address_book']['lname']) . "'," . "'" . add_escape_custom($newdata['misc_address_book']['fname']) . "'," . "'" . add_escape_custom($newdata['misc_address_book']['street']) . "'," . "'" . add_escape_custom($newdata['misc_address_book']['city']) . "'," . "'" . add_escape_custom($newdata['misc_address_book']['state']) . "'," . "'" . add_escape_custom($newdata['misc_address_book']['zip']) . "'," . "'" . add_escape_custom($newdata['misc_address_book']['phone']) . "')");
        } elseif ($table == 'documents') {
            sqlQuery("UPDATE documents SET foreign_id = ? WHERE id =? ", array($pid, $newdata['documents']['id']));
        }
    }
    sqlQuery("UPDATE audit_master SET approval_status=2 WHERE id=?", array($audit_master_id));
}
开发者ID:katopenzz,项目名称:openemr,代码行数:67,代码来源:parse_patient_xml.php


注:本文中的updatePatientData函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。