本文整理汇总了PHP中DbUtil::switchToLabConfig方法的典型用法代码示例。如果您正苦于以下问题:PHP DbUtil::switchToLabConfig方法的具体用法?PHP DbUtil::switchToLabConfig怎么用?PHP DbUtil::switchToLabConfig使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DbUtil
的用法示例。
在下文中一共展示了DbUtil::switchToLabConfig方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: runUpdate
function runUpdate($lab_config_id) {
global $con;
/*BLIS 1.26 Update
$saved_db = DbUtil::switchToLabConfig($lab_config_id);
$query_alter = "ALTER TABLE report_disease ".
"DROP FOREIGN KEY report_disease_ibfk_1";
mysql_query( $query_alter, $con ) or die(mysql_error());
/*BLIS 1.27 Update
$query_alter = "ALTER TABLE stock_details ADD COLUMN used VARCHAR(1000) NULL DEFAULT '' ".
"AFTER quantity_used , ADD COLUMN user VARCHAR(1000) NULL DEFAULT '' AFTER used ,".
" ADD COLUMN receiver VARCHAR(1000) NULL DEFAULT '' AFTER user ,".
" ADD COLUMN remarks VARCHAR(1000) NULL DEFAULT '' AFTER receiver ";
mysql_query( $query_alter, $con ) or die(mysql_error());
/*BLIS 1.28 Update
$query_alter = "ALTER TABLE custom_field_type MODIFY field_type VARCHAR(100) ";
mysql_query( $query_alter, $con ) or die(mysql_error());
*/
/*BLIS 1.29 Update
$saved_db = DbUtil::switchToGlobal();
$query_alter = "ALTER TABLE lab_config add column ageLimit INTEGER ";
mysql_query( $query_alter, $con ) or die(mysql_error());
DbUtil::switchRestore($saved_db);
*/
/*BLIS 1.32 Update
$saved_db = DbUtil::switchToLabConfig($lab_config_id);
$query_alter = "ALTER TABLE test_type ".
"ADD COLUMN prevalence_threshold int(3) default 70, ".
"ADD COLUMN target_tat int(3) default 24";
mysql_query( $query_alter, $con ) or die(mysql_error());
*/
/*BLIS 2.0 Update */
$saved_db = DbUtil::switchToLabConfig($lab_config_id);
$query_update = "ALTER TABLE user_rating ".
"ADD COLUMN comments varchar(2048) default '' ";
mysql_query( $query_update, $con) or die(mysql_error());
}
示例2: get_records_to_print
function get_records_to_print($lab_config, $test_type_id, $date_from, $date_to)
{
$saved_db = DbUtil::switchToLabConfig($lab_config->id);
$retval = array();
$query_string = "SELECT * FROM test WHERE test_type_id={$test_type_id} " . "AND specimen_id IN ( " . "SELECT specimen_id FROM specimen " . "WHERE date_collected BETWEEN '{$date_from}' AND '{$date_to}' " . ")";
$resultset = query_associative_all($query_string, $row_count);
foreach ($resultset as $record) {
$test = Test::getObject($record);
$specimen = Specimen::getById($test->specimenId);
$patient = Patient::getById($specimen->patientId);
$retval[] = array($test, $specimen, $patient);
}
DbUtil::switchRestore($saved_db);
return $retval;
}
示例3: generate_worksheet_config
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);
}
示例4: mergedata
function mergedata()
{
if (!isset($_SESSION['lab_config_id'])) {
return false;
}
$workedID = "";
$lab_config = $_SESSION['lab_config_id'];
$saved_db = DbUtil::switchToLabConfig($importLabConfigId);
$querySelect = "SELECT patient_id,name,surr_id,addl_id FROM patient order by surr_id asc";
$resultset = query_associative_all($querySelect, $rowCount);
$rowCount = 0;
foreach ($resultset as $record) {
if (strstr($workedID, $record['surr_id'])) {
continue;
} else {
$workedID .= "," . $record['surr_id'];
}
$querySelect = "SELECT patient_id,name,surr_id,addl_id FROM patient where \n\t\tsurr_id='" . $record['surr_id'] . "' and \n\t\tpatient_id <> " . $record['patient_id'];
$Dupresult = query_associative_all($querySelect, $rowCount);
foreach ($Dupresult as $Duprecord) {
$rowCount += 1;
echo '<br> Working... ' . $record['surr_id'];
//update spacimen
$updateQuery = "update specimen set patient_id=" . $record['patient_id'] . "where patient_id=" . $Duprecord['patient_id'];
query_blind($updateQuery);
//update bills
$updateQuery = "update bills set patient_id=" . $record['patient_id'] . "where patient_id=" . $Duprecord['patient_id'];
query_blind($updateQuery);
//now delete from custom_data and patients table
$deleteQuery = "delete from patient_custom_data where patient_id=" . $Duprecord['patient_id'];
query_blind($deleteQuery);
$deleteQuery = "delete from patient where patient_id=" . $Duprecord['patient_id'];
query_blind($deleteQuery);
}
}
//var_dump ( $resultset);
if ($rowCount > 0) {
echo '<br>' . $rowCount . " Duplicate Records corrected.";
} else {
echo '<br>' . "No Duplicate Records found.";
}
return true;
}
示例5: foreach
return $retval;
}
foreach ($resultset as $record) {
$test = Test::getObject($record);
$hide_patient_name = TestType::toHidePatientName($test->testTypeId);
if ($hide_patient_name == 1) {
$hidePatientName = 1;
}
$specimen = get_specimen_by_id($test->specimenId);
$retval[] = array($test, $specimen, $hide_patient_name);
}
return $retval;
}
$lab_config_id = $_REQUEST['location'];
$patient_id = $_REQUEST['patient_id'];
DbUtil::switchToLabConfig($lab_config_id);
$lab_config = get_lab_config_by_id($lab_config_id);
$report_id = $REPORT_ID_ARRAY['reports_testhistory.php'];
$report_config = $lab_config->getReportConfig($report_id);
$margin_list = $report_config->margins;
for ($i = 0; $i < count($margin_list); $i++) {
$margin_list[$i] = $SCREEN_WIDTH * $margin_list[$i] / 100;
}
?>
<html>
<head>
<style type="text/css">
.btn {
color:white;
background-color:#9fc748;/*#3B5998;*/
示例6: array
$retval = array();
$existing_stat_list = array();
$testName = null;
for ($i = 0; $i < count($lab_config_id_array); $i++) {
$labIdTestTypeIdSeparated = explode(":", $lab_config_id_array[$i]);
$lab_config_id = $labIdTestTypeIdSeparated[0];
$test_type_id = $labIdTestTypeIdSeparated[1];
$retval = StatsLib::getDiscreteInfectionStatsAggregate($lab_config_id, $date_from, $date_to, $test_type_id);
$existing_stat_list = $stat_list;
$stat_list = array_merge($existing_stat_list, $retval);
$lab_config = LabConfig::getById($lab_config_id);
$labName = $lab_config->name;
$labNamesArray[] = $labName;
getWeeklyStats($lab_config, $test_type_id, $date_from, $date_to);
if (!$testName) {
$saved_db = DbUtil::switchToLabConfig($lab_config_id);
$testName = get_test_name_by_id($test_type_id);
DbUtil::switchRestore($saved_db);
}
if (count($stat_list) == 0) {
?>
<div class='sidetip_nopos'>
<?php
echo LangUtil::$pageTerms['TIPS_NODISCRETE'];
?>
</div>
<?php
include "includes/footer.php";
return;
}
}
示例7: getByAgeAndSex
public static function getByAgeAndSex($age, $sex, $measure_id, $lab_config_id)
{
# Fetches the reference range based on supplied age and sex values
global $con;
$measure_id = mysql_real_escape_string($measure_id, $con);
$lab_config_id = mysql_real_escape_string($lab_config_id, $con);
$age = mysql_real_escape_string($age, $con);
$sex = mysql_real_escape_string($sex, $con);
$saved_db = DbUtil::switchToLabConfig($lab_config_id);
$query_string = "SELECT * FROM reference_range WHERE measure_id={$measure_id}";
$retval = null;
$resultset = query_associative_all($query_string, $row_count);
if ($resultset == null || count($resultset) == 0) {
return $retval;
}
foreach ($resultset as $record) {
$ref_range = ReferenceRange::getObject($record);
if ($ref_range->ageMin == 0 && $ref_range->ageMax == 0) {
# No agewise split
if ($ref_range->sex == "B" || strtolower($ref_range->sex) == strtolower($sex)) {
return $ref_range;
}
} else {
if ($ref_range->ageMin <= $age && $ref_range->ageMax >= $age) {
# Age wise split exists
if ($ref_range->sex == "B" || strtolower($ref_range->sex) == strtolower($sex)) {
return $ref_range;
}
}
}
}
DbUtil::switchRestore($saved_db);
}
示例8: strip_tags
$result_cap = $_REQUEST['result_cap'];
}
if (!isset($_REQUEST['result_counter'])) {
$result_counter = 1;
} else {
$result_counter = $_REQUEST['result_counter'];
}
$a = $_REQUEST['a'];
$saved_db = "";
$lab_config = null;
$q = $_REQUEST['q'];
$q = strip_tags($q);
if (isset($_REQUEST['l'])) {
# Save context
$lab_config = LabConfig::getById($_REQUEST['l']);
$saved_db = DbUtil::switchToLabConfig($_REQUEST['l']);
} else {
$lab_config = LabConfig::getById($_SESSION['lab_config_id']);
}
$patient_list = array();
# Fetch list from DB
if ($a == 0) {
# Fetch by patient ID
$patient_list = search_patients_by_id($q);
} else {
if ($a == 1) {
# Fetch by patient name
if ($dynamic_fetch == 0) {
$patient_list = search_patients_by_name($q);
} else {
$patient_list = search_patients_by_name_dyn($q, $result_cap, $result_counter);
示例9: array
$male_total = array();
$female_total = array();
$cross_gender_total = array();
$age_total = array();
$age_total1 = array();
$age_total2 = array();
$curr_male_total = 0;
$curr_female_total = 0;
$curr_cross_gender_total = 0;
$age_total;
$age_total1;
$age_total2;
foreach ($site_list as $labConfigId) {
$lab_config = get_lab_config_by_id($labConfigId);
$testTypeId = $testIds[$labConfigId];
$saved_db = DbUtil::switchToLabConfig($labConfigId);
$testType = TestType::getById($testTypeId);
StatsLib::setDiseaseSetList($lab_config, $testType, $date_from, $date_to);
DbUtil::switchRestore($saved_db);
$is_range_options = true;
if (strpos($measure->range, "/") === false) {
$is_range_options = false;
}
$range_values = array();
if ($is_range_options) {
# Alphanumeric options
$range_values1 = explode("/", $measure->range);
$range_values = str_replace("#", "/", $range_values1);
} else {
# Numeric ranges: Fetch ranges configured for this test-type/measure from DB
$range_values = $disease_report->getMeasureGroupAsList();
示例10: processWeeklyTrends
function processWeeklyTrends($lab_config_id, $test_type_id, $date_from, $date_to, $test_name = null)
{
global $namesArray;
global $stat_list;
# All Tests & All Labs */
if ($test_type_id == 0 && $lab_config_id == 0) {
$site_list = get_site_list($_SESSION['user_id']);
$userId = $_SESSION['user_id'];
$saved_db = DbUtil::switchToGlobal();
$query = "SELECT * FROM test_mapping WHERE user_id = {$userId}";
$resultset = query_associative_all($query, $row_count);
foreach ($resultset as $record) {
$labIdTestIds = explode(';', $record['lab_id_test_id']);
foreach ($labIdTestIds as $labIdTestId) {
$labIdTestId = explode(':', $labIdTestId);
$labId = $labIdTestId[0];
$testId = $labIdTestId[1];
$test_type_list_all[$labId][] = $testId;
$test_type_names[$labId][] = $record['test_name'];
}
}
DbUtil::switchRestore($saved_db);
foreach ($site_list as $key => $value) {
$lab_config = LabConfig::getById($key);
$test_type_list = array();
$test_type_list = $test_type_list_all[$key];
$testNames = $test_type_names[$key];
$saved_db = DbUtil::switchToLabConfig($lab_config->id);
$testCount = -1;
foreach ($test_type_list as $test_type_id) {
$query_string = "SELECT COUNT(*) AS count_val FROM test t, specimen s " . "WHERE t.test_type_id={$test_type_id} " . "AND t.specimen_id=s.specimen_id " . "AND result!=''" . "AND ( s.date_collected BETWEEN '{$date_from}' AND '{$date_to}' )";
$record = query_associative_one($query_string);
$count_all = intval($record['count_val']);
$testCount++;
if ($count_all == 0) {
continue;
}
$namesArray[] = $lab_config->name . " - " . $testNames[$testCount];
getWeeklyStats($lab_config, $test_type_id, $date_from, $date_to);
}
}
} else {
if ($test_type_id == 0 && count($lab_config_id) == 1) {
$lab_config = LabConfig::getById($lab_config_id[0]);
$test_type_list = get_discrete_value_test_types($lab_config);
foreach ($test_type_list as $test_type_id) {
$namesArray[] = get_test_name_by_id($test_type_id, $lab_config_id[0]);
getWeeklyStats($lab_config, $test_type_id, $date_from, $date_to);
}
} else {
if ($test_type_id == 0 && count($lab_config_id) > 1) {
$userId = $_SESSION['user_id'];
$saved_db = DbUtil::switchToGlobal();
$query = "SELECT * FROM test_mapping WHERE user_id = {$userId}";
$resultset = query_associative_all($query, $row_count);
foreach ($resultset as $record) {
$labIdTestIds = explode(';', $record['lab_id_test_id']);
foreach ($labIdTestIds as $labIdTestId) {
$labIdTestId = explode(':', $labIdTestId);
$labId = $labIdTestId[0];
$testId = $labIdTestId[1];
$test_type_list_all[$labId][] = $testId;
$test_type_names[$labId][] = $record['test_name'];
}
}
DbUtil::switchRestore($saved_db);
foreach ($lab_config_id as $key) {
$lab_config = LabConfig::getById($key);
$test_type_list = array();
$test_type_list = $test_type_list_all[$key];
$testNames = $test_type_names[$key];
$saved_db = DbUtil::switchToLabConfig($lab_config->id);
$testCount = -1;
foreach ($test_type_list as $test_type_id) {
$query_string = "SELECT COUNT(*) AS count_val FROM test t, specimen s " . "WHERE t.test_type_id={$test_type_id} " . "AND t.specimen_id=s.specimen_id " . "AND result!=''" . "AND ( s.date_collected BETWEEN '{$date_from}' AND '{$date_to}' )";
$record = query_associative_one($query_string);
$count_all = intval($record['count_val']);
$testCount++;
if ($count_all == 0) {
continue;
}
$namesArray[] = $lab_config->name . " - " . $testNames[$testCount];
getWeeklyStats($lab_config, $test_type_id, $date_from, $date_to);
}
}
} else {
/* Build Array Map with Lab Id as Key and Test Id as corresponding Value */
$labIdTestIds = explode(";", $test_type_id);
$testIds = array();
foreach ($labIdTestIds as $labIdTestId) {
$labIdTestIdsSeparated = explode(":", $labIdTestId);
$labId = $labIdTestIdsSeparated[0];
$testId = $labIdTestIdsSeparated[1];
$testIds[$labId] = $testId;
}
# Particular Test & All Labs
if ($test_type_id != 0 && $lab_config_id == 0) {
$site_list = get_site_list($_SESSION['user_id']);
foreach ($site_list as $key => $value) {
$lab_config = LabConfig::getById($key);
//.........这里部分代码省略.........
示例11: add_patient
$patientName = $record['name'];
$patient = Patient::getObject($record);
$patient->createdBy = $_SESSION['user_id'];
DbUtil::switchRestore($saved_db);
add_patient($patient, true);
/*
$querySelect =
"SELECT patient_id FROM patient ".
"WHERE name like '$patientName' ";
$record = query_associative_one($querySelect);
$newPatientId = $record['patient_id'];
*/
/* Create New Specimen & Test Records */
$i = 0;
foreach ($specimenRecords as $specimenRecord) {
$saved_db = DbUtil::switchToLabConfig($importLabConfigId);
$querySelect = "SELECT * FROM test " . "WHERE specimen_id={$specimenRecord->specimenId}";
$resultset = query_associative_all($querySelect, $rowcount);
DbUtil::switchRestore($saved_db);
//$specimenRecord->specimenId = get_max_specimen_id() + 1;
$specimenRecord->patientId = $importPatientId;
$specimenRecord->userId = $_SESSION['user_id'];
$specimenRecord->doctor = '';
add_specimen($specimenRecord);
for ($j = 0; $j < count($resultset); $j++) {
$testRecord = $testRecords[$i];
$testRecord->specimenId = $specimenRecord->specimenId;
$testRecord->userId = $_SESSION['user_id'];
$i++;
add_test($testRecord, $testRecord['test_id']);
}
示例12: query_associative_all
<?php
include "../includes/db_lib.php";
include "../includes/user_lib.php";
$patientId = $_REQUEST['p_id'];
$logType = $_REQUEST['log_type'];
$saved_db = DbUtil::switchToGlobal();
$query_configs = "SELECT created_by, creation_date from user_log where patient_id = " . $patientId . " and log_type = '" . $logType . "'";
$resultset = query_associative_all($query_configs, 0);
DbUtil::switchRestore($saved_db);
$saved_db = DbUtil::switchToLabConfig($_SESSION['lab_config_id']);
$queryString = "SELECT t_fields from report_config where report_id =1 ";
$record2 = query_associative_one($queryString);
$test_field_list = explode(",", $record2['t_fields']);
DbUtil::switchRestore($saved_db);
if ($resultset != null && ($logType == 'PRINT' && $test_field_list[10] || $logType == 'RESULT' && $test_field_list[11]) == '1') {
$ret_str = "User id\t\t\t\t Print date";
foreach ($resultset as $aish) {
$ret_str .= "\n " . $aish['created_by'] . "\t\t\t\t" . $aish['creation_date'];
}
echo $ret_str;
} else {
echo "false";
}
示例13: get_test_cost
public function get_test_cost($tid)
{
if ($_SESSION['level'] < 2 || $_SESSION['level'] > 4) {
$user = get_user_by_id($_SESSION['user_id']);
$lid = $user->labConfigId;
}
if ($lid == null) {
$lid = get_lab_config_id_admin($_SESSION['user_id']);
}
//$stocks_list = Inventory::getStocksList($lid, $r_id);
$lab_config_id = $lid;
$saved_db = DbUtil::switchToLabConfig($lab_config_id);
$query_string = "SELECT * from test_type_costs WHERE test_type_id = {$tid} ORDER BY earliest_date_valid DESC LIMIT 1";
$record = query_associative_one($query_string);
DbUtil::switchRestore($saved_db);
if ($record != null) {
$ret = $record['amount'];
} else {
$ret = -1;
}
return $ret;
}
示例14: get_inv_usage_by_user
public function get_inv_usage_by_user($lid, $user)
{
$lab_config_id = $lid;
$saved_db = DbUtil::switchToLabConfig($lab_config_id);
$query_string = "SELECT * from inv_usage WHERE user_id = {$user}";
$recordset = query_associative_all($query_string, $row_count);
DbUtil::switchRestore($saved_db);
return $recordset;
}
示例15: clear_random_data
function clear_random_data($lab_config)
{
# TODO:
if ($lab_config == null) {
return;
}
# Remove entries from 'test' table and 'specimen' table
global $MAX_NUM_PATIENTS, $MAX_NUM_SPECIMENS, $PATIENT_ID_START, $SPECIMEN_ID_START;
$saved_db = DbUtil::switchToLabConfig($lab_config->id);
for ($i = $SPECIMEN_ID_START; $i <= $SPECIMEN_ID_START + $MAX_NUM_SPECIMENS; $i++) {
$query_string = "DELETE FROM test WHERE specimen_id={$i}";
query_blind($query_string);
$query_string = "DELETE FROM specimen WHERE specimen_id={$i}";
query_blind($query_string);
}
# Remove entries from 'patient' table
for ($i = $PATIENT_ID_START; $i <= $PATIENT_ID_START + $MAX_NUM_PATIENTS; $i++) {
$query_string = "DELETE FROM patient WHERE patient_id={$i}";
query_blind($query_string);
}
DbUtil::switchRestore($saved_db);
}