public function getTestTypeInfo($test_name, $show_db_name=false) { # Returns HTML for displaying test type information $test_type = get_test_type_by_name($test_name); ?> <table class='hor-minimalist-b'> <tbody> <tr> <td><?php echo LangUtil::$generalTerms['NAME']; ?></td> <td> <?php if($show_db_name === true) echo $test_type->name; else echo $test_type->getName(); ?> </td> </tr> <tr> <td><?php echo LangUtil::$generalTerms['LAB_SECTION']; ?></td> <td><?php echo get_test_category_name_by_id($test_type->testCategoryId); ?></td> </tr> <tr valign='top'> <td><?php echo LangUtil::$generalTerms['DESCRIPTION']; ?></td> <td><?php echo $test_type->getDescription(); ?></td> </tr> <tr valign='top'> <td><?php echo LangUtil::$generalTerms['MEASURES']; ?></td> <td> <?php # Fetch all test measures $measure_id_list = get_test_type_measures($test_type->testTypeId); sort($measure_id_list); //print_r($measure_id_list); foreach($measure_id_list as $measure_id) { $measure = get_measure_by_id($measure_id); if($measure==NULL && count($meausre_id_list)==1 ) { echo "No Measures Found!"; break; } else if($measure!=NULL) { if(strpos($measure->getName(), "\$sub") !== false) { $decName = $measure->truncateSubmeasureTag(); echo "    ".$decName."<br>"; } else { echo $measure->getName()."<br>"; } } } ?> </td> </tr> <tr valign='top'> <td><?php echo LangUtil::$generalTerms['COMPATIBLE_SPECIMENS']; ?></td> <td> <?php # Fetch list of compatible specimens $compatible_specimens = get_compatible_specimens($test_type->testTypeId); if(count($compatible_specimens) == 0) { echo "-"; } else { foreach($compatible_specimens as $curr_specimen) { # Show test name $specimen_type = get_specimen_type_by_id($curr_specimen); echo $specimen_type->getName()."<br>"; } } ?> </td> </tr> <tr valign='top'> <td>Hide Patient Name in Report</td> <td><?php if( $test_type->hidePatientName == 0) { echo "No"; } else { echo "Yes"; } ?> </td> </tr> <tr valign='top'> <td>Prevalence Threshold</td> <td><?php echo $test_type->prevalenceThreshold; ?></td> </tr> <tr valign='top'> <td>Target TAT</td> <td><?php echo $test_type->targetTat; ?></td> </tr> <tr valign='top' <?php is_billing_enabled($_SESSION['lab_config_id']) ? print("") : print("style='display:none;'") ?>> <td>Cost To Patient</td> <td><?php print(format_number_to_money(get_latest_cost_of_test_type($test_type->testTypeId))); ?></td> </tr> </tbody> </table> <?php }
} else { if ($type == 'd') { $query_string = "SELECT s.date_collected AS week ,COUNT(*) AS count_val FROM test t, patient p,specimen s " . "WHERE t.test_type_id={$test_type_id} " . "AND t.specimen_id=s.specimen_id " . "AND p.patient_id=s.patient_id " . "AND p.sex= '{$gender}' " . "AND t.result!=''" . "AND (s.date_collected BETWEEN '{$date_from}' AND '{$date_to}') " . "GROUP BY s.date_collected"; $resultset = query_associative_all($query_string, $row_count); $query_string1 = "SELECT s.date_collected AS week ,COUNT(*) AS count_val FROM test t, patient p,specimen s " . "WHERE t.test_type_id={$test_type_id} " . "AND t.specimen_id=s.specimen_id " . "AND p.patient_id=s.patient_id " . "AND p.sex= '{$gender}' " . "AND (t.result LIKE 'N,%' OR t.result LIKE 'n�gatif,%' OR t.result LIKE 'negatif,%' OR t.result LIKE 'n,%' OR t.result LIKE 'negative,%')" . "AND (s.date_collected BETWEEN '{$date_from}' AND '{$date_to}') " . "GROUP BY s.date_collected"; $resultset1 = query_associative_all($query_string1, $row_count1); } else { $query_string = "SELECT year(s.date_collected), s.date_collected AS week ,COUNT(*) AS count_val FROM test t, patient p,specimen s " . "WHERE t.test_type_id={$test_type_id} " . "AND t.specimen_id=s.specimen_id " . "AND t.result!=''" . "AND p.patient_id=s.patient_id " . "AND p.sex= '{$gender}' " . "AND (s.date_collected BETWEEN '{$date_from}' AND '{$date_to}') " . "GROUP BY year(s.date_collected), month(s.date_collected)"; $resultset = query_associative_all($query_string, $row_count); $query_string1 = "SELECT year(s.date_collected), s.date_collected AS week ,COUNT(*) AS count_val FROM test t, patient p,specimen s " . "WHERE t.test_type_id={$test_type_id} " . "AND t.specimen_id=s.specimen_id " . "AND p.patient_id=s.patient_id " . "AND p.sex= '{$gender}' " . "AND (t.result LIKE 'N,%' OR t.result LIKE 'n�gatif,%' OR t.result LIKE 'negatif,%' OR t.result LIKE 'n,%' OR t.result LIKE 'negative,%')" . "AND (s.date_collected BETWEEN '{$date_from}' AND '{$date_to}') " . "GROUP BY year(s.date_collected),month(s.date_collected)"; $resultset1 = query_associative_all($query_string1, $row_count1); } } $record_total = array(); $record_neg = array(); foreach ($resultset1 as $record) { $week = $record['week']; $record_neg[$week] = $record['count_val']; } foreach ($resultset as $record) { $week = $record['week']; $count++; $record_total[$week] = $record['count_val']; } $counter = 0; foreach ($record_total as $key => $value) { if ($record_neg[$key] == "") { $count_negative = 0; } else { $count_negative = $record_neg[$key]; } $count_all = $value; $date_from_parts = explode("-", $key); $date_ts = mktime(0, 0, 0, $date_from_parts[1] + $i, $date_from_parts[2], $date_from_parts[0]); $retval[$counter] = array($count_all, $count_negative, $date_ts); $counter++; } DbUtil::switchRestore($saved_db); return $retval; } public static function getDiscreteInfectionStatsDaily($lab_config, $test_type_id, $date_from, $date_to, $gender = null) { $i = 1; # Fetch all test types with one measure having discrete P/N range $retval = array(); $saved_db = DbUtil::switchToLabConfig($lab_config->id); $date_from_parts = explode("-", $date_from); $date_to_parts = explode("-", $date_to); $date_ts = mktime(0, 0, 0, $date_from_parts[1], $date_from_parts[2], $date_from_parts[0]); $date_to_ts = mktime(0, 0, 0, $date_to_parts[1], $date_to_parts[2], $date_to_parts[0]); while ($date_ts < $date_to_ts) { $second_day_ts = mktime(0, 0, 0, $date_from_parts[1], $date_from_parts[2] + $i, $date_from_parts[0]); $date_fromp = date("Y-m-d", $date_ts);
public function getTestTypeInfo($test_name, $show_db_name = false) { # Returns HTML for displaying test type information $test_type = get_test_type_by_name($test_name); ?> <table class='hor-minimalist-b'> <tbody> <tr> <td><?php echo LangUtil::$generalTerms['NAME']; ?> </td> <td> <?php if ($show_db_name === true) { echo $test_type->name; } else { echo $test_type->getName(); } ?> </td> </tr> <tr> <td><?php echo LangUtil::$generalTerms['LAB_SECTION']; ?> </td> <td><?php echo get_test_category_name_by_id($test_type->testCategoryId); ?> </td> </tr> <tr valign='top'> <td><?php echo LangUtil::$generalTerms['DESCRIPTION']; ?> </td> <td><?php echo $test_type->getDescription(); ?> </td> </tr> <tr valign='top'> <td><?php echo LangUtil::$generalTerms['MEASURES']; ?> </td> <td> <?php # Fetch all test measures $measure_id_list = get_test_type_measures($test_type->testTypeId); foreach ($measure_id_list as $measure_id) { $measure = get_measure_by_id($measure_id); if ($measure == NULL && count($meausre_id_list) == 1) { echo "No Measures Found!"; break; } else { if ($measure != NULL) { echo $measure->getName() . "<br>"; } } } ?> </td> </tr> <tr valign='top'> <td><?php echo LangUtil::$generalTerms['COMPATIBLE_SPECIMENS']; ?> </td> <td> <?php # Fetch list of compatible specimens $compatible_specimens = get_compatible_specimens($test_type->testTypeId); if (count($compatible_specimens) == 0) { echo "-"; } else { foreach ($compatible_specimens as $curr_specimen) { # Show test name $specimen_type = get_specimen_type_by_id($curr_specimen); echo $specimen_type->getName() . "<br>"; } } ?> </td> </tr> <tr valign='top'> <td>Hide Patient Name in Report</td> <td><?php if ($test_type->hidePatientName == 0) { echo "No"; } else { echo "Yes"; } ?> </td> </tr> <tr valign='top'> <td>Prevalence Threshold</td> <td><?php echo $test_type->prevalenceThreshold; ?> </td> </tr> <tr valign='top'> <td>Target TAT</td> <td><?php echo $test_type->targetTat; ?> </td> </tr> </tbody> </table> <?php }