示例#1
0
}
# For each measure:
foreach ($measure_list as $measure) {
    $measure_id = $measure->measureId;
    # Remove entries from test_type_measure
    $query_string = "DELETE FROM test_type_measure WHERE measure_id={$measure_id}";
    query_delete($query_string);
    # Remove entry from measure
    $query_string = "DELETE FROM measure WHERE measure_id={$measure_id}";
    query_delete($query_string);
}
$query_string = "SELECT * FROM specimen_type";
$resultset = query_associative_all($query_string, $row_count);
$specimen_list = array();
foreach ($resultset as $record) {
    $specimen_list[] = TestType::getObject($record);
}
# For each specimen type:
foreach ($specimen_list as $specimen) {
    $specimen_type_id = $specimen->specimenTypeId;
    # Remove entries from lab_config_specimen_type
    $query_string = "DELETE FROM lab_config_specimen_type WHERE specimen_type_id={$specimen_type_id}";
    query_delete($query_string);
    # Remove entries from specimen_test
    $query_string = "DELETE FROM specimen_test WHERE specimen_type_id={$specimen_type_id}";
    query_delete($query_string);
    # Remove entry from specimen_type
    $query_string = "DELETE FROM specimen_type WHERE specimen_type_id={$specimen_type_id}";
    query_delete($query_string);
}
DbUtil::switchRestore($saved_db);
示例#2
0
 public static function getById($test_type_id)
 {
     # Returns test type record in DB
     global $con;
     $test_type_id = mysql_real_escape_string($test_type_id, $con);
     $saved_db = DbUtil::switchToLabConfigRevamp();
     $query_string = "SELECT * FROM test_type WHERE test_type_id={$test_type_id} LIMIT 1";
     $record = query_associative_one($query_string);
     DbUtil::switchRestore($saved_db);
     return TestType::getObject($record);
 }
示例#3
0
文件: db_lib.php 项目: caseyi/BLIS
 public function get_test_type($test_type_id)
 {
     global $con;
     if ($_SESSION['level'] < 2 || $_SESSION['level'] > 4) {
         $user = get_user_by_id($_SESSION['user_id']);
         $lab_config_id = $user->labConfigId;
     }
     if ($lab_config_id == null) {
         $lab_config_id = get_lab_config_id_admin($_SESSION['user_id']);
     }
     $test_type_id = mysql_real_escape_string($test_type_id, $con);
     $saved_db = DbUtil::switchToLabConfig($lab_config_id);
     $query_string = "SELECT * FROM test_type WHERE test_type_id={$test_type_id} LIMIT 1";
     $record = query_associative_one($query_string);
     $test_type = TestType::getObject($record);
     //print_r($test_type);
     $ret = array();
     if ($test_type != null) {
         $ret['info'] = $test_type;
     } else {
         return 0;
     }
     $measure_list = array();
     $measure_list_objs = $test_type->getMeasures();
     //print_r($measure_list);
     $submeasure_list_objs = array();
     $comb_measure_list = array();
     // print_r($measure_list);
     foreach ($measure_list_objs as $measure) {
         $submeasure_list_objs = $measure->getSubmeasuresAsObj();
         //echo "<br>".count($submeasure_list);
         //print_r($submeasure_list);
         $submeasure_count = count($submeasure_list_objs);
         if ($measure->checkIfSubmeasure() == 1) {
             continue;
         }
         if ($submeasure_count == 0) {
             array_push($comb_measure_list, $measure);
         } else {
             array_push($comb_measure_list, $measure);
             foreach ($submeasure_list_objs as $submeasure) {
                 array_push($comb_measure_list, $submeasure);
             }
         }
     }
     $measure_list_ids = array();
     //echo "<pre>";
     //print_r($comb_measure_list);
     //echo "</pre>";
     foreach ($comb_measure_list as $measure) {
         array_push($measure_list_ids, $measure->measureId);
     }
     /*
     echo "<pre>";
     print_r($measure_list);
     
     print_r($measure_list_ids);
     echo "</pre>";
     */
     $measure_list = $measure_list_ids;
     //print_r($measure_list_objs);
     $ret['measures'] = $measure_list_objs;
     DbUtil::switchRestore($saved_db);
     return $ret;
 }