Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add print button and put patient's details at top of visit history page #7270 #7359

Merged
merged 7 commits into from
Apr 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 25 additions & 4 deletions interface/patient_file/history/encounters.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

/**
* Encounter list.
* rm: print button to print page & generate pdf; include patients name, id and dob on the page. issue #7270
*
*
* @package OpenEMR
* @link http:https://www.open-emr.org
Expand Down Expand Up @@ -180,6 +182,12 @@ function generatePageElement($start, $pagesize, $billing, $issue, $text)
<script src="<?php echo $GLOBALS['webroot'] ?>/library/js/ajtooltip.js"></script>

<script>

$(function () {
// print the history - as displayed
top.printLogSetup(document.getElementById('printbutton'));
});

// open dialog to edit an invoice w/o opening encounter.
function editInvoice(e, id) {
e.stopPropagation();
Expand Down Expand Up @@ -272,6 +280,8 @@ function changePageSize() {
<?php } else { ?>
<a href='encounters.php?billing=1&issue=<?php echo $issue . $getStringForPage; ?>' class="btn btn-small btn-info" onclick='top.restoreSession()' style='font-size: 11px'><?php echo xlt('To Billing View'); ?></a>
<?php } ?>
&nbsp; &nbsp;
<a href='#' id='printbutton' class='btn btn-secondary btn-print'> <?php echo xlt('Print page'); ?> </a>

<span class="float-right">
<?php echo xlt('Results per page'); ?>:
Expand All @@ -297,6 +307,17 @@ function changePageSize() {
</span>

<br />
<span class="heading" >
<?php
if ($attendant_type == 'pid') {
// RM put patienes name, id and dob at top of the history -->
Copy link
Sponsor Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This breaks if the attendant_type is not a patient (IE therapy group encounters are being viewed. We need to surround all of this:

 if ($attendant_type == 'pid') {

$name = getPatientNameFirstLast($pid);
$dob = text(oeFormatShortDate(getPatientData($pid, "DOB")['DOB']));
$external_id = getPatientData($pid, "pubpid")['pubpid'];
echo $name . " (" . $external_id . ")" . "&nbsp; &nbsp; DOB: " . $dob ;
Copy link
Sponsor Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need escaping:

echo text($name ). " (" . text($external_id) . ")" .  "&nbsp;  &nbsp; DOB: " . $dob ;

}
?>
</span>

<div class="table-responsive">
<table class="table table-hover jumbotron py-4 mt-3">
Expand Down Expand Up @@ -368,7 +389,7 @@ function changePageSize() {
$drow = sqlFetchArray($dres);
}

// $count = 0;
$numRes = 0;

$sqlBindArray = array();
if ($attendant_type == 'pid') {
Expand Down Expand Up @@ -401,7 +422,7 @@ function changePageSize() {

$countRes = sqlStatement($countQuery, $sqlBindArray);
$count = sqlFetchArray($countRes);
$numRes = $count['c'];
$numRes += $count['c'];
Copy link
Sponsor Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like this didn't actually change the code logic, was thinking it did, but on further examination it keeps the code the same.

Copy link
Contributor Author

@ruthkonyn ruthkonyn Apr 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh yes, apologies: - i've been working on this code to sort out the problems where the documents are displayed on every page, issue #7275, and this new line has crept in from that work. It's not needed simply to add the print functionality. I'll fix the new PR



if ($pagesize > 0) {
Expand Down Expand Up @@ -460,7 +481,7 @@ function changePageSize() {

// This generates document lines as appropriate for the date order.
while ($drow && $raw_encounter_date && $drow['docdate'] > $raw_encounter_date) {
showDocument($drow);
showDocument($drow);
$drow = sqlFetchArray($dres);
}

Expand Down Expand Up @@ -813,7 +834,7 @@ function changePageSize() {
} // end while

// Dump remaining document lines if count not exceeded.
while ($drow /* && $count <= $N */) {
while ($drow) {
showDocument($drow);
$drow = sqlFetchArray($dres);
}
Expand Down
Loading