4 * Helper for UB04 form.
7 * @link http://www.open-emr.org
8 * @author Jerry Padgett <sjpadgett@gmail.com>
9 * @author Brady Miller <brady.g.miller@gmail.com>
10 * @copyright Copyright (c) 2017-2019 Jerry Padgett <sjpadgett@gmail.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("ub04_codes.inc.php");
18 $lookup = isset($_GET["code_group"]) ?
filter_input(INPUT_GET
, 'code_group') : "";
19 $term = isset($_GET["term"]) ?
filter_input(INPUT_GET
, 'term') : '';
21 lookup_codes($lookup, $term);
25 // Falling through for user dialog.
26 $users = sqlStatementNoLog("SELECT id,fname,lname,npi,taxonomy FROM users WHERE authorized=? AND active=?", array(1,1));
31 function sendSelection(value
)
33 let parentId
= <?php
echo js_escape($_GET['formid']); ?
>;
35 updateProvider(parentId
, value
);
41 <table
class="table table-sm table-striped">
44 <th
><?php
echo xlt('Provider')?
></th
>
45 <th
><?php
echo xlt('User Id') ?
></th
>
46 <th
><?php
echo xlt('NPI') ?
></th
>
47 <th
><?php
echo xlt('Taxonomy') ?
></th
>
52 while ($row = sqlFetchArray($users)) {
53 $data = json_encode($row);
56 <td
><button btn btn
-secondary btn
-sm onclick
='sendSelection(<?php echo $data;?>)'><?php
echo text($row['fname'] . ' ' . $row['lname'])?
></button
></td
>
57 <td
><?php
echo text($row['id']) ?
></td
>
58 <td
><?php
echo text($row['npi']) ?
></td
>
59 <td
><?php
echo text($row['taxonomy']) ?
></td
>
67 function lookup_codes($group, $term)
72 foreach ($ub04_codes as $k => $v) {
73 if ($v['code_group'] != $group) {
76 $s = "/" . $term . "/i";
77 $label = $v['code'] . " : " . $v['desc'] . ($v['desc1'] ?
(" :: " . $v['desc1']) : "");
78 if (preg_match($s, $label)) {
80 'label' => attr($label),
85 echo json_encode($gotem);
89 * @param lookup group string $group
90 * @param search string $term
92 function get_codes_list($group, $term)
94 $term = "%" . $term . "%";
95 $response = sqlStatement("SELECT CONCAT_WS(': ', isc.code, isc.primary_desc, isc.desc1) as label, isc.code as value, isc.code_group as cg FROM inst_support_codes as isc
96 HAVING label LIKE ? And cg = ? ORDER BY code ASC", array($term, $group ));
98 while ($row = sqlFetchArray($response)) {
102 echo json_encode($resultpd);