예제 #1
1
function newpatient_report($pid, $encounter, $cols, $id)
{
    $res = sqlStatement("select * from form_encounter where pid='{$pid}' and id='{$id}'");
    print "<table><tr><td>\n";
    while ($result = sqlFetchArray($res)) {
        print "<span class=bold>" . xl('Reason') . ": </span><span class=text>" . $result["reason"] . "<br>\n";
        print "<span class=bold>" . xl('Facility') . ": </span><span class=text>" . $result["facility"] . "<br>\n";
    }
    print "</td></tr></table>\n";
}
예제 #2
0
function load_menu($menu_set)
{
    $menuTables = " SHOW TABLES LIKE ?";
    $res = sqlQuery($menuTables, array("menu_trees"));
    if ($res === false) {
        return array();
    }
    $menuQuery = " SELECT * FROM menu_trees, menu_entries WHERE menu_trees.entry_id=menu_entries.id AND menu_set=? ORDER BY parent, seq";
    $res = sqlStatement($menuQuery, array($menu_set));
    $retval = array();
    $entries = array();
    $parent_not_found = array();
    while ($row = sqlFetchArray($res)) {
        $entries[$row['entry_id']] = menu_entry_to_object($row);
        if (empty($row['parent'])) {
            array_push($retval, $entries[$row['entry_id']]);
        } else {
            if (isset($entries[$row['parent']])) {
                $parent = $entries[$row['parent']];
                array_push($parent->children, $entries[$row['entry_id']]);
            } else {
                array_push($parent_not_found, $entries[$row['entry_id']]);
            }
        }
    }
    foreach ($parent_not_found as $row) {
        if (isset($entries[$row->parent])) {
            $parent = $entries[$row->parent];
            array_push($parent->children, $row);
        } else {
            array_push($parent_not_found2, $row);
        }
    }
    return json_decode(json_encode($retval));
}
예제 #3
0
 public static function generate_validate_constraints($form_id)
 {
     $fres = sqlStatement("SELECT layout_options.*,list_options.notes as validation_json \n              FROM layout_options  \n              LEFT JOIN list_options ON layout_options.validation=list_options.option_id AND list_options.list_id = 'LBF_Validations'\n              WHERE layout_options.form_id = ? AND layout_options.uor > 0 AND layout_options.field_id != '' \n              ORDER BY layout_options.group_name, layout_options.seq ", array($form_id));
     $constraints = array();
     $validation_arr = array();
     $required = array();
     while ($frow = sqlFetchArray($fres)) {
         $id = 'form_' . $frow['field_id'];
         $validation_arr = array();
         $required = array();
         //Keep "required" option from the LBF form
         if ($frow['uor'] == 2) {
             $required = array(self::VJS_KEY_REQUIRED => true);
         }
         if ($frow['validation_json']) {
             if (json_decode($frow['validation_json'])) {
                 $validation_arr = json_decode($frow['validation_json'], true);
             } else {
                 trigger_error($frow['validation_json'] . " is not a valid json ", E_USER_WARNING);
             }
         }
         if (!empty($required) || !empty($validation_arr)) {
             $constraints[$id] = array_merge($required, $validation_arr);
         }
     }
     return json_encode($constraints);
 }
