public function getCompatibilityJsArray($array_name, $lab_config_id=null) { # Returns a JavaScript array storing compatible test types for each specimen type $specimen_type_list = get_specimen_types_catalog($lab_config_id); echo "$array_name=new Array(); "; foreach($specimen_type_list as $key=>$value) { $test_list = get_compatible_tests($key); $test_csv = implode(",", $test_list); echo $array_name."[".$key."]='$test_csv'; "; } }
} } $unit = $subunits[$i + 1][$k]; //# Add measure to DB and track the ID (key) $added_submeasures_list[$scc] = add_measure($measure_name, $range_string, $unit); $scc++; $k++; } $i++; } # Store Submeasures } # Fetch compatible specimen types $specimen_list = array(); $reff = 1; $catalog_specimen_list = get_specimen_types_catalog($lab_config_id, $reff); foreach ($catalog_specimen_list as $specimen_typeid => $specimen_name) { if (isset($_REQUEST['s_type_' . $specimen_typeid])) { $specimen_list[] = $specimen_typeid; } } # Add test type record //function add_test_type($test_name, $test_descr, $clinical_data, $cat_code, $is_panel, $specimen_list=array(), $lab_config_id, $hide_patient_name) $test_type_id = ""; if (count($specimen_list) != 0) { # Add entries to 'specimen_test' map table $test_type_id = add_test_type($test_name, $test_descr, $test_clinical_data, $cat_code, $is_panel, $lab_config_id, $hide_patient_name, $prevalenceThreshold, $targetTat, $specimen_list); } else { # No specimens selected. Add test anyway $test_type_id = add_test_type($test_name, $test_descr, $test_clinical_data, $cat_code, $is_panel, $lab_config_id, $hide_patient_name, $prevalenceThreshold, $targetTat); }
$unit = $units[$i]; # Add measure to DB $new_measure_id = add_measure($measure_name, $range_string, $unit); $new_measures_list[] = $new_measure_id; $measures_to_retain[] = $new_measure_id; $count_ref++; } # Add entries for newly listed/measures to 'test_type_measure' map table for ($i = 0; $i < count($new_measures_list); $i += 1) { $measure_id = $new_measures_list[$i]; add_test_type_measure($test_type_id, $measure_id); } } # Fetch compatible specimen types $specimen_list = array(); $catalog_specimen_list = get_specimen_types_catalog(); foreach ($catalog_specimen_list as $specimen_typeid => $specimen_name) { if (isset($_REQUEST['s_type_' . $specimen_typeid])) { $specimen_list[] = $specimen_typeid; } } update_test_type($updated_entry, $specimen_list); # Add entries for newly listed/measures to 'test_type_measure' map table if ($_REQUEST['ispanel'] == 1) { for ($i = 0; $i < count($added_measures_list); $i += 1) { $measure_id = $added_measures_list[$i]; add_test_type_measure($test_type_id, $measure_id); } } //print_r($measures_to_retain); //print_r($reference_ranges_list);
<?php # # (c) C4G, Santosh Vempala, Ruban Monu and Amol Shintre # Updates specimen and tests added to a lab configuration # Called via Ajax from lab_config_home.php # include "../users/accesslist.php"; if (!(isAdmin(get_user_by_id($_SESSION['user_id'])) && in_array(basename($_SERVER['PHP_SELF']), $adminPageList)) && !(isSuperAdmin(get_user_by_id($_SESSION['user_id'])) && in_array(basename($_SERVER['PHP_SELF']), $superAdminPageList)) && !(isCountryDir(get_user_by_id($_SESSION['user_id'])) && in_array(basename($_SERVER['PHP_SELF']), $countryDirPageList))) { displayForbiddenMessage(); } $lab_config_id = $_REQUEST['lid']; $specimen_type_list = get_specimen_types_catalog($lab_config_id); $test_type_list = get_test_types_catalog($lab_config_id); $updated_specimen_list = array(); $updated_test_list = array(); $lab_config = LabConfig::getById($lab_config_id); if ($lab_config == null) { return; } foreach ($specimen_type_list as $key => $value) { $field_tocheck = "s_type_" . $key; if (isset($_REQUEST[$field_tocheck])) { $updated_specimen_list[] = $key; } } foreach ($test_type_list as $key => $value) { $field_tocheck = "t_type_" . $key; if (isset($_REQUEST[$field_tocheck])) { $updated_test_list[] = $key; }