# Error: Autocomplete values not entered properly. # TODO: } # Truncate trailing "_" $range_string = substr($range_string, 0, -1); } else { if ($submeasure_types[$i + 1][$k] == Measure::$RANGE_FREETEXT) { # Free text measure type $range_string = "\$freetext\$\$"; } } } } $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; }
$range_string .= trim($option_value); $range_string .= "_"; } } if ($options_entered === false) { # Error: Autocomplete values not entered properly. # TODO: } # Truncate trailing "_" $range_string = substr($range_string, 0, -1); } } } $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])) {
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>"; }