예제 #1
0
 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");
     }
 }
예제 #2
0
        echo "<td colspan='{$datacols}' class='text'";
        if ($cell_count > 0) {
            echo " style='padding-left:5pt'";
        }
        echo ">";
        $cell_count += $datacols;
    }
    ++$item_count;
    generate_form_field($frow, $currvalue);
}
end_group();
?>

<?php 
if (!$GLOBALS['simplified_demographics']) {
    $insurancei = getInsuranceProviders();
    $pid = 0;
    $insurance_headings = array(xl("Primary Insurance Provider"), xl("Secondary Insurance Provider"), xl("Tertiary Insurance provider"));
    $insurance_info = array();
    $insurance_info[1] = getInsuranceData($pid, "primary");
    $insurance_info[2] = getInsuranceData($pid, "secondary");
    $insurance_info[3] = getInsuranceData($pid, "tertiary");
    echo "<br /><span class='bold'><input type='checkbox' name='form_cb_ins' value='1' " . "onclick='return divclick(this,\"div_ins\");'";
    if ($display_style == 'block') {
        echo " checked";
    }
    echo " /><b>" . xl('Insurance') . "</b></span>\n";
    echo "<div id='div_ins' class='section' style='display:{$display_style};'>\n";
    for ($i = 1; $i <= 3; $i++) {
        $result3 = $insurance_info[$i];
        ?>
예제 #3
0
function generate_plaintext_field($frow, $currvalue)
{
    global $ISSUE_TYPES;
    $data_type = $frow['data_type'];
    $field_id = isset($frow['field_id']) ? $frow['field_id'] : null;
    $list_id = $frow['list_id'];
    $backup_list = $frow['backup_list'];
    $s = '';
    // generic selection list or the generic selection list with add on the fly
    // feature, or radio buttons
    //  Supports backup lists (for datatypes 1,26,33)
    if ($data_type == 1 || $data_type == 26 || $data_type == 27 || $data_type == 33) {
        $lrow = sqlQuery("SELECT title FROM list_options " . "WHERE list_id = ? AND option_id = ?", array($list_id, $currvalue));
        $s = xl_list_label($lrow['title']);
        //if there is no matching value in the corresponding lists check backup list
        // only supported in data types 1,26,33
        if ($lrow == 0 && !empty($backup_list) && ($data_type == 1 || $data_type == 26 || $data_type == 33)) {
            $lrow = sqlQuery("SELECT title FROM list_options " . "WHERE list_id = ? AND option_id = ?", array($backup_list, $currvalue));
            $s = xl_list_label($lrow['title']);
        }
    } else {
        if ($data_type == 2 || $data_type == 3 || $data_type == 15) {
            $s = $currvalue;
        } else {
            if ($data_type == 4) {
                $s = oeFormatShortDate($currvalue);
                // Optional display of age or gestational age.
                $tmp = optionalAge($frow, $currvalue);
                if ($tmp) {
                    $s .= ' ' . $tmp;
                }
            } else {
                if ($data_type == 10 || $data_type == 11) {
                    $urow = sqlQuery("SELECT fname, lname, specialty FROM users " . "WHERE id = ?", array($currvalue));
                    $s = ucwords($urow['fname'] . " " . $urow['lname']);
                } else {
                    if ($data_type == 12) {
                        $pres = get_pharmacies();
                        while ($prow = sqlFetchArray($pres)) {
                            $key = $prow['id'];
                            if ($currvalue == $key) {
                                $s .= $prow['name'] . ' ' . $prow['area_code'] . '-' . $prow['prefix'] . '-' . $prow['number'] . ' / ' . $prow['line1'] . ' / ' . $prow['city'];
                            }
                        }
                    } else {
                        if ($data_type == 14) {
                            $urow = sqlQuery("SELECT fname, lname, specialty FROM users " . "WHERE id = ?", array($currvalue));
                            $uname = $urow['lname'];
                            if ($urow['fname']) {
                                $uname .= ", " . $urow['fname'];
                            }
                            $s = $uname;
                        } else {
                            if ($data_type == 16) {
                                $insprovs = getInsuranceProviders();
                                foreach ($insprovs as $key => $ipname) {
                                    if ($currvalue == $key) {
                                        $s .= $ipname;
                                    }
                                }
                            } else {
                                if ($data_type == 17) {
                                    foreach ($ISSUE_TYPES as $key => $value) {
                                        if ($currvalue == $key) {
                                            $s .= $value[1];
                                        }
                                    }
                                } else {
                                    if ($data_type == 18) {
                                        $crow = sqlQuery("SELECT pc_catid, pc_catname " . "FROM openemr_postcalendar_categories WHERE pc_catid = ?", array($currvalue));
                                        $s = $crow['pc_catname'];
                                    } else {
                                        if ($data_type == 21) {
                                            $avalue = explode('|', $currvalue);
                                            $lres = sqlStatement("SELECT * FROM list_options " . "WHERE list_id = ? ORDER BY seq, title", array($list_id));
                                            $count = 0;
                                            while ($lrow = sqlFetchArray($lres)) {
                                                $option_id = $lrow['option_id'];
                                                if (in_array($option_id, $avalue)) {
                                                    if ($count++) {
                                                        $s .= "; ";
                                                    }
                                                    $s .= xl_list_label($lrow['title']);
                                                }
                                            }
                                        } else {
                                            if ($data_type == 22) {
                                                $tmp = explode('|', $currvalue);
                                                $avalue = array();
                                                foreach ($tmp as $value) {
                                                    if (preg_match('/^([^:]+):(.*)$/', $value, $matches)) {
                                                        $avalue[$matches[1]] = $matches[2];
                                                    }
                                                }
                                                $lres = sqlStatement("SELECT * FROM list_options " . "WHERE list_id = ? ORDER BY seq, title", array($list_id));
                                                while ($lrow = sqlFetchArray($lres)) {
                                                    $option_id = $lrow['option_id'];
                                                    if (empty($avalue[$option_id])) {
                                                        continue;
                                                    }
                                                    if ($s !== '') {
                                                        $s .= '; ';
                                                    }
                                                    $s .= xl_list_label($lrow['title']) . ': ';
                                                    $s .= $avalue[$option_id];
                                                }
                                            } else {
                                                if ($data_type == 23) {
                                                    $tmp = explode('|', $currvalue);
                                                    $avalue = array();
                                                    foreach ($tmp as $value) {
                                                        if (preg_match('/^([^:]+):(.*)$/', $value, $matches)) {
                                                            $avalue[$matches[1]] = $matches[2];
                                                        }
                                                    }
                                                    $lres = sqlStatement("SELECT * FROM list_options " . "WHERE list_id = ? ORDER BY seq, title", array($list_id));
                                                    while ($lrow = sqlFetchArray($lres)) {
                                                        $option_id = $lrow['option_id'];
                                                        $restype = substr($avalue[$option_id], 0, 1);
                                                        $resnote = substr($avalue[$option_id], 2);
                                                        if (empty($restype) && empty($resnote)) {
                                                            continue;
                                                        }
                                                        if ($restype != '2') {
                                                            continue;
                                                        }
                                                        // show abnormal results only
                                                        if ($s !== '') {
                                                            $s .= '; ';
                                                        }
                                                        $s .= xl_list_label($lrow['title']);
                                                        if (!empty($resnote)) {
                                                            $s .= ': ' . $resnote;
                                                        }
                                                    }
                                                } else {
                                                    if ($data_type == 24) {
                                                        $query = "SELECT title, comments FROM lists WHERE " . "pid = ? AND type = 'allergy' AND enddate IS NULL " . "ORDER BY begdate";
                                                        $lres = sqlStatement($query, array($GLOBALS['pid']));
                                                        $count = 0;
                                                        while ($lrow = sqlFetchArray($lres)) {
                                                            if ($count++) {
                                                                $s .= "; ";
                                                            }
                                                            $s .= $lrow['title'];
                                                            if ($lrow['comments']) {
                                                                $s .= ' (' . $lrow['comments'] . ')';
                                                            }
                                                        }
                                                    } else {
                                                        if ($data_type == 25) {
                                                            $tmp = explode('|', $currvalue);
                                                            $avalue = array();
                                                            foreach ($tmp as $value) {
                                                                if (preg_match('/^([^:]+):(.*)$/', $value, $matches)) {
                                                                    $avalue[$matches[1]] = $matches[2];
                                                                }
                                                            }
                                                            $lres = sqlStatement("SELECT * FROM list_options " . "WHERE list_id = ? ORDER BY seq, title", array($list_id));
                                                            while ($lrow = sqlFetchArray($lres)) {
                                                                $option_id = $lrow['option_id'];
                                                                $restype = substr($avalue[$option_id], 0, 1);
                                                                $resnote = substr($avalue[$option_id], 2);
                                                                if (empty($restype) && empty($resnote)) {
                                                                    continue;
                                                                }
                                                                if ($s !== '') {
                                                                    $s .= '; ';
                                                                }
                                                                $s .= xl_list_label($lrow['title']);
                                                                $restype = $restype ? xl('Yes') : xl('No');
                                                                $s .= $restype;
                                                                if ($resnote) {
                                                                    $s .= ' ' . $resnote;
                                                                }
                                                            }
                                                        } else {
                                                            if ($data_type == 28 || $data_type == 32) {
                                                                $tmp = explode('|', $currvalue);
                                                                $resnote = count($tmp) > 0 ? $tmp[0] : '';
                                                                $restype = count($tmp) > 1 ? $tmp[1] : '';
                                                                $resdate = count($tmp) > 2 ? $tmp[2] : '';
                                                                $reslist = count($tmp) > 3 ? $tmp[3] : '';
                                                                $res = "";
                                                                if ($restype == "current" . $field_id) {
                                                                    $res = xl('Current');
                                                                }
                                                                if ($restype == "quit" . $field_id) {
                                                                    $res = xl('Quit');
                                                                }
                                                                if ($restype == "never" . $field_id) {
                                                                    $res = xl('Never');
                                                                }
                                                                if ($restype == "not_applicable" . $field_id) {
                                                                    $res = xl('N/A');
                                                                }
                                                                if ($data_type == 28) {
                                                                    if (!empty($resnote)) {
                                                                        $s .= $resnote;
                                                                    }
                                                                } else {
                                                                    if ($data_type == 32) {
                                                                        if (!empty($reslist)) {
                                                                            $s .= generate_plaintext_field(array('data_type' => '1', 'list_id' => $list_id), $reslist);
                                                                        }
                                                                        if (!empty($resnote)) {
                                                                            $s .= ' ' . $resnote;
                                                                        }
                                                                    }
                                                                }
                                                                if (!empty($res)) {
                                                                    if ($s !== '') {
                                                                        $s .= ' ';
                                                                    }
                                                                    $s .= xl('Status') . ' ' . $res;
                                                                }
                                                                if ($restype == "quit" . $field_id) {
                                                                    if ($s !== '') {
                                                                        $s .= ' ';
                                                                    }
                                                                    $s .= $resdate;
                                                                }
                                                            } else {
                                                                if ($data_type == 36) {
                                                                    $values_array = explode("|", $currvalue);
                                                                    $i = 0;
                                                                    foreach ($values_array as $value) {
                                                                        $lrow = sqlQuery("SELECT title FROM list_options " . "WHERE list_id = ? AND option_id = ?", array($list_id, $value));
                                                                        if ($lrow == 0 && !empty($backup_list)) {
                                                                            //use back up list
                                                                            $lrow = sqlQuery("SELECT title FROM list_options " . "WHERE list_id = ? AND option_id = ?", array($backup_list, $value));
                                                                        }
                                                                        if ($i > 0) {
                                                                            $s = $s . ", " . xl_list_label($lrow['title']);
                                                                        } else {
                                                                            $s = xl_list_label($lrow['title']);
                                                                        }
                                                                        $i++;
                                                                    }
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    return $s;
}