6 * @link http://www.open-emr.org
7 * @author Brady Miller <brady.g.miller@gmail.com>
8 * @copyright Copyright (c) 2018 Brady Miller <brady.g.miller@gmail.com>
9 * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
13 require_once("../../globals.php");
14 require_once("$srcdir/encounter.inc");
15 require_once("$srcdir/group.inc");
16 require_once("$srcdir/calendar.inc");
17 require_once("$srcdir/acl.inc");
18 require_once("$srcdir/patient.inc");
19 require_once("$srcdir/amc.php");
20 require_once $GLOBALS['srcdir'].'/ESign/Api.php';
21 require_once("$srcdir/../controllers/C_Document.class.php");
24 use OpenEMR\Core\Header
;
27 if (!empty($_REQUEST['review_id'])) {
29 $encounter=sanitizeNumber($_REQUEST['review_id']);
32 $is_group = ($attendant_type == 'gid') ?
true : false;
33 if ($attendant_type == 'gid') {
34 $groupId = $therapy_group;
36 $attendant_id = $attendant_type == 'pid' ?
$pid : $therapy_group;
37 if ($is_group && !acl_check("groups", "glog", false, array('view','write'))) {
38 echo xlt("access not allowed");
47 <?php
require $GLOBALS['srcdir'] . '/js/xl/dygraphs.js.php'; ?
>
49 <?php Header
::setupHeader(['common','esign','dygraphs']); ?
>
52 $esignApi = new Api();
55 <?php
// if the track_anything form exists, then include the styling and js functions for graphing
56 if (file_exists(dirname(__FILE__
) . "/../../forms/track_anything/style.css")) { ?
>
57 <script type
="text/javascript" src
="<?php echo $GLOBALS['web_root']?>/interface/forms/track_anything/report.js"></script
>
58 <link rel
="stylesheet" href
="<?php echo $GLOBALS['web_root']?>/interface/forms/track_anything/style.css" type
="text/css">
62 // If the user requested attachment of any orphaned procedure orders, do it.
63 if (!empty($_GET['attachid'])) {
64 $attachid = explode(',', $_GET['attachid']);
65 foreach ($attachid as $aid) {
71 "SELECT COUNT(*) AS count FROM procedure_order WHERE " .
72 "procedure_order_id = ? AND patient_id = ? AND encounter_id = 0 AND activity = 1",
75 if (!empty($tmp['count'])) {
77 "UPDATE procedure_order SET encounter_id = ? WHERE " .
78 "procedure_order_id = ? AND patient_id = ? AND encounter_id = 0 AND activity = 1",
79 array($encounter, $aid, $pid)
81 addForm($encounter, "Procedure Order", $aid, "procedure_order", $pid, $userauthorized);
87 <script type
="text/javascript">
89 jQuery(document
).ready( function($
) {
90 var formConfig
= <?php
echo $esignApi->formConfigToJson(); ?
>;
91 $
(".esign-button-form").esign(
94 afterFormSuccess
: function( response
) {
95 if ( response
.locked
) {
96 var editButtonId
= "form-edit-button-"+response
.formDir+
"-"+response
.formId
;
97 $
("#"+editButtonId
).replaceWith( response
.editButtonHtml
);
100 var logId
= "esign-signature-log-"+response
.formDir+
"-"+response
.formId
;
101 $
.post( formConfig
.logViewAction
, response
, function( html
) {
102 $
("#"+logId
).replaceWith( html
);
108 var encounterConfig
= <?php
echo $esignApi->encounterConfigToJson(); ?
>;
109 $
(".esign-button-encounter").esign(
112 afterFormSuccess
: function( response
) {
113 // If the response indicates a locked encounter, replace all
114 // form edit buttons with a "disabled" button, and "disable" left
115 // nav visit form links
116 if ( response
.locked
) {
117 // Lock the form edit buttons
118 $
(".form-edit-button").replaceWith( response
.editButtonHtml
);
119 // Disable the new-form capabilities in left nav
120 top
.window
.parent
.left_nav
.syncRadios();
121 // Disable the new-form capabilities in top nav of the encounter
122 $
(".encounter-form-category-li").remove();
125 var logId
= "esign-signature-log-encounter-"+response
.encounterId
;
126 $
.post( encounterConfig
.logViewAction
, response
, function( html
) {
127 $
("#"+logId
).replaceWith( html
);
133 $
("#prov_edu_res").click(function() {
134 if ( $
('#prov_edu_res').prop('checked') ) {
140 top
.restoreSession();
141 $
.post( "../../../library/ajax/amc_misc_data.php",
142 { amc_id
: "patient_edu_amc",
145 patient_id
: <?php
echo htmlspecialchars($pid, ENT_NOQUOTES
); ?
>,
146 object_category
: "form_encounter",
147 object_id
: <?php
echo htmlspecialchars($encounter, ENT_NOQUOTES
); ?
>
152 $
("#provide_sum_pat_flag").click(function() {
153 if ( $
('#provide_sum_pat_flag').prop('checked') ) {
159 top
.restoreSession();
160 $
.post( "../../../library/ajax/amc_misc_data.php",
161 { amc_id
: "provide_sum_pat_amc",
164 patient_id
: <?php
echo htmlspecialchars($pid, ENT_NOQUOTES
); ?
>,
165 object_category
: "form_encounter",
166 object_id
: <?php
echo htmlspecialchars($encounter, ENT_NOQUOTES
); ?
>
171 $
("#trans_trand_care").click(function() {
172 if ( $
('#trans_trand_care').prop('checked') ) {
174 // Enable the reconciliation checkbox
175 $
("#med_reconc_perf").removeAttr("disabled");
176 $
("#soc_provided").removeAttr("disabled");
180 //Disable the reconciliation checkbox (also uncheck it if applicable)
181 $
("#med_reconc_perf").attr("disabled", true);
182 $
("#med_reconc_perf").prop("checked",false);
183 $
("#soc_provided").attr("disabled",true);
184 $
("#soc_provided").prop("checked",false);
186 top
.restoreSession();
187 $
.post( "../../../library/ajax/amc_misc_data.php",
188 { amc_id
: "med_reconc_amc",
191 patient_id
: <?php
echo htmlspecialchars($pid, ENT_NOQUOTES
); ?
>,
192 object_category
: "form_encounter",
193 object_id
: <?php
echo htmlspecialchars($encounter, ENT_NOQUOTES
); ?
>
198 $
("#med_reconc_perf").click(function() {
199 if ( $
('#med_reconc_perf').prop('checked') ) {
200 var mode
= "complete";
203 var mode
= "uncomplete";
205 top
.restoreSession();
206 $
.post( "../../../library/ajax/amc_misc_data.php",
207 { amc_id
: "med_reconc_amc",
210 patient_id
: <?php
echo htmlspecialchars($pid, ENT_NOQUOTES
); ?
>,
211 object_category
: "form_encounter",
212 object_id
: <?php
echo htmlspecialchars($encounter, ENT_NOQUOTES
); ?
>
216 $
("#soc_provided").click(function(){
217 if($
('#soc_provided').prop('checked')){
218 var mode
= "soc_provided";
221 var mode
= "no_soc_provided";
223 top
.restoreSession();
224 $
.post( "../../../library/ajax/amc_misc_data.php",
225 { amc_id
: "med_reconc_amc",
228 patient_id
: <?php
echo htmlspecialchars($pid, ENT_NOQUOTES
); ?
>,
229 object_category
: "form_encounter",
230 object_id
: <?php
echo htmlspecialchars($encounter, ENT_NOQUOTES
); ?
>
235 $
(".deleteme").click(function(evt
) { deleteme(); evt
.stopPropogation(); });
238 // If the user was not just asked about orphaned orders, build javascript for that.
239 if (!isset($_GET['attachid'])) {
240 $ares = sqlStatement(
241 "SELECT procedure_order_id, date_ordered " .
242 "FROM procedure_order WHERE " .
243 "patient_id = ? AND encounter_id = 0 AND activity = 1 " .
244 "ORDER BY procedure_order_id",
247 echo " // Ask about attaching orphaned orders to this encounter.\n";
248 echo " var attachid = '';\n";
249 while ($arow = sqlFetchArray($ares)) {
250 $orderid = $arow['procedure_order_id'];
251 $orderdate = $arow['date_ordered'];
252 echo " if (confirm('" . xls('There is a lab order') . " $orderid " .
253 xls('dated') . " $orderdate " .
254 xls('for this patient not yet assigned to any encounter.') . " " .
255 xls('Assign it to this one?') . "')) attachid += '$orderid,';\n";
257 echo " if (attachid) location.href = 'forms.php?attachid=' + attachid;\n";
261 <?php
if ($reviewMode) { ?
>
262 $
("body table:first").hide();
263 $
(".encounter-summary-column").hide();
264 $
(".css_button").hide();
265 $
(".css_button_small").hide();
266 $
(".encounter-summary-column:first").show();
267 $
(".title:first").text("<?php echo xls("Review
"); ?> " + $
(".title:first").text() +
" ( <?php echo addslashes($encounter); ?> )");
271 // Process click on Delete link.
272 function deleteme() {
273 dlgopen('../deleter.php?encounterid=<?php echo $encounter; ?>', '_blank', 500, 200, '', '', {
275 {text
: '<?php echo xla('Done
'); ?>', close
: true, style
: 'primary btn-sm'}
283 // Called by the deleter.php window on a successful delete.
284 function imdeleted(EncounterId
) {
285 top
.window
.parent
.left_nav
.removeOptionSelected(EncounterId
);
286 top
.window
.parent
.left_nav
.clearEncounter();
290 top
.window
.parent
.left_nav
.loadFrame('ens1', window
.parent
.name
, 'patient_file/history/encounters.php');
294 // Called to open the data entry form a specified encounter form instance.
295 function openEncounterForm(formdir
, formname
, formid
) {
296 var url
= '<?php echo "$rootdir/patient_file/encounter/view_form.php?formname=" ?>' +
297 formdir +
'&id=' + formid
;
298 if (formdir
== 'newpatient' ||
!parent
.twAddFrameTab
) {
299 top
.restoreSession();
303 parent
.twAddFrameTab('enctabs', formname
, url
);
308 // Called when an encounter form may changed something that requires a refresh here.
309 function refreshVisitDisplay() {
310 location
.href
= '<?php echo $rootdir; ?>/patient_file/encounter/forms.php';
315 <script language
="javascript">
316 function expandcollapse(atr
) {
317 for (var i
= 1; i
< 15; ++i
) {
318 var mydivid
="divid_" + i
; var myspanid
= "spanid_" + i
;
319 var ele
= document
.getElementById(mydivid
);
320 var text
= document
.getElementById(myspanid
);
322 if (atr
== "expand") {
323 ele
.style
.display
= "block"; text
.innerHTML
= "<?php xl('Collapse', 'e'); ?>";
326 ele
.style
.display
= "none" ; text
.innerHTML
= "<?php xl('Expand', 'e'); ?>";
331 function divtoggle(spanid
, divid
) {
332 var ele
= document
.getElementById(divid
);
333 var text
= document
.getElementById(spanid
);
334 if(ele
.style
.display
== "block") {
335 ele
.style
.display
= "none";
336 text
.innerHTML
= "<?php xl('Expand', 'e'); ?>";
339 ele
.style
.display
= "block";
340 text
.innerHTML
= "<?php xl('Collapse', 'e'); ?>";
345 <style type
="text/css">
356 div
.form_header_controls
{
370 .encounter
-summary
-container
{
375 .encounter
-summary
-column
{
383 <!-- *************** -->
384 <!-- Form menu start
-->
385 <script language
="JavaScript">
387 function openNewForm(sel
, label
) {
388 top
.restoreSession();
389 var FormNameValueArray
= sel
.split('formname=');
390 if (FormNameValueArray
[1] == 'newpatient') {
391 // TBD: Make this work when it's not the first frame.
392 parent
.frames
[0].location
.href
= sel
;
395 parent
.twAddFrameTab('enctabs', label
, sel
);
399 function toggleFrame1(fnum
) {
400 top
.frames
['left_nav'].document
.forms
[0].cb_top
.checked
=false;
401 top
.window
.parent
.left_nav
.toggleFrame(fnum
);
404 <style type
="text/css">
412 <script type
="text/javascript" language
="javascript">
417 var oldddmenuitem
= 0;
423 // cancel close timer
424 //mcancelclosetime();
429 //if(ddmenuitem) ddmenuitem.style.visibility = 'hidden';
430 //if(ddmenuitem) ddmenuitem.style.display = 'none';
432 // get new layer and show it
433 oldddmenuitem
= ddmenuitem
;
434 ddmenuitem
= document
.getElementById(id
);
435 if((ddmenuitem
.style
.visibility
== '')||
(ddmenuitem
.style
.visibility
== 'hidden')){
436 if(oldddmenuitem
) oldddmenuitem
.style
.visibility
= 'hidden';
437 if(oldddmenuitem
) oldddmenuitem
.style
.display
= 'none';
438 ddmenuitem
.style
.visibility
= 'visible';
439 ddmenuitem
.style
.display
= 'block';
441 ddmenuitem
.style
.visibility
= 'hidden';
442 ddmenuitem
.style
.display
= 'none';
445 // close showed layer
453 if(ddmenuitem
) ddmenuitem
.style
.visibility
= 'hidden';
454 if(ddmenuitem
) ddmenuitem
.style
.display
= 'none';
457 // close layer when click-out
458 document
.onclick
= mclose
;
459 //=================================================
460 function findPosX(id
)
462 obj
=document
.getElementById(id
);
467 curleft +
= obj
.offsetLeft
;
468 if(!obj
.offsetParent
)
470 obj
= obj
.offsetParent
;
474 PropertyWidth
=document
.getElementById(id
).offsetWidth
;
475 if(PropertyWidth
>curleft
)
477 document
.getElementById(id
).style
.left
=0;
481 function findPosY(obj
)
487 curtop +
= obj
.offsetTop
;
488 if(!obj
.offsetParent
)
490 obj
= obj
.offsetParent
;
499 <body
class="bgcolor2">
501 <?php
//DYNAMIC FORM RETREIVAL
502 include_once("$srcdir/registry.inc");
504 function myGetRegistered($state = "1", $limit = "unlimited", $offset = "0")
506 global $attendant_type;
507 $sql = "SELECT category, nickname, name, state, directory, id, sql_run, " .
508 "unpackaged, date, aco_spec FROM registry WHERE ";
509 // select different forms for groups
510 if ($attendant_type == 'pid') {
511 $sql .= "patient_encounter = 1 AND ";
513 $sql .= "therapy_group_encounter = 1 AND ";
515 $sql .= "state LIKE \"$state\" ORDER BY category, priority, name";
516 if ($limit != "unlimited") {
517 $sql .= " limit $limit, $offset";
519 $res = sqlStatement($sql);
521 for ($iter=0; $row=sqlFetchArray($res); $iter++
) {
530 $reg = myGetRegistered();
535 // To see if the encounter is locked. If it is, no new forms can be created
536 $encounterLocked = false;
537 if ($esignApi->lockEncounters() &&
538 isset($GLOBALS['encounter']) &&
539 !empty($GLOBALS['encounter']) ) {
540 $esign = $esignApi->createEncounterESign($GLOBALS['encounter']);
541 if ($esign->isLocked()) {
542 $encounterLocked = true;
547 $StringEcho= '<ul id="sddm">';
548 if ($encounterLocked === false) {
549 foreach ($reg as $entry) {
550 // Check permission to create forms of this type.
551 $tmp = explode('|', $entry['aco_spec']);
552 if (!empty($tmp[1])) {
553 if (!acl_check($tmp[0], $tmp[1], '', 'write') && !acl_check($tmp[0], $tmp[1], '', 'addonly')) {
557 $new_category = trim($entry['category']);
558 $new_nickname = trim($entry['nickname']);
559 if ($new_category == '') {
560 $new_category = htmlspecialchars(xl('Miscellaneous'), ENT_QUOTES
);
562 $new_category = htmlspecialchars(xl($new_category), ENT_QUOTES
);
564 if ($new_nickname != '') {
565 $nickname = $new_nickname;
567 $nickname = trim($entry['name']);
569 if ($old_category != $new_category) {
570 $new_category_ = $new_category;
571 $new_category_ = str_replace(' ', '_', $new_category_);
572 if ($old_category != '') {
573 $StringEcho .= "</table></div></li>";
575 $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'>";
576 $old_category = $new_category;
579 $StringEcho .= "<tr><td style='border-top: 1px solid #000000;padding:0px;'><a onclick=\"openNewForm('" .
580 $rootdir . "/patient_file/encounter/load_form.php?formname=" . urlencode($entry['directory']) .
581 "', '" . addslashes(xl_form_title($nickname)) . "')\" href='JavaScript:void(0);'>" .
582 text(xl_form_title($nickname)) . "</a></td></tr>";
585 $StringEcho.= '</table></div></li>';
589 $StringEcho2= '<div style="clear:both"></div>';
594 // This shows Layout Based Form names just like the above.
596 if ($encounterLocked === false) {
597 $lres = sqlStatement("SELECT grp_form_id AS option_id, grp_title AS title, grp_aco_spec " .
598 "FROM layout_group_properties WHERE " .
599 "grp_form_id LIKE 'LBF%' AND grp_group_id = '' AND grp_activity = 1 " .
600 "ORDER BY grp_seq, grp_title");
602 if (sqlNumRows($lres)) {
604 $StringEcho= '<ul id="sddm">';
606 $StringEcho.= "<li class=\"encounter-form-category-li\"><a href='JavaScript:void(0);' onClick=\"mopen('lbf');\" >" .
607 xl('Layout Based') . "</a><div id='lbf' ><table border='0' cellspacing='0' cellpadding='0'>";
608 while ($lrow = sqlFetchArray($lres)) {
609 $option_id = $lrow['option_id']; // should start with LBF
610 $title = $lrow['title'];
611 // Check ACO attribute, if any, of this LBF.
612 if (!empty($lrow['grp_aco_spec'])) {
613 $tmp = explode('|', $lrow['grp_aco_spec']);
614 if (!acl_check($tmp[0], $tmp[1], '', 'write') && !acl_check($tmp[0], $tmp[1], '', 'addonly')) {
618 $StringEcho .= "<tr><td style='border-top: 1px solid #000000;padding:0px;'><a onclick=\"openNewForm('" .
619 $rootdir . "/patient_file/encounter/load_form.php?formname=" . urlencode($option_id) .
620 "', '" . addslashes(xl_form_title($title)) . "')\" href='JavaScript:void(0);'>" .
621 text(xl_form_title($title)) . "</a></td></tr>";
626 <!-- DISPLAYING HOOKS STARTS HERE
-->
628 $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
629 obj_name=enabled_hooks AND ms.mod_id=msh.mod_id LEFT OUTER JOIN modules AS m ON m.mod_id=ms.mod_id
630 WHERE fld_type=3 AND mod_active=1 AND sql_run=1 AND attached_to='encounter' ORDER BY mod_id");
631 $DivId = 'mod_installer';
632 if (sqlNumRows($module_query)) {
635 while ($modulerow = sqlFetchArray($module_query)) {
636 $DivId = 'mod_'.$modulerow['mod_id'];
637 $new_category = $modulerow['mod_ui_name'];
640 if ($modulerow['type'] == 0) {
641 $modulePath = $GLOBALS['customModDir'];
645 $modulePath = $GLOBALS['zendModDir'];
647 $relative_link = "../../modules/".$modulePath."/".$modulerow['path'];
648 $nickname = $modulerow['menu_name'] ?
$modulerow['menu_name'] : 'Noname';
649 if ($jid==0 ||
($modid!=$modulerow['mod_id'])) {
651 $StringEcho.= '</table></div></li>';
653 $StringEcho.= "<li><a href='JavaScript:void(0);' onClick=\"mopen('$DivId');\" >$new_category</a><div id='$DivId' ><table border='0' cellspacing='0' cellpadding='0'>";
656 $modid = $modulerow['mod_id'];
657 $StringEcho.= "<tr><td style='border-top: 1px solid #000000;padding:0px;'><a onclick=" .
658 "\"openNewForm('$relative_link', '" . addslashes(xl_form_title($nickname)) . "')\" " .
659 "href='JavaScript:void(0);'>" . xl_form_title($nickname) . "</a></td></tr>";
663 <!-- DISPLAYING HOOKS ENDS HERE
-->
666 $StringEcho.= "</table></div></li></ul>".$StringEcho2;
669 <table cellspacing
="0" cellpadding
="0" align
="center">
671 <td valign
="top"><?php
echo $StringEcho; ?
></td
>
675 <!-- Form menu stop
-->
676 <!-- *************** -->
678 <div id
="encounter_forms">
681 $dateres = getEncounterDateByEncounter($encounter);
682 $encounter_date = date("Y-m-d", strtotime($dateres["date"]));
683 $providerIDres = getProviderIdOfEncounter($encounter);
684 $providerNameRes = getProviderName($providerIDres);
687 <div
class='encounter-summary-container'>
688 <div
class='encounter-summary-column'>
691 $pass_sens_squad = true;
693 //fetch acl for category of given encounter
694 $pc_catid = fetchCategoryIdByEncounter($encounter);
695 $postCalendarCategoryACO = fetchPostCalendarCategoryACO($pc_catid);
696 if ($postCalendarCategoryACO) {
697 $postCalendarCategoryACO = explode('|', $postCalendarCategoryACO);
698 $authPostCalendarCategory = acl_check($postCalendarCategoryACO[0], $postCalendarCategoryACO[1]);
699 $authPostCalendarCategoryWrite = acl_check($postCalendarCategoryACO[0], $postCalendarCategoryACO[1], '', 'write');
700 } else { // if no aco is set for category
701 $authPostCalendarCategory = true;
702 $authPostCalendarCategoryWrite = true;
705 if ($attendant_type == 'pid' && is_numeric($pid)) {
706 echo '<span class="title">' . text(oeFormatShortDate($encounter_date)) . " " . xlt("Encounter") . '</span>';
708 // Check for no access to the patient's squad.
709 $result = getPatientData($pid, "fname,lname,squad");
710 echo htmlspecialchars(xl('for', '', ' ', ' ') . $result['fname'] . " " . $result['lname']);
711 if ($result['squad'] && ! acl_check('squads', $result['squad'])) {
712 $pass_sens_squad = false;
715 // Check for no access to the encounter's sensitivity level.
716 $result = sqlQuery("SELECT sensitivity FROM form_encounter WHERE " .
717 "pid = '$pid' AND encounter = '$encounter' LIMIT 1");
718 if (($result['sensitivity'] && !acl_check('sensitivities', $result['sensitivity'])) ||
!$authPostCalendarCategory) {
719 $pass_sens_squad = false;
723 echo '<span class="title">' . text(oeFormatShortDate($encounter_date)) . " " . xlt("Group Encounter") . '</span>';
724 // Check for no access to the patient's squad.
725 $result = getGroup($groupId);
726 echo htmlspecialchars(xl('for ', '', ' ', ' ') . $result['group_name']);
727 if ($result['squad'] && ! acl_check('squads', $result['squad'])) {
728 $pass_sens_squad = false;
730 // Check for no access to the encounter's sensitivity level.
731 $result = sqlQuery("SELECT sensitivity FROM form_groups_encounter WHERE " .
732 "group_id = ? AND encounter = ? LIMIT 1", array($groupId, $encounter));
733 if (($result['sensitivity'] && !acl_check('sensitivities', $result['sensitivity'])) ||
!$authPostCalendarCategory) {
734 $pass_sens_squad = false;
739 <div style
='margin-top:8px;'>
741 // ESign for entire encounter
742 $esign = $esignApi->createEncounterESign($encounter);
743 if ($esign->isButtonViewable()) {
744 echo $esign->buttonHtml();
747 <?php
if (acl_check('admin', 'super')) { ?
>
748 <a href
='#' class='css_button' onclick
='return deleteme()'><span
><?php
echo xl('Delete') ?
></span
></a
>
750  
; 
; 
;<a href
="#" onClick
='expandcollapse("expand");' style
="font-size:80%;"><?php
xl('Expand All', 'e'); ?
></a
>
751  
; 
; 
;<a style
="font-size:80%;" href
="#" onClick
='expandcollapse("collapse");'><?php
xl('Collapse All', 'e'); ?
></a
>
755 <div
class='encounter-summary-column'>
756 <?php
if ($esign->isLogViewable()) {
761 <div
class='encounter-summary-column'>
762 <?php
if ($GLOBALS['enable_amc_prompting']) { ?
>
763 <div style
='float:right;margin-right:25px;border-style:solid;border-width:1px;'>
764 <div style
='float:left;margin:5px 5px 5px 5px;'>
768 <?php
// Display the education resource checkbox (AMC prompting)
769 $itemAMC = amcCollect("patient_edu_amc", $pid, 'form_encounter', $encounter);
771 <?php
if (!(empty($itemAMC))) { ?
>
772 <input type
="checkbox" id
="prov_edu_res" checked
>
774 <input type
="checkbox" id
="prov_edu_res">
778 <span
class="text"><?php
echo xl('Provided Education Resource(s)?') ?
></span
>
783 <?php
// Display the Provided Clinical Summary checkbox (AMC prompting)
784 $itemAMC = amcCollect("provide_sum_pat_amc", $pid, 'form_encounter', $encounter);
786 <?php
if (!(empty($itemAMC))) { ?
>
787 <input type
="checkbox" id
="provide_sum_pat_flag" checked
>
789 <input type
="checkbox" id
="provide_sum_pat_flag">
793 <span
class="text"><?php
echo xl('Provided Clinical Summary?') ?
></span
>
796 <?php
// Display the medication reconciliation checkboxes (AMC prompting)
797 $itemAMC = amcCollect("med_reconc_amc", $pid, 'form_encounter', $encounter);
799 <?php
if (!(empty($itemAMC))) { ?
>
802 <input type
="checkbox" id
="trans_trand_care" checked
>
805 <span
class="text"><?php
echo xl('Transition/Transfer of Care?') ?
></span
>
809 <table style
="margin-left:2em;">
812 <?php
if (!(empty($itemAMC['date_completed']))) { ?
>
813 <input type
="checkbox" id
="med_reconc_perf" checked
>
815 <input type
="checkbox" id
="med_reconc_perf">
819 <span
class="text"><?php
echo xl('Medication Reconciliation Performed?') ?
></span
>
824 <?php
if (!(empty($itemAMC['soc_provided']))) { ?
>
825 <input type
="checkbox" id
="soc_provided" checked
>
827 <input type
="checkbox" id
="soc_provided">
831 <span
class="text"><?php
echo xl('Summary Of Care Provided?') ?
></span
>
838 <input type
="checkbox" id
="trans_trand_care">
841 <span
class="text"><?php
echo xl('Transition/Transfer of Care?') ?
></span
>
845 <table style
="margin-left:2em;">
848 <input type
="checkbox" id
="med_reconc_perf" DISABLED
>
851 <span
class="text"><?php
echo xl('Medication Reconciliation Performed?') ?
></span
>
856 <input type
="checkbox" id
="soc_provided" DISABLED
>
859 <span
class="text"><?php
echo xl('Summary of Care Provided?') ?
></span
>
871 <!-- Get the documents tagged to this encounter
and display the links
and notes
as the tooltip
-->
873 if ($attendant_type == 'pid') {
874 $docs_list = getDocumentsByEncounter($pid, $_SESSION['encounter']);
876 // already doesn't exist document for therapy groups
877 $docs_list = array();
879 if (!empty($docs_list) && count($docs_list) > 0) {
881 <div
class='enc_docs'>
882 <span
class="bold"><?php
echo xlt("Document(s)"); ?
>:</span
>
884 $doc = new C_Document();
885 foreach ($docs_list as $doc_iter) {
886 $doc_url = $doc->_tpl_vars
[CURRENT_ACTION
]. "&view&patient_id=".attr($pid)."&document_id=" . attr($doc_iter[id
]) . "&";
887 // Get notes for this document.
888 $queryString = "SELECT GROUP_CONCAT(note ORDER BY date DESC SEPARATOR '|') AS docNotes, GROUP_CONCAT(date ORDER BY date DESC SEPARATOR '|') AS docDates
889 FROM notes WHERE foreign_id = ? GROUP BY foreign_id";
890 $noteData = sqlQuery($queryString, array($doc_iter[id
]));
894 $notes = explode("|", $noteData['docNotes']);
895 $dates = explode("|", $noteData['docDates']);
896 for ($i = 0; $i < count($notes); $i++
) {
897 $note .= oeFormatShortDate(date('Y-m-d', strtotime($dates[$i]))) . " : " . $notes[$i] . "\n";
902 <a href
="<?php echo $doc_url;?>" style
="font-size:small;" onsubmit
="return top.restoreSession()"><?php
echo text(oeFormatShortDate($doc_iter[docdate
])) . ": " . text(basename($doc_iter[url
]));?
></a
>
903 <?php
if ($note != '') {?
>
904 <a href
="javascript:void(0);" title
="<?php echo attr($note);?>"><img src
="../../../images/info.png"/></a
>
912 if ($pass_sens_squad &&
913 ($result = getFormByEncounter(
916 "id, date, form_id, form_name, formdir, user, deleted",
918 "FIND_IN_SET(formdir,'newpatient') DESC, form_name, date DESC"
920 echo "<table width='100%' id='partable'>";
922 foreach ($result as $iter) {
923 $formdir = $iter['formdir'];
925 // skip forms whose 'deleted' flag is set to 1
926 if ($iter['deleted'] == 1) {
932 if (substr($formdir, 0, 3) == 'LBF') {
933 // Skip LBF forms that we are not authorized to see.
935 "SELECT grp_aco_spec " .
936 "FROM layout_group_properties WHERE " .
937 "grp_form_id = ? AND grp_group_id = '' AND grp_activity = 1",
941 if (!empty($lrow['grp_aco_spec'])) {
942 $aco_spec = explode('|', $lrow['grp_aco_spec']);
943 if (!acl_check($aco_spec[0], $aco_spec[1])) {
949 // Skip non-LBF forms that we are not authorized to see.
950 $tmp = getRegistryEntryByDirectory($formdir, 'aco_spec');
951 if (!empty($tmp['aco_spec'])) {
952 $aco_spec = explode('|', $tmp['aco_spec']);
953 if (!acl_check($aco_spec[0], $aco_spec[1])) {
959 // $form_info = getFormInfoById($iter['id']);
960 if (strtolower(substr($iter['form_name'], 0, 5)) == 'camos') {
961 //CAMOS generates links from report.php and these links should
962 //be clickable without causing view.php to come up unexpectedly.
963 //I feel that the JQuery code in this file leading to a click
964 //on the report.php content to bring up view.php steps on a
965 //form's autonomy to generate it's own html content in it's report
966 //but until any other form has a problem with this, I will just
967 //make an exception here for CAMOS and allow it to carry out this
968 //functionality for all other forms. --Mark
969 echo '<tr title="' . xl('Edit form') . '" '.
970 'id="'.$formdir.'~'.$iter['form_id'].'">';
972 echo '<tr id="' . $formdir . '~' . $iter['form_id'] . '" class="text onerow">';
975 $acl_groups = acl_check("groups", "glog", false, 'write') ?
true : false;
976 $user = getNameFromUsername($iter['user']);
978 $form_name = ($formdir == 'newpatient') ?
xl('Visit Summary') : xl_form_title($iter['form_name']);
980 // Create the ESign instance for this form
981 $esign = $esignApi->createFormESign($iter['id'], $formdir, $encounter);
983 // echo "<tr>"; // Removed as bug fix.
985 echo "<td style='border-bottom:1px solid'>";
987 // Figure out the correct author (encounter authors are the '$providerNameRes', while other
988 // form authors are the '$user['fname'] . " " . $user['lname']').
989 if ($formdir == 'newpatient') {
990 $form_author = $providerNameRes;
992 $form_author = $user['fname'] . " " . $user['lname'];
994 echo "<div class='form_header'>";
995 echo "<a href='#' onclick='divtoggle(\"spanid_$divnos\",\"divid_$divnos\");' class='small' id='aid_$divnos'>" .
996 "<div class='formname'>" . text($form_name) . "</div> " .
997 xlt('by') . " " . text($form_author) . " " .
998 "(<span id=spanid_$divnos class=\"indicator\">" . ($divnos == 1 ?
xlt('Collapse') : xlt('Expand')) . "</span>)</a>";
1001 // a link to edit the form
1002 echo "<div class='form_header_controls'>";
1004 // If the form is locked, it is no longer editable
1005 if ($esign->isLocked()) {
1006 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>";
1008 if ((!$aco_spec ||
acl_check($aco_spec[0], $aco_spec[1], '', 'write') and $is_group == 0 and $authPostCalendarCategoryWrite)
1009 or (((!$aco_spec ||
acl_check($aco_spec[0], $aco_spec[1], '', 'write')) and $is_group and acl_check("groups", "glog", false, 'write')) and $authPostCalendarCategoryWrite)) {
1010 echo "<a class='css_button_small form-edit-button' " .
1011 "id='form-edit-button-" . attr($formdir) . "-" . attr($iter['id']) . "' " .
1013 "title='" . xla('Edit this form') . "' " .
1014 "onclick=\"return openEncounterForm('" . attr($formdir) . "', '" .
1015 attr($form_name) . "', '" . attr($iter['form_id']) . "')\">";
1016 echo "<span>" . xlt('Edit') . "</span></a>";
1020 if (($esign->isButtonViewable() and $is_group == 0 and $authPostCalendarCategoryWrite) or ($esign->isButtonViewable() and $is_group and acl_check("groups", "glog", false, 'write') and $authPostCalendarCategoryWrite)) {
1021 if (!$aco_spec ||
acl_check($aco_spec[0], $aco_spec[1], '', 'write')) {
1022 echo $esign->buttonHtml();
1026 if (substr($formdir, 0, 3) == 'LBF') {
1027 // A link for a nice printout of the LBF
1028 echo "<a target='_blank' " .
1029 "href='$rootdir/forms/LBF/printable.php?" .
1030 "formname=" . urlencode($formdir) .
1031 "&formid=" . urlencode($iter['form_id']) .
1032 "&visitid=" . urlencode($encounter) .
1033 "&patientid=" . urlencode($pid) .
1034 "' class='css_button_small' title='" . xl('Print this form') .
1035 "' onclick='top.restoreSession()'><span>" . xlt('Print') . "</span></a>";
1038 if (acl_check('admin', 'super')) {
1039 if ($formdir != 'newpatient' && $formdir != 'newGroupEncounter') {
1040 // a link to delete the form from the encounter
1041 echo "<a href='$rootdir/patient_file/encounter/delete_form.php?" .
1042 "formname=" . $formdir .
1043 "&id=" . $iter['id'] .
1044 "&encounter=". $encounter.
1046 "' class='css_button_small' title='" . xl('Delete this form') . "' onclick='top.restoreSession()'><span>" . xl('Delete') . "</span></a>";
1048 ?
><a href
='javascript:;' class='css_button_small' style
='color:gray'><span
><?php
xl('Delete', 'e'); ?
></span
></a
><?php
1051 echo "</div>\n"; // Added as bug fix.
1056 echo "<td valign='top' class='formrow'><div class='tab' id='divid_$divnos' ";
1057 echo "style='display:" . ($divnos == 1 ?
'block' : 'none') . "'>";
1059 // Use the form's report.php for display. Forms with names starting with LBF
1060 // are list-based forms sharing a single collection of code.
1062 if (substr($formdir, 0, 3) == 'LBF') {
1063 include_once($GLOBALS['incdir'] . "/forms/LBF/report.php");
1065 call_user_func("lbf_report", $attendant_id, $encounter, 2, $iter['form_id'], $formdir, true);
1067 include_once($GLOBALS['incdir'] . "/forms/$formdir/report.php");
1068 call_user_func($formdir . "_report", $attendant_id, $encounter, 2, $iter['form_id']);
1071 if ($esign->isLogViewable()) {
1072 $esign->renderLog();
1075 echo "</div></td></tr>";
1080 if (!$pass_sens_squad) {
1081 echo xlt("Not authorized to view this encounter");
1085 </div
> <!-- end large encounter_forms DIV
-->