本文整理汇总了PHP中query_associative_all函数的典型用法代码示例。如果您正苦于以下问题:PHP query_associative_all函数的具体用法?PHP query_associative_all怎么用?PHP query_associative_all使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了query_associative_all函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_records_to_print
function get_records_to_print($lab_config, $patient_id)
{
global $date_from, $date_to;
$retval = array();
if (isset($_REQUEST['ip']) && $_REQUEST['ip'] == 0) {
# Do not include pending tests
$query_string = "SELECT t.* FROM test t, specimen sp " . "WHERE t.result <> '' " . "AND t.specimen_id=sp.specimen_id " . "AND sp.patient_id={$patient_id} ";
if (isset($_REQUEST['yf'])) {
$query_string .= "AND (sp.date_collected BETWEEN '{$date_from}' AND '{$date_to}') ";
}
$query_string .= "ORDER BY sp.date_collected DESC";
} else {
# Include pending tests
$query_string = "SELECT t.* FROM test t, specimen sp " . "WHERE t.specimen_id=sp.specimen_id " . "AND sp.patient_id={$patient_id} ";
if (isset($_REQUEST['yf'])) {
$query_string .= "AND (sp.date_collected BETWEEN '{$date_from}' AND '{$date_to}') ";
}
$query_string .= "ORDER BY sp.date_collected DESC";
}
$resultset = query_associative_all($query_string, $row_count);
if (count($resultset) == 0 || $resultset == null) {
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;
}
示例2: get_activity_test
function get_activity_test($lab_config_id, $user_id, $date_from, $date_to)
{
$query_string = "SELECT * from test " . "WHERE user_id={$user_id} " . "AND (ts BETWEEN '{$date_from}' AND '{$date_to}' ) " . "AND result <> '' ORDER BY ts DESC";
$resultset = query_associative_all($query_string, $row_count);
$retval = array();
foreach ($resultset as $record) {
$test_entry = Test::getObject($record);
$retval[] = $test_entry;
}
return $retval;
}
示例3: get_unverified_tests
function get_unverified_tests($test_type_id)
{
# Fetches all unverified test results
$query_string = "SELECT * FROM test " . "WHERE verified_by=0 " . "AND result <> '' " . "AND test_type_id={$test_type_id}";
$resultset = query_associative_all($query_string, $row_count);
$retval = array();
foreach ($resultset as $record) {
$test_entry = Test::getObject($record);
$retval[] = $test_entry;
}
return $retval;
}
示例4: 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;
}
示例5: get_records_to_print
function get_records_to_print($lab_config, $patient_id)
{
$retval = array();
# Include pending tests
$query_string = "SELECT t.* FROM test t, specimen sp " . "WHERE t.specimen_id=sp.specimen_id " . "AND sp.patient_id={$patient_id} ";
$resultset = query_associative_all($query_string, $row_count);
if (count($resultset) == 0 || $resultset == null) {
return $retval;
}
foreach ($resultset as $record) {
$test = Test::getObject($record);
$specimen = get_specimen_by_id($test->specimenId);
$retval[] = array($test, $specimen);
}
return $retval;
}
示例6: 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;
}
示例7: listOwnedLabs
public function listOwnedLabs($admin_user_id)
{
# Returns list of lab configurations / sites owned by the admin user
$query_string =
"SELECT * FROM lab_config WHERE admin_user_id=$admin_user_id";
$resultset = query_associative_all($query_string, $row_count);
$retval = "";
if(count($resultset) == 0)
{
$retval = "-";
return $retval;
}
foreach($resultset as $record)
{
$lab_config = LabConfig::getObject($record);
$retval .= $lab_config->getSiteName()."<br>";
}
return $retval;
}
示例8: get_records_to_print
function get_records_to_print($lab_config, $patient_id)
{
global $date_from, $date_to, $LIS_DOCTOR;
$retval = array();
if (isset($_REQUEST['ip']) && $_REQUEST['ip'] == 0) {
# Do not include pending tests
$labsection = 0;
if (isset($_REQUEST['labsection'])) {
$labsection = $_REQUEST['labsection'];
}
if ($labsection == 0) {
$query_string = "SELECT t.* FROM test t, specimen sp " . "WHERE t.result <> '' " . "AND t.specimen_id=sp.specimen_id " . "AND sp.patient_id={$patient_id} ";
} else {
$query_string = "SELECT distinct t.* FROM test t, specimen sp, test_type tt, test_category tc " . "WHERE t.specimen_id=sp.specimen_id " . "AND t.result <> '' " . "AND sp.patient_id={$patient_id} " . "AND t.test_type_id = tt.test_type_id " . "AND tt.test_type_id in (select test_type_id from test_type where test_category_id = {$labsection})";
}
#Taking care of removal tests cases
$query_string .= " AND t.test_id not in (select distinct r_id from removal_record where `status` = 1) ";
if (isset($_REQUEST['yf'])) {
$query_string .= "AND (sp.date_collected BETWEEN '{$date_from}' AND '{$date_to}') ";
}
$query_string .= "ORDER BY sp.date_collected DESC";
} else {
# Include pending tests
$labsection = 0;
if (isset($_REQUEST['labsection'])) {
$labsection = $_REQUEST['labsection'];
}
if ($labsection == 0) {
$query_string = "SELECT t.* FROM test t, specimen sp " . "WHERE t.specimen_id=sp.specimen_id " . "AND sp.patient_id={$patient_id} ";
} else {
$query_string = "SELECT distinct t.* FROM test t, specimen sp, test_type tt, test_category tc " . "WHERE t.specimen_id=sp.specimen_id " . "AND sp.patient_id={$patient_id} " . "AND t.test_type_id = tt.test_type_id " . "AND tt.test_type_id in (select test_type_id from test_type where test_category_id = {$labsection})";
}
#Taking care of removal tests cases
$query_string .= " AND t.test_id not in (select distinct r_id from removal_record where `status` = 1) ";
if (isset($_REQUEST['yf'])) {
$query_string .= "AND (sp.date_collected BETWEEN '{$date_from}' AND '{$date_to}') ";
}
$query_string .= "ORDER BY sp.date_collected DESC";
}
$resultset = query_associative_all($query_string, $row_count);
if (count($resultset) == 0 || $resultset == null) {
return $retval;
}
foreach ($resultset as $record) {
$test = Test::getObject($record);
if ($_SESSION['user_level'] == $LIS_DOCTOR) {
if ($test->verifiedBy == 0) {
continue;
}
}
$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;
}
示例9: get_specimen_types_catalog
$lab_config->testList = $selected_test_list;
$master_specimen_list = get_specimen_types_catalog(true);
$selected_specimen_list = array();
foreach($master_specimen_list as $specimen_type_id=>$specimen_name)
{
if(isset($_REQUEST['s_type_'.$specimen_type_id]))
$selected_specimen_list[] = $specimen_type_id;
}
$lab_config->specimenList = $selected_specimen_list;
*/
$lab_config->idMode = $_REQUEST['id_mode'];
$saved_db = DbUtil::switchToGlobal();
$query = "SELECT country from lab_config";
$records = query_associative_all($query, $row_count);
foreach ($records as $record) {
if (strcmp($record['country'], $country) == 0) {
$count++;
}
}
$count++;
DbUtil::switchRestore($saved_db);
/*
$query_string = "show databases";
$records = query_associative_all($query_string, $row_count);
$count = 0;
foreach($records as $record) {
if( strpos($record['database'], $country) != FALSE ) {
$count++;
}
示例10: 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";
}
示例11: remarks_db2xml
function remarks_db2xml($langdata_path, $lab_config_id)
{
# Creates XML file from existing test measures (indicators) in catalog
global $VERSION;
$new_version = $VERSION;
$handle = fopen($langdata_path . "remarks.xml", "w");
$string_data = <<<EOF
<?xml version="1.0"?>
<measures version="{$new_version}">
EOF;
fwrite($handle, $string_data);
$saved_db = DbUtil::switchToLabConfigRevamp($lab_config_id);
$query_string = "SELECT * FROM measure";
$resultset = query_associative_all($query_string, $row_count);
foreach ($resultset as $record) {
$curr_measure = Measure::getObject($record);
$id = $curr_measure->measureId;
$descr = $curr_measure->name;
$string_data = <<<EOF
\t<measure id="{$id}" descr="{$descr}">
EOF;
fwrite($handle, $string_data);
$range_type = $curr_measure->getRangeType();
$range_values = $curr_measure->getRangeValues();
if ($range_type == Measure::$RANGE_NUMERIC) {
$lower_bound = htmlspecialchars($range_values[0]);
$upper_bound = htmlspecialchars($range_values[1]);
$string_data = <<<EOF
\t\t<range>
\t\t\t<key>{$range_values['0']}:{$range_values['1']}</key>
\t\t\t<value></value>
\t\t</range>
EOF;
fwrite($handle, $string_data);
} else {
if ($range_type == Measure::$RANGE_OPTIONS) {
foreach ($range_values as $range_value) {
$range_value_xml = htmlspecialchars($range_value);
$string_data = <<<EOF
\t\t<range>
\t\t\t<key>{$range_value_xml}</key>
\t\t\t<value></value>
\t\t</range>
EOF;
fwrite($handle, $string_data);
}
}
}
$string_data = <<<EOF
\t</measure>
EOF;
fwrite($handle, $string_data);
}
$string_data = <<<EOF
</measures>
EOF;
fwrite($handle, $string_data);
fclose($handle);
DbUtil::switchRestore($saved_db);
}
示例12: getConfigs
public function getConfigs($lab_config_id)
{
$sql = "select * from dhims2_api_config";
$resultset = query_associative_all($sql, $row_count, $lab_config_id);
$results = array();
$larr = array();
$orgunitTrimList = array();
$datasetTrimList = array();
$dataelementTrimList = array();
$genderTrimList = array();
$icount = count($resultset);
for ($i = 0; $i < $icount; $i++) {
$orgunit = explode('^', $resultset[$i]['orgunit']);
if (!in_array($orgunit[0], $orgunitTrimList)) {
$larr['id'] = $orgunit[0];
$larr['pId'] = 0;
$larr['name'] = $orgunit[1];
$larr['open'] = true;
$larr['ename'] = $resultset[$i]['id'];
$results[] = $larr;
$larr = array();
$orgunitTrimList[] = $orgunit[0];
}
$dataset = explode('^', $resultset[$i]['dataset']);
if (!in_array($dataset[0], $datasetTrimList)) {
$larr['id'] = $dataset[0];
$larr['pId'] = $orgunit[0];
$larr['name'] = $dataset[1];
$larr['isParent'] = true;
$larr['open'] = true;
$larr['ename'] = $resultset[$i]['id'];
$results[] = $larr;
$larr = array();
$datasetTrimList[] = $dataset[0];
}
$dataelement = explode('|', $resultset[$i]['dataelement']);
//$elementname = explode('|',$dataelement[1]);
$elementname = "";
$dsetparts = explode('^', $dataelement[0]);
//.$elementname[1];
for ($dcount = 1; $dcount < count($dataelement); $dcount++) {
$tmp = explode('^', $dataelement[$dcount]);
if (empty($elementname)) {
$elementname .= $tmp[1];
} else {
$elementname .= '+' . $tmp[1];
}
}
$dsetElem = $dsetparts[0];
if (!in_array($dsetElem, $dataelementTrimList)) {
$larr['id'] = $dsetElem;
$larr['pId'] = $dataset[0];
$larr['name'] = $dsetparts[1] . '-->' . $elementname;
$larr['open'] = true;
$larr['isParent'] = true;
$larr['ename'] = $resultset[$i]['id'];
$results[] = $larr;
$larr = array();
$dataelementTrimList[] = $dsetElem;
}
if ($resultset[$i]['gender'] == "M") {
if (!in_array($dsetElem . '_M', $genderTrimList)) {
$larr['id'] = $dsetElem . '_M';
$larr['pId'] = $dsetElem;
$comboname = explode('|', $categorycombo[1]);
$larr['name'] = "Male";
$larr['open'] = true;
$larr['isParent'] = true;
$larr['ename'] = $resultset[$i]['id'];
$results[] = $larr;
$larr = array();
$genderTrimList[] = $dsetElem . '_M';
}
$categorycombo = explode('^', $resultset[$i]['categorycombo']);
$larr['id'] = $categorycombo[0];
$larr['pId'] = $dsetElem . '_M';
$comboname = explode('|', $categorycombo[1]);
$larr['name'] = $comboname[0] . '-->' . $comboname[1];
$larr['open'] = true;
$larr['ename'] = $resultset[$i]['id'];
$results[] = $larr;
$larr = array();
} elseif ($resultset[$i]['gender'] == "F") {
if (!in_array($dsetElem . '_F', $genderTrimList)) {
$larr['id'] = $dsetElem . '_F';
$larr['pId'] = $dsetElem;
$comboname = explode('|', $categorycombo[1]);
$larr['name'] = "Female";
$larr['open'] = true;
$larr['isParent'] = true;
$larr['ename'] = $resultset[$i]['id'];
$results[] = $larr;
$larr = array();
$genderTrimList[] = $dsetElem . '_F';
}
$categorycombo = explode('^', $resultset[$i]['categorycombo']);
$larr['id'] = $categorycombo[0];
$larr['pId'] = $dsetElem . '_F';
$comboname = explode('|', $categorycombo[1]);
$larr['name'] = $comboname[0] . '-->' . $comboname[1];
//.........这里部分代码省略.........
示例13: 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;
}
示例14: add_results_sequential
function add_results_sequential($user_list = array())
{
# Adds random result entries for scheduled specimen
global $NUM_SPECIMENS, $F_PENDING, $SPECIMEN_ID_START;
$lab_config_id = $_SESSION['lab_config_id'];
$saved_db = DbUtil::switchToLabConfig($lab_config_id);
$num_specimens2 = query_num_rows("specimen");
$specimens_to_handle = floor($num_specimens2 * (1 - $F_PENDING));
$specimen_target_list = array();
$query_string = "SELECT * FROM specimen ORDER BY date_collected LIMIT " . $specimens_to_handle;
$resultset = query_associative_all($query_string, $row_count);
foreach ($resultset as $record) {
$specimen_entry = Specimen::getObject($record);
$specimen_target_list[] = $specimen_entry;
}
DbUtil::switchRestore($saved_db);
$count = 0;
$specimen_id_count = $SPECIMEN_ID_START;
foreach ($specimen_target_list as $specimen) {
if ($specimen == null) {
# TODO:
}
$result_entry_ts = get_random_ts($specimen->dateCollected);
if ($specimen == null) {
# Specimen does not exist
//echo "Specimen does not exist<br>";
//$count++;
$specimen_id_count++;
continue;
}
$saved_db = DbUtil::switchToLabConfig($_SESSION['lab_config_id']);
$specimen_id = $specimen->specimenId;
$status_code = get_specimen_status($specimen_id);
DbUtil::switchRestore($saved_db);
if ($status_code == Specimen::$STATUS_DONE) {
# Results already entered
//echo "Results already entered<br>";
$count++;
$specimen_id_count++;
continue;
}
$patientId = $specimen->patientId;
$currentPatient = Patient::getById($patientId);
$hashValue = $currentPatient->generateHashValue();
# Fetch tests scheduled for this specimen
$test_list = get_tests_by_specimen_id($specimen_id);
# For each test, fetch test measures and range from catalog
foreach ($test_list as $test) {
$measure_list = get_test_type_measures($test->testTypeId);
$result_entry = "";
foreach ($measure_list as $measure) {
$range = get_measure_range($measure);
# Select random result value
$result_val = get_random_range_value($range);
csv_append($result_val, $result_entry);
}
$test_id = $test->testId;
# Update result field in test entry
$saved_db = DbUtil::switchToLabConfig($lab_config_id);
# Select random technician as the one of entered this result
$user_id = 0;
if (count($user_list) != 0) {
$random_user_index = rand(1, count($user_list));
$random_user = $user_list[$random_user_index - 1];
$user_id = $random_user->userId;
}
add_test_result($test_id, $result_entry, "", "", $user_id, $result_entry_ts, $hashValue);
# Randomly this test result mark as verified or keep as unverified
# null or 0 => not verified, non-zero => verified.
if (with_probability(0.9)) {
$is_verified = 2;
$test->setVerifiedBy($is_verified);
}
DbUtil::switchRestore($saved_db);
}
$saved_db = DbUtil::switchToLabConfig($lab_config_id);
# Mark specimen as 'all tests done'
update_specimen_status($specimen_id);
# Randomly mark this specimen as reported or keep as unreported
if (with_probability(0.9)) {
$date_reported = date("Y-m-d H:i:s");
$specimen->setDateReported($date_reported);
}
DbUtil::switchRestore($saved_db);
# Update counters
$count++;
$specimen_id_count++;
}
}
示例15: getUnReportedByRegDateRange
public static function getUnReportedByRegDateRange($date_from, $date_to)
{
$emp = "";
$query_string = "SELECT DISTINCT patient_id FROM specimen , test " . "WHERE date_collected BETWEEN '{$date_from}' AND '{$date_to}' " . "AND result='{$emp}' " . "AND specimen.specimen_id=test.specimen_id";
$resultset = query_associative_all($query_string, $row_count);
$retval = array();
$record_p = array();
foreach ($resultset as $record) {
foreach ($record as $key => $value) {
$query_string = "SELECT * FROM patient WHERE patient_id={$value}";
}
$record_each = query_associative_one($query_string);
$record_p[] = Patient::getObject($record_each);
}
return $record_p;
}