예제 #4
0
function catch_logs()
{
    $sql = sqlStatement("select * from log where id not in(select log_id from log_validator) and checksum is NOT null and checksum != ''");
    while ($row = sqlFetchArray($sql)) {
        sqlInsert("INSERT into log_validator (log_id,log_checksum) VALUES(?,?)", array($row['id'], $row['checksum']));
    }
}
예제 #5
0
function fetchEvents($from_date, $to_date, $where_param = null, $orderby_param = null)
{
    $where = "( (e.pc_endDate >= '{$from_date}' AND e.pc_eventDate <= '{$to_date}' AND e.pc_recurrtype = '1') OR " . "(e.pc_eventDate >= '{$from_date}' AND e.pc_eventDate <= '{$to_date}') )";
    if ($where_param) {
        $where .= $where_param;
    }
    $order_by = "e.pc_eventDate, e.pc_startTime";
    if ($orderby_param) {
        $order_by = $orderby_param;
    }
    $query = "SELECT " . "e.pc_eventDate, e.pc_endDate, e.pc_startTime, e.pc_endTime, e.pc_duration, e.pc_recurrtype, e.pc_recurrspec, e.pc_recurrfreq, e.pc_catid, e.pc_eid, " . "e.pc_title, e.pc_hometext, e.pc_apptstatus, " . "p.fname, p.mname, p.lname, p.pid, p.pubpid, p.phone_home, p.phone_cell, " . "u.fname AS ufname, u.mname AS umname, u.lname AS ulname, u.id AS uprovider_id, " . "c.pc_catname, c.pc_catid " . "FROM openemr_postcalendar_events AS e " . "LEFT OUTER JOIN patient_data AS p ON p.pid = e.pc_pid " . "LEFT OUTER JOIN users AS u ON u.id = e.pc_aid " . "LEFT OUTER JOIN openemr_postcalendar_categories AS c ON c.pc_catid = e.pc_catid " . "WHERE {$where} " . "ORDER BY {$order_by}";
    $res = sqlStatement($query);
    $events = array();
    if ($res) {
        while ($row = sqlFetchArray($res)) {
            // if it's a repeating appointment, fetch all occurances in date range
            if ($row['pc_recurrtype']) {
                $reccuringEvents = getRecurringEvents($row, $from_date, $to_date);
                $events = array_merge($events, $reccuringEvents);
            } else {
                $events[] = $row;
            }
        }
    }
    return $events;
}
예제 #6
0
 public function doPatientCheck(RsPatient $patient, $beginDate = null, $endDate = null, $options = null)
 {
     $return = false;
     $listOptions = Codes::lookup($this->getOptionId(), 'CVX');
     if (count($listOptions) > 0) {
         $sqlQueryBind = array();
         $query = "SELECT * " . "FROM immunizations " . "WHERE patient_id = ? AND added_erroneously = '0' " . "AND administered_date >= ? " . "AND administered_date <= ? ";
         $query .= "AND ( ";
         $count = 0;
         array_push($sqlQueryBind, $patient->id, $beginDate, $endDate);
         foreach ($listOptions as $option_id) {
             $query .= "cvx_code = ? ";
             $count++;
             if ($count < count($listOptions)) {
                 $query .= "OR ";
             }
             array_push($sqlQueryBind, $option_id);
         }
         $query .= " ) ";
         $result = sqlStatement($query, $sqlQueryBind);
         $rows = array();
         for ($iter = 0; $row = sqlFetchArray($result); $iter++) {
             $rows[$iter] = $row;
         }
         if (isset($options[self::OPTION_COUNT]) && count($rows) >= $options[self::OPTION_COUNT]) {
             $return = true;
         } else {
             if (!isset($options[self::OPTION_COUNT]) && count($rows) > 0) {
                 $return = true;
             }
         }
     }
     return $return;
 }
예제 #7
0
 private function getListOptionById($id)
 {
     $query = "SELECT * " . "FROM `list_options` " . "WHERE list_id = ? " . "AND option_id = ?";
     $results = sqlStatement($query, array($this->getListId(), $id));
     $arr = sqlFetchArray($results);
     return $arr;
 }
