} } # 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); # Add ref ranges for retained and new measures $measure_count = 0; foreach ($reference_ranges_list as $range_list) { $measure_id = $measures_to_retain[$measure_count]; if ($measure_id == "") { continue; } if (count($range_list) == 0) { # Not a numeric field continue; }
function import_test_between_labs($test_id, $from_id, $to_id) { //echo "<pre>"; $tt = new TestType(); $test_type = new TestType(); $saved_db = DbUtil::switchToLabConfig($from_id); $test_type = $tt->getById($test_id); //print_r($test_obj); $measure_objs = $test_type->getMeasures(); //print_r($measure_objs); DbUtil::switchRestore($saved_db); $saved_db = DbUtil::switchToLabConfig($to_id); //$test_type->testTypeId; $test_name = $test_type->name; $test_descr = $test_type->description; $clinical_data = $test_type->clinical_data; $cat_code = $test_type->testCategoryId; $hide_patient_name = $test_type->hidePatientName; $prevalenceThreshold = $test_type->prevalenceThreshold; $targetTat = $test_type->targetTat; $is_panel = $test_type->isPanel; $lab_config_id = $to_id; $new_test_id = add_test_type($test_name, $test_descr, $clinical_data, $cat_code, $is_panel, $lab_config_id, $hide_patient_name, $prevalenceThreshold, $targetTat); $subm_flags = array(); $id_list = array(); foreach ($measure_objs as $mo) { if ($mo->checkIfSubmeasure() == 0) { if ($mo->getRangeType() == Measure::$RANGE_NUMERIC) { $m_id = add_measure($mo->name, $mo->range, $mo->unit); array_push($id_list, $m_id); if ($mo->range == ':') { //$ref = new ReferenceRange(); $refs = $mo->getReferenceRanges($from_id); foreach ($refs as $ref) { $ref->measureId = $m_id; $ref->addToDb($to_id); } } } else { $m_id = add_measure($mo->name, $mo->range, $mo->unit); array_push($id_list, $m_id); } } else { $dec_name = $mo->truncateSubmeasureTag(); $enc_name = "\$sub*" . $m_id . "/\$" . $dec_name; $sm_id = add_measure($enc_name, $mo->range, $mo->unit); array_push($id_list, $sm_id); } } foreach ($id_list as $measure_id) { add_test_type_measure($new_test_id, $measure_id); } DbUtil::switchRestore($saved_db); //echo "<pre>"; }