function specimen_list_to_json($specimen_list) { $json_params = array('id', 'name'); $assoc_list = array(); foreach ($specimen_list as $specimen_id) { $specimen = get_specimen_type_by_id($specimen_id); $specimen_type_id = $specimen->specimenTypeId; $specimen_name = $specimen->getName(); $assoc_list[$specimen_type_id] = $specimen_name; } return list_to_json($assoc_list, $json_params); }
function update_specimen_type($updated_entry, $new_test_list) { # Updates specimen type info in DB catalog $saved_db = DbUtil::switchToLabConfigRevamp(); $existing_entry = get_specimen_type_by_id($updated_entry->specimenTypeId); if ($existing_entry == null) { # No record found DbUtil::switchRestore($saved_db); return; } $query_string = "UPDATE specimen_type " . "SET name='{$updated_entry->name}', " . "description='{$updated_entry->description}' " . "WHERE specimen_type_id={$updated_entry->specimenTypeId}"; query_blind($query_string); # Delete entries for removed compatible tests $existing_list = get_compatible_tests($updated_entry->specimenTypeId); foreach ($existing_list as $test_type_id) { if (in_array($test_type_id, $new_test_list)) { # Compatible test not removed # Do nothing } else { # Remove entry from mapping table $query_del = "DELETE from specimen_test " . "WHERE test_type_id={$test_type_id} " . "AND specimen_type_id={$updated_entry->specimenTypeId}"; query_blind($query_del); } } # Add entries for new compatible tests foreach ($new_test_list as $test_type_id) { if (in_array($test_type_id, $existing_list)) { # Entry already exists # Do nothing } else { # Add entry in mapping table $query_ins = "INSERT INTO specimen_test (specimen_type_id, test_type_id) " . "VALUES ({$updated_entry->specimenTypeId}, {$test_type_id})"; query_blind($query_ins); } } DbUtil::switchRestore($saved_db); }
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 }
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 }
<?php # # Main page for modifying an existing specimen type # include "redirect.php"; include "includes/header.php"; include "includes/ajax_lib.php"; LangUtil::setPageId("catalog"); $script_elems->enableJQueryForm(); $script_elems->enableTokenInput(); $specimen_type = get_specimen_type_by_id($_REQUEST['sid']); ?> <script type='text/javascript'> $(document).ready(function(){ <?php $test_list = get_compatible_tests($specimen_type->specimenTypeId); foreach ($test_list as $test_type_id) { # Mark existing compatible tests as checked ?> $('#t_type_<?php echo $test_type_id; ?> ').attr("checked", "checked"); <?php } ?> }); function update_stype() {