예제 #8
0
function review_of_systems_report($pid, $encounter, $cols, $id)
{
    $count = 0;
    $data = formFetch("form_review_of_systems", $id);
    $sql = "SELECT name from form_review_of_systems_checks where foreign_id = '" . add_escape_custom($id) . "'";
    $results = sqlQ($sql);
    $data2 = array();
    while ($row = sqlFetchArray($results)) {
        $data2[] = $row['name'];
    }
    $data = array_merge($data, $data2);
    if ($data) {
        print "<table><tr>";
        foreach ($data as $key => $value) {
            if ($key == "id" || $key == "pid" || $key == "user" || $key == "groupname" || $key == "authorized" || $key == "activity" || $key == "date" || $value == "" || $value == "0000-00-00 00:00:00") {
                continue;
            }
            if ($value == "on") {
                $value = "yes";
            }
            $key = ucwords(str_replace("_", " ", $key));
            if (is_numeric($key)) {
                $key = "check";
            }
            print "<td><span class=bold>{$key}: </span><span class=text>{$value}</span></td>";
            $count++;
            if ($count == $cols) {
                $count = 0;
                print "</tr><tr>\n";
            }
        }
    }
}
예제 #9
0
function slInvoiceNumber(&$out)
{
    $invnumber = $out['our_claim_id'];
    $atmp = preg_split('/[ -]/', $invnumber);
    $acount = count($atmp);
    $pid = 0;
    $encounter = 0;
    if ($acount == 2) {
        $pid = $atmp[0];
        $encounter = $atmp[1];
    } else {
        if ($acount == 3) {
            $pid = $atmp[0];
            $brow = sqlQuery("SELECT encounter FROM billing WHERE " . "pid = '{$pid}' AND encounter = '" . $atmp[1] . "' AND activity = 1");
            $encounter = $brow['encounter'];
        } else {
            if ($acount == 1) {
                $pres = sqlStatement("SELECT pid FROM patient_data WHERE " . "lname LIKE '" . addslashes($out['patient_lname']) . "' AND " . "fname LIKE '" . addslashes($out['patient_fname']) . "' " . "ORDER BY pid DESC");
                while ($prow = sqlFetchArray($pres)) {
                    if (strpos($invnumber, $prow['pid']) === 0) {
                        $pid = $prow['pid'];
                        $encounter = substr($invnumber, strlen($pid));
                        break;
                    }
                }
            }
        }
    }
    if ($pid && $encounter) {
        $invnumber = "{$pid}.{$encounter}";
    }
    return array($pid, $encounter, $invnumber);
}
예제 #10
0
파일: report.php 프로젝트: gidsil/openemr
function lbf_report($pid, $encounter, $cols, $id, $formname)
{
    require_once $GLOBALS["srcdir"] . "/options.inc.php";
    $arr = array();
    $shrow = getHistoryData($pid);
    $fres = sqlStatement("SELECT * FROM layout_options " . "WHERE form_id = ? AND uor > 0 " . "ORDER BY group_name, seq", array($formname));
    while ($frow = sqlFetchArray($fres)) {
        $field_id = $frow['field_id'];
        $currvalue = '';
        if ($frow['edit_options'] == 'H') {
            if (isset($shrow[$field_id])) {
                $currvalue = $shrow[$field_id];
            }
        } else {
            $currvalue = lbf_current_value($frow, $id, $encounter);
            if ($currvalue === FALSE) {
                continue;
            }
            // should not happen
        }
        // For brevity, skip fields without a value.
        if ($currvalue === '') {
            continue;
        }
        // $arr[$field_id] = $currvalue;
        // A previous change did this instead of the above, not sure if desirable? -- Rod
        $arr[$field_id] = wordwrap($currvalue, 30, "\n", true);
    }
    echo "<table>\n";
    display_layout_rows($formname, $arr);
    echo "</table>\n";
}
예제 #11
0
function checkCreateCDB()
{
    $globalsres = sqlStatement("SELECT gl_name, gl_index, gl_value FROM globals WHERE gl_name IN \n  ('couchdb_host','couchdb_user','couchdb_pass','couchdb_port','couchdb_dbase','document_storage_method')");
    $options = array();
    while ($globalsrow = sqlFetchArray($globalsres)) {
        $GLOBALS[$globalsrow['gl_name']] = $globalsrow['gl_value'];
    }
    $directory_created = false;
    if ($GLOBALS['document_storage_method'] != 0) {
        // /documents/temp/ folder is required for CouchDB
        if (!is_dir($GLOBALS['OE_SITE_DIR'] . '/documents/temp/')) {
            $directory_created = mkdir($GLOBALS['OE_SITE_DIR'] . '/documents/temp/', 0777, true);
            if (!$directory_created) {
                echo htmlspecialchars(xl("Failed to create temporary folder. CouchDB will not work."), ENT_NOQUOTES);
            }
        }
        $couch = new CouchDB();
        if (!$couch->check_connection()) {
            echo "<script type='text/javascript'>alert('" . addslashes(xl("CouchDB Connection Failed.")) . "');</script>";
            return;
        }
        if ($GLOBALS['couchdb_host'] || $GLOBALS['couchdb_port'] || $GLOBALS['couchdb_dbase']) {
            $couch->createDB($GLOBALS['couchdb_dbase']);
            $couch->createView($GLOBALS['couchdb_dbase']);
        }
    }
    return true;
}
예제 #12
0
파일: new.php 프로젝트: katopenzz/openemr
function showExamLine($line_id, $description, &$linedbrow, $sysnamedisp)
{
    $dres = sqlStatement("SELECT * FROM form_physical_exam_diagnoses " . "WHERE line_id = '{$line_id}' ORDER BY ordering, diagnosis");
    echo " <tr>\n";
    echo "  <td align='center'><input type='checkbox' name='form_obs[{$line_id}][wnl]' " . "value='1'" . ($linedbrow['wnl'] ? " checked" : "") . " /></td>\n";
    echo "  <td align='center'><input type='checkbox' name='form_obs[{$line_id}][abn]' " . "value='1'" . ($linedbrow['abn'] ? " checked" : "") . " /></td>\n";
    echo "  <td nowrap>{$sysnamedisp}</td>\n";
    echo "  <td nowrap>{$description}</td>\n";
    echo "  <td><select name='form_obs[{$line_id}][diagnosis]' onchange='seldiag(this, \"{$line_id}\")' style='width:100%'>\n";
    echo "   <option value=''></option>\n";
    $diagnosis = $linedbrow['diagnosis'];
    while ($drow = sqlFetchArray($dres)) {
        $sel = '';
        $diag = $drow['diagnosis'];
        if ($diagnosis && $diag == $diagnosis) {
            $sel = 'selected';
            $diagnosis = '';
        }
        echo "   <option value='{$diag}' {$sel}>{$diag}</option>\n";
    }
    // If the diagnosis was not in the standard list then it must have been
    // there before and then removed.  In that case show it in parentheses.
    if ($diagnosis) {
        echo "   <option value='{$diagnosis}' selected>({$diagnosis})</option>\n";
    }
    echo "   <option value='*'>-- Edit --</option>\n";
    echo "   </select></td>\n";
    echo "  <td><input type='text' name='form_obs[{$line_id}][comments]' " . "size='20' maxlength='250' style='width:100%' " . "value='" . htmlentities($linedbrow['comments']) . "' /></td>\n";
    echo " </tr>\n";
}
예제 #13
0
function fetchEvents( $from_date, $to_date, $where_param = null, $orderby_param = null, $tracker_board = false ) 
{
   
   $where =
        "( (e.pc_endDate >= '$from_date' AND e.pc_eventDate <= '$to_date' AND e.pc_recurrtype = '1') OR " .
  	    "(e.pc_eventDate >= '$from_date' AND e.pc_eventDate <= '$to_date') )";

    if ( $where_param ) $where .= $where_param;
	
    $order_by = "e.pc_eventDate, e.pc_startTime";
    if ( $orderby_param ) {
       $order_by = $orderby_param;
    }

    // Tracker Board specific stuff
    $tracker_fields = '';
    $tracker_joins = '';     
    if ($tracker_board) {     
    $tracker_fields = "e.pc_room, e.pc_pid, t.id, t.date, t.apptdate, t.appttime, t.eid, t.pid, t.original_user, t.encounter, t.lastseq, t.random_drug_test, t.drug_screen_completed, " .
    "q.pt_tracker_id, q.start_datetime, q.room, q.status, q.seq, q.user, " .
    "s.toggle_setting_1, s.toggle_setting_2, s.option_id, " ;
    $tracker_joins = "LEFT OUTER JOIN patient_tracker AS t ON t.pid = e.pc_pid AND t.apptdate = e.pc_eventDate AND t.appttime = e.pc_starttime AND t.eid = e.pc_eid " .
  	"LEFT OUTER JOIN patient_tracker_element AS q ON q.pt_tracker_id = t.id AND q.seq = t.lastseq " .
    "LEFT OUTER JOIN list_options AS s ON s.list_id = 'apptstat' AND s.option_id = q.status " ;
}

	$query = "SELECT " .
  	"e.pc_eventDate, e.pc_endDate, e.pc_startTime, e.pc_endTime, e.pc_duration, e.pc_recurrtype, e.pc_recurrspec, e.pc_recurrfreq, e.pc_catid, e.pc_eid, " .
  	"e.pc_title, e.pc_hometext, e.pc_apptstatus, " .
  	"p.fname, p.mname, p.lname, p.pid, p.pubpid, p.phone_home, p.phone_cell, " .
  	"u.fname AS ufname, u.mname AS umname, u.lname AS ulname, u.id AS uprovider_id, " .
  	"$tracker_fields" .
    "c.pc_catname, c.pc_catid " .
  	"FROM openemr_postcalendar_events AS e " .
    "$tracker_joins" .
  	"LEFT OUTER JOIN patient_data AS p ON p.pid = e.pc_pid " .
  	"LEFT OUTER JOIN users AS u ON u.id = e.pc_aid " .
	"LEFT OUTER JOIN openemr_postcalendar_categories AS c ON c.pc_catid = e.pc_catid " .
	"WHERE $where " . 
	"ORDER BY $order_by";

	$res = sqlStatement( $query );
	$events = array();
	if ( $res )
	{
		while ( $row = sqlFetchArray($res) ) 
		{
			// if it's a repeating appointment, fetch all occurances in date range
			if ( $row['pc_recurrtype'] ) {
				$reccuringEvents = getRecurringEvents( $row, $from_date, $to_date );
				$events = array_merge( $events, $reccuringEvents );
			} else {
				$events []= $row;
			}
		}
	}

	return $events;
}
예제 #14
0
function recursiveDelete($typeid)
{
    $res = sqlStatement("SELECT procedure_type_id FROM " . "procedure_type WHERE parent = '{$typeid}'");
    while ($row = sqlFetchArray($res)) {
        recursiveDelete($row['procedure_type_id']);
    }
    sqlStatement("DELETE FROM procedure_type WHERE " . "procedure_type_id = '{$typeid}'");
}
예제 #15
0
function getPatientCopay($patient_id, $encounter)
{
    $resMoneyGot = sqlStatement("SELECT sum(pay_amount) as PatientPay FROM ar_activity where " . "pid = ? and encounter = ? and payer_type=0 and account_code='PCP'", array($patient_id, $encounter));
    //new fees screen copay gives account_code='PCP'
    $rowMoneyGot = sqlFetchArray($resMoneyGot);
    $Copay = $rowMoneyGot['PatientPay'];
    return $Copay * -1;
}
예제 #16
0
function BuildArrayForReport($Query)
{
    $array_data = array();
    $res = sqlStatement($Query);
    while ($row = sqlFetchArray($res)) {
        $array_data[$row['id']] = htmlspecialchars($row['name'], ENT_QUOTES);
    }
    return $array_data;
}
예제 #17
0
function care_plan_report($pid, $encounter, $cols, $id)
{
    $count = 0;
    $sql = "SELECT * FROM `form_care_plan` WHERE id=? AND pid = ? AND encounter = ?";
    $res = sqlStatement($sql, array($id, $_SESSION["pid"], $_SESSION["encounter"]));
    for ($iter = 0; $row = sqlFetchArray($res); $iter++) {
        $data[$iter] = $row;
    }
    if ($data) {
        ?>
        <table style='border-collapse:collapse;border-spacing:0;width: 100%;'>
            <tr>
                <td align='center' style='border:1px solid #ccc;padding:4px;'><span class=bold><?php 
        echo xlt('Code');
        ?>
</span></td>
                <td align='center' style='border:1px solid #ccc;padding:4px;'><span class=bold><?php 
        echo xlt('Code Text');
        ?>
</span></td>
                <td align='center' style='border:1px solid #ccc;padding:4px;'><span class=bold><?php 
        echo xlt('Description');
        ?>
</span></td> 
                <td align='center' style='border:1px solid #ccc;padding:4px;'><span class=bold><?php 
        echo xlt('Date');
        ?>
</span></td>
            </tr>
        <?php 
        foreach ($data as $key => $value) {
            ?>
            <tr>
                <td style='border:1px solid #ccc;padding:4px;'><span class=text><?php 
            echo text($value['code']);
            ?>
</span></td>
                <td style='border:1px solid #ccc;padding:4px;'><span class=text><?php 
            echo text($value['codetext']);
            ?>
</span></td>
                <td style='border:1px solid #ccc;padding:4px;'><span class=text><?php 
            echo text($value['description']);
            ?>
</span></td>
                <td style='border:1px solid #ccc;padding:4px;'><span class=text><?php 
            echo text($value['date']);
            ?>
</span></td>
            </tr>
            <?php 
        }
        ?>
        </table>
        <?php 
    }
}
예제 #18
0
 function populate()
 {
     parent::populate();
     $sql = "SELECT name from form_evaluation_checks where foreign_id = '" . add_escape_custom($this->id) . "'";
     $results = sqlQ($sql);
     while ($row = sqlFetchArray($results)) {
         $this->checks[] = $row['name'];
     }
 }
