Feat openemr fix 7480 7494 email prescription (#7495)
[openemr.git] / interface / reports / external_data.php
blob5bcee6c17a4b9e4ee46ff1f1fe1818065af498c7
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.php");
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' => true,
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" id="pill-list" role="tablist">
65 <li class="nav-item" role="presention">
66 <a href="#encounters" id="pills-encounters-tab" class="nav-link active" data-toggle="pill" type="button" role="tab" aria-controls="pills-encounters-tab" aria-selected="true"><?php echo xlt('Encounters'); ?></a>
67 </li>
68 <li class="nav-item" role="presentation">
69 <a href="#procedures" id="pills-procedures-tab" class="nav-link" data-toggle="pill" type="button" role="tab" aria-controls="pills-procedures-tab" aria-selected="false"><?php echo xlt('Procedures'); ?></a>
70 </li>
71 </ul>
72 </div>
73 <div class="col-sm-12 mt-3">
74 <div class="tab-content" id="pills-tabContent">
75 <div class="tab-pane active" id="encounters" role="tabpanel" aria-labelledby="encounters-tab">
76 <div class="table-responsive">
77 <?php
78 $query1 = "SELECT ee.*,CONCAT_WS(' ',u1.lname, u1.fname) AS provider,u2.organization AS facility
79 FROM external_encounters AS ee
80 LEFT JOIN users AS u1 ON u1.id = ee.ee_provider_id
81 LEFT JOIN users AS u2 ON u2.id = ee.ee_facility_id
82 WHERE ee.ee_pid = ?";
83 $res1 = sqlStatement($query1, array($pid));
84 while ($row1 = sqlFetchArray($res1)) {
85 $records1[] = $row1;
89 <?php if (count($records1) > 0) : ?>
90 <table class="table table-sm">
91 <thead>
92 <tr>
93 <th><?php echo xlt('Date'); ?></th>
94 <th><?php echo xlt('Diagnosis'); ?></th>
95 <th><?php echo xlt('Provider'); ?></th>
96 <th><?php echo xlt('Facility'); ?></th>
97 </tr>
98 </thead>
99 <tbody>
100 <?php
101 foreach ($records1 as $value1) : ?>
102 <tr>
103 <td><?php echo text(oeFormatShortDate($value1['ee_date'])); ?></td>
104 <td><?php echo text($value1['ee_encounter_diagnosis']); ?></td>
105 <td><?php echo text($value1['provider']); ?></td>
106 <td><?php echo text($value1['facility']); ?></td>
107 </tr>
108 <?php endforeach; ?>
109 </tbody>
110 </table>
111 <?php else : ?>
112 <p class="text-center">
113 <?php echo xlt('No External Encounters'); ?>
114 </p>
115 <?php endif; ?>
116 </div>
117 </div>
118 <div class="tab-pane" id="procedures" role="tabpanel" aria-labelledby="proccedures-tab">
119 <div class="table-responsive">
120 <?php
121 $query2 = "SELECT ep.*,u.organization AS facility FROM external_procedures AS ep LEFT JOIN users AS u ON u.id = ep.ep_facility_id WHERE ep.ep_pid = ?";
122 $res2 = sqlStatement($query2, array($pid));
123 while ($row2 = sqlFetchArray($res2)) {
124 $records2[] = $row2;
127 <?php if (count($records2) > 0) : ?>
128 <table class="table table-sm">
129 <thead>
130 <tr>
131 <th><?php echo xlt('Date'); ?></th>
132 <th><?php echo xlt('Code'); ?></th>
133 <th><?php echo xlt('Code Text'); ?></th>
134 <th><?php echo xlt('Facility'); ?></th>
135 </tr>
136 </thead>
137 <tbody>
138 <?php
139 foreach ($records2 as $value2) : ?>
140 <tr>
141 <td><?php echo text(oeFormatShortDate($value2['ep_date'])); ?></td>
142 <td><?php echo text($value2['ep_code_type'] . ':' . $value2['ep_code']); ?></td>
143 <td><?php echo text($value2['ep_code_text']); ?></td>
144 <td><?php echo text($value2['facility']); ?></td>
145 </tr>
146 <?php endforeach; ?>
147 </tbody>
148 </table>
149 <?php else : ?>
150 <p class="text-center">
151 <?php echo xlt('No External Procedures'); ?>
152 </p>
153 <?php endif; ?>
154 </div>
155 </div>
156 </div>
157 </div>
158 </div>
159 </div><!--end of container div-->
160 <?php $oemr_ui->oeBelowContainerDiv();?>
161 </body>
162 </html>