4 // This program is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU General Public License
6 // as published by the Free Software Foundation; either version 2
7 // of the License, or (at your option) any later version.
9 require_once("../../globals.php");
10 require_once("$srcdir/encounter.inc");
11 require_once("$srcdir/group.inc");
12 require_once("$srcdir/calendar.inc");
13 require_once("$srcdir/acl.inc");
14 require_once("$srcdir/patient.inc");
15 require_once("$srcdir/amc.php");
16 require_once $GLOBALS['srcdir'].'/ESign/Api.php';
17 require_once("$srcdir/../controllers/C_Document.class.php");
20 if (!empty($_REQUEST['review_id'])) {
22 $encounter=$_REQUEST['review_id'];
25 $is_group = ($attendant_type == 'gid') ?
true : false;
26 if ($attendant_type == 'gid') {
27 $groupId = $therapy_group;
29 $attendant_id = $attendant_type == 'pid' ?
$pid : $therapy_group;
30 if ($is_group && !acl_check("groups", "glog", false, array('view','write'))) {
31 echo xlt("access not allowed");
40 <?php
require $GLOBALS['srcdir'] . '/js/xl/dygraphs.js.php'; ?
>
42 <?php
html_header_show();?
>
43 <link rel
="stylesheet" href
="<?php echo $css_header;?>" type
="text/css">
44 <link rel
="stylesheet" type
="text/css" href
="<?php echo $GLOBALS['webroot'] ?>/library/ESign/css/esign.css" />
45 <link rel
="stylesheet" href
="<?php echo $GLOBALS['assets_static_relative']; ?>/modified/dygraphs-2-0-0/dygraph.css" type
="text/css"></script
>
47 <!-- supporting javascript code
-->
48 <script type
="text/javascript" src
="<?php echo $GLOBALS['assets_static_relative']; ?>/jquery-min-3-1-1/index.js"></script
>
49 <script type
="text/javascript" src
="<?php echo $GLOBALS['webroot'] ?>/library/dialog.js?v=<?php echo $v_js_includes; ?>"></script
>
50 <script type
="text/javascript" src
="../../../library/textformat.js"></script
>
51 <script type
="text/javascript" src
="../../../library/js/common.js"></script
>
52 <script src
="<?php echo $GLOBALS['webroot'] ?>/library/ESign/js/jquery.esign.js"></script
>
53 <script type
="text/javascript" src
="<?php echo $GLOBALS['assets_static_relative']; ?>/modified/dygraphs-2-0-0/dygraph.js?v=<?php echo $v_js_includes; ?>"></script
>
56 $esignApi = new Api();
59 <?php
// if the track_anything form exists, then include the styling and js functions for graphing
60 if (file_exists(dirname(__FILE__
) . "/../../forms/track_anything/style.css")) { ?
>
61 <script type
="text/javascript" src
="<?php echo $GLOBALS['web_root']?>/interface/forms/track_anything/report.js"></script
>
62 <link rel
="stylesheet" href
="<?php echo $GLOBALS['web_root']?>/interface/forms/track_anything/style.css" type
="text/css">
66 // If the user requested attachment of any orphaned procedure orders, do it.
67 if (!empty($_GET['attachid'])) {
68 $attachid = explode(',', $_GET['attachid']);
69 foreach ($attachid as $aid) {
75 "SELECT COUNT(*) AS count FROM procedure_order WHERE " .
76 "procedure_order_id = ? AND patient_id = ? AND encounter_id = 0 AND activity = 1",
79 if (!empty($tmp['count'])) {
81 "UPDATE procedure_order SET encounter_id = ? WHERE " .
82 "procedure_order_id = ? AND patient_id = ? AND encounter_id = 0 AND activity = 1",
83 array($encounter, $aid, $pid)
85 addForm($encounter, "Procedure Order", $aid, "procedure_order", $pid, $userauthorized);
91 <script type
="text/javascript">
93 jQuery(document
).ready( function($
) {
94 var formConfig
= <?php
echo $esignApi->formConfigToJson(); ?
>;
95 $
(".esign-button-form").esign(
98 afterFormSuccess
: function( response
) {
99 if ( response
.locked
) {
100 var editButtonId
= "form-edit-button-"+response
.formDir+
"-"+response
.formId
;
101 $
("#"+editButtonId
).replaceWith( response
.editButtonHtml
);
104 var logId
= "esign-signature-log-"+response
.formDir+
"-"+response
.formId
;
105 $
.post( formConfig
.logViewAction
, response
, function( html
) {
106 $
("#"+logId
).replaceWith( html
);
112 var encounterConfig
= <?php
echo $esignApi->encounterConfigToJson(); ?
>;
113 $
(".esign-button-encounter").esign(
116 afterFormSuccess
: function( response
) {
117 // If the response indicates a locked encounter, replace all
118 // form edit buttons with a "disabled" button, and "disable" left
119 // nav visit form links
120 if ( response
.locked
) {
121 // Lock the form edit buttons
122 $
(".form-edit-button").replaceWith( response
.editButtonHtml
);
123 // Disable the new-form capabilities in left nav
124 top
.window
.parent
.left_nav
.syncRadios();
125 // Disable the new-form capabilities in top nav of the encounter
126 $
(".encounter-form-category-li").remove();
129 var logId
= "esign-signature-log-encounter-"+response
.encounterId
;
130 $
.post( encounterConfig
.logViewAction
, response
, function( html
) {
131 $
("#"+logId
).replaceWith( html
);
137 $
(".onerow").mouseover(function() { $
(this
).toggleClass("highlight"); });
138 $
(".onerow").mouseout(function() { $
(this
).toggleClass("highlight"); });
139 $
(".onerow").click(function() { GotoForm(this
); });
141 $
("#prov_edu_res").click(function() {
142 if ( $
('#prov_edu_res').prop('checked') ) {
148 top
.restoreSession();
149 $
.post( "../../../library/ajax/amc_misc_data.php",
150 { amc_id
: "patient_edu_amc",
153 patient_id
: <?php
echo htmlspecialchars($pid, ENT_NOQUOTES
); ?
>,
154 object_category
: "form_encounter",
155 object_id
: <?php
echo htmlspecialchars($encounter, ENT_NOQUOTES
); ?
>
160 $
("#provide_sum_pat_flag").click(function() {
161 if ( $
('#provide_sum_pat_flag').prop('checked') ) {
167 top
.restoreSession();
168 $
.post( "../../../library/ajax/amc_misc_data.php",
169 { amc_id
: "provide_sum_pat_amc",
172 patient_id
: <?php
echo htmlspecialchars($pid, ENT_NOQUOTES
); ?
>,
173 object_category
: "form_encounter",
174 object_id
: <?php
echo htmlspecialchars($encounter, ENT_NOQUOTES
); ?
>
179 $
("#trans_trand_care").click(function() {
180 if ( $
('#trans_trand_care').prop('checked') ) {
182 // Enable the reconciliation checkbox
183 $
("#med_reconc_perf").removeAttr("disabled");
184 $
("#soc_provided").removeAttr("disabled");
188 //Disable the reconciliation checkbox (also uncheck it if applicable)
189 $
("#med_reconc_perf").attr("disabled", true);
190 $
("#med_reconc_perf").prop("checked",false);
191 $
("#soc_provided").attr("disabled",true);
192 $
("#soc_provided").prop("checked",false);
194 top
.restoreSession();
195 $
.post( "../../../library/ajax/amc_misc_data.php",
196 { amc_id
: "med_reconc_amc",
199 patient_id
: <?php
echo htmlspecialchars($pid, ENT_NOQUOTES
); ?
>,
200 object_category
: "form_encounter",
201 object_id
: <?php
echo htmlspecialchars($encounter, ENT_NOQUOTES
); ?
>
206 $
("#med_reconc_perf").click(function() {
207 if ( $
('#med_reconc_perf').prop('checked') ) {
208 var mode
= "complete";
211 var mode
= "uncomplete";
213 top
.restoreSession();
214 $
.post( "../../../library/ajax/amc_misc_data.php",
215 { amc_id
: "med_reconc_amc",
218 patient_id
: <?php
echo htmlspecialchars($pid, ENT_NOQUOTES
); ?
>,
219 object_category
: "form_encounter",
220 object_id
: <?php
echo htmlspecialchars($encounter, ENT_NOQUOTES
); ?
>
224 $
("#soc_provided").click(function(){
225 if($
('#soc_provided').prop('checked')){
226 var mode
= "soc_provided";
229 var mode
= "no_soc_provided";
231 top
.restoreSession();
232 $
.post( "../../../library/ajax/amc_misc_data.php",
233 { amc_id
: "med_reconc_amc",
236 patient_id
: <?php
echo htmlspecialchars($pid, ENT_NOQUOTES
); ?
>,
237 object_category
: "form_encounter",
238 object_id
: <?php
echo htmlspecialchars($encounter, ENT_NOQUOTES
); ?
>
243 $
(".deleteme").click(function(evt
) { deleteme(); evt
.stopPropogation(); });
245 var GotoForm
= function(obj
) {
246 var parts
= $
(obj
).attr("id").split("~");
247 top
.restoreSession();
248 parent
.location
.href
= "<?php echo $rootdir; ?>/patient_file/encounter/view_form.php?formname="+parts
[0]+
"&id="+parts
[1];
252 // If the user was not just asked about orphaned orders, build javascript for that.
253 if (!isset($_GET['attachid'])) {
254 $ares = sqlStatement(
255 "SELECT procedure_order_id, date_ordered " .
256 "FROM procedure_order WHERE " .
257 "patient_id = ? AND encounter_id = 0 AND activity = 1 " .
258 "ORDER BY procedure_order_id",
261 echo " // Ask about attaching orphaned orders to this encounter.\n";
262 echo " var attachid = '';\n";
263 while ($arow = sqlFetchArray($ares)) {
264 $orderid = $arow['procedure_order_id'];
265 $orderdate = $arow['date_ordered'];
266 echo " if (confirm('" . xls('There is a lab order') . " $orderid " .
267 xls('dated') . " $orderdate " .
268 xls('for this patient not yet assigned to any encounter.') . " " .
269 xls('Assign it to this one?') . "')) attachid += '$orderid,';\n";
271 echo " if (attachid) location.href = 'forms.php?attachid=' + attachid;\n";
275 <?php
if ($reviewMode) { ?
>
276 $
("body table:first").hide();
277 $
(".encounter-summary-column").hide();
278 $
(".css_button").hide();
279 $
(".css_button_small").hide();
280 $
(".encounter-summary-column:first").show();
281 $
(".title:first").text("<?php echo xls("Review
"); ?> " + $
(".title:first").text() +
" ("+
<?php
echo addslashes($encounter); ?
>+
")");
285 // Process click on Delete link.
286 function deleteme() {
287 dlgopen('../deleter.php?encounterid=<?php echo $encounter; ?>', '_blank', 500, 450);
291 // Called by the deleter.php window on a successful delete.
292 function imdeleted(EncounterId
) {
293 top
.window
.parent
.left_nav
.removeOptionSelected(EncounterId
);
294 top
.window
.parent
.left_nav
.clearEncounter();
299 <script language
="javascript">
300 function expandcollapse(atr
){
301 if(atr
== "expand") {
303 var mydivid
="divid_"+i
;var myspanid
="spanid_"+i
;
304 var ele
= document
.getElementById(mydivid
); var text
= document
.getElementById(myspanid
);
305 if (typeof(ele
) != 'undefined' && ele
!= null)
306 ele
.style
.display
= "block";
307 if (typeof(text
) != 'undefined' && text
!= null)
308 text
.innerHTML
= "<?php xl('Collapse', 'e'); ?>";
313 var mydivid
="divid_"+i
;var myspanid
="spanid_"+i
;
314 var ele
= document
.getElementById(mydivid
); var text
= document
.getElementById(myspanid
);
315 if (typeof(ele
) != 'undefined' && ele
!= null)
316 ele
.style
.display
= "none";
317 if (typeof(text
) != 'undefined' && text
!= null)
318 text
.innerHTML
= "<?php xl('Expand', 'e'); ?>";
324 function divtoggle(spanid
, divid
) {
325 var ele
= document
.getElementById(divid
);
326 var text
= document
.getElementById(spanid
);
327 if(ele
.style
.display
== "block") {
328 ele
.style
.display
= "none";
329 text
.innerHTML
= "<?php xl('Expand', 'e'); ?>";
332 ele
.style
.display
= "block";
333 text
.innerHTML
= "<?php xl('Collapse', 'e'); ?>";
338 <style type
="text/css">
344 div
.form_header_controls
{
345 float:left
;margin
-bottom
:2px
;
353 .encounter
-summary
-container
{
358 .encounter
-summary
-column
{
366 <!-- *************** -->
367 <!-- Form menu start
-->
368 <script language
="JavaScript">
370 function openNewForm(sel
) {
371 top
.restoreSession();
372 FormNameValueArray
= sel
.split('formname=');
373 if(FormNameValueArray
[1] == 'newpatient' || FormNameValueArray
[1] == 'newGroupEncounter')
375 parent
.location
.href
= sel
;
377 else if (!parent
.Forms
)
383 parent
.Forms
.location
.href
= sel
;
387 function toggleFrame1(fnum
) {
388 top
.frames
['left_nav'].document
.forms
[0].cb_top
.checked
=false;
389 top
.window
.parent
.left_nav
.toggleFrame(fnum
);
392 <style type
="text/css">
400 <script type
="text/javascript" language
="javascript">
405 var oldddmenuitem
= 0;
411 // cancel close timer
412 //mcancelclosetime();
417 //if(ddmenuitem) ddmenuitem.style.visibility = 'hidden';
418 //if(ddmenuitem) ddmenuitem.style.display = 'none';
420 // get new layer and show it
421 oldddmenuitem
= ddmenuitem
;
422 ddmenuitem
= document
.getElementById(id
);
423 if((ddmenuitem
.style
.visibility
== '')||
(ddmenuitem
.style
.visibility
== 'hidden')){
424 if(oldddmenuitem
) oldddmenuitem
.style
.visibility
= 'hidden';
425 if(oldddmenuitem
) oldddmenuitem
.style
.display
= 'none';
426 ddmenuitem
.style
.visibility
= 'visible';
427 ddmenuitem
.style
.display
= 'block';
429 ddmenuitem
.style
.visibility
= 'hidden';
430 ddmenuitem
.style
.display
= 'none';
433 // close showed layer
441 if(ddmenuitem
) ddmenuitem
.style
.visibility
= 'hidden';
442 if(ddmenuitem
) ddmenuitem
.style
.display
= 'none';
445 // close layer when click-out
446 document
.onclick
= mclose
;
447 //=================================================
448 function findPosX(id
)
450 obj
=document
.getElementById(id
);
455 curleft +
= obj
.offsetLeft
;
456 if(!obj
.offsetParent
)
458 obj
= obj
.offsetParent
;
462 PropertyWidth
=document
.getElementById(id
).offsetWidth
;
463 if(PropertyWidth
>curleft
)
465 document
.getElementById(id
).style
.left
=0;
469 function findPosY(obj
)
475 curtop +
= obj
.offsetTop
;
476 if(!obj
.offsetParent
)
478 obj
= obj
.offsetParent
;
487 <body
class="bgcolor2">
489 <?php
//DYNAMIC FORM RETREIVAL
490 include_once("$srcdir/registry.inc");
492 function myGetRegistered($state = "1", $limit = "unlimited", $offset = "0")
494 global $attendant_type;
495 $sql = "SELECT category, nickname, name, state, directory, id, sql_run, " .
496 "unpackaged, date, aco_spec FROM registry WHERE ";
497 // select different forms for groups
498 if ($attendant_type == 'pid') {
499 $sql .= "patient_encounter = 1 AND ";
501 $sql .= "therapy_group_encounter = 1 AND ";
503 $sql .= "state LIKE \"$state\" ORDER BY category, priority, name";
504 if ($limit != "unlimited") {
505 $sql .= " limit $limit, $offset";
507 $res = sqlStatement($sql);
509 for ($iter=0; $row=sqlFetchArray($res); $iter++
) {
518 $reg = myGetRegistered();
523 // To see if the encounter is locked. If it is, no new forms can be created
524 $encounterLocked = false;
525 if ($esignApi->lockEncounters() &&
526 isset($GLOBALS['encounter']) &&
527 !empty($GLOBALS['encounter']) ) {
528 $esign = $esignApi->createEncounterESign($GLOBALS['encounter']);
529 if ($esign->isLocked()) {
530 $encounterLocked = true;
535 $StringEcho= '<ul id="sddm">';
536 if ($encounterLocked === false) {
537 foreach ($reg as $entry) {
538 // Check permission to create forms of this type.
539 $tmp = explode('|', $entry['aco_spec']);
540 if (!empty($tmp[1])) {
541 if (!acl_check($tmp[0], $tmp[1], '', 'write') && !acl_check($tmp[0], $tmp[1], '', 'addonly')) {
545 $new_category = trim($entry['category']);
546 $new_nickname = trim($entry['nickname']);
547 if ($new_category == '') {
548 $new_category = htmlspecialchars(xl('Miscellaneous'), ENT_QUOTES
);
550 $new_category = htmlspecialchars(xl($new_category), ENT_QUOTES
);
552 if ($new_nickname != '') {
553 $nickname = $new_nickname;} else {
554 $nickname = $entry['name'];}
555 if ($old_category != $new_category) {
556 $new_category_ = $new_category;
557 $new_category_ = str_replace(' ', '_', $new_category_);
558 if ($old_category != '') {
559 $StringEcho.= "</table></div></li>";}
560 $StringEcho.= "<li class=\"encounter-form-category-li\"><a href='JavaScript:void(0);' onClick=\"mopen('$DivId');\" >$new_category</a><div id='$DivId' ><table border='0' cellspacing='0' cellpadding='0'>";
561 $old_category = $new_category;
564 $StringEcho.= "<tr><td style='border-top: 1px solid #000000;padding:0px;'><a onclick=\"openNewForm('" . $rootdir .'/patient_file/encounter/load_form.php?formname=' .urlencode($entry['directory']) .
565 "')\" href='JavaScript:void(0);'>" . xl_form_title($nickname) . "</a></td></tr>";
568 $StringEcho.= '</table></div></li>';
572 $StringEcho2= '<div style="clear:both"></div>';
577 // This shows Layout Based Form names just like the above.
579 if ($encounterLocked === false) {
580 $lres = sqlStatement("SELECT * FROM list_options " .
581 "WHERE list_id = 'lbfnames' AND activity = 1 ORDER BY seq, title");
582 if (sqlNumRows($lres)) {
584 $StringEcho= '<ul id="sddm">';
586 $StringEcho.= "<li class=\"encounter-form-category-li\"><a href='JavaScript:void(0);' onClick=\"mopen('lbf');\" >" .
587 xl('Layout Based') . "</a><div id='lbf' ><table border='0' cellspacing='0' cellpadding='0'>";
588 while ($lrow = sqlFetchArray($lres)) {
589 $option_id = $lrow['option_id']; // should start with LBF
590 $title = $lrow['title'];
591 // Check ACO attribute, if any, of this LBF.
592 $jobj = json_decode($lrow['notes'], true);
593 if (!empty($jobj['aco'])) {
594 $tmp = explode('|', $jobj['aco']);
595 if (!acl_check($tmp[0], $tmp[1], '', 'write') && !acl_check($tmp[0], $tmp[1], '', 'addonly')) {
599 $StringEcho .= "<tr><td style='border-top: 1px solid #000000;padding:0px;'><a href='" .
600 $rootdir . '/patient_file/encounter/load_form.php?formname=' .
601 urlencode($option_id) . "' >" . xl_form_title($title) . "</a></td></tr>";
606 <!-- DISPLAYING HOOKS STARTS HERE
-->
608 $module_query = sqlStatement("SELECT msh.*,ms.menu_name,ms.path,m.mod_ui_name,m.type FROM modules_hooks_settings AS msh LEFT OUTER JOIN modules_settings AS ms ON
609 obj_name=enabled_hooks AND ms.mod_id=msh.mod_id LEFT OUTER JOIN modules AS m ON m.mod_id=ms.mod_id
610 WHERE fld_type=3 AND mod_active=1 AND sql_run=1 AND attached_to='encounter' ORDER BY mod_id");
611 $DivId = 'mod_installer';
612 if (sqlNumRows($module_query)) {
615 while ($modulerow = sqlFetchArray($module_query)) {
616 $DivId = 'mod_'.$modulerow['mod_id'];
617 $new_category = $modulerow['mod_ui_name'];
620 if ($modulerow['type'] == 0) {
621 $modulePath = $GLOBALS['customModDir'];
625 $modulePath = $GLOBALS['zendModDir'];
627 $relative_link = "../../modules/".$modulePath."/".$modulerow['path'];
628 $nickname = $modulerow['menu_name'] ?
$modulerow['menu_name'] : 'Noname';
629 if ($jid==0 ||
($modid!=$modulerow['mod_id'])) {
631 $StringEcho.= '</table></div></li>';
633 $StringEcho.= "<li><a href='JavaScript:void(0);' onClick=\"mopen('$DivId');\" >$new_category</a><div id='$DivId' ><table border='0' cellspacing='0' cellpadding='0'>";
636 $modid = $modulerow['mod_id'];
637 $StringEcho.= "<tr><td style='border-top: 1px solid #000000;padding:0px;'><a onclick=\"openNewForm('$relative_link')\" href='JavaScript:void(0);'>" . xl_form_title($nickname) . "</a></td></tr>";
641 <!-- DISPLAYING HOOKS ENDS HERE
-->
644 $StringEcho.= "</table></div></li></ul>".$StringEcho2;
647 <table cellspacing
="0" cellpadding
="0" align
="center">
649 <td valign
="top"><?php
echo $StringEcho; ?
></td
>
653 <!-- Form menu stop
-->
654 <!-- *************** -->
656 <div id
="encounter_forms">
659 $dateres = getEncounterDateByEncounter($encounter);
660 $encounter_date = date("Y-m-d", strtotime($dateres["date"]));
661 $providerIDres = getProviderIdOfEncounter($encounter);
662 $providerNameRes = getProviderName($providerIDres);
665 <div
class='encounter-summary-container'>
666 <div
class='encounter-summary-column'>
669 $pass_sens_squad = true;
671 //fetch acl for category of given encounter
672 $pc_catid = fetchCategoryIdByEncounter($encounter);
673 $postCalendarCategoryACO = fetchPostCalendarCategoryACO($pc_catid);
674 if ($postCalendarCategoryACO) {
675 $postCalendarCategoryACO = explode('|', $postCalendarCategoryACO);
676 $authPostCalendarCategory = acl_check($postCalendarCategoryACO[0], $postCalendarCategoryACO[1]);
677 $authPostCalendarCategoryWrite = acl_check($postCalendarCategoryACO[0], $postCalendarCategoryACO[1], '', 'write');
678 } else { // if no aco is set for category
679 $authPostCalendarCategory = true;
680 $authPostCalendarCategoryWrite = true;
683 if ($attendant_type == 'pid' && is_numeric($pid)) {
684 echo '<span class="title">' . oeFormatShortDate($encounter_date) . " " . xlt("Encounter") . '</span>';
686 // Check for no access to the patient's squad.
687 $result = getPatientData($pid, "fname,lname,squad");
688 echo htmlspecialchars(xl('for', '', ' ', ' ') . $result['fname'] . " " . $result['lname']);
689 if ($result['squad'] && ! acl_check('squads', $result['squad'])) {
690 $pass_sens_squad = false;
693 // Check for no access to the encounter's sensitivity level.
694 $result = sqlQuery("SELECT sensitivity FROM form_encounter WHERE " .
695 "pid = '$pid' AND encounter = '$encounter' LIMIT 1");
696 if (($result['sensitivity'] && !acl_check('sensitivities', $result['sensitivity'])) ||
!$authPostCalendarCategory) {
697 $pass_sens_squad = false;
701 echo '<span class="title">' . oeFormatShortDate($encounter_date) . " " . xlt("Group Encounter") . '</span>';
702 // Check for no access to the patient's squad.
703 $result = getGroup($groupId);
704 echo htmlspecialchars(xl('for ', '', ' ', ' ') . $result['group_name']);
705 if ($result['squad'] && ! acl_check('squads', $result['squad'])) {
706 $pass_sens_squad = false;
708 // Check for no access to the encounter's sensitivity level.
709 $result = sqlQuery("SELECT sensitivity FROM form_groups_encounter WHERE " .
710 "group_id = ? AND encounter = ? LIMIT 1", array($groupId, $encounter));
711 if (($result['sensitivity'] && !acl_check('sensitivities', $result['sensitivity'])) ||
!$authPostCalendarCategory) {
712 $pass_sens_squad = false;
717 <div style
='margin-top:8px;'>
719 // ESign for entire encounter
720 $esign = $esignApi->createEncounterESign($encounter);
721 if ($esign->isButtonViewable()) {
722 echo $esign->buttonHtml();
725 <?php
if (acl_check('admin', 'super')) { ?
>
726 <a href
='toggledivs(this.id,this.id);' class='css_button' onclick
='return deleteme()'><span
><?php
echo xl('Delete') ?
></span
></a
>
728  
; 
; 
;<a href
="#" onClick
='expandcollapse("expand");' style
="font-size:80%;"><?php
xl('Expand All', 'e'); ?
></a
>
729  
; 
; 
;<a style
="font-size:80%;" href
="#" onClick
='expandcollapse("collapse");'><?php
xl('Collapse All', 'e'); ?
></a
>
733 <div
class='encounter-summary-column'>
734 <?php
if ($esign->isLogViewable()) {
739 <div
class='encounter-summary-column'>
740 <?php
if ($GLOBALS['enable_amc_prompting']) { ?
>
741 <div style
='float:right;margin-right:25px;border-style:solid;border-width:1px;'>
742 <div style
='float:left;margin:5px 5px 5px 5px;'>
746 <?php
// Display the education resource checkbox (AMC prompting)
747 $itemAMC = amcCollect("patient_edu_amc", $pid, 'form_encounter', $encounter);
749 <?php
if (!(empty($itemAMC))) { ?
>
750 <input type
="checkbox" id
="prov_edu_res" checked
>
752 <input type
="checkbox" id
="prov_edu_res">
756 <span
class="text"><?php
echo xl('Provided Education Resource(s)?') ?
></span
>
761 <?php
// Display the Provided Clinical Summary checkbox (AMC prompting)
762 $itemAMC = amcCollect("provide_sum_pat_amc", $pid, 'form_encounter', $encounter);
764 <?php
if (!(empty($itemAMC))) { ?
>
765 <input type
="checkbox" id
="provide_sum_pat_flag" checked
>
767 <input type
="checkbox" id
="provide_sum_pat_flag">
771 <span
class="text"><?php
echo xl('Provided Clinical Summary?') ?
></span
>
774 <?php
// Display the medication reconciliation checkboxes (AMC prompting)
775 $itemAMC = amcCollect("med_reconc_amc", $pid, 'form_encounter', $encounter);
777 <?php
if (!(empty($itemAMC))) { ?
>
780 <input type
="checkbox" id
="trans_trand_care" checked
>
783 <span
class="text"><?php
echo xl('Transition/Transfer of Care?') ?
></span
>
787 <table style
="margin-left:2em;">
790 <?php
if (!(empty($itemAMC['date_completed']))) { ?
>
791 <input type
="checkbox" id
="med_reconc_perf" checked
>
793 <input type
="checkbox" id
="med_reconc_perf">
797 <span
class="text"><?php
echo xl('Medication Reconciliation Performed?') ?
></span
>
802 <?php
if (!(empty($itemAMC['soc_provided']))) { ?
>
803 <input type
="checkbox" id
="soc_provided" checked
>
805 <input type
="checkbox" id
="soc_provided">
809 <span
class="text"><?php
echo xl('Summary Of Care Provided?') ?
></span
>
816 <input type
="checkbox" id
="trans_trand_care">
819 <span
class="text"><?php
echo xl('Transition/Transfer of Care?') ?
></span
>
823 <table style
="margin-left:2em;">
826 <input type
="checkbox" id
="med_reconc_perf" DISABLED
>
829 <span
class="text"><?php
echo xl('Medication Reconciliation Performed?') ?
></span
>
834 <input type
="checkbox" id
="soc_provided" DISABLED
>
837 <span
class="text"><?php
echo xl('Summary of Care Provided?') ?
></span
>
849 <!-- Get the documents tagged to this encounter
and display the links
and notes
as the tooltip
-->
851 if ($attendant_type == 'pid') {
852 $docs_list = getDocumentsByEncounter($pid, $_SESSION['encounter']);
854 // already doesn't exist document for therapy groups
855 $docs_list = array();
857 if (count($docs_list) > 0) {
859 <div
class='enc_docs'>
860 <span
class="bold"><?php
echo xlt("Document(s)"); ?
>:</span
>
862 $doc = new C_Document();
863 foreach ($docs_list as $doc_iter) {
864 $doc_url = $doc->_tpl_vars
[CURRENT_ACTION
]. "&view&patient_id=".attr($pid)."&document_id=" . attr($doc_iter[id
]) . "&";
865 // Get notes for this document.
866 $queryString = "SELECT GROUP_CONCAT(note ORDER BY date DESC SEPARATOR '|') AS docNotes, GROUP_CONCAT(date ORDER BY date DESC SEPARATOR '|') AS docDates
867 FROM notes WHERE foreign_id = ? GROUP BY foreign_id";
868 $noteData = sqlQuery($queryString, array($doc_iter[id
]));
872 $notes = explode("|", $noteData['docNotes']);
873 $dates = explode("|", $noteData['docDates']);
874 for ($i = 0; $i < count($notes); $i++
) {
875 $note .= oeFormatShortDate(date('Y-m-d', strtotime($dates[$i]))) . " : " . $notes[$i] . "\n";
880 <a href
="<?php echo $doc_url;?>" style
="font-size:small;" onsubmit
="return top.restoreSession()"><?php
echo oeFormatShortDate($doc_iter[docdate
]) . ": " . text(basename($doc_iter[url
]));?
></a
>
881 <?php
if ($note != '') {?
>
882 <a href
="javascript:void(0);" title
="<?php echo attr($note);?>"><img src
="../../../images/info.png"/></a
>
891 if (($pass_sens_squad) && ($result = getFormByEncounter($attendant_id, $encounter, "id, date, form_id, form_name, formdir, user, deleted"))) {
892 echo "<table width='100%' id='partable'>";
894 foreach ($result as $iter) {
895 $formdir = $iter['formdir'];
897 // skip forms whose 'deleted' flag is set to 1
898 if ($iter['deleted'] == 1) {
904 if (substr($formdir, 0, 3) == 'LBF') {
905 // Skip LBF forms that we are not authorized to see.
907 "SELECT * FROM list_options WHERE " .
908 "list_id = 'lbfnames' AND option_id = ? AND activity = 1",
912 $jobj = json_decode($lrow['notes'], true);
913 if (!empty($jobj['aco'])) {
914 $aco_spec = explode('|', $jobj['aco']);
915 if (!acl_check($aco_spec[0], $aco_spec[1])) {
921 // Skip non-LBF forms that we are not authorized to see.
922 $tmp = getRegistryEntryByDirectory($formdir, 'aco_spec');
923 if (!empty($tmp['aco_spec'])) {
924 $aco_spec = explode('|', $tmp['aco_spec']);
925 if (!acl_check($aco_spec[0], $aco_spec[1])) {
931 // $form_info = getFormInfoById($iter['id']);
932 if (strtolower(substr($iter['form_name'], 0, 5)) == 'camos') {
933 //CAMOS generates links from report.php and these links should
934 //be clickable without causing view.php to come up unexpectedly.
935 //I feel that the JQuery code in this file leading to a click
936 //on the report.php content to bring up view.php steps on a
937 //form's autonomy to generate it's own html content in it's report
938 //but until any other form has a problem with this, I will just
939 //make an exception here for CAMOS and allow it to carry out this
940 //functionality for all other forms. --Mark
941 echo '<tr title="' . xl('Edit form') . '" '.
942 'id="'.$formdir.'~'.$iter['form_id'].'">';
944 echo '<tr title="' . xl('Edit form') . '" '.
945 'id="'.$formdir.'~'.$iter['form_id'].'" class="text onerow">';
948 $acl_groups = acl_check("groups", "glog", false, 'write') ?
true : false;
949 $user = getNameFromUsername($iter['user']);
951 $form_name = ($formdir == 'newpatient') ?
xl('Patient Encounter') : xl_form_title($iter['form_name']);
953 // Create the ESign instance for this form
954 $esign = $esignApi->createFormESign($iter['id'], $formdir, $encounter);
956 echo "<td style='border-bottom:1px solid'>";
957 // a link to edit the form
958 echo "<div class='form_header_controls'>";
960 // If the form is locked, it is no longer editable
961 if ($esign->isLocked()) {
962 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>";
964 if ((!$aco_spec ||
acl_check($aco_spec[0], $aco_spec[1], '', 'write') and $is_group == 0 and $authPostCalendarCategoryWrite)
965 or (((!$aco_spec ||
acl_check($aco_spec[0], $aco_spec[1], '', 'write')) and $is_group and acl_check("groups", "glog", false, 'write')) and $authPostCalendarCategoryWrite)) {
966 echo "<a class='css_button_small form-edit-button' id='form-edit-button-".attr($formdir)."-".attr($iter['id']).
967 "' href='$rootdir/patient_file/encounter/view_form.php?" .
968 "formname=" . attr($formdir) . "&id=" . attr($iter['form_id']) .
969 "' onclick='top.restoreSession()'>";
970 echo "<span>" . xlt('Edit') . "</span></a>";
974 if (($esign->isButtonViewable() and $is_group == 0 and $authPostCalendarCategoryWrite) or ($esign->isButtonViewable() and $is_group and acl_check("groups", "glog", false, 'write') and $authPostCalendarCategoryWrite)) {
975 if (!$aco_spec ||
acl_check($aco_spec[0], $aco_spec[1], '', 'write')) {
976 echo $esign->buttonHtml();
980 if (acl_check('admin', 'super')) {
981 if ($formdir != 'newpatient' && $formdir != 'newGroupEncounter') {
982 // a link to delete the form from the encounter
983 echo "<a target='_parent'" .
984 " href='$rootdir/patient_file/encounter/delete_form.php?" .
985 "formname=" . $formdir .
986 "&id=" . $iter['id'] .
987 "&encounter=". $encounter.
989 "' class='css_button_small' title='" . xl('Delete this form') . "' onclick='top.restoreSession()'><span>" . xl('Delete') . "</span></a>";
991 ?
><a href
='javascript:;' class='css_button_small' style
='color:gray'><span
><?php
xl('Delete', 'e'); ?
></span
></a
><?php
995 echo "<div class='form_header'>";
997 // Figure out the correct author (encounter authors are the '$providerNameRes', while other
998 // form authors are the '$user['fname'] . " " . $user['lname']').
999 if ($formdir == 'newpatient') {
1000 $form_author = $providerNameRes;
1002 $form_author = $user['fname'] . " " . $user['lname'];
1004 echo "<a href='#' onclick='divtoggle(\"spanid_$divnos\",\"divid_$divnos\");' class='small' id='aid_$divnos'><b>$form_name</b> <span class='text'>". xl('by')." ". htmlspecialchars($form_author) . "</span> (<span id=spanid_$divnos class=\"indicator\">" . xl('Collapse') . "</span>)</a></div>";
1009 echo "<td valign='top' class='formrow'><div class='tab' id='divid_$divnos' style='display:block'>";
1011 // Use the form's report.php for display. Forms with names starting with LBF
1012 // are list-based forms sharing a single collection of code.
1014 if (substr($formdir, 0, 3) == 'LBF') {
1015 include_once($GLOBALS['incdir'] . "/forms/LBF/report.php");
1017 call_user_func("lbf_report", $attendant_id, $encounter, 2, $iter['form_id'], $formdir, true);
1019 include_once($GLOBALS['incdir'] . "/forms/$formdir/report.php");
1020 call_user_func($formdir . "_report", $attendant_id, $encounter, 2, $iter['form_id']);
1023 if ($esign->isLogViewable()) {
1024 $esign->renderLog();
1027 echo "</div></td></tr>";
1032 if (!$pass_sens_squad) {
1033 echo xlt("Not authorized to view this encounter");
1037 </div
> <!-- end large encounter_forms DIV
-->