예제 #19
0
function getLoggedInUserFacility()
{
    $sql = "SELECT f.name, f.facility_npi FROM users AS u LEFT JOIN facility AS f ON u.facility_id = f.id WHERE u.id=?";
    $res = sqlStatement($sql, array($_SESSION['authUserID']));
    while ($arow = sqlFetchArray($res)) {
        return $arow;
    }
    return null;
}
예제 #20
0
function return_code_info_test($type, $string, $limit = 20, $modes = NULL, $count = false)
{
    echo "<ol>";
    $res = return_code_information($type, $string);
    while ($code = sqlFetchArray($res)) {
        echo "<li>" . $code['code_type_name'] . ":" . $code['code'] . ":" . $code['code_text'] . ":" . $code['code_text_short'] . "</li>";
    }
    echo "</ol>";
}
예제 #21
0
function createCCR($action, $raw = "no", $requested_by = "")
{
    $authorID = getUuid();
    $patientID = getUuid();
    $sourceID = getUuid();
    $oemrID = getUuid();
    $result = getActorData();
    while ($res = sqlFetchArray($result[2])) {
        ${"labID{$res['id']}"} = getUuid();
    }
    $ccr = new DOMDocument('1.0', 'UTF-8');
    $e_styleSheet = $ccr->createProcessingInstruction('xml-stylesheet', 'type="text/xsl" href="stylesheet/ccr.xsl"');
    $ccr->appendChild($e_styleSheet);
    $e_ccr = $ccr->createElementNS('urn:astm-org:CCR', 'ContinuityOfCareRecord');
    $ccr->appendChild($e_ccr);
    /////////////// Header
    require_once "createCCRHeader.php";
    $e_Body = $ccr->createElement('Body');
    $e_ccr->appendChild($e_Body);
    /////////////// Problems
    $e_Problems = $ccr->createElement('Problems');
    require_once "createCCRProblem.php";
    $e_Body->appendChild($e_Problems);
    /////////////// Alerts
    $e_Alerts = $ccr->createElement('Alerts');
    require_once "createCCRAlerts.php";
    $e_Body->appendChild($e_Alerts);
    ////////////////// Medication
    $e_Medications = $ccr->createElement('Medications');
    require_once "createCCRMedication.php";
    $e_Body->appendChild($e_Medications);
    ///////////////// Immunization
    $e_Immunizations = $ccr->createElement('Immunizations');
    require_once "createCCRImmunization.php";
    $e_Body->appendChild($e_Immunizations);
    /////////////////// Results
    $e_Results = $ccr->createElement('Results');
    require_once "createCCRResult.php";
    $e_Body->appendChild($e_Results);
    /////////////////// Procedures
    //$e_Procedures = $ccr->createElement('Procedures');
    //require_once("createCCRProcedure.php");
    //$e_Body->appendChild($e_Procedures);
    //////////////////// Footer
    // $e_VitalSigns = $ccr->createElement('VitalSigns');
    // $e_Body->appendChild($e_VitalSigns);
    /////////////// Actors
    $e_Actors = $ccr->createElement('Actors');
    require_once "createCCRActor.php";
    $e_ccr->appendChild($e_Actors);
    if ($action == "generate") {
        gnrtCCR($ccr, $raw, $requested_by);
    }
    if ($action == "viewccd") {
        viewCCD($ccr, $raw, $requested_by);
    }
}
예제 #22
0
/**
 * 
 * wrapper for sequential code set search
 * 
 * @param type $search_type_id      The integer ID used for code_type in codes (e.g. 2 for ICD9)
 * @param type $search_type         A string representing the code type to be searched on (e.g. ICD9, DSMIV)
 * @param type $search_query        The text to search on.
 * @return array
 */
