</tr> </tbody> </table> </form> </div> <div id='patient_report_div' class='reports_subdiv' style='display:none'> <b><?php echo LangUtil::$pageTerms['MENU_PATIENT']; ?> </b> <br><br> <form name='preport_form' id='preport_form'> <table cellpadding='4px'> <?php $site_list = get_site_list($_SESSION['user_id']); if (count($site_list) == 1) { foreach ($site_list as $key => $value) { echo "<input type='hidden' name='location' id='location15' value='{$key}'></input>"; } } else { ?> <tr class="location_row" id="location_row15"> <td><?php echo LangUtil::$generalTerms['FACILITY']; ?> </td> <td> <select name='location' id='location15' class='uniform_width'> <?php //echo "<OPTION VALUE='' selected='selected'>Select..</option>";
} } } } } # # Disease Report related functions # Called from report_disease.php # public static function getDiseaseTotal($lab_config, $test_type, $date_from, $date_to) { # Returns the total number of tests performed during the given date range $query_string = "SELECT COUNT(*) AS val FROM test t, specimen sp " . "WHERE t.test_type_id={$test_type->testTypeId} " . "AND t.specimen_id=sp.specimen_id " . "AND t.result <> '' " . "AND (sp.date_collected BETWEEN '{$date_from}' AND '{$date_to}')"; $saved_db = DbUtil::switchToLabConfig($lab_config->id); $resultset = query_associative_all($query_string, $row_count); DbUtil::switchRestore($saved_db); return $resultset[0]['val']; } public static function setDiseaseSetList($lab_config, $test_type, $date_from, $date_to, $multipleCount = 0) { # Initializes diseaseSetList for capturing params if ($multipleCount == 0) { StatsLib::$diseaseSetList = array(); } $query_string = "SELECT t.result AS result_value, " . "p.sex AS patient_gender, " . "p.patient_id AS patient_id " . "FROM test t, specimen sp, patient p " . "WHERE t.specimen_id=sp.specimen_id " . "AND t.result <> '' " . "AND t.test_type_id={$test_type->testTypeId} " . "AND (sp.date_collected BETWEEN '{$date_from}' AND '{$date_to}') " . "AND sp.patient_id=p.patient_id"; $saved_db = DbUtil::switchToLabConfig($lab_config->id); $resultset = query_associative_all($query_string, $row_count); $measure_list = $test_type->getMeasureIds(); if (count($resultset) == 0 || $resultset == null) { DbUtil::switchRestore($saved_db); return; } foreach ($resultset as $record) { $patient_id = $record['patient_id']; $patient = Patient::getById($patient_id); $current_set = new DiseaseSet(); $current_set->resultValues = array(); $result_csv_parts = explode(",", $record['result_value']); # Build assoc list for result values ## Format: resultValues[measure_id] = result_value for ($i = 0; $i < count($measure_list); $i++) { $result_part = $result_csv_parts[$i]; if (trim($result_part) == "") { continue; } $curr_measure_id = $measure_list[$i]; $current_set->resultValues[$curr_measure_id] = $result_part; }
public function getTestCategoryCountrySelect($lab_config_id=null) { #Returns a set of drop down options for test categories in catalog of all labs in a country $site_list = get_site_list($_SESSION['user_id']); $final_cat_list = array(); $count = 0; foreach($site_list as $lab_config_id => $lab_name) { $cat_list = get_test_categories($lab_config_id); foreach($cat_list as $key => $value) { if ( !in_array($value, $final_cat_list) ) $final_cat_list[] = $value; else continue; } } foreach($final_cat_list as $value) echo "<option value='$value'>$value</option>"; }
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); $test_type_id = $testIds[$lab_config->id]; $namesArray[] = $lab_config->name; 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_id = $testIds[$lab_config->id]; $namesArray[] = $lab_config->name; getWeeklyStats($lab_config, $test_type_id, $date_from, $date_to); } else { if ($lab_config_id != 0 && $test_type_id != 0) { foreach ($lab_config_id as $key) { $lab_config = LabConfig::getById($key); $test_type_id = $testIds[$lab_config->id]; $namesArray[] = $lab_config->name; getWeeklyStats($lab_config, $test_type_id, $date_from, $date_to); } } } } } } } /* $lab_config = LabConfig::getById($lab_config_id[0]); if($lab_config) { //$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); } } */ }
dataString = dataString.substring(0, dataString.length-1); $('#commonSpecimenNameError').hide(); $.ajax({ type: "POST", url: "ajax/add_country_level_specimens.php", data: dataString, success: function(data) { $('#progress_specimen_spinner').hide(); window.location = "country_catalog.php?show_s"; } }); } function submitMeasureNames() { var count = <?php echo count(get_site_list($_SESSION['user_id'])); ?> ; if( $('#commonMeasureName').val() == "") { $('#commonMeasureNameError').show(); return; } $('#progress_spinner').show(); var dataString = "measureName="+$('#commonMeasureName').val(); dataString += "&labIdMeasureId="; for( var i=1; i<=count; i++) { value = $('#measureNameSelect'+i).val(); dataString += value+";"; } dataString = dataString.substring(0, dataString.length-1); $('#commonMeasureNameError').hide();
<br> <label for="effective_datetime">Effective Date/Time:</label> <input type="text" name="effective_datetime" id="effective_datetime" value="' . date('Y-m-d H:i:s', time()) . '"> </fieldset> <fieldset class="right"> <legend>Optional Shopping/Basket Info.</legend> <label for="basket_id">Basket ID:</label> <input type="text" class="regular_input" name="basket_id" id="basket_id" value="" placeholder="' . $transaction_data['basket_id'] . '"> <br> <label for="bpid">Basket/Product ID:</label> <input type="text" class="regular_input" name="bpid" id="bpid" value="" placeholder="' . $transaction_data['bpid'] . '"> <br> <label for="site_id">Site ID:</label> <input type="text" class="regular_input" name="site_id" id="site_id" list="site_list" value="" placeholder="' . $transaction_data['site_id'] . '"> <datalist id="site_list"> ' . get_site_list() . ' </datalist> <br> <label for="delivery_id">Delivery ID:</label> <input type="text" class="regular_input" name="delivery_id" id="delivery_id" value="" placeholder="' . $transaction_data['delivery_id'] . '"> <br> <label for="pvid">Product/Version ID:</label> <input type="text" class="regular_input" name="pvid" id="pvid" value="" placeholder="' . $transaction_data['pvid'] . '"> </fieldset> <div><input class="edit_button" type="button" onclick="new_transaction(' . $transaction_data['transaction_id'] . ')" value="ADD"></div> <div><input class="edit_button" type="button" onclick="cancel_new_dialog()" value="Cancel"></div> <div><input class="edit_button" type="reset" value="Reset"></div> </form> </td> </tr>'; echo $display;