Example #1
0
#
# Returns list of matched specimens
# Called via Ajax from /search.php
#
include "../includes/db_lib.php";
LangUtil::setPageId("search");
$q = $_REQUEST['q'];
$a = $_REQUEST['a'];
$uiinfo = "op=" . $a . "&qr=" . $q;
putUILog('search_s', $uiinfo, basename($_SERVER['REQUEST_URI'], ".php"), 'X', 'X', 'X');
$specimen_list = array();
# Fetch list from DB
if ($a == 0) {
    # Fetch by specimen ID
    $specimen_list = search_specimens_by_id($q);
} else {
    if ($a == 1) {
        # Fetch by additional ID
        $specimen_list = search_specimens_by_addlid($q);
    } else {
        if ($a == 2) {
            # Fetch by Session No.
            $specimen_list = search_specimens_by_session($q);
        }
    }
}
if (count($specimen_list) == 0 || $specimen_list[0] == null) {
    ?>
	<br>
	<div class='sidetip_nopos'>
Example #2
0
 public function search_specimens($by, $str)
 {
     //by 3 = patient name, 2 = patient id, 1 = specimen_id
     global $con;
     $q = mysql_real_escape_string($str, $con);
     if ($by == 1) {
         $patient_list = search_specimens_by_id($q);
         if (count($patient_list) > 0) {
             $ret = $patient_list;
         } else {
             $ret = 0;
         }
     } else {
         if ($by == 3) {
             $patient_list = search_specimens_by_patient_name($q);
             if (count($patient_list) > 0) {
                 $ret = $patient_list;
             } else {
                 $ret = 0;
             }
         } else {
             if ($by == 2) {
                 $patient_list = search_specimens_by_patient_id($q);
                 if (count($patient_list) > 0) {
                     $ret = $patient_list;
                 } else {
                     $ret = 0;
                 }
             } else {
                 return -1;
             }
         }
     }
     return $ret;
 }