immun updates (#4145)
[openemr.git] / interface / reports / external_data.php
blob7794e9f566c79f135a98c1835cfdd9ec49132541
1 <?php
3 /**
4 * external_data.php
6 * @package OpenEMR
7 * @link http://www.open-emr.org
8 * @author Jacob T Paul <jacob@zhservices.com>
9 * @author Vinish K <vinish@zhservices.com>
10 * @author Brady Miller <brady.g.miller@gmail.com>
11 * @copyright Copyright (c) 2015 Z&H Consultancy Services Private Limited <sam@zhservices.com>
12 * @copyright Copyright (c) 2018 Brady Miller <brady.g.miller@gmail.com>
13 * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
16 require_once("../globals.php");
17 require_once("$srcdir/patient.inc");
18 require_once "$srcdir/options.inc.php";
20 use OpenEMR\Core\Header;
21 use OpenEMR\Menu\PatientMenuRole;
22 use OpenEMR\OeUI\OemrUI;
24 $records1 = array();
25 $records2 = array();
27 <html>
28 <head>
29 <?php Header::setupHeader();?>
30 <title><?php echo xlt('External Data'); ?></title>
31 <script><?php require_once("$include_root/patient_file/erx_patient_portal_js.php"); // jQuery for popups for eRx and patient portal ?></script>
32 <?php
33 $arrOeUiSettings = array(
34 'heading_title' => xl('External Data'),
35 'include_patient_name' => true,
36 'expandable' => false,
37 'expandable_files' => array("external_data_patient_xpd", "stats_full_patient_xpd", "patient_ledger_patient_xpd"),//all file names need suffix _xpd
38 'action' => "",//conceal, reveal, search, reset, link or back
39 'action_title' => "",
40 'action_href' => "",//only for actions - reset, link or back
41 'show_help_icon' => false,
42 'help_file_name' => "external_data_dashboard_help.php"
44 $oemr_ui = new OemrUI($arrOeUiSettings);
46 </head>
47 <body>
48 <div id="container_div" class="<?php echo $oemr_ui->oeContainer();?> mt-3">
49 <div class="row">
50 <div class="col-sm-12">
51 <?php
52 require_once("$include_root/patient_file/summary/dashboard_header.php")
54 </div>
55 </div>
56 <?php
57 $list_id = "external_data"; // to indicate nav item is active, count and give correct id
58 // Collect the patient menu then build it
59 $menuPatient = new PatientMenuRole();
60 $menuPatient->displayHorizNavBarMenu();
62 <div class="row mt-3">
63 <div class="col-sm-12">
64 <ul class="nav nav-pills">
65 <li class="nav-item" id="btnEncounters">
66 <a href="#" class="nav-link font-weight-bold active"><?php echo xlt('Encounters'); ?></a>
67 </li>
68 <li class="nav-item" id="btnProcedures">
69 <a href="#" class="nav-link font-weight-bold"><?php echo xlt('Procedures'); ?></a>
70 </li>
71 </ul>
72 </div>
73 <div class="col-sm-12 mt-3">
74 <div class="table-responsive jumbotron py-4" id="encounters">
75 <table class="table">
76 <tr>
77 <td><?php echo xlt('Date'); ?></td>
78 <td><?php echo xlt('Diagnosis'); ?></td>
79 <td><?php echo xlt('Provider'); ?></td>
80 <td><?php echo xlt('Facility'); ?></td>
81 </tr>
82 <?php
83 $query1 = "SELECT ee.*,CONCAT_WS(' ',u1.lname, u1.fname) AS provider,u2.organization AS facility
84 FROM external_encounters AS ee
85 LEFT JOIN users AS u1 ON u1.id = ee.ee_provider_id
86 LEFT JOIN users AS u2 ON u2.id = ee.ee_facility_id
87 WHERE ee.ee_pid = ?";
88 $res1 = sqlStatement($query1, array($pid));
89 while ($row1 = sqlFetchArray($res1)) {
90 $records1[] = $row1;
93 foreach ($records1 as $value1) {
95 <tr>
96 <td><?php echo text(oeFormatShortDate($value1['ee_date'])); ?></td>
97 <td><?php echo text($value1['ee_encounter_diagnosis']); ?></td>
98 <td><?php echo text($value1['provider']); ?></td>
99 <td><?php echo text($value1['facility']); ?></td>
100 </tr>
101 <?php
102 } ?>
103 </table>
104 <?php if (empty($records1)) { ?>
105 <p class="text-center">
106 <?php echo xlt('Nothing to display'); ?>
107 </p>
108 <?php } ?>
109 </div>
110 <div class="table-responsive jumbotron py-4" id="procedures">
111 <table class="table">
112 <tr>
113 <td><?php echo xlt('Date'); ?></td>
114 <td><?php echo xlt('Code'); ?></td>
115 <td><?php echo xlt('Code Text'); ?></td>
116 <td><?php echo xlt('Facility'); ?></td>
117 </tr>
118 <?php
119 $query2 = "SELECT ep.*,u.organization AS facility
120 FROM external_procedures AS ep
121 LEFT JOIN users AS u ON u.id = ep.ep_facility_id
122 WHERE ep.ep_pid = ?";
123 $res2 = sqlStatement($query2, array($pid));
124 while ($row2 = sqlFetchArray($res2)) {
125 $records2[] = $row2;
128 foreach ($records2 as $value2) { ?>
129 <tr>
130 <td><?php echo text(oeFormatShortDate($value2['ep_date'])); ?></td>
131 <td><?php echo text($value2['ep_code_type'] . ':' . $value2['ep_code']); ?></td>
132 <td><?php echo text($value2['ep_code_text']); ?></td>
133 <td><?php echo text($value2['facility']); ?></td>
134 </tr>
135 <?php
136 } ?>
137 </table>
138 <?php if (empty($records2)) { ?>
139 <p class="text-center">
140 <?php echo xlt('Nothing to display'); ?>
141 </p>
142 <?php } ?>
143 </div>
144 </div>
145 </div>
146 </div><!--end of container div-->
147 <?php $oemr_ui->oeBelowContainerDiv();?>
148 <script>
149 var listId = '#' + <?php echo js_escape($list_id); ?>;
150 $(function () {
151 $(listId).addClass("active");
154 $(function() {
155 $('.nav-link').click(function() {
156 $('.nav-link').removeClass("active");
157 $(this).addClass("active");
160 $('#btnEncounters').click(function() {
161 $('#encounters').show();
162 $('#procedures').hide();
165 $('#btnProcedures').click(function() {
166 $('#procedures').show();
167 $('#encounters').hide();
170 $('#encounters').hide();
171 </script>
172 </body>
173 </html>