3 * add or edit a medical problem.
5 * Copyright (C) 2005-2011 Rod Roark <rod@sunsetsystems.com>
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
13 * @author Rod Roark <rod@sunsetsystems.com>
14 * @link http://www.open-emr.org
17 //SANITIZE ALL ESCAPES
18 $sanitize_all_escapes=true;
21 //STOP FAKE REGISTER GLOBALS
22 $fake_register_globals=false;
25 require_once('../../globals.php');
26 require_once($GLOBALS['srcdir'].'/lists.inc');
27 require_once($GLOBALS['srcdir'].'/patient.inc');
28 require_once($GLOBALS['srcdir'].'/acl.inc');
29 require_once($GLOBALS['srcdir'].'/options.inc.php');
30 require_once($GLOBALS['fileroot'].'/custom/code_types.inc.php');
31 require_once($GLOBALS['srcdir'].'/csv_like_join.php');
32 require_once($GLOBALS['srcdir'].'/htmlspecialchars.inc.php');
33 require_once($GLOBALS['srcdir'].'/formdata.inc.php');
35 <script type
="text/javascript" src
="<?php echo $webroot ?>/interface/main/tabs/js/include_opener.js"></script
>
38 if (isset($ISSUE_TYPES['football_injury'])) {
39 if ($ISSUE_TYPES['football_injury']) {
40 // Most of the logic for the "football injury" issue type comes from this
41 // included script. We might eventually refine this approach to support
42 // a plug-in architecture for custom issue types.
43 require_once($GLOBALS['srcdir'].'/football_injury.inc.php');
46 if (isset($ISSUE_TYPES['ippf_gcac'])) {
47 if ($ISSUE_TYPES['ippf_gcac']) {
48 // Similarly for IPPF issues.
49 require_once($GLOBALS['srcdir'].'/ippf_issues.inc.php');
53 $issue = $_REQUEST['issue'];
54 $thispid = 0 +
(empty($_REQUEST['thispid']) ?
$pid : $_REQUEST['thispid']);
57 // A nonempty thisenc means we are to link the issue to the encounter.
58 $thisenc = 0 +
(empty($_REQUEST['thisenc']) ?
0 : $_REQUEST['thisenc']);
60 // A nonempty thistype is an issue type to be forced for a new issue.
61 $thistype = empty($_REQUEST['thistype']) ?
'' : $_REQUEST['thistype'];
63 if ($issue && !acl_check('patients','med','','write') ) die(xlt("Edit is not authorized!"));
64 if ( !acl_check('patients','med','',array('write','addonly') )) die(xlt("Add is not authorized!"));
66 $tmp = getPatientData($thispid, "squad");
67 if ($tmp['squad'] && ! acl_check('squads', $tmp['squad']))
68 die(xlt("Not authorized for this squad!"));
70 function QuotedOrNull($fld) {
71 if ($fld) return "'".add_escape_custom($fld)."'";
76 // Do not use this function since quotes are added in query escaping mechanism
77 // Only keeping since used in the football injury code football_injury.inc.php that is included.
78 // If start using this function, then incorporate the add_escape_custom() function into it
79 function rbvalue($rbname) {
80 $tmp = $_POST[$rbname];
81 if (! $tmp) $tmp = '0';
85 function cbvalue($cbname) {
86 return $_POST[$cbname] ?
'1' : '0';
89 function invalue($inname) {
90 return (int) trim($_POST[$inname]);
93 // Do not use this function since quotes are added in query escaping mechanism
94 // Only keeping since used in the football injury code football_injury.inc.php that is included.
95 // If start using this function, then incorporate the add_escape_custom() function into it
96 function txvalue($txname) {
97 return "'" . trim($_POST[$txname]) . "'";
100 function rbinput($name, $value, $desc, $colname) {
102 $ret = "<input type='radio' name='".attr($name)."' value='".attr($value)."'";
103 if ($irow[$colname] == $value) $ret .= " checked";
104 $ret .= " />".text($desc);
108 function rbcell($name, $value, $desc, $colname) {
109 return "<td width='25%' nowrap>" . rbinput($name, $value, $desc, $colname) . "</td>\n";
112 // Given an issue type as a string, compute its index.
113 function issueTypeIndex($tstr) {
116 foreach ($ISSUE_TYPES as $key => $value) {
117 if ($key == $tstr) break;
123 function ActiveIssueCodeRecycleFn($thispid2, $ISSUE_TYPES2) {
124 ///////////////////////////////////////////////////////////////////////
125 // Active Issue Code Recycle Function authored by epsdky (2014-2015) //
126 ///////////////////////////////////////////////////////////////////////
128 $modeIssueTypes = array();
129 $issueTypeIdx2 = array();
132 foreach ($ISSUE_TYPES2 as $issueTypeX => $isJunk) {
134 $modeIssueTypes[$idx2] = $issueTypeX;
135 $issueTypeIdx2[$issueTypeX] = $idx2;
140 $pe2 = array($thispid2);
141 $qs2 = str_repeat('?, ', count($modeIssueTypes) - 1) . '?';
142 $sqlParameters2 = array_merge($pe2, $modeIssueTypes);
144 $codeList2 = array();
146 $issueCodes2 = sqlStatement("SELECT diagnosis FROM lists WHERE pid = ? AND enddate is NULL AND type IN ($qs2)", $sqlParameters2);
148 while ($issueCodesRow2 = sqlFetchArray($issueCodes2)) {
150 if ($issueCodesRow2['diagnosis'] != "") {
152 $someCodes2 = explode(";", $issueCodesRow2['diagnosis']);
153 $codeList2 = array_merge($codeList2, $someCodes2);
161 $codeList2 = array_unique($codeList2);
166 $memberCodes = array();
167 $memberCodes[0] = array();
168 $memberCodes[1] = array();
169 $memberCodes[2] = array();
171 $allowedCodes2 = array();
172 $allowedCodes2[0] = collect_codetypes("medical_problem");
173 $allowedCodes2[1] = collect_codetypes("diagnosis");
174 $allowedCodes2[2] = collect_codetypes("drug");
176 // Test membership of codes to each code type set
177 foreach ($allowedCodes2 as $akey1 => $allowCodes2) {
179 foreach ($codeList2 as $listCode2) {
181 list($codeTyX,) = explode(":", $listCode2);
183 if (in_array($codeTyX, $allowCodes2)) {
185 array_push($memberCodes[$akey1], $listCode2);
193 // output sets of display options
194 $displayCodeSets[0] = $memberCodes[0]; // medical_problem
195 $displayCodeSets[1] = array_merge($memberCodes[1], $memberCodes[2]); // allergy
196 $displayCodeSets[2] = array_merge($memberCodes[2], $memberCodes[1]); // medication
197 $displayCodeSets[3] = $memberCodes[1]; // default
199 echo "var listBoxOptionSets = new Array();\n\n";
201 foreach ($displayCodeSets as $akey => $displayCodeSet) {
203 echo "listBoxOptionSets[" . attr($akey) . "] = new Array();\n";
205 if ($displayCodeSet) {
207 foreach ($displayCodeSet as $dispCode2) {
209 $codeDesc2 = lookup_code_descriptions($dispCode2);
210 echo "listBoxOptionSets[" . attr($akey) . "][listBoxOptionSets[" . attr($akey) . "].length] = new Option('" . attr($dispCode2) . " (" . attr(trim($codeDesc2)) . ") ' ,'" . attr($dispCode2) . "' , false, false);\n";
218 // map issues to a set of display options
219 $modeIndexMapping = array();
221 foreach ($modeIssueTypes as $akey2 => $isJunk) $modeIndexMapping[$akey2] = 3;
223 if (array_key_exists("medical_problem", $issueTypeIdx2))
224 $modeIndexMapping[$issueTypeIdx2['medical_problem']] = 0;
225 if (array_key_exists("allergy", $issueTypeIdx2))
226 $modeIndexMapping[$issueTypeIdx2['allergy']] = 1;
227 if (array_key_exists("medication", $issueTypeIdx2))
228 $modeIndexMapping[$issueTypeIdx2['medication']] = 2;
230 echo "\nvar listBoxOptions2 = new Array();\n\n";
232 foreach ($modeIssueTypes as $akey2 => $isJunk) {
233 echo "listBoxOptions2[" . attr($akey2) . "] = listBoxOptionSets[" . attr($modeIndexMapping[$akey2]) . "];\n";
235 ///////////////////////////////////////////////////////////////////////
236 // End of Active Issue Code Recycle Function main code block //
237 ///////////////////////////////////////////////////////////////////////
240 // If we are saving, then save and close the window.
242 if ($_POST['form_save']) {
245 $text_type = "unknown";
246 foreach ($ISSUE_TYPES as $key => $value) {
247 if ($i++
== $_POST['form_type']) $text_type = $key;
250 $form_begin = fixDate($_POST['form_begin'], '');
251 $form_end = fixDate($_POST['form_end'], '');
253 if ($text_type == 'football_injury') {
254 $form_injury_part = $_POST['form_injury_part'];
255 $form_injury_type = $_POST['form_injury_type'];
258 $form_injury_part = $_POST['form_medical_system'];
259 $form_injury_type = $_POST['form_medical_type'];
264 $query = "UPDATE lists SET " .
265 "type = '" . add_escape_custom($text_type) . "', " .
266 "title = '" . add_escape_custom($_POST['form_title']) . "', " .
267 "comments = '" . add_escape_custom($_POST['form_comments']) . "', " .
268 "begdate = " . QuotedOrNull($form_begin) . ", " .
269 "enddate = " . QuotedOrNull($form_end) . ", " .
270 "returndate = " . QuotedOrNull($form_return) . ", " .
271 "diagnosis = '" . add_escape_custom($_POST['form_diagnosis']) . "', " .
272 "occurrence = '" . add_escape_custom($_POST['form_occur']) . "', " .
273 "classification = '" . add_escape_custom($_POST['form_classification']) . "', " .
274 "reinjury_id = '" . add_escape_custom($_POST['form_reinjury_id']) . "', " .
275 "referredby = '" . add_escape_custom($_POST['form_referredby']) . "', " .
276 "injury_grade = '" . add_escape_custom($_POST['form_injury_grade']) . "', " .
277 "injury_part = '" . add_escape_custom($form_injury_part) . "', " .
278 "injury_type = '" . add_escape_custom($form_injury_type) . "', " .
279 "outcome = '" . add_escape_custom($_POST['form_outcome']) . "', " .
280 "destination = '" . add_escape_custom($_POST['form_destination']) . "', " .
281 "reaction ='" . add_escape_custom($_POST['form_reaction']) . "', " .
282 "severity_al ='" . add_escape_custom($_POST['form_severity_id']) . "', " .
283 "erx_uploaded = '0', " .
284 "modifydate = NOW() " .
285 "WHERE id = '" . add_escape_custom($issue) . "'";
286 sqlStatement($query);
287 if ($text_type == "medication" && enddate
!= '') {
288 sqlStatement('UPDATE prescriptions SET '
289 . 'medication = 0 where patient_id = ? '
290 . " and upper(trim(drug)) = ? "
291 . ' and medication = 1', array($thispid,strtoupper($_POST['form_title'])) );
296 $issue = sqlInsert("INSERT INTO lists ( " .
297 "date, pid, type, title, activity, comments, begdate, enddate, returndate, " .
298 "diagnosis, occurrence, classification, referredby, user, groupname, " .
299 "outcome, destination, reinjury_id, injury_grade, injury_part, injury_type, " .
300 "reaction, severity_al " .
303 "'" . add_escape_custom($thispid) . "', " .
304 "'" . add_escape_custom($text_type) . "', " .
305 "'" . add_escape_custom($_POST['form_title']) . "', " .
307 "'" . add_escape_custom($_POST['form_comments']) . "', " .
308 QuotedOrNull($form_begin) . ", " .
309 QuotedOrNull($form_end) . ", " .
310 QuotedOrNull($form_return) . ", " .
311 "'" . add_escape_custom($_POST['form_diagnosis']) . "', " .
312 "'" . add_escape_custom($_POST['form_occur']) . "', " .
313 "'" . add_escape_custom($_POST['form_classification']) . "', " .
314 "'" . add_escape_custom($_POST['form_referredby']) . "', " .
315 "'" . add_escape_custom($
$_SESSION['authUser']) . "', " .
316 "'" . add_escape_custom($
$_SESSION['authProvider']) . "', " .
317 "'" . add_escape_custom($_POST['form_outcome']) . "', " .
318 "'" . add_escape_custom($_POST['form_destination']) . "', " .
319 "'" . add_escape_custom($_POST['form_reinjury_id']) . "', " .
320 "'" . add_escape_custom($_POST['form_injury_grade']) . "', " .
321 "'" . add_escape_custom($form_injury_part) . "', " .
322 "'" . add_escape_custom($form_injury_type) . "', " .
323 "'" . add_escape_custom($_POST['form_reaction']) . "', " .
324 "'" . add_escape_custom($_POST['form_severity_id']) . "' " .
329 // For record/reporting purposes, place entry in lists_touch table.
330 setListTouch($thispid,$text_type);
332 if ($text_type == 'football_injury') issue_football_injury_save($issue);
333 if ($text_type == 'ippf_gcac' ) issue_ippf_gcac_save($issue);
334 if ($text_type == 'contraceptive' ) issue_ippf_con_save($issue);
336 // If requested, link the issue to a specified encounter.
338 $query = "INSERT INTO issue_encounter ( " .
339 "pid, list_id, encounter " .
340 ") VALUES ( ?,?,? )";
341 sqlStatement($query, array($thispid,$issue,$thisenc));
344 $tmp_title = addslashes($ISSUE_TYPES[$text_type][2] . ": $form_begin " .
345 substr($_POST['form_title'], 0, 40));
347 // Close this window and redisplay the updated list of issues.
349 echo "<html><body><script language='JavaScript'>\n";
350 if ($info_msg) echo " alert('$info_msg');\n";
352 echo " var myboss = opener ? opener : parent;\n";
353 echo " if (myboss.refreshIssue) myboss.refreshIssue($issue,'$tmp_title');\n";
354 echo " else if (myboss.reloadIssues) myboss.reloadIssues();\n";
355 echo " else myboss.location.reload();\n";
356 echo " if (parent.$ && parent.$.fancybox) parent.$.fancybox.close();\n";
357 echo " else window.close();\n";
359 echo "</script></body></html>\n";
365 $irow = sqlQuery("SELECT * FROM lists WHERE id = ?",array($issue));
367 $irow['type'] = $thistype;
371 if (!empty($irow['type'])) {
372 foreach ($ISSUE_TYPES as $key => $value) {
373 if ($key == $irow['type']) break;
380 <?php
html_header_show();?
>
382 <title
><?php
echo $issue ?
xlt('Edit') : xlt('Add New'); ?
><?php
echo " ".xlt('Issue'); ?
></title
>
383 <link rel
="stylesheet" href
='<?php echo $css_header ?>' type
='text/css'>
387 td
, input
, select
, textarea
{
388 font
-family
: Arial
, Helvetica
, sans
-serif
;
395 border
-color
: #0000ff;
402 <script type
="text/javascript" src
="<?php echo $GLOBALS['assets_static_relative']; ?>/jquery-min-1-9-1/index.js"></script
>
403 <style type
="text/css">@import
url(<?php
echo $GLOBALS['webroot']; ?
>/library
/dynarch_calendar
.css
);</style
>
404 <script type
="text/javascript" src
="<?php echo $GLOBALS['webroot']; ?>/library/dynarch_calendar.js"></script
>
405 <?php
require_once($GLOBALS['srcdir'].'/dynarch_calendar_en.inc.php'); ?
>
406 <script type
="text/javascript" src
="<?php echo $GLOBALS['webroot']; ?>/library/dynarch_calendar_setup.js"></script
>
407 <script type
="text/javascript" src
="<?php echo $GLOBALS['webroot']; ?>/library/textformat.js"></script
>
408 <script type
="text/javascript" src
="<?php echo $GLOBALS['webroot']; ?>/library/dialog.js?v=<?php echo $v_js_includes; ?>"></script
>
410 <script language
="JavaScript">
412 var mypcc
= '<?php echo $GLOBALS['phone_country_code
'] ?>';
414 var aitypes
= new Array(); // issue type attributes
415 var aopts
= new Array(); // Option objects
418 foreach ($ISSUE_TYPES as $key => $value) {
419 echo " aitypes[$i] = " . attr($value[3]) . ";\n";
420 echo " aopts[$i] = new Array();\n";
421 $qry = sqlStatement("SELECT * FROM list_options WHERE list_id = ? AND activity = 1",array($key."_issue_list"));
422 while($res = sqlFetchArray($qry)){
423 echo " aopts[$i][aopts[$i].length] = new Option('".attr(xl_list_label(trim($res['title'])))."', '".attr(trim($res['option_id']))."', false, false);\n";
425 echo " aopts[$i][aopts[$i].length-1].setAttribute('data-code','".attr(trim($res['codes']))."');\n";
432 ActiveIssueCodeRecycleFn($thispid, $ISSUE_TYPES);
436 <?php
require($GLOBALS['srcdir'] . "/restoreSession.php"); ?
>
438 ///////////////////////////
439 function codeBoxFunction2() {
440 var f
= document
.forms
[0];
441 var x2
= f
.form_codeSelect2
.options
[f
.form_codeSelect2
.selectedIndex
].value
;
442 f
.form_codeSelect2
.selectedIndex
= -1;
443 var x6
= f
.form_diagnosis
.value
;
444 if (x6
.length
> 0) x6 +
= ";";
446 f
.form_diagnosis
.value
= x6
;
448 ///////////////////////////
450 // React to selection of an issue type. This loads the associated
451 // shortcuts into the selection list of titles, and determines which
452 // rows are displayed or hidden.
453 function newtype(index
) {
454 var f
= document
.forms
[0];
455 var theopts
= f
.form_titles
.options
;
458 for (i
= 0; i
< aopts
[index
].length
; ++i
) {
459 theopts
[i
] = aopts
[index
][i
];
461 document
.getElementById('row_titles').style
.display
= i ?
'' : 'none';
463 ///////////////////////
464 var listBoxOpts2
= f
.form_codeSelect2
.options
;
465 listBoxOpts2
.length
= 0;
467 for (ix
= 0; ix
< listBoxOptions2
[index
].length
; ++ix
) {
468 listBoxOpts2
[ix
] = listBoxOptions2
[index
][ix
];
469 listBoxOpts2
[ix
].title
= listBoxOptions2
[index
][ix
].text
;
471 document
.getElementById('row_codeSelect2').style
.display
= ix ?
'' : 'none';
472 //////////////////////
474 // Show or hide various rows depending on issue type, except do not
475 // hide the comments or referred-by fields if they have data.
476 var comdisp
= (aitypes
[index
] == 1) ?
'none' : '';
477 var revdisp
= (aitypes
[index
] == 1) ?
'' : 'none';
478 var injdisp
= (aitypes
[index
] == 2) ?
'' : 'none';
479 var nordisp
= (aitypes
[index
] == 0) ?
'' : 'none';
480 // reaction row should be displayed only for medication allergy.
481 var alldisp
= (index
== <?php
echo issueTypeIndex('allergy'); ?
>) ?
'' : 'none';
482 document
.getElementById('row_enddate' ).style
.display
= comdisp
;
483 // Note that by default all the issues will not show the active row
484 // (which is desired functionality, since then use the end date
485 // to inactivate the item.)
486 document
.getElementById('row_active' ).style
.display
= revdisp
;
487 document
.getElementById('row_diagnosis' ).style
.display
= comdisp
;
488 document
.getElementById('row_occurrence' ).style
.display
= comdisp
;
489 document
.getElementById('row_classification').style
.display
= injdisp
;
490 document
.getElementById('row_reinjury_id' ).style
.display
= injdisp
;
491 document
.getElementById('row_severity' ).style
.display
= alldisp
;
492 document
.getElementById('row_reaction' ).style
.display
= alldisp
;
493 document
.getElementById('row_referredby' ).style
.display
= (f
.form_referredby
.value
) ?
'' : comdisp
;
494 document
.getElementById('row_comments' ).style
.display
= (f
.form_comments
.value
) ?
'' : revdisp
;
495 document
.getElementById('row_referredby' ).style
.display
= (f
.form_referredby
.value
) ?
'' : comdisp
;
498 if ($ISSUE_TYPES['football_injury']) {
499 // Generate more of these for football injury fields.
500 issue_football_injury_newtype();
502 if ($ISSUE_TYPES['ippf_gcac'] && !$_POST['form_save']) {
503 // Generate more of these for gcac and contraceptive fields.
504 if (empty($issue) ||
$irow['type'] == 'ippf_gcac' ) issue_ippf_gcac_newtype();
505 if (empty($issue) ||
$irow['type'] == 'contraceptive') issue_ippf_con_newtype();
510 // If a clickoption title is selected, copy it to the title field.
511 // If it has a code, add that too.
512 function set_text() {
513 var f
= document
.forms
[0];
514 f
.form_title
.value
= f
.form_titles
.options
[f
.form_titles
.selectedIndex
].text
;
515 f
.form_diagnosis
.value
= f
.form_titles
.options
[f
.form_titles
.selectedIndex
].getAttribute('data-code');
516 f
.form_titles
.selectedIndex
= -1;
519 // Process click on Delete link.
520 function deleteme() {
521 dlgopen('../deleter.php?issue=<?php echo attr($issue) ?>', '_blank', 500, 450);
525 // Called by the deleteme.php window on a successful delete.
526 function imdeleted() {
531 if (parent
.$
&& parent
.$
.fancybox
) parent
.$
.fancybox
.close();
535 // Called when the Active checkbox is clicked. For consistency we
536 // use the existence of an end date to indicate inactivity, even
537 // though the simple verion of the form does not show an end date.
538 function activeClicked(cb
) {
539 var f
= document
.forms
[0];
541 f
.form_end
.value
= '';
543 var today
= new Date();
544 f
.form_end
.value
= '' +
(today
.getYear() +
1900) +
'-' +
545 (today
.getMonth() +
1) +
'-' + today
.getDate();
549 // Called when resolved outcome is chosen and the end date is entered.
550 function outcomeClicked(cb
) {
551 var f
= document
.forms
[0];
552 if (cb
.value
== '1'){
553 var today
= new Date();
554 f
.form_end
.value
= '' +
(today
.getYear() +
1900) +
'-' +
555 ("0" +
(today
.getMonth() +
1)).slice(-2) +
'-' +
("0" + today
.getDate()).slice(-2);
560 // This is for callback by the find-code popup.
561 // Appends to or erases the current list of diagnoses.
562 function set_related(codetype
, code
, selector
, codedesc
) {
563 var f
= document
.forms
[0];
564 var s
= f
.form_diagnosis
.value
;
565 var title
= f
.form_title
.value
;
567 //disabled duplicate codes
568 if (s
.indexOf(codetype +
':' + code
) == -1){
569 if (s
.length
> 0) s +
= ';';
570 s +
= codetype +
':' + code
;
575 f
.form_diagnosis
.value
= s
;
576 if(title
== '') f
.form_title
.value
= codedesc
;
579 // This invokes the find-code popup.
580 function sel_diagnosis() {
582 $url = '../encounter/find_code_popup.php?codetype=';
583 if($irow['type'] == 'medical_problem') {
584 $url .= collect_codetypes("medical_problem", "csv");
587 $url .= collect_codetypes("diagnosis","csv");
588 $tmp = collect_codetypes("drug","csv");
589 if($irow['type'] == 'allergy') {
590 if ($tmp) $url .= ",$tmp";
592 else if($irow['type'] == 'medication') {
593 if ($tmp) $url .= ",$tmp&default=$tmp";
597 dlgopen('<?php echo $url; ?>', '_blank', 700, 500);
600 // Check for errors when the form is submitted.
601 function validate() {
602 var f
= document
.forms
[0];
603 if(f
.form_begin
.value
> f
.form_end
.value
&& (f
.form_end
.value
)) {
604 alert("<?php echo addslashes(xl('Please Enter End Date greater than Begin Date!')); ?>");
607 if (! f
.form_title
.value
) {
608 alert("<?php echo addslashes(xl('Please enter a title!')); ?>");
611 top
.restoreSession();
615 // Supports customizable forms (currently just for IPPF).
616 function divclick(cb
, divid
) {
617 var divstyle
= document
.getElementById(divid
).style
;
619 divstyle
.display
= 'block';
621 divstyle
.display
= 'none';
630 <body
class="body_top" style
="padding-right:0.5em">
632 <form method
='post' name
='theform'
633 action
='add_edit_issue.php?issue=<?php echo attr($issue); ?>&thispid=<?php echo attr($thispid); ?>&thisenc=<?php echo attr($thisenc); ?>'
634 onsubmit
='return validate()'>
636 <table border
='0' width
='100%'>
639 <td valign
='top' width
='1%' nowrap
><b
><?php
echo xlt('Type'); ?
>:</b
></td
>
643 foreach ($ISSUE_TYPES as $value) {
644 if ($issue ||
$thistype) {
645 if ($index == $type_index) {
646 echo text($value[1]);
647 echo "<input type='hidden' name='form_type' value='".attr($index)."'>\n";
650 echo " <input type='radio' name='form_type' value='".attr($index)."' onclick='newtype($index)'";
651 if ($index == $type_index) echo " checked";
652 echo " />" . text($value[1]) . " \n";
661 <td valign
='top' nowrap
> 
;</td
>
663 <select name
='form_titles' size
='4' onchange
='set_text()'>
664 </select
> <?php
echo xlt('(Select one of these, or type your own title)'); ?
>
669 <td valign
='top' id
='title_diagnosis' nowrap
><b
><?php
echo xlt('Title'); ?
>:</b
></td
>
671 <input type
='text' size
='40' name
='form_title' value
='<?php echo attr($irow['title
']) ?>' style
='width:100%' />
675 <tr id
='row_codeSelect2'>
676 <td
><b
><?php
echo xlt('Active Issue Codes'); ?
>:</b
>
679 <select name
='form_codeSelect2' size
='4' onchange
="codeBoxFunction2()" style
="max-width:100%;">
684 <tr id
='row_diagnosis'>
685 <td valign
='top' nowrap
><b
><?php
echo xlt('Coding'); ?
>:</b
></td
>
687 <input type
='text' size
='50' name
='form_diagnosis'
688 value
='<?php echo attr($irow['diagnosis
']) ?>' onclick
='sel_diagnosis()'
689 title
='<?php echo xla('Click to select
or change coding
'); ?>'
690 style
='width:100%' readonly
/>
695 <td valign
='top' nowrap
><b
><?php
echo xlt('Begin Date'); ?
>:</b
></td
>
698 <input type
='text' size
='10' name
='form_begin' id
='form_begin'
699 value
='<?php echo attr($irow['begdate
']) ?>'
700 onkeyup
='datekeyup(this,mypcc)' onblur
='dateblur(this,mypcc)'
701 title
='<?php echo xla('yyyy
-mm
-dd date of onset
, surgery
or start of medication
'); ?>' />
702 <img src
='../../pic/show_calendar.gif' align
='absbottom' width
='24' height
='22'
703 id
='img_begin' border
='0' alt
='[?]' style
='cursor:pointer'
704 title
='<?php echo xla('Click here to choose a date
'); ?>' />
708 <tr id
='row_enddate'>
709 <td valign
='top' nowrap
><b
><?php
echo xlt('End Date'); ?
>:</b
></td
>
711 <input type
='text' size
='10' name
='form_end' id
='form_end'
712 value
='<?php echo attr($irow['enddate
']) ?>'
713 onkeyup
='datekeyup(this,mypcc)' onblur
='dateblur(this,mypcc)'
714 title
='<?php echo xla('yyyy
-mm
-dd date of recovery
or end of medication
'); ?>' />
715 <img src
='../../pic/show_calendar.gif' align
='absbottom' width
='24' height
='22'
716 id
='img_end' border
='0' alt
='[?]' style
='cursor:pointer'
717 title
='<?php echo xla('Click here to choose a date
'); ?>' />
718  
;(<?php
echo xlt('leave blank if still active'); ?
>)
723 <td valign
='top' nowrap
><b
><?php
echo xlt('Active'); ?
>:</b
></td
>
725 <input type
='checkbox' name
='form_active' value
='1' <?php
echo attr($irow['enddate']) ?
"" : "checked"; ?
>
726 onclick
='activeClicked(this);'
727 title
='<?php echo xla('Indicates
if this issue is currently active
'); ?>' />
731 <tr id
='row_returndate'>
733 <input type
='hidden' name
='form_return' id
='form_return' />
734 <input type
='hidden' name
='row_reinjury_id' id
='row_reinjury_id' />
742 <tr id
='row_occurrence'>
743 <td valign
='top' nowrap
><b
><?php
echo xlt('Occurrence'); ?
>:</b
></td
>
746 // Modified 6/2009 by BM to incorporate the occurrence items into the list_options listings
747 generate_form_field(array('data_type'=>1,'field_id'=>'occur','list_id'=>'occurrence','empty_title'=>'SKIP'), $irow['occurrence']);
752 <tr id
='row_classification'>
754 <td valign
='top' nowrap
><b
><?php
echo xlt('Classification'); ?
>:</b
></td
>
756 <select name
='form_classification'>
758 foreach ($ISSUE_CLASSIFICATIONS as $key => $value) {
759 echo " <option value='".attr($key)."'";
760 if ($key == $irow['classification']) echo " selected";
761 echo ">".text($value)."\n";
768 <!-- Reaction
For Medication Allergy
-->
769 <tr id
='row_severity'>
770 <td valign
='top' nowrap
><b
><?php
echo xlt('Severity'); ?
>:</b
></td
>
772 $severity=$irow['severity_al'];
773 generate_form_field(array('data_type'=>1,'field_id'=>'severity_id','list_id'=>'severity_ccda','empty_title'=>'SKIP'), $severity);
777 <tr id
='row_reaction'>
778 <td valign
='top' nowrap
><b
><?php
echo xlt('Reaction'); ?
>:</b
></td
>
781 echo generate_select_list('form_reaction', 'reaction', $irow['reaction'], '', '', '', '');
785 <!-- End of reaction
-->
787 <tr id
='row_referredby'>
788 <td valign
='top' nowrap
><b
><?php
echo xlt('Referred by'); ?
>:</b
></td
>
790 <input type
='text' size
='40' name
='form_referredby' value
='<?php echo attr($irow['referredby
']) ?>'
791 style
='width:100%' title
='<?php echo xla('Referring physician
and practice
'); ?>' />
795 <tr id
='row_comments'>
796 <td valign
='top' nowrap
><b
><?php
echo xlt('Comments'); ?
>:</b
></td
>
798 <textarea name
='form_comments' rows
='4' cols
='40' wrap
='virtual' style
='width:100%'><?php
echo text($irow['comments']) ?
></textarea
>
802 <tr
<?php
if ($GLOBALS['ippf_specific']) echo " style='display:none;'"; ?
>>
803 <td valign
='top' nowrap
><b
><?php
echo xlt('Outcome'); ?
>:</b
></td
>
806 echo generate_select_list('form_outcome', 'outcome', $irow['outcome'], '', '', '', 'outcomeClicked(this);');
811 <tr
<?php
if ($GLOBALS['ippf_specific']) echo " style='display:none;'"; ?
>>
812 <td valign
='top' nowrap
><b
><?php
echo xlt('Destination'); ?
>:</b
></td
>
815 <input type
='text' size
='40' name
='form_destination' value
='<?php echo attr($irow['destination
']) ?>'
816 style
='width:100%' title
='GP, Secondary care specialist, etc.' />
817 <?php
} else { // leave this here for now, please -- Rod ?>
818 <?php
echo rbinput('form_destination', '1', 'GP' , 'destination') ?
> 
;
819 <?php
echo rbinput('form_destination', '2', 'Secondary care spec', 'destination') ?
> 
;
820 <?php
echo rbinput('form_destination', '3', 'GP via physio' , 'destination') ?
> 
;
821 <?php
echo rbinput('form_destination', '4', 'GP via podiatry' , 'destination') ?
>
829 if ($ISSUE_TYPES['football_injury']) {
830 issue_football_injury_form($issue);
832 if ($ISSUE_TYPES['ippf_gcac']) {
833 if (empty($issue) ||
$irow['type'] == 'ippf_gcac')
834 issue_ippf_gcac_form($issue, $thispid);
835 if (empty($issue) ||
$irow['type'] == 'contraceptive')
836 issue_ippf_con_form($issue, $thispid);
843 <input type
='submit' name
='form_save' value
='<?php echo xla('Save
'); ?>' />
845 <?php
if ($issue && acl_check('admin', 'super')) { ?
>
847 <input type
='button' value
='<?php echo xla('Delete
'); ?>' style
='color:red' onclick
='deleteme()' />
851 <input type
='button' value
='<?php echo xla('Cancel
'); ?>' onclick
='closeme();' />
857 <script language
='JavaScript'>
858 newtype(<?php
echo $type_index ?
>);
859 Calendar
.setup({inputField
:"form_begin", ifFormat
:"%Y-%m-%d", button
:"img_begin"});
860 Calendar
.setup({inputField
:"form_end", ifFormat
:"%Y-%m-%d", button
:"img_end"});
861 Calendar
.setup({inputField
:"form_return", ifFormat
:"%Y-%m-%d", button
:"img_return"});
864 <?php
validateUsingPageRules($_SERVER['PHP_SELF']);?
>