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');
33 <script type
="text/javascript" src
="<?php echo $webroot ?>/interface/main/tabs/js/include_opener.js"></script
>
36 if (isset($ISSUE_TYPES['football_injury'])) {
37 if ($ISSUE_TYPES['football_injury']) {
38 // Most of the logic for the "football injury" issue type comes from this
39 // included script. We might eventually refine this approach to support
40 // a plug-in architecture for custom issue types.
41 require_once($GLOBALS['srcdir'].'/football_injury.inc.php');
44 if (isset($ISSUE_TYPES['ippf_gcac'])) {
45 if ($ISSUE_TYPES['ippf_gcac']) {
46 // Similarly for IPPF issues.
47 require_once($GLOBALS['srcdir'].'/ippf_issues.inc.php');
51 $issue = $_REQUEST['issue'];
52 $thispid = 0 +
(empty($_REQUEST['thispid']) ?
$pid : $_REQUEST['thispid']);
55 // A nonempty thisenc means we are to link the issue to the encounter.
56 $thisenc = 0 +
(empty($_REQUEST['thisenc']) ?
0 : $_REQUEST['thisenc']);
58 // A nonempty thistype is an issue type to be forced for a new issue.
59 $thistype = empty($_REQUEST['thistype']) ?
'' : $_REQUEST['thistype'];
61 if ($issue && !acl_check('patients','med','','write') ) die(xlt("Edit is not authorized!"));
62 if ( !acl_check('patients','med','',array('write','addonly') )) die(xlt("Add is not authorized!"));
64 $tmp = getPatientData($thispid, "squad");
65 if ($tmp['squad'] && ! acl_check('squads', $tmp['squad']))
66 die(xlt("Not authorized for this squad!"));
68 function QuotedOrNull($fld) {
69 if ($fld) return "'".add_escape_custom($fld)."'";
74 // Do not use this function since quotes are added in query escaping mechanism
75 // Only keeping since used in the football injury code football_injury.inc.php that is included.
76 // If start using this function, then incorporate the add_escape_custom() function into it
77 function rbvalue($rbname) {
78 $tmp = $_POST[$rbname];
79 if (! $tmp) $tmp = '0';
83 function cbvalue($cbname) {
84 return $_POST[$cbname] ?
'1' : '0';
87 function invalue($inname) {
88 return (int) trim($_POST[$inname]);
91 // Do not use this function since quotes are added in query escaping mechanism
92 // Only keeping since used in the football injury code football_injury.inc.php that is included.
93 // If start using this function, then incorporate the add_escape_custom() function into it
94 function txvalue($txname) {
95 return "'" . trim($_POST[$txname]) . "'";
98 function rbinput($name, $value, $desc, $colname) {
100 $ret = "<input type='radio' name='".attr($name)."' value='".attr($value)."'";
101 if ($irow[$colname] == $value) $ret .= " checked";
102 $ret .= " />".text($desc);
106 function rbcell($name, $value, $desc, $colname) {
107 return "<td width='25%' nowrap>" . rbinput($name, $value, $desc, $colname) . "</td>\n";
110 // Given an issue type as a string, compute its index.
111 function issueTypeIndex($tstr) {
114 foreach ($ISSUE_TYPES as $key => $value) {
115 if ($key == $tstr) break;
121 function ActiveIssueCodeRecycleFn($thispid2, $ISSUE_TYPES2) {
122 ///////////////////////////////////////////////////////////////////////
123 // Active Issue Code Recycle Function authored by epsdky (2014-2015) //
124 ///////////////////////////////////////////////////////////////////////
126 $modeIssueTypes = array();
127 $issueTypeIdx2 = array();
130 foreach ($ISSUE_TYPES2 as $issueTypeX => $isJunk) {
132 $modeIssueTypes[$idx2] = $issueTypeX;
133 $issueTypeIdx2[$issueTypeX] = $idx2;
138 $pe2 = array($thispid2);
139 $qs2 = str_repeat('?, ', count($modeIssueTypes) - 1) . '?';
140 $sqlParameters2 = array_merge($pe2, $modeIssueTypes);
142 $codeList2 = array();
144 $issueCodes2 = sqlStatement("SELECT diagnosis FROM lists WHERE pid = ? AND enddate is NULL AND type IN ($qs2)", $sqlParameters2);
146 while ($issueCodesRow2 = sqlFetchArray($issueCodes2)) {
148 if ($issueCodesRow2['diagnosis'] != "") {
150 $someCodes2 = explode(";", $issueCodesRow2['diagnosis']);
151 $codeList2 = array_merge($codeList2, $someCodes2);
159 $codeList2 = array_unique($codeList2);
164 $memberCodes = array();
165 $memberCodes[0] = array();
166 $memberCodes[1] = array();
167 $memberCodes[2] = array();
169 $allowedCodes2 = array();
170 $allowedCodes2[0] = collect_codetypes("medical_problem");
171 $allowedCodes2[1] = collect_codetypes("diagnosis");
172 $allowedCodes2[2] = collect_codetypes("drug");
174 // Test membership of codes to each code type set
175 foreach ($allowedCodes2 as $akey1 => $allowCodes2) {
177 foreach ($codeList2 as $listCode2) {
179 list($codeTyX,) = explode(":", $listCode2);
181 if (in_array($codeTyX, $allowCodes2)) {
183 array_push($memberCodes[$akey1], $listCode2);
191 // output sets of display options
192 $displayCodeSets[0] = $memberCodes[0]; // medical_problem
193 $displayCodeSets[1] = array_merge($memberCodes[1], $memberCodes[2]); // allergy
194 $displayCodeSets[2] = array_merge($memberCodes[2], $memberCodes[1]); // medication
195 $displayCodeSets[3] = $memberCodes[1]; // default
197 echo "var listBoxOptionSets = new Array();\n\n";
199 foreach ($displayCodeSets as $akey => $displayCodeSet) {
201 echo "listBoxOptionSets[" . attr($akey) . "] = new Array();\n";
203 if ($displayCodeSet) {
205 foreach ($displayCodeSet as $dispCode2) {
207 $codeDesc2 = lookup_code_descriptions($dispCode2);
208 echo "listBoxOptionSets[" . attr($akey) . "][listBoxOptionSets[" . attr($akey) . "].length] = new Option('" . attr($dispCode2) . " (" . attr(trim($codeDesc2)) . ") ' ,'" . attr($dispCode2) . "' , false, false);\n";
216 // map issues to a set of display options
217 $modeIndexMapping = array();
219 foreach ($modeIssueTypes as $akey2 => $isJunk) $modeIndexMapping[$akey2] = 3;
221 if (array_key_exists("medical_problem", $issueTypeIdx2))
222 $modeIndexMapping[$issueTypeIdx2['medical_problem']] = 0;
223 if (array_key_exists("allergy", $issueTypeIdx2))
224 $modeIndexMapping[$issueTypeIdx2['allergy']] = 1;
225 if (array_key_exists("medication", $issueTypeIdx2))
226 $modeIndexMapping[$issueTypeIdx2['medication']] = 2;
228 echo "\nvar listBoxOptions2 = new Array();\n\n";
230 foreach ($modeIssueTypes as $akey2 => $isJunk) {
231 echo "listBoxOptions2[" . attr($akey2) . "] = listBoxOptionSets[" . attr($modeIndexMapping[$akey2]) . "];\n";
233 ///////////////////////////////////////////////////////////////////////
234 // End of Active Issue Code Recycle Function main code block //
235 ///////////////////////////////////////////////////////////////////////
238 // If we are saving, then save and close the window.
240 if ($_POST['form_save']) {
243 $text_type = "unknown";
244 foreach ($ISSUE_TYPES as $key => $value) {
245 if ($i++
== $_POST['form_type']) $text_type = $key;
248 $form_begin = fixDate($_POST['form_begin'], '');
249 $form_end = fixDate($_POST['form_end'], '');
251 if ($text_type == 'football_injury') {
252 $form_injury_part = $_POST['form_injury_part'];
253 $form_injury_type = $_POST['form_injury_type'];
256 $form_injury_part = $_POST['form_medical_system'];
257 $form_injury_type = $_POST['form_medical_type'];
262 $query = "UPDATE lists SET " .
263 "type = '" . add_escape_custom($text_type) . "', " .
264 "title = '" . add_escape_custom($_POST['form_title']) . "', " .
265 "comments = '" . add_escape_custom($_POST['form_comments']) . "', " .
266 "begdate = " . QuotedOrNull($form_begin) . ", " .
267 "enddate = " . QuotedOrNull($form_end) . ", " .
268 "returndate = " . QuotedOrNull($form_return) . ", " .
269 "diagnosis = '" . add_escape_custom($_POST['form_diagnosis']) . "', " .
270 "occurrence = '" . add_escape_custom($_POST['form_occur']) . "', " .
271 "classification = '" . add_escape_custom($_POST['form_classification']) . "', " .
272 "reinjury_id = '" . add_escape_custom($_POST['form_reinjury_id']) . "', " .
273 "referredby = '" . add_escape_custom($_POST['form_referredby']) . "', " .
274 "injury_grade = '" . add_escape_custom($_POST['form_injury_grade']) . "', " .
275 "injury_part = '" . add_escape_custom($form_injury_part) . "', " .
276 "injury_type = '" . add_escape_custom($form_injury_type) . "', " .
277 "outcome = '" . add_escape_custom($_POST['form_outcome']) . "', " .
278 "destination = '" . add_escape_custom($_POST['form_destination']) . "', " .
279 "reaction ='" . add_escape_custom($_POST['form_reaction']) . "', " .
280 "severity_al ='" . add_escape_custom($_POST['form_severity_id']) . "', " .
281 "erx_uploaded = '0', " .
282 "modifydate = NOW() " .
283 "WHERE id = '" . add_escape_custom($issue) . "'";
284 sqlStatement($query);
285 if ($text_type == "medication" && enddate
!= '') {
286 sqlStatement('UPDATE prescriptions SET '
287 . 'medication = 0 where patient_id = ? '
288 . " and upper(trim(drug)) = ? "
289 . ' and medication = 1', array($thispid,strtoupper($_POST['form_title'])) );
294 $issue = sqlInsert("INSERT INTO lists ( " .
295 "date, pid, type, title, activity, comments, begdate, enddate, returndate, " .
296 "diagnosis, occurrence, classification, referredby, user, groupname, " .
297 "outcome, destination, reinjury_id, injury_grade, injury_part, injury_type, " .
298 "reaction, severity_al " .
301 "'" . add_escape_custom($thispid) . "', " .
302 "'" . add_escape_custom($text_type) . "', " .
303 "'" . add_escape_custom($_POST['form_title']) . "', " .
305 "'" . add_escape_custom($_POST['form_comments']) . "', " .
306 QuotedOrNull($form_begin) . ", " .
307 QuotedOrNull($form_end) . ", " .
308 QuotedOrNull($form_return) . ", " .
309 "'" . add_escape_custom($_POST['form_diagnosis']) . "', " .
310 "'" . add_escape_custom($_POST['form_occur']) . "', " .
311 "'" . add_escape_custom($_POST['form_classification']) . "', " .
312 "'" . add_escape_custom($_POST['form_referredby']) . "', " .
313 "'" . add_escape_custom($
$_SESSION['authUser']) . "', " .
314 "'" . add_escape_custom($
$_SESSION['authProvider']) . "', " .
315 "'" . add_escape_custom($_POST['form_outcome']) . "', " .
316 "'" . add_escape_custom($_POST['form_destination']) . "', " .
317 "'" . add_escape_custom($_POST['form_reinjury_id']) . "', " .
318 "'" . add_escape_custom($_POST['form_injury_grade']) . "', " .
319 "'" . add_escape_custom($form_injury_part) . "', " .
320 "'" . add_escape_custom($form_injury_type) . "', " .
321 "'" . add_escape_custom($_POST['form_reaction']) . "', " .
322 "'" . add_escape_custom($_POST['form_severity_id']) . "' " .
327 // For record/reporting purposes, place entry in lists_touch table.
328 setListTouch($thispid,$text_type);
330 if ($text_type == 'football_injury') issue_football_injury_save($issue);
331 if ($text_type == 'ippf_gcac' ) issue_ippf_gcac_save($issue);
332 if ($text_type == 'contraceptive' ) issue_ippf_con_save($issue);
334 // If requested, link the issue to a specified encounter.
336 $query = "INSERT INTO issue_encounter ( " .
337 "pid, list_id, encounter " .
338 ") VALUES ( ?,?,? )";
339 sqlStatement($query, array($thispid,$issue,$thisenc));
342 $tmp_title = addslashes($ISSUE_TYPES[$text_type][2] . ": $form_begin " .
343 substr($_POST['form_title'], 0, 40));
345 // Close this window and redisplay the updated list of issues.
347 echo "<html><body><script language='JavaScript'>\n";
348 if ($info_msg) echo " alert('$info_msg');\n";
350 echo " var myboss = opener ? opener : parent;\n";
351 echo " if (myboss.refreshIssue) myboss.refreshIssue($issue,'$tmp_title');\n";
352 echo " else if (myboss.reloadIssues) myboss.reloadIssues();\n";
353 echo " else myboss.location.reload();\n";
354 echo " if (parent.$ && parent.$.fancybox) parent.$.fancybox.close();\n";
355 echo " else window.close();\n";
357 echo "</script></body></html>\n";
363 $irow = sqlQuery("SELECT * FROM lists WHERE id = ?",array($issue));
365 $irow['type'] = $thistype;
369 if (!empty($irow['type'])) {
370 foreach ($ISSUE_TYPES as $key => $value) {
371 if ($key == $irow['type']) break;
378 <?php
html_header_show();?
>
380 <title
><?php
echo $issue ?
xlt('Edit') : xlt('Add New'); ?
><?php
echo " ".xlt('Issue'); ?
></title
>
381 <link rel
="stylesheet" href
='<?php echo $css_header ?>' type
='text/css'>
385 td
, input
, select
, textarea
{
386 font
-family
: Arial
, Helvetica
, sans
-serif
;
393 border
-color
: #0000ff;
400 <script type
="text/javascript" src
="<?php echo $GLOBALS['assets_static_relative']; ?>/jquery-min-1-9-1/index.js"></script
>
401 <style type
="text/css">@import
url(<?php
echo $GLOBALS['webroot']; ?
>/library
/dynarch_calendar
.css
);</style
>
402 <script type
="text/javascript" src
="<?php echo $GLOBALS['webroot']; ?>/library/dynarch_calendar.js"></script
>
403 <?php
require_once($GLOBALS['srcdir'].'/dynarch_calendar_en.inc.php'); ?
>
404 <script type
="text/javascript" src
="<?php echo $GLOBALS['webroot']; ?>/library/dynarch_calendar_setup.js"></script
>
405 <script type
="text/javascript" src
="<?php echo $GLOBALS['webroot']; ?>/library/textformat.js"></script
>
406 <script type
="text/javascript" src
="<?php echo $GLOBALS['webroot']; ?>/library/dialog.js?v=<?php echo $v_js_includes; ?>"></script
>
408 <script language
="JavaScript">
410 var mypcc
= '<?php echo $GLOBALS['phone_country_code
'] ?>';
412 var aitypes
= new Array(); // issue type attributes
413 var aopts
= new Array(); // Option objects
416 foreach ($ISSUE_TYPES as $key => $value) {
417 echo " aitypes[$i] = " . attr($value[3]) . ";\n";
418 echo " aopts[$i] = new Array();\n";
419 $qry = sqlStatement("SELECT * FROM list_options WHERE list_id = ? AND activity = 1",array($key."_issue_list"));
420 while($res = sqlFetchArray($qry)){
421 echo " aopts[$i][aopts[$i].length] = new Option('".attr(xl_list_label(trim($res['title'])))."', '".attr(trim($res['option_id']))."', false, false);\n";
423 echo " aopts[$i][aopts[$i].length-1].setAttribute('data-code','".attr(trim($res['codes']))."');\n";
430 ActiveIssueCodeRecycleFn($thispid, $ISSUE_TYPES);
434 <?php
require($GLOBALS['srcdir'] . "/restoreSession.php"); ?
>
436 ///////////////////////////
437 function codeBoxFunction2() {
438 var f
= document
.forms
[0];
439 var x2
= f
.form_codeSelect2
.options
[f
.form_codeSelect2
.selectedIndex
].value
;
440 f
.form_codeSelect2
.selectedIndex
= -1;
441 var x6
= f
.form_diagnosis
.value
;
442 if (x6
.length
> 0) x6 +
= ";";
444 f
.form_diagnosis
.value
= x6
;
446 ///////////////////////////
448 // React to selection of an issue type. This loads the associated
449 // shortcuts into the selection list of titles, and determines which
450 // rows are displayed or hidden.
451 function newtype(index
) {
452 var f
= document
.forms
[0];
453 var theopts
= f
.form_titles
.options
;
456 for (i
= 0; i
< aopts
[index
].length
; ++i
) {
457 theopts
[i
] = aopts
[index
][i
];
459 document
.getElementById('row_titles').style
.display
= i ?
'' : 'none';
461 ///////////////////////
462 var listBoxOpts2
= f
.form_codeSelect2
.options
;
463 listBoxOpts2
.length
= 0;
465 for (ix
= 0; ix
< listBoxOptions2
[index
].length
; ++ix
) {
466 listBoxOpts2
[ix
] = listBoxOptions2
[index
][ix
];
467 listBoxOpts2
[ix
].title
= listBoxOptions2
[index
][ix
].text
;
469 document
.getElementById('row_codeSelect2').style
.display
= ix ?
'' : 'none';
470 //////////////////////
472 // Show or hide various rows depending on issue type, except do not
473 // hide the comments or referred-by fields if they have data.
474 var comdisp
= (aitypes
[index
] == 1) ?
'none' : '';
475 var revdisp
= (aitypes
[index
] == 1) ?
'' : 'none';
476 var injdisp
= (aitypes
[index
] == 2) ?
'' : 'none';
477 var nordisp
= (aitypes
[index
] == 0) ?
'' : 'none';
478 // reaction row should be displayed only for medication allergy.
479 var alldisp
= (index
== <?php
echo issueTypeIndex('allergy'); ?
>) ?
'' : 'none';
480 document
.getElementById('row_enddate' ).style
.display
= comdisp
;
481 // Note that by default all the issues will not show the active row
482 // (which is desired functionality, since then use the end date
483 // to inactivate the item.)
484 document
.getElementById('row_active' ).style
.display
= revdisp
;
485 document
.getElementById('row_diagnosis' ).style
.display
= comdisp
;
486 document
.getElementById('row_occurrence' ).style
.display
= comdisp
;
487 document
.getElementById('row_classification').style
.display
= injdisp
;
488 document
.getElementById('row_reinjury_id' ).style
.display
= injdisp
;
489 document
.getElementById('row_severity' ).style
.display
= alldisp
;
490 document
.getElementById('row_reaction' ).style
.display
= alldisp
;
491 document
.getElementById('row_referredby' ).style
.display
= (f
.form_referredby
.value
) ?
'' : comdisp
;
492 document
.getElementById('row_comments' ).style
.display
= (f
.form_comments
.value
) ?
'' : revdisp
;
493 document
.getElementById('row_referredby' ).style
.display
= (f
.form_referredby
.value
) ?
'' : comdisp
;
496 if ($ISSUE_TYPES['football_injury']) {
497 // Generate more of these for football injury fields.
498 issue_football_injury_newtype();
500 if ($ISSUE_TYPES['ippf_gcac'] && !$_POST['form_save']) {
501 // Generate more of these for gcac and contraceptive fields.
502 if (empty($issue) ||
$irow['type'] == 'ippf_gcac' ) issue_ippf_gcac_newtype();
503 if (empty($issue) ||
$irow['type'] == 'contraceptive') issue_ippf_con_newtype();
508 // If a clickoption title is selected, copy it to the title field.
509 // If it has a code, add that too.
510 function set_text() {
511 var f
= document
.forms
[0];
512 f
.form_title
.value
= f
.form_titles
.options
[f
.form_titles
.selectedIndex
].text
;
513 f
.form_diagnosis
.value
= f
.form_titles
.options
[f
.form_titles
.selectedIndex
].getAttribute('data-code');
514 f
.form_titles
.selectedIndex
= -1;
517 // Process click on Delete link.
518 function deleteme() {
519 dlgopen('../deleter.php?issue=<?php echo attr($issue) ?>', '_blank', 500, 450);
523 // Called by the deleteme.php window on a successful delete.
524 function imdeleted() {
529 if (parent
.$
&& parent
.$
.fancybox
) parent
.$
.fancybox
.close();
533 // Called when the Active checkbox is clicked. For consistency we
534 // use the existence of an end date to indicate inactivity, even
535 // though the simple verion of the form does not show an end date.
536 function activeClicked(cb
) {
537 var f
= document
.forms
[0];
539 f
.form_end
.value
= '';
541 var today
= new Date();
542 f
.form_end
.value
= '' +
(today
.getYear() +
1900) +
'-' +
543 (today
.getMonth() +
1) +
'-' + today
.getDate();
547 // Called when resolved outcome is chosen and the end date is entered.
548 function outcomeClicked(cb
) {
549 var f
= document
.forms
[0];
550 if (cb
.value
== '1'){
551 var today
= new Date();
552 f
.form_end
.value
= '' +
(today
.getYear() +
1900) +
'-' +
553 ("0" +
(today
.getMonth() +
1)).slice(-2) +
'-' +
("0" + today
.getDate()).slice(-2);
558 // This is for callback by the find-code popup.
559 // Appends to or erases the current list of diagnoses.
560 function set_related(codetype
, code
, selector
, codedesc
) {
561 var f
= document
.forms
[0];
562 var s
= f
.form_diagnosis
.value
;
563 var title
= f
.form_title
.value
;
565 //disabled duplicate codes
566 if (s
.indexOf(codetype +
':' + code
) == -1){
567 if (s
.length
> 0) s +
= ';';
568 s +
= codetype +
':' + code
;
573 f
.form_diagnosis
.value
= s
;
574 if(title
== '') f
.form_title
.value
= codedesc
;
577 // This invokes the find-code popup.
578 function sel_diagnosis() {
580 $url = '../encounter/find_code_popup.php?codetype=';
581 if($irow['type'] == 'medical_problem') {
582 $url .= collect_codetypes("medical_problem", "csv");
585 $url .= collect_codetypes("diagnosis","csv");
586 $tmp = collect_codetypes("drug","csv");
587 if($irow['type'] == 'allergy') {
588 if ($tmp) $url .= ",$tmp";
590 else if($irow['type'] == 'medication') {
591 if ($tmp) $url .= ",$tmp&default=$tmp";
595 dlgopen('<?php echo $url; ?>', '_blank', 700, 500);
598 // Check for errors when the form is submitted.
599 function validate() {
600 var f
= document
.forms
[0];
601 if(f
.form_begin
.value
> f
.form_end
.value
&& (f
.form_end
.value
)) {
602 alert("<?php echo addslashes(xl('Please Enter End Date greater than Begin Date!')); ?>");
605 if (! f
.form_title
.value
) {
606 alert("<?php echo addslashes(xl('Please enter a title!')); ?>");
609 top
.restoreSession();
613 // Supports customizable forms (currently just for IPPF).
614 function divclick(cb
, divid
) {
615 var divstyle
= document
.getElementById(divid
).style
;
617 divstyle
.display
= 'block';
619 divstyle
.display
= 'none';
628 <body
class="body_top" style
="padding-right:0.5em">
630 <form method
='post' name
='theform'
631 action
='add_edit_issue.php?issue=<?php echo attr($issue); ?>&thispid=<?php echo attr($thispid); ?>&thisenc=<?php echo attr($thisenc); ?>'
632 onsubmit
='return validate()'>
634 <table border
='0' width
='100%'>
637 <td valign
='top' width
='1%' nowrap
><b
><?php
echo xlt('Type'); ?
>:</b
></td
>
641 foreach ($ISSUE_TYPES as $value) {
642 if ($issue ||
$thistype) {
643 if ($index == $type_index) {
644 echo text($value[1]);
645 echo "<input type='hidden' name='form_type' value='".attr($index)."'>\n";
648 echo " <input type='radio' name='form_type' value='".attr($index)."' onclick='newtype($index)'";
649 if ($index == $type_index) echo " checked";
650 echo " />" . text($value[1]) . " \n";
659 <td valign
='top' nowrap
> 
;</td
>
661 <select name
='form_titles' size
='4' onchange
='set_text()'>
662 </select
> <?php
echo xlt('(Select one of these, or type your own title)'); ?
>
667 <td valign
='top' id
='title_diagnosis' nowrap
><b
><?php
echo xlt('Title'); ?
>:</b
></td
>
669 <input type
='text' size
='40' name
='form_title' value
='<?php echo attr($irow['title
']) ?>' style
='width:100%' />
673 <tr id
='row_codeSelect2'>
674 <td
><b
><?php
echo xlt('Active Issue Codes'); ?
>:</b
>
677 <select name
='form_codeSelect2' size
='4' onchange
="codeBoxFunction2()" style
="max-width:100%;">
682 <tr id
='row_diagnosis'>
683 <td valign
='top' nowrap
><b
><?php
echo xlt('Coding'); ?
>:</b
></td
>
685 <input type
='text' size
='50' name
='form_diagnosis'
686 value
='<?php echo attr($irow['diagnosis
']) ?>' onclick
='sel_diagnosis()'
687 title
='<?php echo xla('Click to select
or change coding
'); ?>'
688 style
='width:100%' readonly
/>
693 <td valign
='top' nowrap
><b
><?php
echo xlt('Begin Date'); ?
>:</b
></td
>
696 <input type
='text' size
='10' name
='form_begin' id
='form_begin'
697 value
='<?php echo attr($irow['begdate
']) ?>'
698 onkeyup
='datekeyup(this,mypcc)' onblur
='dateblur(this,mypcc)'
699 title
='<?php echo xla('yyyy
-mm
-dd date of onset
, surgery
or start of medication
'); ?>' />
700 <img src
='../../pic/show_calendar.gif' align
='absbottom' width
='24' height
='22'
701 id
='img_begin' border
='0' alt
='[?]' style
='cursor:pointer'
702 title
='<?php echo xla('Click here to choose a date
'); ?>' />
706 <tr id
='row_enddate'>
707 <td valign
='top' nowrap
><b
><?php
echo xlt('End Date'); ?
>:</b
></td
>
709 <input type
='text' size
='10' name
='form_end' id
='form_end'
710 value
='<?php echo attr($irow['enddate
']) ?>'
711 onkeyup
='datekeyup(this,mypcc)' onblur
='dateblur(this,mypcc)'
712 title
='<?php echo xla('yyyy
-mm
-dd date of recovery
or end of medication
'); ?>' />
713 <img src
='../../pic/show_calendar.gif' align
='absbottom' width
='24' height
='22'
714 id
='img_end' border
='0' alt
='[?]' style
='cursor:pointer'
715 title
='<?php echo xla('Click here to choose a date
'); ?>' />
716  
;(<?php
echo xlt('leave blank if still active'); ?
>)
721 <td valign
='top' nowrap
><b
><?php
echo xlt('Active'); ?
>:</b
></td
>
723 <input type
='checkbox' name
='form_active' value
='1' <?php
echo attr($irow['enddate']) ?
"" : "checked"; ?
>
724 onclick
='activeClicked(this);'
725 title
='<?php echo xla('Indicates
if this issue is currently active
'); ?>' />
729 <tr id
='row_returndate'>
731 <input type
='hidden' name
='form_return' id
='form_return' />
732 <input type
='hidden' name
='row_reinjury_id' id
='row_reinjury_id' />
740 <tr id
='row_occurrence'>
741 <td valign
='top' nowrap
><b
><?php
echo xlt('Occurrence'); ?
>:</b
></td
>
744 // Modified 6/2009 by BM to incorporate the occurrence items into the list_options listings
745 generate_form_field(array('data_type'=>1,'field_id'=>'occur','list_id'=>'occurrence','empty_title'=>'SKIP'), $irow['occurrence']);
750 <tr id
='row_classification'>
752 <td valign
='top' nowrap
><b
><?php
echo xlt('Classification'); ?
>:</b
></td
>
754 <select name
='form_classification'>
756 foreach ($ISSUE_CLASSIFICATIONS as $key => $value) {
757 echo " <option value='".attr($key)."'";
758 if ($key == $irow['classification']) echo " selected";
759 echo ">".text($value)."\n";
766 <!-- Reaction
For Medication Allergy
-->
767 <tr id
='row_severity'>
768 <td valign
='top' nowrap
><b
><?php
echo xlt('Severity'); ?
>:</b
></td
>
770 $severity=$irow['severity_al'];
771 generate_form_field(array('data_type'=>1,'field_id'=>'severity_id','list_id'=>'severity_ccda','empty_title'=>'SKIP'), $severity);
775 <tr id
='row_reaction'>
776 <td valign
='top' nowrap
><b
><?php
echo xlt('Reaction'); ?
>:</b
></td
>
779 echo generate_select_list('form_reaction', 'reaction', $irow['reaction'], '', '', '', '');
783 <!-- End of reaction
-->
785 <tr id
='row_referredby'>
786 <td valign
='top' nowrap
><b
><?php
echo xlt('Referred by'); ?
>:</b
></td
>
788 <input type
='text' size
='40' name
='form_referredby' value
='<?php echo attr($irow['referredby
']) ?>'
789 style
='width:100%' title
='<?php echo xla('Referring physician
and practice
'); ?>' />
793 <tr id
='row_comments'>
794 <td valign
='top' nowrap
><b
><?php
echo xlt('Comments'); ?
>:</b
></td
>
796 <textarea name
='form_comments' rows
='4' cols
='40' wrap
='virtual' style
='width:100%'><?php
echo text($irow['comments']) ?
></textarea
>
800 <tr
<?php
if ($GLOBALS['ippf_specific']) echo " style='display:none;'"; ?
>>
801 <td valign
='top' nowrap
><b
><?php
echo xlt('Outcome'); ?
>:</b
></td
>
804 echo generate_select_list('form_outcome', 'outcome', $irow['outcome'], '', '', '', 'outcomeClicked(this);');
809 <tr
<?php
if ($GLOBALS['ippf_specific']) echo " style='display:none;'"; ?
>>
810 <td valign
='top' nowrap
><b
><?php
echo xlt('Destination'); ?
>:</b
></td
>
813 <input type
='text' size
='40' name
='form_destination' value
='<?php echo attr($irow['destination
']) ?>'
814 style
='width:100%' title
='GP, Secondary care specialist, etc.' />
815 <?php
} else { // leave this here for now, please -- Rod ?>
816 <?php
echo rbinput('form_destination', '1', 'GP' , 'destination') ?
> 
;
817 <?php
echo rbinput('form_destination', '2', 'Secondary care spec', 'destination') ?
> 
;
818 <?php
echo rbinput('form_destination', '3', 'GP via physio' , 'destination') ?
> 
;
819 <?php
echo rbinput('form_destination', '4', 'GP via podiatry' , 'destination') ?
>
827 if ($ISSUE_TYPES['football_injury']) {
828 issue_football_injury_form($issue);
830 if ($ISSUE_TYPES['ippf_gcac']) {
831 if (empty($issue) ||
$irow['type'] == 'ippf_gcac')
832 issue_ippf_gcac_form($issue, $thispid);
833 if (empty($issue) ||
$irow['type'] == 'contraceptive')
834 issue_ippf_con_form($issue, $thispid);
841 <input type
='submit' name
='form_save' value
='<?php echo xla('Save
'); ?>' />
843 <?php
if ($issue && acl_check('admin', 'super')) { ?
>
845 <input type
='button' value
='<?php echo xla('Delete
'); ?>' style
='color:red' onclick
='deleteme()' />
849 <input type
='button' value
='<?php echo xla('Cancel
'); ?>' onclick
='closeme();' />
855 <script language
='JavaScript'>
856 newtype(<?php
echo $type_index ?
>);
857 Calendar
.setup({inputField
:"form_begin", ifFormat
:"%Y-%m-%d", button
:"img_begin"});
858 Calendar
.setup({inputField
:"form_end", ifFormat
:"%Y-%m-%d", button
:"img_end"});
859 Calendar
.setup({inputField
:"form_return", ifFormat
:"%Y-%m-%d", button
:"img_return"});
862 <?php
validateUsingPageRules($_SERVER['PHP_SELF']);?
>