示例#1
0
function render_treatment($dbc, $db_name, $id)
{
    echo '<p>系统为您推荐如下的方剂:</p>';
    echo '<ul><li>';
    render_solution($dbc, $db_name, PREFIX . $id);
    echo '</li></ul>';
    /*
        $formulas = array();
    
        $values = array_merge(get_values($dbc, PREFIX . $id, "方剂加(调整)"), get_values($dbc, PREFIX . $id, "方剂(调整)"));
        foreach ($values as $value) {
       if (array_key_exists($value, $formulas)) {
           $formulas[$value] = $formulas[$value] + 1;
       } else {
           $formulas[$value] = 1;
       }
        }
    
        arsort($formulas);
    
        $formulas = array_slice(array_keys($formulas), 0, 5);
    
        echo '<ol>';
        foreach ($formulas as $value) {
    
       //echo '<li class="list-group-item">';   
       echo '<li>';
       echo render_value($dbc, $db_name, $value, true);
       echo '<p/></li>';
        }
        echo '</ol>';
    * 
    */
}
示例#2
0
function render_syndrome_plus($dbc, $db_name, $id)
{
    $diseases = array();
    $values = array_merge(get_subjects($dbc, PREFIX . $id, "证候(调整)"));
    foreach ($values as $value) {
        if (array_key_exists($value, $diseases)) {
            $diseases[$value] = $diseases[$value] + 1;
        } else {
            $diseases[$value] = 1;
        }
    }
    arsort($diseases);
    if (count($diseases) != 0) {
        echo '<hr/>';
        echo '<p>证候治疗的加减变化:</p>';
        //$diseases = array_slice(array_keys($diseases), 0, 5);
        $diseases = array_keys($diseases);
        echo '<ol>';
        foreach ($diseases as $value) {
            //echo '<li class="list-group-item">';
            echo '<li>';
            $sp_links = array();
            $symptoms_plus = get_values($dbc, $value, '症状加(调整)');
            foreach ($symptoms_plus as $symptom_plus) {
                $sp_links[] = render_value($dbc, $db_name, $symptom_plus, false);
            }
            $title = '';
            if (count($sp_links) != 0) {
                $title .= '兼有' . implode(',&nbsp;', $sp_links);
            }
            $sm_links = array();
            $symptoms_minuses = get_values($dbc, $value, '症状减(调整)');
            foreach ($symptoms_minuses as $symptoms_minus) {
                $sm_links[] = render_value($dbc, $db_name, $symptoms_minus, false);
            }
            if (count($sm_links) != 0) {
                if ($title != '') {
                    $title .= ',&nbsp;';
                }
                $title .= '无' . implode(',&nbsp;', $sm_links);
            }
            if ($title == '') {
                $title = render_value($dbc, $db_name, $value, false);
            }
            echo $title;
            if (!endsWith($title, '者')) {
                echo '者';
            }
            echo ':&nbsp;';
            render_solution($dbc, $db_name, $value);
            //echo render_value($dbc, $db_name, $value, true);
            echo '&nbsp;<a class="btn btn-xs btn-primary" href="qa.php?db_name=' . $db_name . '&keywords=' . get_entity_name($dbc, $value) . '&question_type=证候加减" ><span class="glyphicon glyphicon-search"></span></a>';
            echo '<p/></li>';
        }
        echo '</ol>';
    }
}