} } } } } # # Disease Report related functions # Called from report_disease.php # public static function getDiseaseTotal($lab_config, $test_type, $date_from, $date_to) { # Returns the total number of tests performed during the given date range $query_string = "SELECT COUNT(*) AS val FROM test t, specimen sp " . "WHERE t.test_type_id={$test_type->testTypeId} " . "AND t.specimen_id=sp.specimen_id " . "AND t.result <> '' " . "AND (sp.date_collected BETWEEN '{$date_from}' AND '{$date_to}')"; $saved_db = DbUtil::switchToLabConfig($lab_config->id); $resultset = query_associative_all($query_string, $row_count); DbUtil::switchRestore($saved_db); return $resultset[0]['val']; } public static function setDiseaseSetList($lab_config, $test_type, $date_from, $date_to, $multipleCount = 0) { # Initializes diseaseSetList for capturing params if ($multipleCount == 0) { StatsLib::$diseaseSetList = array(); } $query_string = "SELECT t.result AS result_value, " . "p.sex AS patient_gender, " . "p.patient_id AS patient_id " . "FROM test t, specimen sp, patient p " . "WHERE t.specimen_id=sp.specimen_id " . "AND t.result <> '' " . "AND t.test_type_id={$test_type->testTypeId} " . "AND (sp.date_collected BETWEEN '{$date_from}' AND '{$date_to}') " . "AND sp.patient_id=p.patient_id"; $saved_db = DbUtil::switchToLabConfig($lab_config->id); $resultset = query_associative_all($query_string, $row_count); $measure_list = $test_type->getMeasureIds(); if (count($resultset) == 0 || $resultset == null) { DbUtil::switchRestore($saved_db); return; } foreach ($resultset as $record) { $patient_id = $record['patient_id']; $patient = Patient::getById($patient_id); $current_set = new DiseaseSet(); $current_set->resultValues = array(); $result_csv_parts = explode(",", $record['result_value']); # Build assoc list for result values ## Format: resultValues[measure_id] = result_value for ($i = 0; $i < count($measure_list); $i++) { $result_part = $result_csv_parts[$i]; if (trim($result_part) == "") { continue; } $curr_measure_id = $measure_list[$i]; $current_set->resultValues[$curr_measure_id] = $result_part; }
} 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; } $lab_config_id = $_REQUEST['location']; $patient_id = $_REQUEST['patient_id']; DbUtil::switchToLabConfig($lab_config_id); $lab_config = get_lab_config_by_id($lab_config_id); $report_id = $REPORT_ID_ARRAY['reports_testhistory.php']; $report_config = $lab_config->getReportConfig($report_id); $margin_list = $report_config->margins; for ($i = 0; $i < count($margin_list); $i++) { $margin_list[$i] = $SCREEN_WIDTH * $margin_list[$i] / 100; } ?> <html> <head> <style type="text/css"> .btn { color:white; background-color:#9fc748;/*#3B5998;*/ border-style:none;
public static function switchToLabConfigRevamp($lab_config_id = null) { $saved_db_name = db_get_current(); $lab_config = get_lab_config_by_id($lab_config_id); if ($lab_config == null) { # Error: Lab configuration correspinding to $lab_config_id not found in DB return; } $db_name = $lab_config->dbName; db_change($db_name); return $saved_db_name; }
. <br><br> <a href='find_patient.php'>« <?php echo LangUtil::$generalTerms['CMD_BACK']; ?> </a> </div> <?php include "includes/footer.php"; return; } if (isset($_SESSION['specimenFieldOrder'])) { unset($_SESSION['specimenFieldOrder']); } if (!isset($_SESSION['specimenFieldOrder'])) { $lab_config = get_lab_config_by_id($_SESSION['lab_config_id']); $specimenFieldOrderingObj = field_order_update::install_first_order($lab_config, 2); $specimenOrder = $specimenFieldOrderingObj->form_field_inOrder; $_SESSION['specimenFieldOrder'] = explode(',', $specimenOrder); } ?> <table cellpadding='5px'> <tbody> <tr valign='top'> <td> <span id='specimenboxes'> <?php echo $page_elems->getNewSpecimenForm(1, $pid, $dnum, $session_num); ?> </span>
<?php // Get test result data for visualization include "../includes/db_lib.php"; include "../includes/stats_lib.php"; $loc = $_REQUEST['location']; $lab_config = get_lab_config_by_id($loc); // From configuration //$date_from = '2011-8-1'; //$date_to = '2012-5-1'; $patient_id = $_REQUEST['patient_id']; $test_result_list = array(); $patient = get_patient_by_id($patient_id); if ($patient == null) { // can't find patient infomation echo LangUtil::$generalTerms['PATIENT_ID'] . " {$patient_id} " . LangUtil::$generalTerms['MSG_NOTFOUND']; } else { $record_list = get_records_to_print($lab_config, $patient_id); foreach ($record_list as $value) { $test = $value[0]; $specimen = $value[1]; // get columns required for visualization $id = $test->testTypeId; $patient_name = $patient->name; $test_name = get_test_name_by_id($test->testTypeId); $test_date = get_test_date_by_id($test->testTypeId); $result = ""; if (trim($test->result) == "") { $result = ""; } else { if ($report_config->useMeasures == 1) {
public function getMeasureCheckboxes($lab_config_id="") { # Returns a set of checkboxes with existing test types checked $lab_config = get_lab_config_by_id($lab_config_id); if($lab_config == null && $lab_config_id != "") { ?> <div class='sidetip_nopos'> ERROR: Lab configuration not found </div> <?php return; } # Fetch all specimen types $measure_list = get_measures_catalog(); # For each measure, create a check box. ?> <table class='hor-minimalist-b' style='width:700px;'> <tbody> <tr> <?php $count = 0; foreach($measure_list as $key=>$value) { $measure_id = $key; $measure_name = $value; $count++; ?> <td><input type='checkbox' class='m_entry' name='m_<?php echo $key; ?>' id='m_<?php echo $key; ?>' <?php /* if(in_array($test_type_id, $current_test_list)) { echo " checked "; } */ ?> > <?php /* if(in_array($test_type_id, $current_test_list)) { ?> <span class='clean-ok'><?php echo $test_name; ?></span> <?php } else */ echo $measure_name; ?> </input></td> <?php if($count % 2 == 0) echo "</tr><tr>"; } ?> </tbody> </table> <?php }
foreach ($measures as $measure) { $disease_report = GlobalInfectionReport::getByKeys($_SESSION['user_id'], $globalTestType->testId, $measure->measureId); $male_total = array(); $female_total = array(); $cross_gender_total = array(); $age_total = array(); $age_total1 = array(); $age_total2 = array(); $curr_male_total = 0; $curr_female_total = 0; $curr_cross_gender_total = 0; $age_total; $age_total1; $age_total2; foreach ($site_list as $labConfigId) { $lab_config = get_lab_config_by_id($labConfigId); $testTypeId = $testIds[$labConfigId]; $saved_db = DbUtil::switchToLabConfig($labConfigId); $testType = TestType::getById($testTypeId); StatsLib::setDiseaseSetList($lab_config, $testType, $date_from, $date_to); DbUtil::switchRestore($saved_db); $is_range_options = true; if (strpos($measure->range, "/") === false) { $is_range_options = false; } $range_values = array(); if ($is_range_options) { # Alphanumeric options $range_values1 = explode("/", $measure->range); $range_values = str_replace("#", "/", $range_values1); } else {
$rwoptsarr = explode(" ", $rwopts); $_SESSION['rwoptionsarray'] = $rwoptsarr; } //if($user->isAdmin()) if (is_admin($user)) { $lab_id = get_lab_config_id_admin($user->userId); $_SESSION['lab_config_id'] = -1; // $lab_id; $_SESSION['db_name'] = "blis_" . $lab_id; $_SESSION['dformat'] = $DEFAULT_DATE_FORMAT; $_SESSION['country'] = $user->country; } else { $_SESSION['lab_config_id'] = $user->labConfigId; echo $user->labConfigId; $_SESSION['country'] = $user->country; $lab_config = get_lab_config_by_id($user->labConfigId); $_SESSION['db_name'] = $lab_config->dbName; $_SESSION['dformat'] = $lab_config->dateFormat; $_SESSION['dnum_reset'] = $lab_config->dailyNumReset; $_SESSION['pnamehide'] = $lab_config->hidePatientName; # Config values for registration fields if ($user->level != 17) { $_SESSION['p_addl'] = $lab_config->patientAddl; $_SESSION['s_addl'] = $lab_config->specimenAddl; $_SESSION['dnum'] = $lab_config->dailyNum; $_SESSION['sid'] = $lab_config->sid; $_SESSION['pid'] = $lab_config->pid; $_SESSION['comm'] = $lab_config->comm; $_SESSION['age'] = $lab_config->age; $_SESSION['dob'] = $lab_config->dob; $_SESSION['rdate'] = $lab_config->rdate;
# # Main page for switching from admin/director role to technician role # include("redirect.php"); include("includes/db_lib.php"); include("includes/user_lib.php"); # Backup required session variables $_SESSION['lab_config_id_backup'] = $_SESSION['lab_config_id']; $_SESSION['user_level_backup'] = $_SESSION['user_level']; $_SESSION['db_name_backup'] = $_SESSION['db_name']; # Overwrite new values $_SESSION['lab_config_id'] = $_REQUEST['id']; # Change to technician mode with patient name access $_SESSION['user_level'] = $LIS_TECH_SHOWPNAME; $lab_config = get_lab_config_by_id($_REQUEST['id']); $_SESSION['db_name'] = $lab_config->dbName; # Config values for registration fields $_SESSION['p_addl'] = $lab_config->patientAddl; $_SESSION['s_addl'] = $lab_config->specimenAddl; $_SESSION['dnum'] = $lab_config->dailyNum; $_SESSION['sid'] = $lab_config->sid; $_SESSION['pid'] = $lab_config->pid; $_SESSION['comm'] = $lab_config->comm; $_SESSION['age'] = $lab_config->age; $_SESSION['dob'] = $lab_config->dob; $_SESSION['rdate'] = $lab_config->rdate; $_SESSION['refout'] = $lab_config->refout; $_SESSION['pname'] = $lab_config->pname; $_SESSION['sex'] = $lab_config->sex; $_SESSION['dformat'] = $lab_config->dateFormat;
| <a href="javascript:toggle_stat_table();" id='showtablelink'><?php echo LangUtil::$pageTerms['MSG_SHOWGRAPH']; ?> </a> | <a href='reports.php?show_p_agg'>« <?php echo LangUtil::$pageTerms['MSG_BACKTOREPORTS']; ?> </a> <br><br> <div id='prevalance_graph' > </div> <?php if ($lab_config_id != 0) { $lab_config = get_lab_config_by_id($lab_config_id[0]); if ($lab_config == null) { ?> <div class='sidetip_nopos'> <?php echo LangUtil::$generalTerms['MSG_NOTFOUND']; ?> </div> <?php return; } DbUtil::switchToLabConfig($lab_config_id); } # Cumulative summary $stat_list = array(); $stat_list = StatsLib::getDiscreteInfectionStatsAggregate($lab_config_id, $date_from, $date_to, $test_type_id);
public function start_session($username, $password) { session_start(); $sid = session_id(); //$_SESSION['tok'] = $sid; $user = get_user_by_name($username); $_SESSION['username'] = $username; $_SESSION['user_id'] = $user->userId; $_SESSION['user_actualname'] = $user->actualName; $_SESSION['user_level'] = $user->level; $_SESSION['level'] = $user->level; $_SESSION['locale'] = $user->langId; if ($user->level == 17) { $combinedString = $user->rwoptions; $_SESSION['doctorConfig'] = $combinedString; } if (is_admin_check($user)) { $lab_id = get_lab_config_id_admin($user->userId); $_SESSION['lab_config_id'] = $lab_id; $_SESSION['db_name'] = "blis_" . $lab_id; $_SESSION['dformat'] = $DEFAULT_DATE_FORMAT; $_SESSION['country'] = $user->country; } else { $_SESSION['lab_config_id'] = $user->labConfigId; echo $user->labConfigId; $_SESSION['country'] = $user->country; $lab_config = get_lab_config_by_id($user->labConfigId); $_SESSION['db_name'] = $lab_config->dbName; $_SESSION['dformat'] = $lab_config->dateFormat; $_SESSION['dnum_reset'] = $lab_config->dailyNumReset; $_SESSION['pnamehide'] = $lab_config->hidePatientName; # Config values for registration fields if ($user->level != 17) { $_SESSION['p_addl'] = $lab_config->patientAddl; $_SESSION['s_addl'] = $lab_config->specimenAddl; $_SESSION['dnum'] = $lab_config->dailyNum; $_SESSION['sid'] = $lab_config->sid; $_SESSION['pid'] = $lab_config->pid; $_SESSION['comm'] = $lab_config->comm; $_SESSION['age'] = $lab_config->age; $_SESSION['dob'] = $lab_config->dob; $_SESSION['rdate'] = $lab_config->rdate; $_SESSION['refout'] = $lab_config->refout; $_SESSION['pname'] = $lab_config->pname; $_SESSION['sex'] = $lab_config->sex; $_SESSION['doctor'] = $lab_config->doctor; } else { $arr1 = str_split($combinedString); $_SESSION['p_addl'] = $arr1[0]; $_SESSION['s_addl'] = $arr1[1]; $_SESSION['dnum'] = $arr1[2]; $_SESSION['sid'] = $arr1[3]; $_SESSION['pid'] = $arr1[4]; $_SESSION['comm'] = $arr1[5]; $_SESSION['age'] = $arr1[6]; $_SESSION['dob'] = $arr1[7]; $_SESSION['rdate'] = $arr1[8]; $_SESSION['refout'] = $arr1[9]; $_SESSION['pname'] = $arr1[10]; $_SESSION['sex'] = $arr1[11]; $_SESSION['doctor'] = $arr1[12]; } if ($SERVER == $ON_PORTABLE) { $_SESSION['langdata_path'] = $LOCAL_PATH . "langdata_" . $lab_config->id . "/"; } else { $_SESSION['langdata_path'] = $LOCAL_PATH . "langdata_revamp/"; } } # Set session variables for recording latency/user props $_SESSION['PROPS_RECORDED'] = false; $_SESSION['DELAY_RECORDED'] = false; #TODO: Add other session variables here $_SESSION['user_role'] = "garbage"; return 1; }
public function getLogsByID($id, $datefrom = NULL, $dateto = NULL) { $csvdata = apc_fetch('csvdata'); $log = array(); foreach ($csvdata as $data) { if ($data[1] == $id) { $level = get_level_by_id($data[4]); $uname = get_username_by_id($data[4]); $data[4] = $uname . "(" . $level . ")"; $labconfig_obj = get_lab_config_by_id($data[5]); $data[5] = $labconfig_obj->name; array_push($log, $data); } } return $log; }
//$labs[1] = 129; //$date_from = "2011-06-01"; //$date_to = "2012-01-01"; $ip = 0; sort($labs); $tname = getGlobalTestName($test_type_id); $testTypeMapping = TestTypeMapping::getTestTypeById($test_type_id, $_SESSION['user_id']); $mapping_list = array(); $mapping_list = get_test_mapping_list_by_string($testTypeMapping->labIdTestId); $i = 0; $theprevdata = array(); $thetatdata = array(); $labname = array(); $xc = array(); $yc = array(); foreach ($labs as $lab) { $theprevdata[$i] = get_prevalence_data_per_test_per_lab_dir($mapping_list[$lab], $lab, $date_from, $date_to); $thetatdata[$i] = get_tat_data_per_test_per_lab_dir_new($mapping_list[$lab], $lab, $date_from, $date_to, $ip); $tem = get_lab_config_by_id($lab); $labname[$i] = $tem->name; $tem = get_coordinates($lab); $xc[$i] = $tem[0]; $yc[$i] = $tem[1]; $i++; } $i = 0; foreach ($labs as $lb) { $ret[$i] = array('lab' => $lb, 'labname' => $labname[$i], 'xc' => $xc[$i], 'yc' => $yc[$i], 'prev' => $theprevdata[$i], 'tat' => $thetatdata[$i], 'date_from' => $newDate = date("d F Y", strtotime($date_from)), 'date_to' => $newDate = date("d F Y", strtotime($date_to)), 'testname' => $tname); $i++; } echo json_encode($ret);