3 // This program is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU General Public License
5 // as published by the Free Software Foundation; either version 2
6 // of the License, or (at your option) any later version.
8 require_once("../../globals.php");
9 require_once("$srcdir/forms.inc");
10 require_once("$srcdir/calendar.inc");
11 require_once("$srcdir/acl.inc");
12 require_once("$srcdir/formatting.inc.php");
13 require_once("$srcdir/patient.inc");
14 require_once("$srcdir/amc.php");
15 require_once $GLOBALS['srcdir'].'/ESign/Api.php';
20 <?php
html_header_show();?
>
21 <link rel
="stylesheet" href
="<?php echo $css_header;?>" type
="text/css">
22 <link rel
="stylesheet" type
="text/css" href
="../../../library/js/fancybox-2.1.5/source/jquery.fancybox.css" media
="screen" />
23 <style type
="text/css">@import
url(../../../library
/dynarch_calendar
.css
);</style
>
25 <!-- supporting javascript code
-->
26 <script type
="text/javascript" src
="<?php echo $GLOBALS['webroot'] ?>/library/js/jquery-1.9.1.min.js"></script
>
27 <script type
="text/javascript" src
="<?php echo $GLOBALS['webroot'] ?>/library/dialog.js"></script
>
28 <script type
="text/javascript" src
="../../../library/textformat.js"></script
>
29 <script type
="text/javascript" src
="../../../library/dynarch_calendar.js"></script
>
30 <?php
include_once("{$GLOBALS['srcdir']}/dynarch_calendar_en.inc.php"); ?
>
31 <script type
="text/javascript" src
="../../../library/dynarch_calendar_setup.js"></script
>
32 <script type
="text/javascript" src
="../../../library/js/common.js"></script
>
33 <script type
="text/javascript" src
="../../../library/js/fancybox-2.1.5/source/jquery.fancybox.js"></script
>
34 <script src
="<?php echo $GLOBALS['webroot'] ?>/library/ESign/js/jquery.esign.js"></script
>
35 <link rel
="stylesheet" type
="text/css" href
="<?php echo $GLOBALS['webroot'] ?>/library/ESign/css/esign.css" />
37 $esignApi = new Api();
39 <script type
="text/javascript">
40 $
(document
).ready( function() {
41 var formConfig
= <?php
echo $esignApi->formConfigToJson(); ?
>;
42 $
(".esign-button-form").esign(
45 afterFormSuccess
: function( response
) {
46 if ( response
.locked
) {
47 var editButtonId
= "form-edit-button-"+response
.formDir+
"-"+response
.formId
;
48 $
("#"+editButtonId
).replaceWith( response
.editButtonHtml
);
51 var logId
= "esign-signature-log-"+response
.formDir+
"-"+response
.formId
;
52 $
.post( formConfig
.logViewAction
, response
, function( html
) {
53 $
("#"+logId
).replaceWith( html
);
59 var encounterConfig
= <?php
echo $esignApi->encounterConfigToJson(); ?
>;
60 $
(".esign-button-encounter").esign(
63 afterFormSuccess
: function( response
) {
64 // If the response indicates a locked encounter, replace all
65 // form edit buttons with a "disabled" button, and "disable" left
66 // nav visit form links
67 if ( response
.locked
) {
68 // Lock the form edit buttons
69 $
(".form-edit-button").replaceWith( response
.editButtonHtml
);
70 // Disable the new-form capabilities in left nav
71 top
.window
.parent
.left_nav
.syncRadios();
72 // Disable the new-form capabilities in top nav of the encounter
73 $
(".encounter-form-category-li").remove();
76 var logId
= "esign-signature-log-encounter-"+response
.encounterId
;
77 $
.post( encounterConfig
.logViewAction
, response
, function( html
) {
78 $
("#"+logId
).replaceWith( html
);
85 // Process click on Delete link.
87 dlgopen('../deleter.php?encounterid=<?php echo $encounter; ?>', '_blank', 500, 450);
91 // Called by the deleter.php window on a successful delete.
92 function imdeleted(EncounterId
) {
93 <?php
if ($GLOBALS['concurrent_layout']) { ?
>
94 top
.window
.parent
.left_nav
.removeOptionSelected(EncounterId
);
95 top
.window
.parent
.left_nav
.clearEncounter();
98 top
.Title
.location
.href
= '../patient_file/encounter/encounter_title.php';
99 top
.Main
.location
.href
= '../patient_file/encounter/patient_encounter.php?mode=new';
105 <script language
="javascript">
106 function expandcollapse(atr
){
107 if(atr
== "expand") {
109 var mydivid
="divid_"+i
;var myspanid
="spanid_"+i
;
110 var ele
= document
.getElementById(mydivid
); var text
= document
.getElementById(myspanid
);
111 ele
.style
.display
= "block";text
.innerHTML
= "<?php xl('Collapse','e'); ?>";
116 var mydivid
="divid_"+i
;var myspanid
="spanid_"+i
;
117 var ele
= document
.getElementById(mydivid
); var text
= document
.getElementById(myspanid
);
118 ele
.style
.display
= "none"; text
.innerHTML
= "<?php xl('Expand','e'); ?>";
124 function divtoggle(spanid
, divid
) {
125 var ele
= document
.getElementById(divid
);
126 var text
= document
.getElementById(spanid
);
127 if(ele
.style
.display
== "block") {
128 ele
.style
.display
= "none";
129 text
.innerHTML
= "<?php xl('Expand','e'); ?>";
132 ele
.style
.display
= "block";
133 text
.innerHTML
= "<?php xl('Collapse','e'); ?>";
138 <style type
="text/css">
144 div
.form_header_controls
{
145 float:left
;margin
-bottom
:2px
;
153 .encounter
-summary
-container
{
158 .encounter
-summary
-column
{
169 require_once("$incdir/patient_file/encounter/new_form.php");
171 <body
class="body_top">
173 <div id
="encounter_forms">
177 $dateres = getEncounterDateByEncounter($encounter);
178 $encounter_date = date("Y-m-d",strtotime($dateres["date"]));
179 $providerIDres = getProviderIdOfEncounter($encounter);
180 $providerNameRes = getProviderName($providerIDres);
183 <div
class='encounter-summary-container'>
184 <div
class='encounter-summary-column'>
186 <span
class="title"><?php
echo oeFormatShortDate($encounter_date) . " " . xl("Encounter"); ?
> </span
>
188 $auth_notes_a = acl_check('encounters', 'notes_a');
189 $auth_notes = acl_check('encounters', 'notes');
190 $auth_relaxed = acl_check('encounters', 'relaxed');
192 if (is_numeric($pid)) {
193 // Check for no access to the patient's squad.
194 $result = getPatientData($pid, "fname,lname,squad");
195 echo htmlspecialchars( xl('for','',' ',' ') . $result['fname'] . " " . $result['lname'] );
196 if ($result['squad'] && ! acl_check('squads', $result['squad'])) {
197 $auth_notes_a = $auth_notes = $auth_relaxed = 0;
199 // Check for no access to the encounter's sensitivity level.
200 $result = sqlQuery("SELECT sensitivity FROM form_encounter WHERE " .
201 "pid = '$pid' AND encounter = '$encounter' LIMIT 1");
202 if ($result['sensitivity'] && !acl_check('sensitivities', $result['sensitivity'])) {
203 $auth_notes_a = $auth_notes = $auth_relaxed = 0;
208 <div style
='margin-top:8px;'>
210 // ESign for entire encounter
211 $esign = $esignApi->createEncounterESign( $encounter );
212 if ( $esign->isButtonViewable() ) {
213 echo $esign->buttonHtml();
216 <?php
if (acl_check('admin', 'super')) { ?
>
217 <a href
='toggledivs(this.id,this.id);' class='css_button' onclick
='return deleteme()'><span
><?php
echo xl('Delete') ?
></span
></a
>
219  
; 
; 
;<a href
="#" onClick
='expandcollapse("expand");' style
="font-size:80%;"><?php
xl('Expand All','e'); ?
></a
>
220  
; 
; 
;<a style
="font-size:80%;" href
="#" onClick
='expandcollapse("collapse");'><?php
xl('Collapse All','e'); ?
></a
>
224 <div
class='encounter-summary-column'>
225 <?php
if ( $esign->isLogViewable() ) {
230 <div
class='encounter-summary-column'>
231 <?php
if ($GLOBALS['enable_amc_prompting']) { ?
>
232 <div style
='float:right;margin-right:25px;border-style:solid;border-width:1px;'>
233 <div style
='float:left;margin:5px 5px 5px 5px;'>
237 <?php
// Display the education resource checkbox (AMC prompting)
238 $itemAMC = amcCollect("patient_edu_amc", $pid, 'form_encounter', $encounter);
240 <?php
if (!(empty($itemAMC))) { ?
>
241 <input type
="checkbox" id
="prov_edu_res" checked
>
243 <input type
="checkbox" id
="prov_edu_res">
247 <span
class="text"><?php
echo xl('Provided Education Resource(s)?') ?
></span
>
252 <?php
// Display the Provided Clinical Summary checkbox (AMC prompting)
253 $itemAMC = amcCollect("provide_sum_pat_amc", $pid, 'form_encounter', $encounter);
255 <?php
if (!(empty($itemAMC))) { ?
>
256 <input type
="checkbox" id
="provide_sum_pat_flag" checked
>
258 <input type
="checkbox" id
="provide_sum_pat_flag">
262 <span
class="text"><?php
echo xl('Provided Clinical Summary?') ?
></span
>
265 <?php
// Display the medication reconciliation checkboxes (AMC prompting)
266 $itemAMC = amcCollect("med_reconc_amc", $pid, 'form_encounter', $encounter);
268 <?php
if (!(empty($itemAMC))) { ?
>
271 <input type
="checkbox" id
="trans_trand_care" checked
>
274 <span
class="text"><?php
echo xl('Transition/Transfer of Care?') ?
></span
>
278 <table style
="margin-left:2em;">
281 <?php
if (!(empty($itemAMC['date_completed']))) { ?
>
282 <input type
="checkbox" id
="med_reconc_perf" checked
>
284 <input type
="checkbox" id
="med_reconc_perf">
288 <span
class="text"><?php
echo xl('Medication Reconciliation Performed?') ?
></span
>
295 <input type
="checkbox" id
="trans_trand_care">
298 <span
class="text"><?php
echo xl('Transition/Transfer of Care?') ?
></span
>
302 <table style
="margin-left:2em;">
305 <input type
="checkbox" id
="med_reconc_perf" DISABLED
>
308 <span
class="text"><?php
echo xl('Medication Reconciliation Performed?') ?
></span
>
324 if ($result = getFormByEncounter($pid, $encounter, "id, date, form_id, form_name, formdir, user, deleted")) {
325 echo "<table width='100%' id='partable'>";
327 foreach ($result as $iter) {
328 $formdir = $iter['formdir'];
330 // skip forms whose 'deleted' flag is set to 1
331 if ($iter['deleted'] == 1) continue;
333 // Skip forms that we are not authorized to see.
334 if (($auth_notes_a) ||
335 ($auth_notes && $iter['user'] == $_SESSION['authUser']) ||
336 ($auth_relaxed && ($formdir == 'sports_fitness' ||
$formdir == 'podiatry'))) ;
339 // $form_info = getFormInfoById($iter['id']);
340 if (strtolower(substr($iter['form_name'],0,5)) == 'camos') {
341 //CAMOS generates links from report.php and these links should
342 //be clickable without causing view.php to come up unexpectedly.
343 //I feel that the JQuery code in this file leading to a click
344 //on the report.php content to bring up view.php steps on a
345 //form's autonomy to generate it's own html content in it's report
346 //but until any other form has a problem with this, I will just
347 //make an exception here for CAMOS and allow it to carry out this
348 //functionality for all other forms. --Mark
349 echo '<tr title="' . xl('Edit form') . '" '.
350 'id="'.$formdir.'~'.$iter['form_id'].'">';
352 echo '<tr title="' . xl('Edit form') . '" '.
353 'id="'.$formdir.'~'.$iter['form_id'].'" class="text onerow">';
355 $user = getNameFromUsername($iter['user']);
357 $form_name = ($formdir == 'newpatient') ?
xl('Patient Encounter') : xl_form_title($iter['form_name']);
359 // Create the ESign instance for this form
360 $esign = $esignApi->createFormESign( $iter['id'], $formdir, $encounter );
362 echo "<td style='border-bottom:1px solid'>";
363 // a link to edit the form
364 echo "<div class='form_header_controls'>";
366 // If the form is locked, it is no longer editable
367 if ( $esign->isLocked() ) {
368 echo "<a href=# class='css_button_small form-edit-button-locked' id='form-edit-button-".attr($formdir)."-".attr($iter['id'])."'><span>".xlt('Locked')."</span></a>";
370 echo "<a class='css_button_small form-edit-button' id='form-edit-button-".attr($formdir)."-".attr($iter['id'])."' target='".
371 ($GLOBALS['concurrent_layout'] ?
"_parent" : "Main") .
372 "' href='$rootdir/patient_file/encounter/view_form.php?" .
373 "formname=" . attr($formdir) . "&id=" . attr($iter['form_id']) .
374 "' onclick='top.restoreSession()'>";
375 echo "<span>" . xlt('Edit') . "</span></a>";
378 if ( $esign->isButtonViewable() ) {
379 echo $esign->buttonHtml();
382 if (acl_check('admin', 'super') ) {
383 if ( $formdir != 'newpatient') {
384 // a link to delete the form from the encounter
386 ($GLOBALS['concurrent_layout'] ?
"_parent" : "Main") .
387 "' href='$rootdir/patient_file/encounter/delete_form.php?" .
388 "formname=" . $formdir .
389 "&id=" . $iter['id'] .
390 "&encounter=". $encounter.
392 "' class='css_button_small' title='" . xl('Delete this form') . "' onclick='top.restoreSession()'><span>" . xl('Delete') . "</span></a>";
394 ?
><a href
='javascript:;' class='css_button_small' style
='color:gray'><span
><?php
xl('Delete','e'); ?
></span
></a
><?php
398 echo "<div class='form_header'>";
400 // Figure out the correct author (encounter authors are the '$providerNameRes', while other
401 // form authors are the '$user['fname'] . " " . $user['lname']').
402 if ($formdir == 'newpatient') {
403 $form_author = $providerNameRes;
406 $form_author = $user['fname'] . " " . $user['lname'];
408 echo "<a href='#' onclick='divtoggle(\"spanid_$divnos\",\"divid_$divnos\");' class='small' id='aid_$divnos'><b>$form_name</b> <span class='text'>by " . htmlspecialchars( $form_author ) . "</span> (<span id=spanid_$divnos class=\"indicator\">" . xl('Collapse') . "</span>)</a></div>";
413 echo "<td valign='top' class='formrow'><div class='tab' id='divid_$divnos' style='display:block'>";
415 // Use the form's report.php for display. Forms with names starting with LBF
416 // are list-based forms sharing a single collection of code.
418 if (substr($formdir,0,3) == 'LBF') {
419 include_once($GLOBALS['incdir'] . "/forms/LBF/report.php");
420 call_user_func("lbf_report", $pid, $encounter, 2, $iter['form_id'], $formdir);
423 include_once($GLOBALS['incdir'] . "/forms/$formdir/report.php");
424 call_user_func($formdir . "_report", $pid, $encounter, 2, $iter['form_id']);
427 if ( $esign->isLogViewable() ) {
431 echo "</div></td></tr>";
438 <?php
if ($GLOBALS['athletic_team'] && $GLOBALS['concurrent_layout'] == 2) { ?
>
439 <script language
='JavaScript'>
440 // If this is the top frame then show the encounters list in the bottom frame.
441 // var n = parent.parent.left_nav;
442 var n
= top
.left_nav
;
443 var nf
= n
.document
.forms
[0];
444 if (parent
.window
.name
== 'RTop' && nf
.cb_bot
.checked
) {
445 var othername
= 'RBot';
446 n
.setRadio(othername
, 'ens');
447 n
.loadFrame('ens1', othername
, 'patient_file/history/encounters.php');
452 </div
> <!-- end large encounter_forms DIV
-->
455 <script language
="javascript">
456 // jQuery stuff to make the page a little easier to use
458 $
(document
).ready(function(){
459 $
(".onerow").mouseover(function() { $
(this
).toggleClass("highlight"); });
460 $
(".onerow").mouseout(function() { $
(this
).toggleClass("highlight"); });
461 $
(".onerow").click(function() { GotoForm(this
); });
463 $
("#prov_edu_res").click(function() {
464 if ( $
('#prov_edu_res').attr('checked') ) {
470 top
.restoreSession();
471 $
.post( "../../../library/ajax/amc_misc_data.php",
472 { amc_id
: "patient_edu_amc",
475 patient_id
: <?php
echo htmlspecialchars($pid,ENT_NOQUOTES
); ?
>,
476 object_category
: "form_encounter",
477 object_id
: <?php
echo htmlspecialchars($encounter,ENT_NOQUOTES
); ?
>
482 $
("#provide_sum_pat_flag").click(function() {
483 if ( $
('#provide_sum_pat_flag').attr('checked') ) {
489 top
.restoreSession();
490 $
.post( "../../../library/ajax/amc_misc_data.php",
491 { amc_id
: "provide_sum_pat_amc",
494 patient_id
: <?php
echo htmlspecialchars($pid,ENT_NOQUOTES
); ?
>,
495 object_category
: "form_encounter",
496 object_id
: <?php
echo htmlspecialchars($encounter,ENT_NOQUOTES
); ?
>
501 $
("#trans_trand_care").click(function() {
502 if ( $
('#trans_trand_care').attr('checked') ) {
504 // Enable the reconciliation checkbox
505 $
("#med_reconc_perf").removeAttr("disabled");
509 //Disable the reconciliation checkbox (also uncheck it if applicable)
510 $
("#med_reconc_perf").attr("disabled", true);
511 $
("#med_reconc_perf").removeAttr("checked");
513 top
.restoreSession();
514 $
.post( "../../../library/ajax/amc_misc_data.php",
515 { amc_id
: "med_reconc_amc",
518 patient_id
: <?php
echo htmlspecialchars($pid,ENT_NOQUOTES
); ?
>,
519 object_category
: "form_encounter",
520 object_id
: <?php
echo htmlspecialchars($encounter,ENT_NOQUOTES
); ?
>
525 $
("#med_reconc_perf").click(function() {
526 if ( $
('#med_reconc_perf').attr('checked') ) {
527 var mode
= "complete";
530 var mode
= "uncomplete";
532 top
.restoreSession();
533 $
.post( "../../../library/ajax/amc_misc_data.php",
534 { amc_id
: "med_reconc_amc",
537 patient_id
: <?php
echo htmlspecialchars($pid,ENT_NOQUOTES
); ?
>,
538 object_category
: "form_encounter",
539 object_id
: <?php
echo htmlspecialchars($encounter,ENT_NOQUOTES
); ?
>
544 // $(".deleteme").click(function(evt) { deleteme(); evt.stopPropogation(); });
546 var GotoForm
= function(obj
) {
547 var parts
= $
(obj
).attr("id").split("~");
548 top
.restoreSession();
549 <?php
if ($GLOBALS['concurrent_layout']): ?
>
550 parent
.location
.href
= "<?php echo $rootdir; ?>/patient_file/encounter/view_form.php?formname="+parts
[0]+
"&id="+parts
[1];
552 top
.Main
.location
.href
= "<?php echo $rootdir; ?>/patient_file/encounter/view_form.php?formname="+parts
[0]+
"&id="+parts
[1];