コード例 #1
0
function generate_worksheet_config($lab_config_id)
{
    $lab_config = LabConfig::getById($lab_config_id);
    $test_ids = $lab_config->getTestTypeIds();
    $saved_db = DbUtil::switchToLabConfig($lab_config_id);
    foreach ($test_ids as $test_id) {
        $test_entry = TestType::getById($test_id);
        $query_string = "SELECT * FROM report_config WHERE test_type_id={$test_id} LIMIT 1";
        $record = query_associative_one($query_string);
        if ($record == null) {
            # Add new entry
            $query_string_add = "INSERT INTO report_config (" . "test_type_id, header, footer, margins, " . "p_fields, s_fields, t_fields, p_custom_fields, s_custom_fields " . ") VALUES (" . "'{$test_id}', 'Worksheet - " . $test_entry->name . "', '', '5,0,5,0', " . "'0,1,0,1,1,0,0', '0,0,1,1,0,0', '1,0,1,0,0,0,0,1', '', '' " . ")";
            query_insert_one($query_string_add);
        }
    }
    DbUtil::switchRestore($saved_db);
}
コード例 #2
0
ファイル: db_lib.php プロジェクト: nchopra/C4G-BLIS
 public function addToDb()
 {
     $infectionReportSettings = $this;
     $saved_db = DbUtil::switchToGlobal();
     # Remove existing entry
     $query_string = "DELETE FROM infection_report_settings " . "WHERE user_id={$this->userId} " . "AND test_id={$this->testId} " . "AND measure_id={$this->measureId}";
     query_blind($query_string);
     # Add updated entry
     $query_string = "INSERT INTO infection_report_settings( " . "id, " . "user_id, " . "test_id, " . "measure_id, " . "group_by_gender, " . "group_by_age, " . "age_groups, " . "measure_groups " . ") " . "VALUES ( " . "{$infectionReportSettings->id}, " . "{$infectionReportSettings->userId}, " . "{$infectionReportSettings->testId}, " . "{$infectionReportSettings->measureId}, " . "{$infectionReportSettings->groupByGender}, " . "{$infectionReportSettings->groupByAge}, " . "'{$infectionReportSettings->ageGroups}', " . "'{$infectionReportSettings->measureGroups}' " . ")";
     query_insert_one($query_string);
     DbUtil::switchRestore($saved_db);
 }
コード例 #3
0
<?php

include "../includes/db_lib.php";
$userId = $_SESSION['user_id'];
$testCategoryName = $_REQUEST['testCategoryName'];
$labIdTestCategoryId = $_REQUEST['labIdTestCategoryId'];
$saved_db = DbUtil::switchToGlobal();
$queryString = "SELECT MAX(test_category_id) AS test_category_id FROM test_category_mapping " . "WHERE user_id={$userId}";
$record = query_associative_one($queryString);
$testCategoryId = intval($record['test_category_id']) + 1;
$queryString = "INSERT INTO TEST_CATEGORY_MAPPING (user_id, test_category_name, lab_id_test_category_id, test_category_id) " . "VALUES (" . $userId . ",'" . $testCategoryName . "','" . $labIdTestCategoryId . "'," . $testCategoryId . ")";
query_insert_one($queryString) or die(mysql_error());
DbUtil::switchRestore($saved_db);
echo "true";
コード例 #4
0
<?php

include "../includes/db_lib.php";
include "../includes/script_elems.php";
include "../includes/page_elems.php";
include "../includes/user_lib.php";
$equipment_id = $_REQUEST['equipment_id'];
$equipment_name = $_REQUEST['equipment_name'];
$equipment_version = $_REQUEST['equipment_version'];
$lab_department = $_REQUEST['lab_department'];
$comm_type = $_REQUEST['comm_type'];
$feed_source = $_REQUEST['feed_source'];
$config_file = $_REQUEST['config_file'];
$prop_ids = $_REQUEST['prop_ids'];
$propidarr = explode(",", $prop_ids);
$prop_values = $_REQUEST['prop_values'];
$propvaluesarr = explode(",", $prop_values);
$saved_db = DbUtil::switchToGlobal();
$query_string = "update interfaced_equipment\r\n\tset equipment_name = '{$equipment_name}',\r\n\t\tequipment_version = '{$equipment_version}',\r\n\t\tlab_department = '{$lab_department}',\r\n\t\tcomm_type = '{$comm_type}',\r\n\t\tfeed_source = '{$feed_source}',\r\n\t\tconfig_file = '{$config_file}'\r\n\t\twhere id = {$equipment_id}";
query_insert_one($query_string);
for ($i = 0; $i < count($propidarr); $i++) {
    $query_string = "update equip_config\r\n\tset prop_value = '{$propvaluesarr[$i]}'\r\n\twhere equip_id = {$equipment_id}\r\n\t\tand prop_id = {$propidarr[$i]}";
    query_insert_one($query_string);
}
DbUtil::switchRestore($saved_db);
コード例 #5
0
ファイル: db_lib.php プロジェクト: caseyi/BLIS
 public function useStock($reagent_id, $lot, $quant, $u_date, $remarks)
 {
     $created_by = $_SESSION["user_id"];
     $lab_config_id = $_SESSION["lab_config_id"];
     $saved_db = DbUtil::switchToLabConfig($lab_config_id);
     $query_string = "INSERT INTO inv_usage (reagent_id, lot, quantity_used, date_of_use, user_id, remarks) " . "VALUES ({$reagent_id}, '{$lot}', {$quant}, '{$u_date}', {$created_by}, '{$remarks}')";
     query_insert_one($query_string);
     DbUtil::switchRestore($saved_db);
 }
コード例 #6
0
ファイル: random.php プロジェクト: caseyi/BLIS
function add_patients_random($num_patients)
{
    # Adds random patient entries
    global $MAX_NUM_PATIENTS, $NUM_PATIENTS;
    if ($num_patients > $MAX_NUM_PATIENTS) {
        $num_patients = $MAX_NUM_PATIENTS;
    }
    //$patient_sql_filename = "../data/patients.sql";
    /*
    if(strpos($_SERVER['HTTP_REFERER'], "lab_config_home.php") !== false)
    {
    	$patient_sql_filename = "../data/patients.sql";	
    }
    else
    {
    	$patient_sql_filename = "../data/patients.sql";	
    }
    */
    /*$patient_sql_file = fopen($patient_sql_filename, 'r');
    	$count = 0;
    	while($count < $num_patients)
    	{
    		$sql = fgets($patient_sql_file);
    		query_insert_one($sql);
    		$count++;
    	}
    	*/
    $count = 1;
    $minDate = "1930-01-01";
    $maxDate = "2011-01-01";
    while ($count <= $num_patients) {
        $patientId = $count;
        $addl_id = $count + 5000;
        $surr_id = $count + 8500;
        $name = get_random_name();
        $sex = get_random_gender();
        $dob = get_random_date($minDate, $maxDate);
        $sql = "INSERT INTO `patient` (`patient_id`,`name`,`dob`,`sex`,`addl_id`,`surr_id`)" . "VALUES ({$patientId}, '{$name}' , '{$dob}' , '{$sex}', {$addl_id}, {$surr_id})";
        query_insert_one($sql);
        $count++;
    }
    $NUM_PATIENTS = $num_patients;
}