fix: quick fix to enforce support of x509 database connection on install (#6157)
[openemr.git] / interface / orders / types_edit.php
blob46ba83bb2806d6830f477a3d909b075c52dfee2e
1 <?php
3 /**
4 * types_edit.php
6 * @package OpenEMR
7 * @link http://www.open-emr.org
8 * @author Rod Roark <rod@sunsetsystems.com>
9 * @author Brady Miller <brady.g.miller@gmail.com>
10 * @author Jerry Padgett <sjpadgett@gmail.com>
11 * @copyright Copyright (c) 2010-2017 Rod Roark <rod@sunsetsystems.com>
12 * @copyright Copyright (c) 2019 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/options.inc.php");
19 use OpenEMR\Core\Header;
21 $typeid = (isset($_REQUEST['typeid']) ? $_REQUEST['typeid'] : '') + 0;
22 $parent = (isset($_REQUEST['parent']) ? $_REQUEST['parent'] : '') + 0;
23 $ordtype = isset($_REQUEST['addfav']) ? $_REQUEST['addfav'] : '';
24 $disabled = $ordtype ? "disabled" : '';
25 $labid = isset($_GET['labid']) ? $_GET['labid'] : 0;
26 $info_msg = "";
28 function QuotedOrNull($fld)
30 $fld = add_escape_custom(trim($fld));
31 if ($fld) {
32 return "'$fld'";
35 return "NULL";
38 function invalue($name)
40 $fld = formData($name, "P", true);
41 return "'$fld'";
44 function rbinput($name, $value, $desc, $colname)
46 global $row;
47 $ret = "<input type='radio' name='" . attr($name) . "' value='" . attr($value) . "'";
48 if ($row[$colname] == $value) {
49 $ret .= " checked";
52 $ret .= " />" . text($desc);
53 return $ret;
56 function rbvalue($rbname)
58 $tmp = $_POST[$rbname];
59 if (!$tmp) {
60 $tmp = '0';
63 return "'$tmp'";
66 function cbvalue($cbname)
68 return empty($_POST[$cbname]) ? 0 : 1;
71 function recursiveDelete($typeid)
73 $res = sqlStatement("SELECT procedure_type_id FROM " .
74 "procedure_type WHERE parent = ?", [$typeid]);
75 while ($row = sqlFetchArray($res)) {
76 recursiveDelete($row['procedure_type_id']);
79 sqlStatement("DELETE FROM procedure_type WHERE " .
80 "procedure_type_id = ?", [$typeid]);
85 <!DOCTYPE html>
86 <html>
87 <head>
88 <?php Header::setupHeader(['opener', 'topdialog', 'datetime-picker']); ?>
89 <title>
90 <?php echo $typeid ? xlt('Edit') : xlt('Add New{{Type}}'); ?><?php echo xlt('Order/Result Type'); ?>
91 </title>
92 <style>
93 .disabled {
94 pointer-events: none;
95 opacity: 0.50;
96 font-weight: bold;
99 td {
100 font-size: 10pt;
103 .inputtext {
104 padding-left: 2px;
105 padding-right: 2px;
108 .ordonly {
112 .resonly {
116 .label-div > a {
117 display: none;
120 .label-div:hover > a {
121 display: inline-block;
124 div[id$="_info"] {
125 background: #F7FAB3;
126 padding: 20px;
127 margin: 10px 15px 0px 15px;
130 div[id$="_info"] > a {
131 margin-left: 10px;
134 @media only screen {
135 fieldset > [class*="col-"] {
136 width: 100%;
137 text-align: left !Important;
140 </style>
142 <script>
144 <?php require($GLOBALS['srcdir'] . "/restoreSession.php"); ?>
146 // The name of the form field for find-code popup results.
147 var rcvarname;
149 // This is for callback by the find-code popup.
150 // Appends to or erases the current list of related codes.
151 function set_related(codetype, code, selector, codedesc) {
152 var f = document.forms[0];
153 var s = f[rcvarname].value;
154 if (code) {
155 if (s.length > 0) s += ';';
156 s += codetype + ':' + code;
157 } else {
158 s = '';
160 f[rcvarname].value = s;
163 // This is for callback by the find-code popup.
164 // Returns the array of currently selected codes with each element in codetype:code format.
165 function get_related() {
166 return document.forms[0][rcvarname].value.split(';');
169 // This is for callback by the find-code popup.
170 // Deletes the specified codetype:code from the currently selected list.
171 function del_related(s) {
172 my_del_related(s, document.forms[0][rcvarname], false);
175 // This invokes the find-code popup.
176 function sel_related(varname) {
177 if (typeof varname == 'undefined') {
178 varname = 'form_related_code';
180 rcvarname = varname;
181 let url = '../patient_file/encounter/find_code_dynamic.php';
182 if (varname == 'form_diagnosis_code') {
183 url = '../patient_file/encounter/find_code_dynamic.php?codetype=' + <?php echo js_url(collect_codetypes("diagnosis", "csv")); ?>;
185 dlgopen(url, '_codeslkup', 985, 800, '', <?php echo xlj("Select Default Codes"); ?>);
188 // call back for procedure picker
189 function set_new_fav(result) {
190 var f = document.forms[0];
191 f.form_procedure_code.value = result.procedure_code;
192 f.form_name.value = result.name;
193 f.form_lab_id.value = result.lab_id;
194 f.form_procedure_code.value = result.procedure_code;
195 f.form_procedure_type.value = "for";
196 f.form_procedure_type_name.value = result.procedure_type_name;
197 f.form_body_site.value = result.body_site;
198 f.form_specimen.value = result.specimen;
199 f.form_route_admin.value = result.route_admin;
200 f.form_laterality.value = result.laterality;
201 f.form_description.value = result.description;
202 f.form_units.value = result.units;
203 f.form_range.value = result.range;
204 f.form_standard_code.value = result.standard_code;
207 function doOrdPicker(e) {
208 e.preventDefault();
209 let labid = $("#form_lab_id").val();
210 let title = <?php echo xlj("Find Procedure Order"); ?>;
211 dlgopen('find_order_popup.php?addfav=1&labid=' + labid, '_blank', 850, 500, '', title);
214 // Show or hide sections depending on procedure type.
215 function proc_type_changed() {
216 var f = document.forms[0];
217 var pt = f.form_procedure_type;
218 var ix = pt.selectedIndex;
219 if (ix < 0) {
220 ix = 0;
222 var ptval = pt.options[ix].value;
223 var ptpfx = ptval.substring(0, 3);
224 $('.ordonly').hide();
225 $('.resonly').hide();
226 $('.fgponly').hide();
227 $('.foronly').hide();
228 if (ptpfx == 'ord') {
229 $('.ordonly').show();
231 if (ptpfx == 'for') {
232 $('.foronly').show();
234 if (ptpfx == 'res' || ptpfx == 'rec') {
235 $('.resonly').show();
237 if (ptpfx == 'fgp') {
238 $('.fgponly').show(); // Favorites
240 if (ptpfx == 'grp') {
241 $('#form_legend').html(
242 "<?php echo xla('Enter Details for Group'); ?>" + " <i id='grp' class='fa fa-info-circle oe-text-black oe-superscript enter-details-tooltip' aria-hidden='true'></i>");
243 } else if (ptpfx == 'fgp') {
244 $('#form_legend').html(
245 "<?php echo xla('Enter Details for Custom Favorite Group'); ?>" + " <i id='ord' class='fa fa-info-circle oe-text-black oe-superscript enter-details-tooltip' aria-hidden='true'></i>");
246 } else if (ptpfx == 'ord') {
247 $('#form_legend').html(
248 "<?php echo xla('Enter Details for Individual Procedures'); ?>" + " <i id='ord' class='fa fa-info-circle oe-text-black oe-superscript enter-details-tooltip' aria-hidden='true'></i>");
249 } else if (ptpfx == 'for') {
250 $('#form_legend').html(
251 "<?php echo xla('Enter Details for Individual Custom Favorite Item'); ?>" + " <i id='ord' class='fa fa-info-circle oe-text-black oe-superscript enter-details-tooltip' aria-hidden='true'></i>");
252 } else if (ptpfx == 'res') {
253 $('#form_legend').html(
254 "<?php echo xla('Enter Details for Discrete Results'); ?>" + " <i id='res' class='fa fa-info-circle oe-text-black oe-superscript enter-details-tooltip' aria-hidden='true'></i>");
255 } else if (ptpfx == 'rec') {
256 $('#form_legend').html(
257 "<?php echo xla('Enter Details for Recommendation'); ?>" + " <i id='rec' class='fa fa-info-circle oe-text-black oe-superscript enter-details-tooltip' aria-hidden='true'></i>");
261 $(function () {
262 proc_type_changed();
264 </script>
266 </head>
267 <body>
268 <div class="container mt-3">
269 <?php
270 // If we are saving, then save and close the window.
272 if (!empty($_POST['form_save'])) {
273 $p_procedure_code = invalue('form_procedure_code');
275 if ($_POST['form_procedure_type'] == 'grp') {
276 $p_procedure_code = "''";
279 $sets =
280 "name = " . invalue('form_name') . ", " .
281 "lab_id = " . invalue('form_lab_id') . ", " .
282 "procedure_code = $p_procedure_code, " .
283 "procedure_type = " . invalue('form_procedure_type') . ", " .
284 "procedure_type_name = " . invalue('form_procedure_type_name') . ", " .
285 "body_site = " . invalue('form_body_site') . ", " .
286 "specimen = " . invalue('form_specimen') . ", " .
287 "route_admin = " . invalue('form_route_admin') . ", " .
288 "laterality = " . invalue('form_laterality') . ", " .
289 "description = " . invalue('form_description') . ", " .
290 "units = " . invalue('form_units') . ", " .
291 "`range` = " . invalue('form_range') . ", " .
292 "standard_code = " . invalue('form_standard_code') . ", " .
293 "related_code = " . (isset($_POST['form_diagnosis_code']) ? invalue('form_diagnosis_code') : invalue('form_related_code')) . ", " .
294 "seq = " . invalue('form_seq');
296 if ($typeid) {
297 sqlStatement("UPDATE procedure_type SET $sets WHERE procedure_type_id = '" . add_escape_custom($typeid) . "'");
298 // Get parent ID so we can refresh the tree view.
299 $row = sqlQuery("SELECT parent FROM procedure_type WHERE " .
300 "procedure_type_id = ?", [$typeid]);
301 $parent = $row['parent'];
302 } else {
303 $newid = sqlInsert("INSERT INTO procedure_type SET parent = '" . add_escape_custom($parent) . "', $sets");
304 // $newid is not really used in this script
306 } elseif (!empty($_POST['form_delete'])) {
307 if ($typeid) {
308 // Get parent ID so we can refresh the tree view after deleting.
309 $row = sqlQuery("SELECT parent FROM procedure_type WHERE " .
310 "procedure_type_id = ?", [$typeid]);
311 $parent = $row['parent'];
312 recursiveDelete($typeid);
316 if (!empty($_POST['form_save']) || !empty($_POST['form_delete'])) {
317 // Find out if this parent still has any children.
318 $trow = sqlQuery("SELECT procedure_type_id FROM procedure_type WHERE parent = ? LIMIT 1", [$parent]);
319 // Close this window and redisplay the updated list.
320 echo "<script>\n";
321 if ($info_msg) {
322 echo " alert(" . js_escape($info_msg) . ");\n";
325 echo " window.close();\n";
326 echo " if (opener.refreshFamily) opener.refreshFamily(" . js_escape($parent) . ",'true');\n";
327 echo "</script></body></html>\n";
328 exit();
331 if ($typeid) {
332 $row = sqlQuery("SELECT * FROM procedure_type WHERE procedure_type_id = ?", [$typeid]);
334 $info_icon_title = xl("Click to reveal more information");
336 <div class="row">
337 <div class="col-sm-12">
338 <form method='post' name='theform' class="form-horizontal"
339 action='types_edit.php?typeid=<?php echo attr_url($typeid); ?>&parent=<?php echo attr_url($parent); ?>'>
340 <!-- no restoreSession() on submit because session data are not relevant -->
341 <fieldset>
342 <legend name="form_legend" id="form_legend"><?php echo xlt('Enter Details'); ?> <i id='enter_details' class='fa fa-info-circle oe-text-black oe-superscript enter-details-tooltip' aria-hidden='true'></i></legend>
343 <div class="row">
344 <div class="col-sm-12">
345 <div class="clearfix">
346 <div class="col-sm-12 label-div">
347 <label class="control-label" for="form_procedure_type"><?php echo xlt('Procedure Tier'); ?>:</label>
348 <a href="#procedure_type_info" class="info-anchor icon-tooltip" data-toggle="collapse"><i class="fa fa-question-circle" aria-hidden="true"></i></a>
349 </div>
350 <div class="col-sm-12">
351 <?php
352 $ordd = (!empty($ordtype)) ? $ordtype : ($row['procedure_type'] ?? null);
353 echo generate_select_list(
354 'form_procedure_type',
355 'proc_type',
356 $ordd,
357 xl('The type of this entity'),
358 ' ',
359 "$disabled",
360 'proc_type_changed()'
363 </div>
364 </div>
365 <div id="procedure_type_info" class="collapse">
366 <a href="#procedure_type_info" data-toggle="collapse" class="oe-pull-away"><i class="fa fa-times oe-help-x" aria-hidden="true"></i></a>
367 <p><?php echo xlt("In order to properly store and retrieve test results and place new orders, tests/orders have to be setup in a hierarchical manner"); ?></p>
368 <p><strong><?php echo xlt("Single Tests"); ?>:</strong></p>
369 <p><?php echo xlt("Group > Procedure Order > Discrete Result"); ?></p>
370 <p><?php echo xlt("Tier 1 - Group - e.g. Serum Chemistry"); ?></p>
371 <p><?php echo xlt("Tier 2 - Procedure Order - e.g. Serum Uric Acid"); ?></p>
372 <p><?php echo xlt("Tier 3 - Discrete Result - e.g. Serum Uric Acid - will hold the returned result value and Default Units, Default Range etc"); ?></p>
373 <p><?php echo xlt("Recommendation - Optional"); ?></p>
374 <p><strong><?php echo xlt("For a Recognized Panel of Tests"); ?>:</strong></p>
375 <p><?php echo xlt("Group > Group > Procedure Order > Discrete Result"); ?></p>
376 <p><?php echo xlt("Tier 1 - Group - e.g. Serum Chemistry"); ?></p>
377 <p><?php echo xlt("Tier 2 - Group (will display in category column as Sub Group) - e.g. Organ/Disease Panel"); ?></p>
378 <p><?php echo xlt("Tier 3 - Procedure Order - e.g. Electrolyte Panel"); ?></p>
379 <p><?php echo xlt("Tier 4 - Discrete Result - The actual test names to hold the results returned Na, K, Cl, CO2 and Default Units, Default Range etc"); ?></p>
380 <p><?php echo xlt("The difference between the two is that for a panel of tests that are ordered together the individual tests are represented by Discrete Result only and these tests cannot be ordered separately unless they have also been setup as single tests"); ?></p>
381 <p><strong><?php echo xlt("For Custom Groups"); ?>: <i class="fa fa-exclamation-circle oe-text-red" aria-hidden="true"></i>&nbsp;<?php echo xlt("New in openEMR ver 5.0.2 "); ?></strong></p>
382 <p><?php echo xlt("Custom Favorite Group > Custom Favorite Item > Discrete results"); ?></p>
383 <p><?php echo xlt("As the first step choose Group or Custom Favorite Group, as the case may be, as the Top Level Tier 1 and fill in the required details"); ?></p>
384 <p><?php echo xlt("For detailed instructions close the 'Enter Details' pop-up and click on the Help icon on the main form. "); ?><i class="fa fa-question-circle" aria-hidden="true"></i></p>
385 </div>
386 </div>
387 </div>
388 <div class="row">
389 <div class="col-sm-12">
390 <div class="clearfix">
391 <div class="col-sm-12 label-div ordonly">
392 <label for="form_procedure_type_names" class="control-label"><?php echo xlt('Order Test Type') . " (" . xlt('Required') . ")"; ?></label>
393 </div>
394 <div class="col-sm-12 ordonly">
395 <?php
396 $fieldnames = array('option_id', 'title');
397 $procedure_order_type = array();
398 $query = sqlStatement("SELECT " . implode(',', $fieldnames) . " FROM list_options where list_id = ? AND activity = 1 order by seq", array('order_type'));
399 while ($ll = sqlFetchArray($query)) {
400 foreach ($fieldnames as $val) {
401 $procedure_order_type[$ll['option_id']][$val] = $ll[$val];
405 <select name="form_procedure_type_name" id="form_procedure_type_name" class='form-control'>
406 <?php foreach ($procedure_order_type as $ordered_types) { ?>
407 <option value="<?php echo attr($ordered_types['option_id']); ?>"
408 <?php echo $ordered_types['option_id'] == $row['procedure_type_name'] ? " selected" : ""; ?>>
409 <?php echo text(xl_list_label($ordered_types['title'])); ?>
410 </option>
411 <?php } ?>
412 </select>
413 </div>
414 <div class="col-sm-12 label-div">
415 <label class="control-label" for="form_name"><?php echo xlt('Name'); ?>:</label><a href="#name_info" class="icon-tooltip" data-toggle="collapse"><i class="fa fa-question-circle" aria-hidden="true"></i></a>
416 </div>
417 <div class="col-sm-12">
418 <input type='text' name='form_name' id='form_name ' maxlength='63'
419 value='<?php echo attr($row['name'] ?? ''); ?>'
420 title='<?php echo xla('Your name for this category, procedure or result'); ?>'
421 class='form-control'>
422 </div>
423 </div>
424 <div id="name_info" class="collapse">
425 <a href="#name_info" data-toggle="collapse" class="oe-pull-away"><i class="fa fa-times oe-help-x" aria-hidden="true"></i></a>
426 <p><?php echo xlt("Name for this Category, Procedure or Result"); ?></p>
427 </div>
428 </div>
429 </div>
430 <div class="row">
431 <div class="col-sm-12">
432 <div class="clearfix">
433 <div class="col-sm-12 label-div">
434 <label class="control-label" for="form_description"><?php echo xlt('Description'); ?>:</label><a href="#description_info" class="icon-tooltip" data-toggle="collapse"><i class="fa fa-question-circle" aria-hidden="true"></i></a>
435 </div>
436 <div class="col-sm-12">
437 <input type='text' name='form_description' id='form_description'
438 maxlength='255'
439 value='<?php echo attr($row['description'] ?? ''); ?>'
440 title='<?php echo xla('Description of this procedure or result code'); ?>'
441 class='form-control'>
442 </div>
443 </div>
444 <div id="description_info" class="collapse">
445 <a href="#description_info" data-toggle="collapse" class="oe-pull-away"><i class="fa fa-times oe-help-x" aria-hidden="true"></i></a>
446 <p><?php echo xlt("A short description of this procedure or result code"); ?></p>
447 </div>
448 </div>
449 </div>
450 <div class="row">
451 <div class="col-sm-12">
452 <div class="clearfix">
453 <div class="col-sm-12 label-div">
454 <label class="control-label" for="form_seq"><?php echo xlt('Sequence'); ?>:</label><a href="#sequence_info" class="icon-tooltip" data-toggle="collapse"><i class="fa fa-question-circle" aria-hidden="true"></i></a>
455 </div>
456 <div class="col-sm-12">
457 <input type='text' name='form_seq' id=='form_seq' maxlength='11'
458 value='<?php echo attr($row['seq'] ?? 0); ?>'
459 title='<?php echo xla('Relative ordering of this entity'); ?>'
460 class='form-control'>
461 </div>
462 </div>
463 <div id="sequence_info" class="collapse">
464 <a href="#sequence_info" data-toggle="collapse" class="oe-pull-away"><i class="fa fa-times oe-help-x" aria-hidden="true"></i></a>
465 <p><?php echo xlt("The order in which the Category, Procedure or Result appears"); ?></p>
466 <p><?php echo xlt("If value is left as zero, will be sorted alphabetically"); ?></p>
467 </div>
468 </div>
469 </div>
470 <div class="row">
471 <div class="col-sm-12 ordonly fgponly foronly">
472 <div class="clearfix">
473 <div class="col-sm-12 label-div">
474 <label class="control-label" for="form_lab_id"><?php echo xlt('Order From'); ?>:</label><a href="#order_info" class="icon-tooltip" data-toggle="collapse"><i class="fa fa-question-circle" aria-hidden="true"></i></a>
475 </div>
476 <div class="col-sm-12">
477 <?php
478 if ($ordtype == 'for') {
479 //$title = xl('This Custom Favorite item can only be sent to the displayed lab, the one that was chosen in the Custom Favorite Group');
480 $ord_disabled = 'disabled';
481 } elseif ($ordtype == 'fgp') {
482 //$title = xl('You cannot edit the already chosen lab, if sending to different lab delete entry and create a new one');
483 $ord_disabled = 'disabled';
484 } else {
485 $title = xl('The entity performing this procedure');
486 $ord_disabled = '';
489 <select name='form_lab_id' id='form_lab_id' class='form-control <?php echo $ord_disabled; ?>'
490 title='<?php echo attr($title); ?>'>
491 <?php
492 if ($ordtype) {
493 $ppres = sqlStatement("SELECT ppid, name FROM procedure_providers WHERE ppid = ? ORDER BY name, ppid", array($labid));
494 } else {
495 $ppres = sqlStatement("SELECT ppid, name FROM procedure_providers ORDER BY name, ppid");
499 while ($pprow = sqlFetchArray($ppres)) {
500 echo "<option value='" . attr($pprow['ppid']) . "'";
501 if (!empty($row['lab_id']) && ($pprow['ppid'] == $row['lab_id'])) {
502 echo " selected";
505 echo ">" . text($pprow['name']) . "</option>";
508 </select>
509 </div>
510 </div>
511 <div id="order_info" class="collapse">
512 <a href="#order_info" data-toggle="collapse" class="oe-pull-away"><i class="fa fa-times oe-help-x" aria-hidden="true"></i></a>
513 <p><?php echo xlt("The entity performing this procedure"); ?></p>
514 <p><?php echo xlt("The entity for a Custom Favorite Item is the entity chosen for the Custom Favorite Group and cannot be changed"); ?></p>
515 <p><?php echo xlt("Once saved the entity for a Custom Favorite Group cannot be changed. If you need to change the entity you have to delete this entry and create a new one"); ?></p>
516 </div>
517 </div>
518 </div>
519 <div class="row">
520 <div class="col-sm-12 ordonly resonly fgponly foronly">
521 <div class="clearfix">
522 <div class="col-sm-12 label-div">
523 <label class="control-label" for="form_procedure_code"><?php echo xlt('Identifying Code'); ?>:</label><a href="#procedure_code_info" class="icon-tooltip" data-toggle="collapse"><i class="fa fa-question-circle" aria-hidden="true"></i></a>
524 </div>
525 <div class="col-sm-12">
526 <input type='text' name='form_procedure_code' id='form_procedure_code'
527 maxlength='31'
528 value='<?php echo attr($row['procedure_code'] ?? ''); ?>'
529 title='<?php echo xla('The vendor-specific code identifying this procedure or result'); ?>'
530 class='form-control'>
531 </div>
532 </div>
533 <div id="procedure_code_info" class="collapse">
534 <a href="#procedure_code_info" data-toggle="collapse" class="oe-pull-away"><i class="fa fa-times oe-help-x" aria-hidden="true"></i></a>
535 <p><?php echo xlt("The vendor-specific code identifying this procedure or result. If no vendor enter any arbitrary unique number, preferably a 5 digit zero-padded e.g. 00211"); ?></p>
536 <p><?php echo xlt("For proper display of results this is a required field"); ?></p>
537 <p><i class="fa fa-exclamation-circle oe-text-orange" aria-hidden="true"></i> <strong><?php echo xlt("Important - the Identifying Code for Custom Favorite Group is always user defined"); ?></strong></p>
538 </div>
539 </div>
540 </div>
541 <div class="row">
542 <div class="col-sm-12 ordonly foronly">
543 <div class="clearfix">
544 <div class="col-sm-12 label-div">
545 <label class="control-label" for="form_standard_code"><?php echo xlt('Standard Code (LOINC)'); ?>:</label><a href="#standard_code_info" class="icon-tooltip" data-toggle="collapse"><i class="fa fa-question-circle" aria-hidden="true"></i></a>
546 </div>
547 <div class="col-sm-12">
548 <input type='text' name='form_standard_code' id='form_standard_code'
549 value='<?php echo attr($row['standard_code'] ?? ''); ?>'
550 title='<?php echo xla('Enter the LOINC code for this procedure'); ?>'
551 class='form-control'>
552 </div>
553 </div>
554 <div id="standard_code_info" class="collapse">
555 <a href="#standard_code_info" data-toggle="collapse" class="oe-pull-away"><i class="fa fa-times oe-help-x" aria-hidden="true"></i></a>
556 <p><?php echo xlt("Enter the Logical Observation Identifiers Names and Codes (LOINC) code for this procedure. LOINC is a database and universal standard for identifying medical laboratory observations."); ?></p>
557 <p><?php echo xlt("This code is optional if only using manual lab data entry"); ?></p>
558 <p><?php echo xlt("Generally a good idea to include it"); ?></p>
559 </div>
560 </div>
561 </div>
562 <div class="row">
563 <div class="col-sm-12 foronly">
564 <div class="clearfix">
565 <div class="col-sm-12 label-div">
566 <label class="control-label" for="form_diagnosis_code"><?php echo xlt('Diagnosis Codes'); ?>:</label><a href="#diagnosis_code_info" class="icon-tooltip" data-toggle="collapse"><i class="fa fa-question-circle" aria-hidden="true"></i></a>
567 </div>
568 <div class="col-sm-12">
569 <input type='text' name='form_diagnosis_code' id='form_diagnosis_code'
570 value='<?php echo attr($row['related_code'] ?? '') //data stored in related_code field?>'
571 onclick='sel_related("form_diagnosis_code")'
572 title='<?php echo xla('Click to select diagnosis or procedure code to default to order'); ?>'
573 class='form-control' readonly />
574 </div>
575 </div>
576 <div id="diagnosis_code_info" class="collapse">
577 <a href="#diagnosis_code_info" data-toggle="collapse" class="oe-pull-away"><i class="fa fa-times oe-help-x" aria-hidden="true"></i></a>
578 <p><?php echo xlt("Click to select a default diagnosis or procedure code for this order"); ?></p>
579 <p><?php echo xlt("A default code is optional as the needed code can be entered at the time of placing the actual order"); ?></p>
580 </div>
581 </div>
582 </div>
583 <div class="row">
584 <div class="col-sm-12 ordonly foronly">
585 <div class="clearfix">
586 <div class="col-sm-12 label-div">
587 <label class="control-label" for="form_body_site"><?php echo xlt('Body Site'); ?>:</label><a href="#body_site_info" class="icon-tooltip" data-toggle="collapse"><i class="fa fa-question-circle" aria-hidden="true"></i></a>
588 </div>
589 <div class="col-sm-12">
590 <?php
591 generate_form_field(array(
592 'data_type' => 1,
593 'field_id' => 'body_site',
594 'list_id' => 'proc_body_site',
595 'description' => xl('Body site, if applicable')
596 ), ($row['body_site'] ?? null));
598 </div>
599 </div>
600 <div id="body_site_info" class="collapse">
601 <a href="#body_site_info" data-toggle="collapse" class="oe-pull-away"><i class="fa fa-times oe-help-x" aria-hidden="true"></i></a>
602 <p><?php echo xlt("Enter the relevant site if applicable."); ?></p>
603 </div>
604 </div>
605 </div>
606 <div class="row">
607 <div class="col-sm-12 ordonly foronly">
608 <div class="clearfix">
609 <div class="col-sm-12 label-div">
610 <label class="control-label" for="form_specimen"><?php echo xlt('Specimen Type'); ?>:</label><a href="#specimen_info" class="icon-tooltip" data-toggle="collapse"><i class="fa fa-question-circle" aria-hidden="true"></i></a>
611 </div>
612 <div class="col-sm-12">
613 <?php
614 generate_form_field(array(
615 'data_type' => 1,
616 'field_id' => 'specimen',
617 'list_id' => 'proc_specimen',
618 'description' => xl('Specimen Type')
619 ), ($row['specimen'] ?? null));
621 </div>
622 </div>
623 <div id="specimen_info" class="collapse">
624 <a href="#specimen_info" data-toggle="collapse" class="oe-pull-away"><i class="fa fa-times oe-help-x" aria-hidden="true"></i></a>
625 <p><?php echo xlt("Enter the specimen type if applicable."); ?></p>
626 <p><?php echo xlt("This code is optional, but is a good practice to do so."); ?></p>
627 </div>
628 </div>
629 </div>
630 <div class="row">
631 <div class="col-sm-12 ordonly foronly">
632 <div class="clearfix">
633 <div class="col-sm-12 label-div">
634 <label class="control-label" for="form_route_admin"><?php echo xlt('Administer Via'); ?>:</label><a href="#administer_via_info" class="icon-tooltip" data-toggle="collapse"><i class="fa fa-question-circle" aria-hidden="true"></i></a>
635 </div>
636 <div class="col-sm-12">
637 <?php
638 generate_form_field(array(
639 'data_type' => 1,
640 'field_id' => 'route_admin',
641 'list_id' => 'proc_route',
642 'description' => xl('Route of administration, if applicable')
643 ), ($row['route_admin'] ?? null));
645 </div>
646 </div>
647 <div id="administer_via_info" class="collapse">
648 <a href="#administer_via_info" data-toggle="collapse" class="oe-pull-away"><i class="fa fa-times oe-help-x" aria-hidden="true"></i></a>
649 <p><?php echo xlt("Enter the specimen type if applicable."); ?></p>
650 <p><?php echo xlt("This code is optional."); ?></p>
651 </div>
652 </div>
653 </div>
654 <div class="row">
655 <div class="col-sm-12 ordonly foronly">
656 <div class="clearfix">
657 <div class="col-sm-12 label-div">
658 <label class="control-label" for="form_laterality"><?php echo xlt('Laterality'); ?>:</label><a href="#laterality_info" class="icon-tooltip" data-toggle="collapse"><i class="fa fa-question-circle" aria-hidden="true"></i></a>
659 </div>
660 <div class="col-sm-12">
661 <?php
662 generate_form_field(array(
663 'data_type' => 1,
664 'field_id' => 'laterality',
665 'list_id' => 'proc_lat',
666 'description' => xl('Laterality of this procedure, if applicable')
667 ), ($row['laterality'] ?? null));
669 </div>
670 </div>
671 <div id="laterality_info" class="collapse">
672 <a href="#laterality_info" data-toggle="collapse" class="oe-pull-away"><i class="fa fa-times oe-help-x" aria-hidden="true"></i></a>
673 <p><?php echo xlt("Enter the laterality of this procedure, if applicable."); ?></p>
674 <p><?php echo xlt("This code is optional."); ?></p>
675 </div>
676 </div>
677 </div>
678 <div class="row">
679 <div class="col-sm-12 resonly">
680 <div class="clearfix">
681 <div class="col-sm-12 label-div">
682 <label class="control-label" for="form_units"><?php echo xlt('Default Units'); ?>:</label><a href="#units_info" class="icon-tooltip" data-toggle="collapse"><i class="fa fa-question-circle" aria-hidden="true"></i></a>
683 </div>
684 <div class="col-sm-12">
685 <?php
686 generate_form_field(array(
687 'data_type' => 1,
688 'field_id' => 'units',
689 'list_id' => 'proc_unit',
690 'description' => xl('Optional default units for manual entry of results')
691 ), ($row['units'] ?? null));
693 </div>
694 </div>
695 <div id="units_info" class="collapse">
696 <a href="#units_info" data-toggle="collapse" class="oe-pull-away"><i class="fa fa-times oe-help-x" aria-hidden="true"></i></a>
697 <p><?php echo xlt("Enter the default units for this test."); ?></p>
698 <p><?php echo xlt("This code is optional, but is a good practice."); ?></p>
699 </div>
700 </div>
701 </div>
702 <div class="row">
703 <div class="col-sm-12 resonly">
704 <div class="clearfix">
705 <div class="col-sm-12 label-div">
706 <label class="control-label" for="form_range"><?php echo xlt('Default Range'); ?>:</label><a href="#range_info" class="icon-tooltip" data-toggle="collapse"><i class="fa fa-question-circle" aria-hidden="true"></i></a>
707 </div>
708 <div class="col-sm-12">
709 <input type='text' name='form_range' id='form_range' maxlength='255'
710 value='<?php echo attr($row['range'] ?? ''); ?>'
711 title='<?php echo xla('Optional default range for manual entry of results'); ?>'
712 class='form-control'>
713 </div>
714 </div>
715 <div id="range_info" class="collapse">
716 <a href="#range_info" data-toggle="collapse" class="oe-pull-away"><i class="fa fa-times oe-help-x" aria-hidden="true"></i></a>
717 <p><?php echo xlt("Enter the default range values if applicable, used in manual entry of results."); ?></p>
718 <p><?php echo xlt("This code is optional."); ?></p>
719 </div>
720 </div>
721 </div>
722 <div class="row">
723 <div class="col-sm-12 resonly">
724 <div class="clearfix">
725 <div class="col-sm-12 label-div">
726 <label class="control-label" for="form_related_code"><?php echo xlt('Followup Services'); ?>:</label><a href="#related_code_info" class="icon-tooltip" data-toggle="collapse"><i class="fa fa-question-circle" aria-hidden="true"></i></a>
727 </div>
728 <div class="col-sm-12">
729 <input type='text' name='form_related_code' id='form_related_code'
730 value='<?php echo attr($row['related_code'] ?? '') ?>'
731 onclick='sel_related("form_related_code")'
732 title='<?php echo xla('Click to select services to perform if this result is abnormal'); ?>'
733 class='form-control' readonly />
734 </div>
735 </div>
736 <div id="related_code_info" class="collapse">
737 <a href="#related_code_info" data-toggle="collapse" class="oe-pull-away"><i class="fa fa-times oe-help-x" aria-hidden="true"></i></a>
738 <p><?php echo xlt("Click to select services to perform if this result is abnormal."); ?></p>
739 <p><?php echo xlt("This code is optional."); ?></p>
740 </div>
741 </div>
742 </div>
743 </fieldset>
744 <?php //can change position of buttons by creating a class 'position-override' and adding rule text-alig:center or right as the case may be in individual stylesheets ?>
745 <div class="form-group" id="button-container">
746 <div class="col-sm-12 text-left position-override">
747 <div class="btn-group" role="group">
748 <button type='submit' name='form_save' class="btn btn-primary btn-save" value='<?php echo xla('Save'); ?>'><?php echo xlt('Save'); ?></button>
749 <button type="button" class="btn btn-secondary btn-cancel" onclick='window.close()' ;><?php echo xlt('Cancel'); ?></button>
750 <?php if ($typeid) { ?>
751 <button type='submit' name='form_delete' class="btn btn-danger btn-cancel btn-delete" value='<?php echo xla('Delete'); ?>'><?php echo xlt('Delete'); ?></button>
752 <?php } ?>
753 </div>
754 </div>
755 </div>
756 </form>
757 </div>
758 </div>
759 </div><!--end of conatainer div-->
760 <script>
761 //jqury-ui tooltip
762 $(function () {
763 $('.icon-tooltip i').attr({"title": <?php echo xlj('Click to see more information'); ?>, "data-toggle": "tooltip", "data-placement": "bottom"}).tooltip({
764 show: {
765 delay: 700,
766 duration: 0
769 $('.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();
770 $('#form_procedure_type').click(function () {
771 $('.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();
774 </script>
775 </body>
776 </html>