Example #1
0
function get_records_to_print($lab_config, $patient_id)
{
    global $date_from, $date_to;
    $retval = array();
    if (isset($_REQUEST['ip']) && $_REQUEST['ip'] == 0) {
        # Do not include pending tests
        $query_string = "SELECT t.* FROM test t, specimen sp " . "WHERE t.result <> '' " . "AND t.specimen_id=sp.specimen_id " . "AND sp.patient_id={$patient_id} ";
        if (isset($_REQUEST['yf'])) {
            $query_string .= "AND (sp.date_collected BETWEEN '{$date_from}' AND '{$date_to}') ";
        }
        $query_string .= "ORDER BY sp.date_collected DESC";
    } else {
        # Include pending tests
        $query_string = "SELECT t.* FROM test t, specimen sp " . "WHERE t.specimen_id=sp.specimen_id " . "AND sp.patient_id={$patient_id} ";
        if (isset($_REQUEST['yf'])) {
            $query_string .= "AND (sp.date_collected BETWEEN '{$date_from}' AND '{$date_to}') ";
        }
        $query_string .= "ORDER BY sp.date_collected DESC";
    }
    $resultset = query_associative_all($query_string, $row_count);
    if (count($resultset) == 0 || $resultset == null) {
        return $retval;
    }
    foreach ($resultset as $record) {
        $test = Test::getObject($record);
        $hide_patient_name = TestType::toHidePatientName($test->testTypeId);
        if ($hide_patient_name == 1) {
            $hidePatientName = 1;
        }
        $specimen = get_specimen_by_id($test->specimenId);
        $retval[] = array($test, $specimen, $hide_patient_name);
    }
    return $retval;
}
Example #2
0
function get_records_to_print($lab_config, $patient_id, $specimen_id)
{
    $retval = array();
    $query_string = "SELECT * FROM test,specimen " . "WHERE specimen.specimen_id={$specimen_id} and test.specimen_id=specimen.specimen_id and specimen.patient_id={$patient_id}";
    $resultset = query_associative_one($query_string);
    if ($resultset == null) {
        echo "hiral";
    }
    $test = Test::getObject($resultset);
    $hide_patient_name = TestType::toHidePatientName($test->testTypeId);
    if ($hide_patient_name == 1) {
        $hidePatientName = 1;
    }
    $specimen = get_specimen_by_id($test->specimenId);
    $retval[] = array($test, $specimen, $hide_patient_name);
    return $retval;
}
function get_records_to_print($lab_config, $patient_id)
{
    global $date_from, $date_to, $LIS_DOCTOR;
    $retval = array();
    if (isset($_REQUEST['ip']) && $_REQUEST['ip'] == 0) {
        # Do not include pending tests
        $labsection = 0;
        if (isset($_REQUEST['labsection'])) {
            $labsection = $_REQUEST['labsection'];
        }
        if ($labsection == 0) {
            $query_string = "SELECT t.* FROM test t, specimen sp " . "WHERE t.result <> '' " . "AND t.specimen_id=sp.specimen_id " . "AND sp.patient_id={$patient_id} ";
        } else {
            $query_string = "SELECT distinct t.* FROM test t, specimen sp, test_type tt, test_category tc " . "WHERE t.specimen_id=sp.specimen_id " . "AND t.result <> '' " . "AND sp.patient_id={$patient_id} " . "AND t.test_type_id = tt.test_type_id " . "AND tt.test_type_id in (select test_type_id from test_type where test_category_id = {$labsection})";
        }
        #Taking care of removal tests cases
        $query_string .= " AND t.test_id not in (select distinct r_id from removal_record where `status` = 1) ";
        if (isset($_REQUEST['yf'])) {
            $query_string .= "AND (sp.date_collected BETWEEN '{$date_from}' AND '{$date_to}') ";
        }
        $query_string .= "ORDER BY sp.date_collected DESC";
    } else {
        # Include pending tests
        $labsection = 0;
        if (isset($_REQUEST['labsection'])) {
            $labsection = $_REQUEST['labsection'];
        }
        if ($labsection == 0) {
            $query_string = "SELECT t.* FROM test t, specimen sp " . "WHERE t.specimen_id=sp.specimen_id " . "AND sp.patient_id={$patient_id} ";
        } else {
            $query_string = "SELECT distinct t.* FROM test t, specimen sp, test_type tt, test_category tc " . "WHERE t.specimen_id=sp.specimen_id " . "AND sp.patient_id={$patient_id} " . "AND t.test_type_id = tt.test_type_id " . "AND tt.test_type_id in (select test_type_id from test_type where test_category_id = {$labsection})";
        }
        #Taking care of removal tests cases
        $query_string .= " AND t.test_id not in (select distinct r_id from removal_record where `status` = 1) ";
        if (isset($_REQUEST['yf'])) {
            $query_string .= "AND (sp.date_collected BETWEEN '{$date_from}' AND '{$date_to}') ";
        }
        $query_string .= "ORDER BY sp.date_collected DESC";
    }
    $resultset = query_associative_all($query_string, $row_count);
    if (count($resultset) == 0 || $resultset == null) {
        return $retval;
    }
    foreach ($resultset as $record) {
        $test = Test::getObject($record);
        if ($_SESSION['user_level'] == $LIS_DOCTOR) {
            if ($test->verifiedBy == 0) {
                continue;
            }
        }
        $hide_patient_name = TestType::toHidePatientName($test->testTypeId);
        if ($hide_patient_name == 1) {
            $hidePatientName = 1;
        }
        $specimen = get_specimen_by_id($test->specimenId);
        $retval[] = array($test, $specimen, $hide_patient_name);
    }
    return $retval;
}