function diagnosis_search($search_type_id, $search_type, $search_query)
{
    $retval = array();
    $search = main_code_set_search($search_type, $search_query, 20);
    while ($code = sqlFetchArray($search)) {
        array_push($retval, new code_info($code['code'], $search_type, $code['code_text']));
    }
    return $retval;
}
예제 #23
0
파일: ui.php 프로젝트: katopenzz/openemr
function getListOptions($list_id)
{
    $options = array();
    $sql = sqlStatement("SELECT option_id, title from list_options WHERE list_id = ?", array($list_id));
    for ($iter = 0; $row = sqlFetchArray($sql); $iter++) {
        $options[] = new Option(out($row['option_id']), out(xl_list_label($row['title'])));
    }
    return $options;
}
예제 #24
0
/**
 * Retrieve the recent 'N' disclosures.
 * @param $pid   -  patient id.
 * @param $limit -  certain limit up to which the disclosures are to be displyed.
 */
function getDisclosureByDate($pid, $limit)
{
    $r1 = sqlStatement("select event,recipient,description,date from extended_log where patient_id=? AND event in (select option_id from list_options where list_id='disclosure_type') order by date desc limit 0,{$limit}", array($pid));
    $result2 = array();
    for ($iter = 0; $frow = sqlFetchArray($r1); $iter++) {
        $result2[$iter] = $frow;
    }
    return $result2;
}
예제 #25
0
function search_test($type, $string, $mode = 'default', $return_only_one = false)
{
    echo "<ol>";
    $res = code_set_search($type, $string, false, true, $return_only_one, 0, 10, array(), null, $mode);
    while ($code = sqlFetchArray($res)) {
        echo "<li>" . $code['code_type_name'] . ":" . $code['code'] . ":" . $code['code_text'] . ":" . $code['code_text_short'] . "</li>";
    }
    echo "</ol>";
}
예제 #26
0
 /**
  * Selects  holidays/closed clinic events from the table events in a range of dates
  * @param $star_date
  * @param $end_date
  * @return array [0=>"2016/06/16"]
  */
 public static function get_holidays_by_dates($start_date, $end_date)
 {
     $holidays = array();
     $sql = 'SELECT * FROM openemr_postcalendar_events WHERE (pc_catid = ? OR pc_catid = ?) AND pc_eventDate >= ? AND pc_eventDate <= ?';
     $res = sqlStatement($sql, array(self::CALENDAR_CATEGORY_HOLIDAY, self::CALENDAR_CATEGORY_CLOSED, $start_date, $end_date));
     while ($row = sqlFetchArray($res)) {
         $holidays[] = $row['pc_eventDate'];
     }
     return $holidays;
 }
