Beispiel #1
0
function getDocListByEncID($encounter, $raw_encounter_date, $pid)
{
    global $ISSUE_TYPES, $auth_med;
    $documents = getDocumentsByEncounter($pid, $encounter);
    if (count($documents) > 0) {
        foreach ($documents as $documentrow) {
            if ($auth_med) {
                $irow = sqlQuery("SELECT type, title, begdate FROM lists WHERE id = ? LIMIT 1", array($documentrow['list_id']));
                if ($irow) {
                    $tcode = $irow['type'];
                    if ($ISSUE_TYPES[$tcode]) {
                        $tcode = $ISSUE_TYPES[$tcode][2];
                    }
                    echo text("{$tcode}: " . $irow['title']);
                }
            } else {
                echo "(" . xlt('No access') . ")";
            }
            // Get the notes for this document and display as title for the link.
            $queryString = "SELECT date,note FROM notes WHERE foreign_id = ? ORDER BY date";
            $noteResultSet = sqlStatement($queryString, array($documentrow['id']));
            $note = '';
            while ($row = sqlFetchArray($noteResultSet)) {
                $note .= oeFormatShortDate(date('Y-m-d', strtotime($row['date']))) . " : " . attr($row['note']) . "\n";
            }
            $docTitle = $note ? $note : xla("View document");
            $docHref = $GLOBALS['webroot'] . "/controller.php?document&view&patient_id=" . attr($pid) . "&doc_id=" . attr($documentrow['id']);
            echo "<div class='text docrow' id='" . attr($documentrow['id']) . "' title='" . $docTitle . "'>\n";
            echo "<a href='{$docHref}' onclick='top.restoreSession()' >" . xlt('Document') . ": " . text(basename($documentrow['url'])) . ' (' . text(xl_document_category($documentrow['name'])) . ')' . "</a>";
            echo "</div>";
        }
    }
}
Beispiel #2
0
                </table>
            <?php 
    }
    ?>
        </div>
    </div>
<?php 
}
?>
</div>

</div>

<!-- Get the documents tagged to this encounter and display the links and notes as the tooltip -->
<?php 
$docs_list = getDocumentsByEncounter($pid, $_SESSION['encounter']);
if (count($docs_list) > 0) {
    ?>
<div class='enc_docs'>
<span class="bold"><?php 
    echo xlt("Document(s)");
    ?>
:</span>
<?php 
    $doc = new C_Document();
    foreach ($docs_list as $doc_iter) {
        $doc_url = $doc->_tpl_vars[CURRENT_ACTION] . "&view&patient_id=" . attr($pid) . "&document_id=" . attr($doc_iter[id]) . "&";
        // Get notes for this document.
        $queryString = "SELECT GROUP_CONCAT(note ORDER BY date DESC SEPARATOR '|') AS docNotes, GROUP_CONCAT(date ORDER BY date DESC SEPARATOR '|') AS docDates\n\t\t\tFROM notes WHERE foreign_id = ? GROUP BY foreign_id";
        $noteData = sqlQuery($queryString, array($doc_iter[id]));
        $note = '';