# # Returns matched sampled in reverse chronological order # Called via Ajax from reports.php # Used for '[MENU_PATIENT]' report # include "../includes/db_lib.php"; LangUtil::setPageId("reports"); $lab_config_id = $_REQUEST['l']; $query = $_REQUEST['q']; $attrib_type = $_REQUEST['a']; $lab_config = LabConfig::getById($lab_config_id); $saved_db = DbUtil::switchToLabConfig($lab_config_id); $specimen_list = array(); if ($attrib_type == 0) { # Fetch by patient ID $specimen_list = search_specimens_by_patient_id($query); } else { if ($attrib_type == 1) { # Fetch by patient name $specimen_list = search_specimens_by_patient_name($query); } else { if ($attrib_type == 2) { # Fetch by patient daily number $specimen_list = search_specimens_by_dailynum("-" . $query); } } } if (count($specimen_list) == 0) { # No match found ?> <div class='sidetip_nopos'>
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; }