예제 #27
0
 function providers_factory($sort = "ORDER BY lname,fname")
 {
     $psa = array();
     $sql = "SELECT id FROM " . $this->_table . " where authorized = 1 " . $sort;
     $results = sqlQ($sql);
     while ($row = sqlFetchArray($results)) {
         $psa[] = new Provider($row['id']);
     }
     return $psa;
 }
예제 #28
0
/**
 * Retrieve the recent 'N' disclosures.
 * @param $pid   -  patient id.
 * @param $limit -  certain limit up to which the disclosures are to be displyed.
 */
function getDisclosureByDate($pid, $limit)
{
    $discQry = " SELECT el.id, el.event, el.recipient, el.description, el.date, CONCAT(u.fname, ' ', u.lname) as user_fullname FROM extended_log el " . " LEFT JOIN users u ON u.username = el.user " . " WHERE el.patient_id=? AND el.event IN (SELECT option_id FROM list_options WHERE list_id='disclosure_type') ORDER BY el.date DESC LIMIT 0,{$limit}";
    $r1 = sqlStatement($discQry, array($pid));
    $result2 = array();
    for ($iter = 0; $frow = sqlFetchArray($r1); $iter++) {
        $result2[$iter] = $frow;
    }
    return $result2;
}
예제 #29
0
function BuildArrayForReport($Query)
{
    //Parses the database value and prepares for display.
    $array_data = array();
    $res = sqlStatement($Query);
    while ($row = sqlFetchArray($res)) {
        $array_data[$row['id']] = htmlspecialchars($row['name'], ENT_QUOTES);
    }
    return $array_data;
}
 function insurance_numbers_factory($provider_id)
 {
     $ins = array();
     $sql = "SELECT id FROM " . $this->_table . " where provider_id = '" . $provider_id . "' order by insurance_company_id";
     $results = sqlQ($sql);
     while ($row = sqlFetchArray($results)) {
         $ins[] = new InsuranceNumbers($row['id']);
     }
     return $ins;
 }