/**
 * 
 * wrapper for sequential code set search
 * 
 * @param type $search_type_id      The integer ID used for code_type in codes (e.g. 2 for ICD9)
 * @param type $search_type         A string representing the code type to be searched on (e.g. ICD9, DSMIV)
 * @param type $search_query        The text to search on.
 * @return array
 */
function diagnosis_search($search_type_id, $search_type, $search_query)
{
    $retval = array();
    $search = main_code_set_search($search_type, $search_query, 20);
    while ($code = sqlFetchArray($search)) {
        array_push($retval, new code_info($code['code'], $search_type, $code['code_text']));
    }
    return $retval;
}
function main_search_test($type, $string, $limit = 20, $modes = NULL, $count = false, $category = NULL)
{
    echo "<ol>";
    $res = main_code_set_search($type, $string, $limit, $category, true, $modes, $count);
    if ($count) {
        echo "<li>" . $res . "</li>";
    } else {
        while ($code = sqlFetchArray($res)) {
            echo "<li>" . $code['code_type_name'] . ":" . $code['code'] . ":" . $code['code_text'] . ":" . $code['code_text_short'] . "</li>";
        }
    }
    echo "</ol>";
}
Beispiel #3
0
 }
 $search_type = $default_search_type;
 if ($_POST['search_type']) {
     $search_type = $_POST['search_type'];
 }
 $ndc_applies = true;
 // Assume all payers require NDC info.
 echo $i ? "  <td></td>\n </tr>\n" : "";
 echo " <tr>\n";
 echo "  <td colspan='" . attr($FEE_SHEET_COLUMNS) . "' align='center' nowrap>\n";
 // If Search was clicked, do it and write the list of results here.
 // There's no limit on the number of results!
 //
 $numrows = 0;
 if ($_POST['bn_search'] && $_POST['search_term']) {
     $res = main_code_set_search($search_type, $_POST['search_term']);
     if (!empty($res)) {
         $numrows = sqlNumRows($res);
     }
 }
 echo "   <select name='Search Results' style='width:98%' " . "onchange='codeselect(this)'";
 if (!$numrows) {
     echo ' disabled';
 }
 echo ">\n";
 echo "    <option value=''> " . xlt("Search Results") . " ({$numrows} " . xlt("items") . ")\n";
 if ($numrows) {
     while ($row = sqlFetchArray($res)) {
         $code = $row['code'];
         if ($row['modifier']) {
             $code .= ":" . $row['modifier'];
    echo xlt('Related');
    ?>
</span></td>
<?php 
}
$pres = sqlStatement("SELECT title FROM list_options " . "WHERE list_id = 'pricelevel' ORDER BY seq");
while ($prow = sqlFetchArray($pres)) {
    echo "  <td class='bold' align='right' nowrap>" . text(xl_list_label($prow['title'])) . "</td>\n";
}
?>
  <td></td>
  <td></td>
 </tr>
<?php 
if (isset($_REQUEST['filter'])) {
    $res = main_code_set_search($filter_key, $search, NULL, NULL, false, NULL, false, $fstart, $fend - $fstart, $filter_elements);
}
for ($i = 0; $row = sqlFetchArray($res); $i++) {
    $all[$i] = $row;
}
if (!empty($all)) {
    $count = 0;
    foreach ($all as $iter) {
        $count++;
        $has_fees = false;
        foreach ($code_types as $key => $value) {
            if ($value['id'] == $iter['code_type']) {
                $has_fees = $value['fee'];
                break;
            }
        }
/**
 *  This function checks a single field for a term and, if found, codes it.
 *  It is not called directly but via the wrapper function start_your_engines().
 *
 *  @param string $term, text to search for in the coding tables.
 *  @param string $field, location where to search. In fact any text that refines the search can be contained here.
 *  @return outputs array of $codes matching the $term & $field
 */
function coding_carburetor($term, $field)
{
    if (!$term || !$field) {
        return;
    }
    $codes = array();
    $code_type = "ICD10";
    //only option is PROD (product or drug search) or NOT PROD...
    $search_term = $term . " " . $field;
    $res = main_code_set_search($code_type, $search_term);
    while ($row = sqlFetchArray($res)) {
        $newdata = array('code' => $row['code'], 'code_text' => $row['code_text'], 'code_type' => $row['code_type_name'], 'code_desc' => $row['code_desc']);
        $codes[] = $newdata;
    }
    return $codes;
}
    ?>

<table border='0'>
 <tr>
  <td><b><?php 
    echo xlt('Code');
    ?>
</b></td>
  <td><b><?php 
    echo xlt('Description');
    ?>
</b></td>
 </tr>
<?php 
    $search_term = $_REQUEST['search_term'];
    $res = main_code_set_search($form_code_type, $search_term);
    if ($form_code_type == 'PROD') {
        // Special case that displays search for products/drugs
        while ($row = sqlFetchArray($res)) {
            $drug_id = $row['drug_id'];
            $selector = $row['selector'];
            $desc = $row['name'];
            $anchor = "<a href='' " . "onclick='return selcode(\"PROD\", \"" . attr(addslashes($drug_id)) . "\", \"" . attr(addslashes($selector)) . "\", \"" . attr(addslashes($desc)) . "\")'>";
            echo " <tr>";
            echo "  <td>{$anchor}" . text($drug_id . ":" . $selector) . "</a></td>\n";
            echo "  <td>{$anchor}" . text($desc) . "</a></td>\n";
            echo " </tr>";
        }
    } else {
        while ($row = sqlFetchArray($res)) {
            // Display normal search
             if (function_exists('main_code_set_search')) {
                 $result = main_code_set_search("ICD9", $search_term, 1000);
                 $numrows = sqlNumRows($result);
             } elseif (function_exists('code_set_search')) {
                 $result = code_set_search("ICD9", $search_term, $count = false, $active = true, $return_only_one = false, $start = 0, $number = 1000);
                 $numrows = sqlNumRows($result);
             } else {
                 $strQuery = "SELECT code_text,code_text_short,code,code_type \n                                    FROM  `codes` \n                                    WHERE `code_type` = 2  AND `code_text` LIKE ? LIMIT 1000";
                 $result = sqlStatement($strQuery, array("%" . $search_term . "%"));
                 $numrows = $result->_numOfRows;
             }
     }
 } else {
     $search_term = "";
     if (function_exists('main_code_set_search')) {
         $result = main_code_set_search("ICD9", $search_term, 1000);
         $numrows = sqlNumRows($result);
     } elseif (function_exists('code_set_search')) {
         $result = code_set_search("ICD9", $search_term, $count = false, $active = true, $return_only_one = false, $start = 0, $number = 1000);
         $numrows = sqlNumRows($result);
     } else {
         $strQuery = "SELECT code_text,code_text_short,code,code_type \n                                    FROM  `codes` \n                                    WHERE `code_type` = 2  AND `code_text` LIKE ? LIMIT 1000";
         $result = sqlStatement($strQuery, array("%" . $search_term . "%"));
         $numrows = $result->_numOfRows;
     }
 }
 if ($numrows > 0) {
     $xml_string .= "<status>0</status>";
     $xml_string .= "<reason>Diagnosis Codes Processed successfully</reason>";
     while ($res = sqlFetchArray($result)) {
         $xml_string .= "<DiagnosisCode>\n";