7 * @link http://www.open-emr.org
8 * @author Brady Miller <brady.g.miller@gmail.com>
9 * @copyright Copyright (c) 2017-2018 Brady Miller <brady.g.miller@gmail.com>
10 * @author Stephen Nielson <stephen@nielson.org>
11 * @copyright Copyright (c) 2019 Stephen Nielson <stephen@nielson.org>
12 * @author Jerry Padgett <sjpadgett@gmail.com>
13 * @copyright Copyright (c) 2019 Jerry Padgett <sjpadgett@gmail.com>
14 * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
17 require_once("../../globals.php");
18 require_once("$srcdir/lists.inc.php");
19 require_once("$srcdir/forms.inc.php");
20 require_once("$srcdir/patient.inc.php");
22 use OpenEMR\Common\Acl\AclMain
;
23 use OpenEMR\Common\Csrf\CsrfUtils
;
24 use OpenEMR\Common\Twig\TwigContainer
;
25 use OpenEMR\Core\Header
;
26 use OpenEMR\Events\PatientReport\PatientReportEvent
;
27 use OpenEMR\Menu\PatientMenuRole
;
28 use OpenEMR\OeUI\OemrUI
;
29 use Symfony\Component\EventDispatcher\EventDispatcherInterface
;
30 use Symfony\Component\EventDispatcher\GenericEvent
;
32 if (!AclMain
::aclCheckCore('patients', 'pat_rep')) {
33 echo (new TwigContainer(null, $GLOBALS['kernel']))->getTwig()->render('core/unauthorized.html.twig', ['pageTitle' => xl("Patient Reports")]);
36 // get various authorization levels
37 $auth_notes_a = AclMain
::aclCheckCore('encounters', 'notes_a');
38 $auth_notes = AclMain
::aclCheckCore('encounters', 'notes');
39 $auth_coding_a = AclMain
::aclCheckCore('encounters', 'coding_a');
40 $auth_coding = AclMain
::aclCheckCore('encounters', 'coding');
41 $auth_relaxed = AclMain
::aclCheckCore('encounters', 'relaxed');
42 $auth_med = AclMain
::aclCheckCore('patients', 'med');
43 $auth_demo = AclMain
::aclCheckCore('patients', 'demo');
46 * @var EventDispatcherInterface $eventDispatcher The event dispatcher / listener object
48 $eventDispatcher = $GLOBALS['kernel']->getEventDispatcher();
53 <title
><?php
echo xlt("Patient Reports"); ?
></title
>
55 <?php Header
::setupHeader(['datetime-picker', 'common']); ?
>
58 function checkAll(check
) {
59 var f
= document
.forms
['report_form'];
60 for (var i
= 0; i
< f
.elements
.length
; ++i
) {
61 if (f
.elements
[i
].type
== 'checkbox') f
.elements
[i
].checked
= check
;
66 function show_date_fun(){
67 if(document
.getElementById('show_date').checked
== true){
68 document
.getElementById('date_div').style
.display
= '';
70 document
.getElementById('date_div').style
.display
= 'none';
74 <?php
require_once("$include_root/patient_file/erx_patient_portal_js.php"); // jQuery for popups for eRx and patient portal ?>
77 $arrOeUiSettings = array(
78 'heading_title' => xl('Patient Reports'),
79 'include_patient_name' => true,
80 'expandable' => false,
81 'expandable_files' => array(),//all file names need suffix _xpd
82 'action' => "",//conceal, reveal, search, reset, link or back
84 'action_href' => "",//only for actions - reset, link or back
85 'show_help_icon' => true,
86 'help_file_name' => "report_dashboard_help.php"
88 $oemr_ui = new OemrUI($arrOeUiSettings);
93 <div id
="container_div" class="<?php echo $oemr_ui->oeContainer();?> mt-3">
94 <div id
="patient_reports"> <!-- large outer DIV
-->
96 <div
class="col-sm-12">
97 <?php
require_once("$include_root/patient_file/summary/dashboard_header.php");?
>
101 $list_id = "report"; // to indicate nav item is active, count and give correct id
102 // Collect the patient menu then build it
103 $menuPatient = new PatientMenuRole();
104 $menuPatient->displayHorizNavBarMenu();
108 if ($GLOBALS['activate_ccr_ccd_report']) { // show CCR/CCD reporting options ?>
109 <div
class="mt-3" id
="ccr_report">
110 <form name
='ccr_form' id
='ccr_form' method
='post' action
='../../../ccr/createCCR.php'>
112 <div
class="col-sm-12">
113 <span
class='title oe-report-section-header'><?php
echo xlt('Continuity of Care Record (CCR)'); ?
></span
>
114 <span
class='text'>(<?php
echo xlt('Pop ups need to be enabled to see these reports'); ?
>)</span
>
117 <input type
='hidden' name
='ccrAction' />
118 <input type
='hidden' name
='raw' />
119 <input type
="checkbox" name
="show_date" id
="show_date" onchange
="show_date_fun();" ><span
class='text'><?php
echo xlt('Use Date Range'); ?
>
122 <div id
="date_div" style
="display: none">
123 <div
class="form-row">
124 <div
class="col-12 col-sm-2">
125 <label
for="Start" class='font-weight-bold'><?php
echo xlt('Start Date');?
>: </label
>
127 <div
class="col-12 col-sm-4">
128 <input type
='text' class='datepicker form-control' size
='10' name
='Start' id
='Start' title
='<?php echo xla('yyyy
-mm
-dd
'); ?>' />
130 <div
class="col-12 col-sm-2">
131 <label
for="End" class='font-weight-bold'><?php
echo xlt('End Date');?
>: </label
>
133 <div
class="col-12 col-sm-4">
134 <input type
='text' class='datepicker form-control' size
='10' name
='End' id
='End' title
='<?php echo xla('yyyy
-mm
-dd
'); ?>' />
139 <button type
="button" class="generateCCR btn btn-primary btn-save btn-sm" value
="<?php echo xla('Generate Report'); ?>" ><?php
echo xlt('Generate Report'); ?
></button
>
140 <!--<input type
="button" class="generateCCR_raw" value
="<?php echo xlt('Raw Report'); ?>" /> -->
141 <button type
="button" class="generateCCR_download_p btn btn-primary btn-download btn-sm" value
="<?php echo xla('Download'); ?>" ><?php
echo xlt('Download'); ?
></button
>
144 if ($GLOBALS['phimail_enable'] == true && $GLOBALS['phimail_ccr_enable'] == true) { ?
>
145 <button type
="button" class="viewCCR_send_dialog btn btn-primary btn-transmit btn-sm" value
="<?php echo xla('Transmit'); ?>"><?php
echo xlt('Transmit'); ?
></button
>
147 <div id
="ccr_send_dialog" style
="display: none">
149 <div
class="table-responsive">
150 <table
class="table border-0">
153 <span
class='font-weight-bold'><?php
echo xlt('Enter Recipient\'s Direct Address');?
>: </span
>
154 <input type
="text" size
="64" name
="ccr_send_to" id
="ccr_send_to" value
="" />
155 <input type
="hidden" name
="ccr_sent_by" id
="ccr_sent_by" value
="user" />
156 <button type
="button" class="viewCCR_transmit btn btn-primary btn-send-msg btn-sm" value
="<?php echo xla('Send CCR'); ?>"><?php
echo xlt('Send CCR'); ?
></button
>
157 <div id
="ccr_send_result" style
="display: none">
158 <span
class="text" id
="ccr_send_message"></span
>
170 <div
class="col-sm-12">
171 <span
class='title oe-report-section-header'><?php
echo xlt('Continuity of Care Document (CCD)'); ?
></span
> 
; 
;
172 <span
class='text'>(<?php
echo xlt('Pop ups need to be enabled to see these reports'); ?
>)</span
>
175 <button type
="button" class="viewCCD btn btn-primary btn-save btn-sm" value
="<?php echo xla('Generate Report'); ?>" ><?php
echo xlt('Generate Report'); ?
></button
>
176 <button type
="button" class="viewNewCCD btn btn-primary btn-save btn-sm" value
="<?php echo xla('Generate Report'); ?>" ><?php
echo xlt('Generate New Report'); ?
></button
>
177 <button type
="button" class="viewCCD_download btn btn-primary btn-download btn-sm" value
="<?php echo xla('Download'); ?>" ><?php
echo xlt('Download'); ?
></button
>
179 if ($GLOBALS['phimail_enable'] == true && $GLOBALS['phimail_ccd_enable'] == true) { ?
>
180 <button type
="button" class="viewCCD_send_dialog btn btn-primary btn-transmit btn-sm" value
="<?php echo xla('Transmit'); ?>" ><?php
echo xlt('Transmit'); ?
></button
>
182 <div id
="ccd_send_dialog" style
="display: none">
183 <div
class="form-row mt-3">
185 <label
for="" class="font-weight-bold">
186 <?php
echo xlt('Enter Recipient\'s Direct Address');?
>:
190 <input type
="text" class="form-control" size
="64" name
="ccd_send_to" id
="ccd_send_to" value
="" />
191 <input type
="hidden" name
="ccd_sent_by" id
="ccd_sent_by" value
="user" />
194 <button type
="button" class="viewCCD_transmit btn btn-primary btn-send-msg btn-sm" value
="<?php echo xla('Send CCD'); ?>"><?php
echo xlt('Send CCD'); ?
></button
>
197 <div id
="ccd_send_result" style
="display: none">
198 <span
class="text" id
="ccd_send_message"></span
>
208 } // end CCR/CCD reporting options ?>
210 <form name
='report_form' id
="report_form" method
='post' action
='custom_report.php'>
212 <div
class="col-sm-12">
213 <span
class='title oe-report-section-header'><?php
echo xlt('Patient Report'); ?
></span
> 
; 
;
215 <a
class="link_submit" href
="full_report.php" onclick
="top.restoreSession()">
216 [<?php
echo xlt('View Comprehensive Patient Report'); ?
>]</a
>
218 <a
class="link_submit btn btn-secondary btn-sm btn-save" href
="#" onclick
="return checkAll(true)">
219 <?php
echo xla('Check All'); ?
>
221 <a
class="link_submit btn btn-secondary btn-sm btn-undo" href
="#" onclick
="return checkAll(false)">
222 <?php
echo xla('Clear All'); ?
>
225 <table
class="includes mt-3">
228 <input type
='checkbox' name
='include_demographics' id
='include_demographics' value
="demographics" checked
/><?php
echo xlt('Demographics'); ?
>
230 <?php
if (AclMain
::aclCheckCore('patients', 'med')) : ?
>
231 <input type
='checkbox' name
='include_history' id
='include_history' value
="history" /><?php
echo xlt('History'); ?
>
235 <input type
='checkbox' name
='include_employer' id
='include_employer' value
="employer"><?php
echo xlt('Employer'); ?
><br
/>
237 <input type
='checkbox' name
='include_insurance' id
='include_insurance' value
="insurance" /><?php
echo xlt('Insurance'); ?
>
239 <input type
='checkbox' name
='include_billing' id
='include_billing' value
="billing"
241 if (!$GLOBALS['simplified_demographics']) {
243 } ?
> /><?php
echo xlt('Billing'); ?
>
248 <input type
='checkbox' name
='include_allergies' id
='include_allergies' value
="allergies">Allergies
<br
/>
249 <input type
='checkbox' name
='include_medications' id
='include_medications' value
="medications">Medications
<br
/>
251 <input type
='checkbox' name
='include_immunizations' id
='include_immunizations' value
="immunizations" /><?php
echo xlt('Immunizations'); ?
>
254 <input type
='checkbox' name
='include_medical_problems' id
='include_medical_problems' value
="medical_problems">Medical Problems
<br
/>
256 <input type
='checkbox' name
='include_notes' id
='include_notes' value
="notes" /><?php
echo xlt('Patient Notes'); ?
>
258 <input type
='checkbox' name
='include_transactions' id
='include_transactions' value
="transactions" /><?php
echo xlt('Transactions'); ?
>
260 <input type
='checkbox' name
='include_batchcom' id
='include_batchcom' value
="batchcom" /><?php
echo xlt('Communications'); ?
>
264 <input type
='checkbox' name
='include_recurring_days' id
='include_recurring_days' value
="recurring_days" /><?php
echo xlt('Recurrent Appointments'); ?
>
270 <button type
="button" class="genreport btn btn-primary btn-save btn-sm" value
="<?php echo xla('Generate Report'); ?>" ><?php
echo xlt('Generate Report'); ?
></button
>
271 <button type
="button" class="genpdfrep btn btn-primary btn-download btn-sm" value
="<?php echo xla('Download PDF'); ?>" ><?php
echo xlt('Download PDF'); ?
></button
>
275 $eventDispatcher->dispatch(new GenericEvent(), PatientReportEvent
::ACTIONS_RENDER_POST
);
278 <input type
='hidden' name
='pdf' value
='0' />
281 <!-- old ccr button position
-->
284 <div
class="row issues_encounters_forms">
286 <div
class="col-md-6">
287 <div
class="issues table-responsive">
288 <span
class='font-weight-bold oe-report-section-header'><?php
echo xlt('Issues'); ?
>:</span
>
292 <?php
if (! AclMain
::aclCheckCore('patients', 'med')) { ?
>
293 <br
/>(Issues not authorized
)
295 <table
class="table table-borderless">
298 $pres = sqlStatement("SELECT * FROM lists WHERE pid = ? " .
299 "ORDER BY type, begdate", array($pid));
301 while ($prow = sqlFetchArray($pres)) {
302 if ($lasttype != $prow['type']) {
303 $lasttype = $prow['type'];
306 $disptype = $lasttype;
308 case "allergy" : $disptype = "Allergies" ; break;
310 case "medical_problem": $disptype = "Medical Problems"; break;
311 case "medication" : $disptype = "Medications" ; break;
312 case "surgery" : $disptype = "Surgeries" ; break;
315 $disptype = $ISSUE_TYPES[$lasttype][0];
318 echo " <td colspan='4' class='font-weight-bold'><span class='oe-report-section-header'>" . xlt($disptype) . ":</span></td>\n";
322 $rowid = $prow['id'];
323 $disptitle = trim($prow['title']) ?
$prow['title'] : "[Missing Title]";
325 $ieres = sqlStatement("SELECT encounter FROM issue_encounter WHERE " .
326 "pid = ? AND list_id = ?", array($pid, $rowid));
328 echo " <tr class='text'>\n";
329 echo " <td> </td>\n";
331 echo "<input type='checkbox' name='issue_" . attr($rowid) . "' id='issue_" . attr($rowid) . "' class='issuecheckbox' value='/";
332 while ($ierow = sqlFetchArray($ieres)) {
333 echo attr($ierow['encounter']) . "/";
336 echo "' />" . text($disptitle) . "</td>\n";
337 echo " <td>" . text($prow['begdate']);
339 if ($prow['enddate']) {
340 echo " - " . text($prow['enddate']);
350 <?php
} // end of Issues output ?>
351 </div
> <!-- end issues DIV
-->
352 <button type
="button" class="genreport btn btn-primary btn-save btn-sm" value
="<?php echo xla('Generate Report'); ?>" ><?php
echo xlt('Generate Report'); ?
></button
>
353 <button type
="button" class="genpdfrep btn btn-primary btn-download btn-sm" value
="<?php echo xla('Download PDF'); ?>" ><?php
echo xlt('Download PDF'); ?
></button
>
355 <!-- Encounters
and Forms
-->
356 <div
class="col-md-6">
357 <div
class='encounters table-responsive'>
358 <span
class='font-weight-bold oe-report-section-header'><?php
echo xlt('Encounters & Forms'); ?
>:</span
>
363 if (!($auth_notes_a ||
$auth_notes ||
$auth_coding_a ||
$auth_coding ||
$auth_med ||
$auth_relaxed)) { ?
>
364 (Encounters not authorized
)
369 $res = sqlStatement("SELECT forms.encounter, forms.form_id, forms.form_name, " .
370 "forms.formdir, forms.date AS fdate, form_encounter.date " .
371 ",form_encounter.reason " .
372 "FROM forms, form_encounter WHERE " .
373 "forms.pid = ? AND form_encounter.pid = ? AND " .
374 "form_encounter.encounter = forms.encounter " .
375 " AND forms.deleted=0 " . // --JRM--
376 "ORDER BY form_encounter.encounter DESC, form_encounter.date DESC, fdate ASC", array($pid, $pid));
377 $res2 = sqlStatement("SELECT name FROM registry ORDER BY priority");
378 $html_strings = array();
379 $registry_form_name = array();
380 while ($result2 = sqlFetchArray($res2)) {
381 array_push($registry_form_name, trim($result2['name']));
384 while ($result = sqlFetchArray($res)) {
385 if ($result["form_name"] == "New Patient Encounter") {
387 foreach ($registry_form_name as $var) {
388 if ($toprint = ($html_strings[$var] ??
'')) {
389 foreach ($toprint as $var) {
394 $html_strings = array();
395 echo "</div>\n"; // end DIV encounter_forms
396 echo "</div>\n\n"; //end DIV encounter_data
400 echo "<div class='encounter_data'>\n";
401 echo "<input type=checkbox " .
402 " name='" . attr($result["formdir"]) . "_" . attr($result["form_id"]) . "'" .
403 " id='" . attr($result["formdir"]) . "_" . attr($result["form_id"]) . "'" .
404 " value='" . attr($result["encounter"]) . "'" .
405 " class='encounter'" .
407 // show encounter reason, not just 'New Encounter'
408 // trim to a reasonable length for display purposes --cfapress
409 $maxReasonLength = 20;
410 if (strlen($result["reason"]) > $maxReasonLength) {
411 // The default encoding for this mb_substr() call is set near top of globals.php
412 $result['reason'] = mb_substr($result['reason'], 0, $maxReasonLength) . " ... ";
414 echo text($result["reason"]) .
415 " (" . text(date("Y-m-d", strtotime($result["date"]))) .
417 echo "<div class='encounter_forms'>\n";
419 $form_name = trim($result["form_name"]);
420 //if form name is not in registry, look for the closest match by
421 // finding a registry name which is at the start of the form name.
422 //this is to allow for forms to put additional helpful information
423 //in the database in the same string as their form name after the name
424 $form_name_found_flag = 0;
425 foreach ($registry_form_name as $var) {
426 if ($var == $form_name) {
427 $form_name_found_flag = 1;
430 // if the form does not match precisely with any names in the registry, now see if any front partial matches
431 // and change $form_name appropriately so it will print above in $toprint = $html_strings[$var]
432 if (!$form_name_found_flag) {
433 foreach ($registry_form_name as $var) {
434 if (strpos($form_name, $var) == 0) {
439 if (empty($html_strings[$form_name]) ||
!is_array($html_strings[$form_name])) {
440 $html_strings[$form_name] = array();
442 array_push($html_strings[$form_name], "<input type='checkbox' " .
443 " name='" . attr($result["formdir"]) . "_" . attr($result["form_id"]) . "'" .
444 " id='" . attr($result["formdir"]) . "_" . attr($result["form_id"]) . "'" .
445 " value='" . attr($result["encounter"]) . "'" .
446 " class='encounter_form' " .
447 ">" . text(xl_form_title($result["form_name"])) . "<br />\n");
451 foreach ($registry_form_name as $var) {
452 if (!empty($html_strings[$var])) {
453 if ($toprint = $html_strings[$var]) {
454 foreach ($toprint as $var) {
464 </div
> <!-- end encounters DIV
-->
469 <div
class="col-sm-12">
470 <!-- Procedure Orders
-->
472 <div
class="table-responsive">
473 <table
class="table table-borderless">
475 <td
class='font-weight-bold'><span
class='oe-report-section-header'><?php
echo xlt('Procedures'); ?
>:</span
></td
>
476 <td
class='text'> 
;<?php
echo xlt('Order Date'); ?
> 
; 
;</td
>
477 <td
class='text'><?php
echo xlt('Encounter Date'); ?
> 
; 
;</td
>
478 <td
class='text'><?php
echo xlt('Order Descriptions'); ?
></td
>
482 "SELECT po.procedure_order_id, po.date_ordered, fe.date " .
483 "FROM procedure_order AS po " .
484 "LEFT JOIN forms AS f ON f.pid = po.patient_id AND f.formdir = 'procedure_order' AND " .
485 "f.form_id = po.procedure_order_id AND f.deleted = 0 " .
486 "LEFT JOIN form_encounter AS fe ON fe.pid = f.pid AND fe.encounter = f.encounter " .
487 "WHERE po.patient_id = ? " .
488 "ORDER BY po.date_ordered DESC, po.procedure_order_id DESC",
491 while ($row = sqlFetchArray($res)) {
492 $poid = $row['procedure_order_id'];
494 echo " <td class='text text-center'>" .
495 "<input type='checkbox' name='procedures[]' value='" . attr($poid) . "' /> </td>\n";
496 echo " <td class='text'>" . text(oeFormatShortDate($row['date_ordered'])) . " </td>\n";
497 echo " <td class='text'>" . text(oeFormatShortDate($row['date'])) . " </td>\n";
498 echo " <td class='text'>";
499 $opres = sqlStatement(
500 "SELECT procedure_code, procedure_name FROM procedure_order_code " .
501 "WHERE procedure_order_id = ? ORDER BY procedure_order_seq",
504 while ($oprow = sqlFetchArray($opres)) {
505 $tmp = $oprow['procedure_name'];
507 $tmp = $oprow['procedure_code'];
509 echo text($tmp) . "<br />";
518 <button type
="button" class="genreport btn btn-primary btn-save btn-sm" value
="<?php echo xla('Generate Report'); ?>" ><?php
echo xlt('Generate Report'); ?
></button
>
519 <button type
="button" class="genpdfrep btn btn-primary btn-download btn-sm" value
="<?php echo xla('Download PDF'); ?>" ><?php
echo xlt('Download PDF'); ?
></button
>
523 <span
class="font-weight-bold oe-report-section-header"><?php
echo xlt('Documents'); ?
>:</span
><br
/>
526 // show available documents
527 $db = $GLOBALS['adodb']['db'];
528 $sql = "SELECT d.id, d.url, d.name as document_name, c.name, c.aco_spec FROM documents AS d " .
529 "LEFT JOIN categories_to_documents AS ctd ON d.id=ctd.document_id " .
530 "LEFT JOIN categories AS c ON c.id = ctd.category_id WHERE " .
531 "d.foreign_id = ? AND d.deleted = 0";
532 $result = $db->Execute($sql, array($pid));
533 if ($db->ErrorMsg()) {
534 echo $db->ErrorMsg();
536 while ($result && !$result->EOF
) {
537 if (empty($result->fields
['aco_spec']) || AclMain
::aclCheckAcoSpec($result->fields
['aco_spec'])) {
538 echo "<li class='font-weight-bold'>";
539 echo '<input type="checkbox" name="documents[]" value="' .
540 attr($result->fields
['id']) . '">';
541 echo ' <i>' . text(xl_document_category($result->fields
['name'])) . "</i>";
542 echo ' ' . xlt('Name') . ': <i>' . text($result->fields
['document_name']) . '-' . text($result->fields
['id']) . "</i>";
549 <button type
="button" class="genreport btn btn-primary btn-save btn-sm" value
="<?php echo xla('Generate Report'); ?>" ><?php
echo xlt('Generate Report'); ?
></button
>
550 <button type
="button" class="genpdfrep btn btn-primary btn-download btn-sm" value
="<?php echo xla('Download PDF'); ?>" ><?php
echo xlt('Download PDF'); ?
></button
>
553 </div
> <!-- close patient_reports DIV
-->
554 </div
><!--end of container div
-->
555 <?php
$oemr_ui->oeBelowContainerDiv();?
>
559 // jQuery stuff to make the page a little easier to use
561 $
('.datepicker').datetimepicker({
562 <?php
$datetimepicker_timepicker = false; ?
>
563 <?php
$datetimepicker_showseconds = false; ?
>
564 <?php
$datetimepicker_formatInput = false; ?
>
565 <?php
require($GLOBALS['srcdir'] . '/js/xl/jquery-datetimepicker-2-5-4.js.php'); ?
>
566 <?php
// can add any additional javascript settings to datetimepicker here; need to prepend first setting with a comma ?>
569 $
(".genreport").click(function() { top
.restoreSession(); document
.report_form
.pdf
.value
= 0; $
("#report_form").submit(); });
570 $
(".genpdfrep").click(function() { top
.restoreSession(); document
.report_form
.pdf
.value
= 1; $
("#report_form").submit(); });
571 $
(".genportal").click(function() { top
.restoreSession(); document
.report_form
.pdf
.value
= 2; $
("#report_form").submit(); });
572 $
("#genfullreport").click(function() { location
.href
='<?php echo "$rootdir/patient_file/encounter/" . ($returnurl ?? ''); ?>'; });
573 //$("#printform").click(function() { PrintForm(); });
574 $
(".issuecheckbox").click(function() { issueClick(this
); });
576 // check/uncheck all Forms of an encounter
577 $
(".encounter").click(function() { SelectForms($
(this
)); });
579 $
(".generateCCR").click(function() {
580 if(document
.getElementById('show_date').checked
== true){
581 if(document
.getElementById('Start').value
== '' || document
.getElementById('End').value
== ''){
582 alert(<?php
echo xlj('Please select a start date and end date') ?
>);
586 var ccrAction
= document
.getElementsByName('ccrAction');
587 ccrAction
[0].value
= 'generate';
588 var raw
= document
.getElementsByName('raw');
590 top
.restoreSession();
591 ccr_form
.setAttribute("target", "_blank");
592 $
("#ccr_form").submit();
593 ccr_form
.setAttribute("target", "");
595 $
(".generateCCR_raw").click(function() {
596 var ccrAction
= document
.getElementsByName('ccrAction');
597 ccrAction
[0].value
= 'generate';
598 var raw
= document
.getElementsByName('raw');
599 raw
[0].value
= 'yes';
600 top
.restoreSession();
601 ccr_form
.setAttribute("target", "_blank");
602 $
("#ccr_form").submit();
603 ccr_form
.setAttribute("target", "");
605 $
(".generateCCR_download_h").click(function() {
606 var ccrAction
= document
.getElementsByName('ccrAction');
607 ccrAction
[0].value
= 'generate';
608 var raw
= document
.getElementsByName('raw');
609 raw
[0].value
= 'hybrid';
610 top
.restoreSession();
611 $
("#ccr_form").submit();
613 $
(".generateCCR_download_p").click(function() {
614 if(document
.getElementById('show_date').checked
== true){
615 if(document
.getElementById('Start').value
== '' || document
.getElementById('End').value
== ''){
616 alert(<?php
echo xlj('Please select a start date and end date'); ?
>);
620 var ccrAction
= document
.getElementsByName('ccrAction');
621 ccrAction
[0].value
= 'generate';
622 var raw
= document
.getElementsByName('raw');
623 raw
[0].value
= 'pure';
624 top
.restoreSession();
625 $
("#ccr_form").submit();
627 $
(".viewNewCCD").click(function() {
628 // there's a lot of ways to do this but for now, we'll go with this!
629 top
.restoreSession();
630 let url
= './../../../ccdaservice/ccda_gateway.php?action=report_ccd_view&csrf_token_form=' +
631 encodeURIComponent("<?php echo CsrfUtils::collectCsrfToken() ?>");
633 credentials
: 'same-origin',
636 .then(response
=> response
.text())
638 let view
= window
.open('about:blank', '_blank');
639 view
.document
.write(response
);
640 view
.document
.close();
644 $
(".viewCCD").click(function() {
645 var ccrAction
= document
.getElementsByName('ccrAction');
646 ccrAction
[0].value
= 'viewccd';
647 var raw
= document
.getElementsByName('raw');
649 top
.restoreSession();
650 ccr_form
.setAttribute("target", "_blank");
651 $
("#ccr_form").submit();
652 ccr_form
.setAttribute("target", "");
654 $
(".viewCCD_raw").click(function() {
655 var ccrAction
= document
.getElementsByName('ccrAction');
656 ccrAction
[0].value
= 'viewccd';
657 var raw
= document
.getElementsByName('raw');
658 raw
[0].value
= 'yes';
659 top
.restoreSession();
660 ccr_form
.setAttribute("target", "_blank");
661 $
("#ccr_form").submit();
662 ccr_form
.setAttribute("target", "");
664 $
(".viewCCD_download").click(function() {
665 var ccrAction
= document
.getElementsByName('ccrAction');
666 ccrAction
[0].value
= 'viewccd';
667 var raw
= document
.getElementsByName('raw');
668 raw
[0].value
= 'pure';
669 $
("#ccr_form").submit();
672 <?php
if ($GLOBALS['phimail_enable'] == true && $GLOBALS['phimail_ccr_enable'] == true) { ?
>
673 $
(".viewCCR_send_dialog").click(function() {
674 $
("#ccr_send_dialog").toggle();
676 $
(".viewCCR_transmit").click(function() {
677 $
(".viewCCR_transmit").attr('disabled','disabled');
678 var ccrAction
= document
.getElementsByName('ccrAction');
679 ccrAction
[0].value
= 'generate';
680 var ccrRecipient
= $
("#ccr_send_to").val();
681 var raw
= document
.getElementsByName('raw');
682 raw
[0].value
= 'send '+ccrRecipient
;
683 if(ccrRecipient
=="") {
684 $
("#ccr_send_message").html(<?php
685 echo xlj('Please enter a valid Direct Address above.'); ?
>);
686 $
("#ccr_send_result").show();
688 $
(".viewCCR_transmit").attr('disabled','disabled');
689 $
("#ccr_send_message").html(<?php
690 echo xlj('Working... this may take a minute.'); ?
>);
691 $
("#ccr_send_result").show();
692 var action
=$
("#ccr_form").attr('action');
695 ccrAction
:'generate',
696 raw
:'send '+ccrRecipient
,
700 if(data
=="SUCCESS") {
701 $
("#ccr_send_message").html(<?php
702 echo xlj('Your message was submitted for delivery to');
703 ?
>+
" " + ccrRecipient
);
704 $
("#ccr_send_to").val("");
706 $
("#ccr_send_message").html(data
);
708 $
(".viewCCR_transmit").removeAttr('disabled');
714 if ($GLOBALS['phimail_enable'] == true && $GLOBALS['phimail_ccd_enable'] == true) { ?
>
715 $
(".viewCCD_send_dialog").click(function() {
716 $
("#ccd_send_dialog").toggle();
718 $
(".viewCCD_transmit").click(function() {
719 $
(".viewCCD_transmit").attr('disabled','disabled');
720 var ccrAction
= document
.getElementsByName('ccrAction');
721 ccrAction
[0].value
= 'viewccd';
722 var ccdRecipient
= $
("#ccd_send_to").val();
723 var raw
= document
.getElementsByName('raw');
724 raw
[0].value
= 'send '+ccdRecipient
;
725 if(ccdRecipient
=="") {
726 $
("#ccd_send_message").html(<?php
727 echo xlj('Please enter a valid Direct Address above.'); ?
>);
728 $
("#ccd_send_result").show();
730 $
(".viewCCD_transmit").attr('disabled','disabled');
731 $
("#ccd_send_message").html(<?php
732 echo xlj('Working... this may take a minute.'); ?
>);
733 $
("#ccd_send_result").show();
734 var action
=$
("#ccr_form").attr('action');
738 raw
:'send '+ccdRecipient
,
742 if(data
=="SUCCESS") {
743 $
("#ccd_send_message").html(<?php
744 echo xlj('Your message was submitted for delivery to');
745 ?
> +
" " + ccdRecipient
);
746 $
("#ccd_send_to").val("");
748 $
("#ccd_send_message").html(data
);
750 $
(".viewCCD_transmit").removeAttr('disabled');
758 $eventDispatcher->dispatch(new GenericEvent(), PatientReportEvent
::JAVASCRIPT_READY_POST
);
764 // select/deselect the Forms related to the selected Encounter
765 // (it ain't pretty code folks)
766 var SelectForms
= function (selectedEncounter
) {
767 if ($
(selectedEncounter
).prop("checked")) {
768 $
(selectedEncounter
).parent().children().each(function(i
, obj
) {
769 $
(this
).children().each(function(i
, obj
) {
770 $
(this
).prop("checked", true);
775 $
(selectedEncounter
).parent().children().each(function(i
, obj
) {
776 $
(this
).children().each(function(i
, obj
) {
777 $
(this
).prop("checked", false);
783 // When an issue is checked, auto-check all the related encounters and forms
784 function issueClick(issue
) {
785 // do nothing when unchecked
786 if (! $
(issue
).prop("checked")) return;
788 $
("#report_form :checkbox").each(function(i
, obj
) {
789 if ($
(issue
).val().indexOf('/' + $
(this
).val() +
'/') >= 0) {
790 $
(this
).attr("checked", "checked");
795 var listId
= '#' +
<?php
echo js_escape($list_id); ?
>;
797 $
(listId
).addClass("active");