4 * Maintenance for the list of procedure providers.
7 * @link http://www.open-emr.org
8 * @author Rod Roark <rod@sunsetsystems.com>
9 * @author Brady Miller <brady.g.miller@gmail.com>
10 * @copyright Copyright (c) 2012-2014 Rod Roark <rod@sunsetsystems.com>
11 * @copyright Copyright (c) 2019 Brady Miller <brady.g.miller@gmail.com>
12 * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
15 require_once("../globals.php");
16 require_once("$srcdir/options.inc.php");
18 use OpenEMR\Common\Acl\AclMain
;
19 use OpenEMR\Common\Csrf\CsrfUtils
;
20 use OpenEMR\Common\Twig\TwigContainer
;
21 use OpenEMR\Core\Header
;
24 if (!CsrfUtils
::verifyCsrfToken($_GET["csrf_token_form"])) {
25 CsrfUtils
::csrfNotVerified();
30 if (!CsrfUtils
::verifyCsrfToken($_POST["csrf_token_form"])) {
31 CsrfUtils
::csrfNotVerified();
35 if (!AclMain
::aclCheckCore('admin', 'users')) {
36 echo (new TwigContainer(null, $GLOBALS['kernel']))->getTwig()->render('core/unauthorized.html.twig', ['pageTitle' => xl("Edit/Add Procedure Provider")]);
40 // Collect user id if editing entry
41 $ppid = $_REQUEST['ppid'];
45 function invalue($name)
47 $fld = add_escape_custom(trim($_POST[$name]));
51 function onvalue($name)
53 $fld = ($_POST[$name] == 'on') ?
'1' : '0';
60 <?php Header
::setupHeader(['opener']);?
>
61 <title
><?php
echo $ppid ?
xlt('Edit') : xlt('Add New{{Provider}}') ?
> <?php
echo xlt('Procedure Provider'); ?
></title
>
73 font
-family
:sans
-serif
;
82 .label
-div
:hover
> a
{
85 /* This is overridden on any theme */
90 margin
: 10px
15px
0 15px
;
92 div
[id$
="_info"] > a
{
100 <div
class="container-fluid">
102 // If we are saving, then save and close the window.
103 // lab_director is the id of the organization in the users table
105 if (!empty($_POST['form_save'])) {
106 $org_qry = "SELECT organization FROM users WHERE id = ?";
107 $org_res = sqlQuery($org_qry, array($_POST['form_name']));
108 $org_name = $org_res['organization'];
110 "name = '" . add_escape_custom($org_name) . "', " .
111 "lab_director = " . invalue('form_name') . ", " .
112 "npi = " . invalue('form_npi') . ", " .
113 "send_app_id = " . invalue('form_send_app_id') . ", " .
114 "send_fac_id = " . invalue('form_send_fac_id') . ", " .
115 "recv_app_id = " . invalue('form_recv_app_id') . ", " .
116 "recv_fac_id = " . invalue('form_recv_fac_id') . ", " .
117 "DorP = " . invalue('form_DorP') . ", " .
118 "direction = " . invalue('form_direction') . ", " .
119 "protocol = " . invalue('form_protocol') . ", " .
120 "remote_host = " . invalue('form_remote_host') . ", " .
121 "login = " . invalue('form_login') . ", " .
122 "password = " . invalue('form_password') . ", " .
123 "orders_path = " . invalue('form_orders_path') . ", " .
124 "results_path = " . invalue('form_results_path') . ", " .
125 "notes = " . invalue('form_notes') . ", " .
126 "active = " . onvalue('form_active');
129 $query = "UPDATE procedure_providers SET $sets " .
130 "WHERE ppid = '" . add_escape_custom($ppid) . "'";
131 sqlStatement($query);
133 $ppid = sqlInsert("INSERT INTO `procedure_providers` SET $sets");
135 } elseif (!empty($_POST['form_delete'])) {
137 sqlStatement("DELETE FROM procedure_providers WHERE ppid = ?", array($ppid));
141 if (!empty($_POST['form_save']) ||
!empty($_POST['form_delete'])) {
142 // Close this window and redisplay the updated list.
145 echo " alert(" . js_escape($info_msg) . ");\n";
148 echo " window.close();\n";
149 echo " if (opener.refreshme) opener.refreshme();\n";
150 echo "</script></body></html>\n";
155 $row = sqlQuery("SELECT * FROM procedure_providers WHERE ppid = ?", array($ppid));
158 $ppid_active = $row['active'] ??
null;
160 $org_query = "SELECT id, organization FROM users WHERE abook_type LIKE 'ord_%'";
161 $org_res = sqlStatement($org_query);
163 while ($org_row = sqlFetchArray($org_res)) {
164 $org_name = $org_row['organization'];
167 if ($row['lab_director'] == $org_row['id']) {
168 $selected = "selected";
169 $optionsStr .= "<option value='" . attr($org_row['id']) . "' $selected>" . text($org_name) . "</option>";
172 $checkName = sqlQuery("SELECT `name` FROM `procedure_providers` WHERE `name` = ?", [$org_name]);
173 if (empty($checkName['name'])) {
174 $optionsStr .= "<option value='" . attr($org_row['id']) . "' $selected>" . text($org_name) . "</option>";
179 <div
class="page-header" name
="form_legend" id
="form_legend">
180 <h4
><?php
echo xlt('Enter Provider Details'); ?
><i id
="enter-details-tooltip" class="fa fa-info-circle oe-text-black oe-superscript ml-2" aria
-hidden
="true"></i
></h4
>
183 <div
class="col-sm-12">
184 <form method
='post' name
='theform' action
="procedure_provider_edit.php?ppid=<?php echo attr_url($ppid); ?>&csrf_token_form=<?php echo attr_url(CsrfUtils::collectCsrfToken()); ?>">
185 <input type
="hidden" name
="csrf_token_form" value
="<?php echo attr(CsrfUtils::collectCsrfToken()); ?>" />
186 <div
class="form-check-inline">
187 <label
class='form-check-label mr-2' for="form_active"><?php
echo xlt('Active'); ?
></label
>
188 <input type
='checkbox' class='form-check-input' name
='form_active' id
='form_active'
190 echo !empty($ppid_active) ?
" checked" : "";
195 <div
class="row mt-3">
197 <div
class="col-sm-6">
198 <div
class="clearfix">
199 <div
class="label-div">
200 <label
for="form_name"><?php
echo xlt('Name'); ?
>:</label
><a href
="#name_info" class="info-anchor icon-tooltip" data
-toggle
="collapse"><i
class="fa fa-question-circle" aria
-hidden
="true"></i
></a
>
202 <select name
='form_name' id
='form_name' class='form-control'>
203 <?php
echo $optionsStr ??
''; ?
>
206 <div id
="name_info" class="collapse">
207 <a href
="#name_info" data
-toggle
="collapse" class="oe-pull-away"><i
class="fa fa-times oe-help-x" aria
-hidden
="true"></i
></a
>
208 <p
><?php
echo xlt("Name - Select a provider name from the drop-down list"); ?
></p
>
209 <p
><?php
echo xlt("For the name to appear on the drop-down list it must be first entered in Administration > Address Book "); ?
></p
>
210 <p
><?php
echo xlt("Select Lab Service in the Type drop-down box and enter a name under organization"); ?
></p
>
211 <p
><?php
echo xlt("For detailed instructions close the 'Enter Provider Details' popup and click on the Help icon on the main form. "); ?
><i
class="fa fa-question-circle" aria
-hidden
="true"></i
></p
>
214 <div
class="col-sm-6">
215 <div
class="clearfix">
216 <div
class="label-div">
217 <label
class="col-form-label" for="form_npi"><?php
echo xlt('NPI'); ?
>:</label
> <a href
="#npi_info" class="info-anchor icon-tooltip" data
-toggle
="collapse"><i
class="fa fa-question-circle" aria
-hidden
="true"></i
></a
>
219 <input type
='text' name
='form_npi' id
='form_npi' maxlength
='10' value
='<?php echo attr($row['npi
'] ?? ''); ?>' class='form-control' />
221 <div id
="npi_info" class="collapse">
222 <a href
="#npi_info" data
-toggle
="collapse" class="oe-pull-away"><i
class="fa fa-times oe-help-x" aria
-hidden
="true"></i
></a
>
223 <p
><?php
echo xlt("NPI - Enter the Provider's unique 10-digit National Provider Identifier or NPI identification number"); ?
></p
>
224 <p
><?php
echo xlt("It is issued to health care providers in the United States by the Centers for Medicare and Medicaid Services (CMS)"); ?
></p
>
225 <p
><?php
echo xlt("This has to entered once in this form"); ?
></p
>
226 <p
><?php
echo xlt("IMPORTANT: The NPI number also exists in the Address Book entry for the provider, take care to enter the correct NPI number"); ?
></p
>
231 <div
class="row mt-3">
233 <div
class="clearfix">
234 <div
class="col-sm-12 label-div">
235 <label
class="col-form-label" for="form_DorP"><?php
echo xlt('Usage'); ?
>:</label
> <a href
="#usage_info" class="info-anchor icon-tooltip" data
-toggle
="collapse"><i
class="fa fa-question-circle" aria
-hidden
="true"></i
></a
>
237 <div
class="col-sm-6">
238 <select name
='form_DorP' id
='form_DorP' class='form-control' title
='<?php echo xla('HL7
- MSH
-11 - Processing ID
'); ?>'>
242 'D' => xl('Debugging'),
243 'P' => xl('Production'),
244 'T' => xl('Quest Cert Testing'),
245 'Q' => xl('Quest Cert Debug'),
248 echo " <option value='" . attr($key) . "'";
249 if (!empty($row['DorP']) && ($key == $row['DorP'])) {
252 echo ">" . text($value) . "</option>\n";
258 <div id
="usage_info" class="collapse">
259 <a href
="#usage_info" data
-toggle
="collapse" class="oe-pull-away"><i
class="fa fa-times oe-help-x" aria
-hidden
="true"></i
></a
>
260 <p
><?php
echo xlt("Usage - is only required if you are submitting an electronic order to an external facility"); ?
></p
>
261 <p
><?php
echo xlt("It is a field in the HL7 Message header known as Processing ID"); ?
></p
>
262 <p
><?php
echo xlt("Health Level-7 or HL7 refers to a set of international standards for transfer of clinical and administrative data between software applications used by various healthcare providers"); ?
></p
>
263 <p
><?php
echo xlt("This field is used to decide whether to process the message as defined in HL7 Application (level 7) Processing rules"); ?
></p
>
264 <p
><?php
echo xlt("Select the appropriate choice - Debugging or Production"); ?
></p
>
268 <div
class="row mt-3">
270 <div
class="clearfix">
271 <div
class="col-sm-12 label-div">
272 <label
class="col-form-label" for="form_send_app_id"><?php
echo xlt('Sender IDs'); ?
>:</label
>
273 <a href
="#sender_id_info" class="info-anchor icon-tooltip" data
-toggle
="collapse"><i
class="fa fa-question-circle" aria
-hidden
="true"></i
></a
>
275 <div
class="row col-12">
276 <div
class="col-sm-6">
277 <input type
='text' name
='form_send_app_id' id
='form_send_app_id' maxlength
='100'
278 value
='<?php echo attr($row['send_app_id
'] ?? ''); ?>'
279 title
='<?php echo xla('HL7
- MSH
-3.1 - Sending application
'); ?>'
280 placeholder
='<?php echo xla('Enter Application Name
'); ?>'
281 class='form-control' />
283 <div
class="col-sm-6">
284 <input type
='text' name
='form_send_fac_id' id
='form_send_fac_id' maxlength
='100'
285 value
='<?php echo attr($row['send_fac_id
'] ?? ''); ?>'
286 title
='<?php echo xla('HL7
- MSH
-4.1 - Sending facility
'); ?>'
287 placeholder
='<?php echo xla('Enter Facility Name
'); ?>'
288 class='form-control' />
292 <div id
="sender_id_info" class="collapse">
293 <a href
="#sender_id_info" data
-toggle
="collapse" class="oe-pull-away"><i
class="fa fa-times oe-help-x" aria
-hidden
="true"></i
></a
>
294 <p
><?php
echo xlt("Sender IDs - is only required if you are submitting an electronic order to an external facility"); ?
></p
>
295 <p
><?php
echo xlt("It consists of two parts - the Sending application and Sending facility"); ?
></p
>
296 <p
><?php
echo xlt("These are used to populate fields 3 and 4 in the HL7 MSH - message header"); ?
></p
>
297 <p
><?php
echo xlt("Sending application name will be provided by the facility that you will be connecting to"); ?
></p
>
298 <p
><?php
echo xlt("Sending facility name is user defined"); ?
></p
>
302 <div
class="row mt-3">
304 <div
class="clearfix">
305 <div
class="col-sm-12 label-div">
306 <label
class="col-form-label" for="form_recv_app_id"><?php
echo xlt('Receiver IDs'); ?
>:</label
>
307 <a href
="#receiver_id_info" class="info-anchor icon-tooltip" data
-toggle
="collapse"><i
class="fa fa-question-circle" aria
-hidden
="true"></i
></a
>
309 <div
class="row col-12">
310 <div
class="col-sm-6">
311 <input type
='text' name
='form_recv_app_id' id
='form_recv_app_id' maxlength
='100' value
='<?php echo attr($row['recv_app_id
'] ?? ''); ?>' title
='<?php echo xla('HL7
- MSH
-5.1 - Receiving application
'); ?>' placeholder
='<?php echo xla('Enter Application Name
'); ?>' class='form-control' />
313 <div
class="col-sm-6">
314 <input type
='text' name
='form_recv_fac_id' id
='form_recv_fac_id' maxlength
='100' value
='<?php echo attr($row['recv_fac_id
'] ?? ''); ?>' title
='<?php echo xla('HL7
- MSH
-6.1 - Receiving facility
'); ?>' placeholder
='<?php echo xla('Enter Facility Name
'); ?>' class='form-control' />
318 <div id
="receiver_id_info" class="collapse">
319 <a href
="#receiver_id_info" data
-toggle
="collapse" class="oe-pull-away"><i
class="fa fa-times oe-help-x" aria
-hidden
="true"></i
></a
>
320 <p
><?php
echo xlt("Receiver IDs - is only required if you are submitting an electronic order to an external facility"); ?
></p
>
321 <p
><?php
echo xlt("It consists of two parts - the Receiving application and Receiving facility"); ?
></p
>
322 <p
><?php
echo xlt("These are used to populate fields 5 and 6 in the HL7 MSH - message header"); ?
></p
>
323 <p
><?php
echo xlt("They will be provided by the facility that you will be connecting to"); ?
></p
>
327 <div
class="row mt-3">
329 <div
class="clearfix">
330 <div
class="col-sm-12 label-div">
331 <label
for="form_protocol"><?php
echo xlt('Protocol'); ?
>:</label
> <a href
="#protocol_info" class="info-anchor icon-tooltip" data
-toggle
="collapse"><i
class="fa fa-question-circle" aria
-hidden
="true"></i
></a
>
333 <div
class="row col-12">
334 <div
class="col-sm-6">
335 <select name
='form_protocol' id
='form_protocol' class='form-control'>
339 // Add to this list as more protocols are supported.
340 'DL' => xl('Download'),
341 'SFTP' => xl('SFTP'),
342 'FS' => xl('Local Filesystem'),
343 'WS' => xl('Web Service'),
346 echo " <option value='" . attr($key) . "'";
347 if (!empty($row['protocol']) && ($key == $row['protocol'])) {
350 echo ">" . text($value) . "</option>\n";
355 <div
class="col-sm-6">
356 <select name
='form_direction' id
='form_direction' class='form-control'>
360 'B' => xl('Bidirectional'),
361 'R' => xl('Results Only'),
364 echo " <option value='" . attr($key) . "'";
365 if (!empty($row['direction']) && ($key == $row['direction'])) {
369 echo ">" . text($value) . "</option>\n";
376 <div id
="protocol_info" class="collapse">
377 <a href
="#protocol_info" data
-toggle
="collapse" class="oe-pull-away"><i
class="fa fa-times oe-help-x" aria
-hidden
="true"></i
></a
>
378 <p
><?php
echo xlt("Protocol - consists of two parts - the method used to send orders and receive results and whether it is used to receive results only or is used to send orders and receive result i.e. bidirectional"); ?
></p
>
379 <p
><?php
echo xlt("If you do not submit orders electronically or receive result electronically leave it as the default value, Download"); ?
></p
>
380 <p
><?php
echo xlt("Download will download a text file containing the order in the HL7v2.3 message format to the downloads directory of your computer"); ?
></p
>
381 <p
><?php
echo xlt("SFTP will send the order as a HL7v2.3 message to the receiving lab using the SFTP protocol"); ?
></p
>
382 <p
><?php
echo xlt("Secure File Transfer Protocol, or SFTP is a network protocol that provides file access, file transfer, and file management over a secure connection"); ?
></p
>
383 <p
><?php
echo xlt("Local Filesystem will store the order as a HL7v2.3 message in a predefined location in the local server hosting openEMR"); ?
></p
>
384 <p
><?php
echo xlt("Select Bidirectional or Results Only as appropriate, again only used for electronic orders"); ?
></p
>
388 <div
class="row mt-3">
390 <div
class="clearfix">
391 <div
class="col-sm-12 label-div">
392 <label
for="form_login"><?php
echo xlt('Login'); ?
>:</label
> <a href
="#login_info" class="info-anchor icon-tooltip" data
-toggle
="collapse"><i
class="fa fa-question-circle" aria
-hidden
="true"></i
></a
>
394 <div
class="row col-12">
395 <div
class="col-sm-6">
396 <input type
='text' name
='form_login' id
='form_login' maxlength
='255' value
='<?php echo attr($row['login
'] ?? ''); ?>' placeholder
='<?php echo xla('Enter User Login ID
'); ?>' class='form-control' />
398 <div
class="col-sm-6">
399 <input type
='text' name
='form_password' id
='form_password' maxlength
='255' value
='<?php echo attr($row['password
'] ?? ''); ?>' placeholder
='<?php echo xla('Enter Password
'); ?>' class='form-control' />
403 <div id
="login_info" class="collapse">
404 <a href
="#login_info" data
-toggle
="collapse" class="oe-pull-away"><i
class="fa fa-times oe-help-x" aria
-hidden
="true"></i
></a
>
405 <p
><?php
echo xlt("Login - details are only required if you are connecting to a facility using the SFTP protocol "); ?
></p
>
406 <p
><?php
echo xlt("Type in the username and password provided by the facility"); ?
></p
>
410 <div
class="row mt-3">
412 <div
class="clearfix">
413 <div
class="col-sm-12 label-div">
414 <label
class="col-form-label" for="form_remote_host"><?php
echo xlt('Remote Host'); ?
>:</label
> <a href
="#remote_host_info" class="info-anchor icon-tooltip" data
-toggle
="collapse"><i
class="fa fa-question-circle" aria
-hidden
="true"></i
></a
>
416 <div
class="col-sm-12">
417 <input type
='text' name
='form_remote_host' id
='form_remote_host' maxlength
='255' value
='<?php echo attr($row['remote_host
'] ?? ''); ?>' class='form-control' />
420 <div id
="remote_host_info" class="collapse">
421 <a href
="#remote_host_info" data
-toggle
="collapse" class="oe-pull-away"><i
class="fa fa-times oe-help-x" aria
-hidden
="true"></i
></a
>
422 <p
><?php
echo xlt("Remote Host - is only required if you are submitting an electronic order to an external facility or just receiving results from it"); ?
></p
>
423 <p
><?php
echo xlt("Type in the URL of the external facility to which the order will be sent, this will be provided by the facility"); ?
></p
>
427 <div
class="row mt-3">
429 <div
class="clearfix">
430 <div
class="col-sm-12 label-div">
431 <label
class="col-form-label" for="form_orders_path"><?php
echo xlt('Orders Path'); ?
>:</label
> <a href
="#orders_path_info" class="info-anchor icon-tooltip" data
-toggle
="collapse"><i
class="fa fa-question-circle" aria
-hidden
="true"></i
></a
>
433 <div
class="col-sm-12">
434 <input type
='text' name
='form_orders_path' id
='form_orders_path' maxlength
='255'
435 value
='<?php echo attr($row['orders_path
'] ?? ''); ?>' class='form-control' />
438 <div id
="orders_path_info" class="collapse">
439 <a href
="#orders_path_info" data
-toggle
="collapse" class="oe-pull-away"><i
class="fa fa-times oe-help-x" aria
-hidden
="true"></i
></a
>
440 <p
><?php
echo xlt("Orders Path - is only required if you are submitting an electronic order to an external facility"); ?
></p
>
441 <p
><?php
echo xlt("Type in the location of the directory or folder in which the created orders (HL7 messages) will be stored"); ?
></p
>
445 <div
class="row mt-3">
447 <div
class="clearfix">
448 <div
class="col-sm-12 label-div">
449 <label
class="col-form-label" for="form_results_path"><?php
echo xlt('Results Path'); ?
>:</label
>
450 <a href
="#results_path_info" class="info-anchor icon-tooltip" data
-toggle
="collapse"><i
class="fa fa-question-circle" aria
-hidden
="true"></i
></a
>
452 <div
class="col-sm-12">
453 <input type
='text' name
='form_results_path' id
='form_results_path' maxlength
='255'
454 value
='<?php echo attr($row['results_path
'] ?? ''); ?>' class='form-control' />
457 <div id
="results_path_info" class="collapse">
458 <a href
="#results_path_info" data
-toggle
="collapse" class="oe-pull-away"><i
class="fa fa-times oe-help-x" aria
-hidden
="true"></i
></a
>
459 <p
><?php
echo xlt("Results Path - is only required if you are submitting an electronic order to an external facility or just receiving results from it"); ?
></p
>
460 <p
><?php
echo xlt("Type in the location of the directory or folder in which the returned results (HL7 messages) will be stored"); ?
></p
>
464 <div
class="row mt-3">
466 <div
class="clearfix">
467 <div
class="col-sm-12 label-div">
468 <label
class="col-form-label" for="form_notes"><?php
echo xlt('Notes'); ?
>:</label
> <a href
="#notes_info" class="info-anchor icon-tooltip" data
-toggle
="collapse"><i
class="fa fa-question-circle" aria
-hidden
="true"></i
></a
>
470 <div
class="col-sm-12">
471 <textarea rows
='3' name
='form_notes' id
='form_notes' wrap
='virtual' class='form-control'><?php
echo text($row['notes'] ??
''); ?
></textarea
>
474 <div id
="notes_info" class="collapse">
475 <a href
="#notes_info" data
-toggle
="collapse" class="oe-pull-away"><i
class="fa fa-times oe-help-x" aria
-hidden
="true"></i
></a
>
476 <p
><?php
echo xlt("Any additional information pertaining to this provider"); ?
></p
>
480 <div
class="row mt-3">
481 <div
class="form-group clearfix" id
="button-container">
482 <div
class="col-sm-12 text-left position-override">
483 <div
class="btn-group" role
="group">
484 <button type
='submit' name
='form_save' class="btn btn-primary btn-save" value
='<?php echo xla('Save
'); ?>'><?php
echo xlt('Save'); ?
></button
>
485 <button type
="button" class="btn btn-secondary btn-cancel" onclick
='window.close()' ;><?php
echo xlt('Cancel'); ?
></button
>
486 <?php
if ($ppid) { ?
>
487 <button type
='submit' name
='form_delete' class="btn btn-danger btn-cancel btn-delete" value
='<?php echo xla('Delete
'); ?>'><?php
echo xlt('Delete'); ?
></button
>
496 </div
><!--end of container div
-->
500 $
('.icon-tooltip i').attr({"title": <?php
echo xlj('Click to see more information'); ?
>, "data-toggle": "tooltip", "data-placement": "bottom"}).tooltip({
506 $
('#enter-details-tooltip').attr({"title": <?php
echo xlj('Additional help to fill out this form is available by hovering over labels of each box and clicking on the dark blue help ? icon that is revealed. On mobile devices tap once on the label to reveal the help icon and tap on the icon to show the help section'); ?
>, "data-toggle": "tooltip", "data-placement": "bottom"}).tooltip();