Standardized the diagnosis code searching in the Rules admin GUI
[openemr.git] / library / football_injury.inc.php
blob791f0c79c39e3a62d1a921a58b4391b9e5f615e3
1 <?php
2 $arr_injtime = array(
3 '1' => 'Warm Up',
4 '2' => 'Extra Time',
5 '3' => 'Cool Down',
6 '4' => 'Training Warm Up (deprecated)',
7 '5' => 'Training Session (deprecated)',
8 '6' => 'Training Cool Down (deprecated)',
9 '7' => 'Training Rehab (deprecated)',
12 // This is the number of leading entries in $arr_activity that are for
13 // injuries due to contact with a player or object.
14 $arr_activity_contact_count = 12;
16 $arr_activity = array(
17 'blocked' => 'Blocked', // new
18 'hitbyball' => 'Hit by Ball', // new
19 'goalpost' => 'Collision with Goal Post', // new
20 'ground' => 'Collision with Ground', // new
21 'kicked' => 'Collision with Other Player',
22 'collother' => 'Collision with Other Object', // new
23 'collision' => 'Collision Non Specified',
24 'tackled' => 'Tackled from Front',
25 'tackside' => 'Tackled from Side', // new
26 'tackback' => 'Tackled from Back', // new
27 'tackling' => 'Tackling Other Player',
28 'elbow' => 'Use of Arm/Elbow',
29 // 12 Contact entries, see $arr_activity_contact_count.
30 'running' => 'Running/Sprinting',
31 'turning' => 'Twisting/Turning',
32 'shooting' => 'Shooting',
33 'passing' => 'Passing/Crossing',
34 'dribbling' => 'Dribbling',
35 'jumping' => 'Jumping/Landing',
36 'fall' => 'Falling/Diving',
37 'stretching' => 'Stretching',
38 'sliding' => 'Sliding', // new
39 'throwing' => 'Throwing',
40 'heading' => 'Heading',
41 'landing' => 'Landing (deprecated)', // change to jumping
42 'diving' => 'Diving (deprecated)', // change to fall
43 'overuse' => 'Overuse (deprecated)', // s/b recorded in Classification
46 $arr_sanction = array(
47 'nofoul' => 'No Foul',
48 'oppfoul' => 'Opponent Foul',
49 'ownfoul' => 'Own Foul',
50 'yellow' => 'Yellow Card',
51 'red' => 'Red Card',
54 $arr_surface = array(
55 '7' => 'Grass' ,
56 '3' => 'Outdoor Artificial' ,
57 '4' => 'Indoor Artificial' ,
58 '8' => 'Wooden' ,
59 '9' => 'Concrete' ,
60 '10' => 'Carpet' ,
61 '6' => 'Other' ,
62 '1' => 'Pitch (deprecated)' ,
63 '2' => 'Training (deprecated)',
64 '5' => 'Gym (deprecated)' ,
67 $arr_condition = array(
68 '1' => 'Hard' ,
69 '2' => 'Firm' ,
70 '3' => 'Soft' ,
71 '4' => 'Slippery/Wet',
72 '5' => 'Uneven' ,
73 '6' => 'Good' ,
74 '7' => 'Poor' ,
77 $arr_weather = array(
78 'sunny' => 'Sunny' ,
79 'rainy' => 'Rainy' ,
80 'windy' => 'Windy' ,
81 'dry' => 'Dry' ,
82 'sleet' => 'Sleet/Snow',
83 'overcast' => 'Overcast' ,
86 $arr_position = array(
87 '5' => 'Goal Keeper' ,
88 '1' => 'Defender' ,
89 '7' => 'Midfielder' ,
90 '4' => 'Forward' ,
91 '2' => 'Midfield Offensive (deprecated)',
92 '3' => 'Midfield Defensive (deprecated)',
93 '6' => 'Substitute (deprecated)' ,
96 $arr_footwear = array(
97 '4' => 'Blades' ,
98 '1' => 'Molded Studs' ,
99 '2' => 'Detachable Studs',
100 '3' => 'Indoor Shoes' ,
101 '5' => 'Trainers' ,
104 /*********************************************************************
105 $arr_side = array(
106 '1' => 'Left' ,
107 '2' => 'Right' ,
108 '3' => 'Bilateral' ,
109 '4' => 'Not Applicable',
111 *********************************************************************/
113 $arr_removed = array(
114 '1' => 'Immediately',
115 '2' => 'Later' ,
116 '3' => 'Not at All' ,
119 $arr_match_type = array(
120 '1' => 'Premiership (deprecated)',
121 '2' => 'FA Cup (deprecated)',
122 '3' => 'League Cup (deprecated)',
123 '4' => 'Champions League Cup (deprecated)',
124 '5' => 'Championship Match (deprecated)',
125 '6' => 'League One Match (deprecated)',
126 '7' => 'League Two Match (deprecated)',
127 '8' => 'International Match (deprecated)',
128 '9' => 'Friendly',
129 '10' => 'League Match',
130 '11' => 'UEFA Champtions League Match',
131 '12' => 'UEFA Europa League Match',
132 '13' => 'Carling Cup Match',
133 '14' => 'Other Cup Match',
134 '15' => 'National Match',
135 '16' => 'Reserve Match',
136 '17' => 'Youth Team Match',
139 $arr_training_type = array(
140 '51' => 'Football',
141 '52' => 'Other',
142 '53' => 'Mixed i.e. Football + Other',
143 '54' => 'Endurance',
144 '55' => 'Speed Agility Quickness',
145 '56' => 'Strength',
146 '57' => 'Injury Prevention F-mark 11',
147 '58' => 'Injury Prevention Squad Own',
148 '59' => 'Recovery',
151 $firow = array();
153 function rbfiinput($name, $value, $desc, $colname) {
154 global $firow;
155 $ret = "<input type='radio' name='$name' value='$value'";
156 if ($firow[$colname] == $value) $ret .= " checked";
157 $ret .= " />$desc";
158 return $ret;
161 function rbficell($name, $value, $desc, $colname) {
162 return "<td width='25%' nowrap>" . rbfiinput($name, $value, $desc, $colname) . "</td>\n";
165 function cbfiinput($name, $colname) {
166 global $firow;
167 $ret = "<input type='checkbox' name='$name' value='1'";
168 if ($firow[$colname]) $ret .= " checked";
169 $ret .= " />";
170 return $ret;
173 function cbficell($name, $desc, $colname) {
174 return "<td width='25%' nowrap>" . cbfiinput($name, $colname) . "$desc</td>\n";
177 function issue_football_injury_newtype() {
178 echo " var fiadisp = (aitypes[index] == 2) ? '' : 'none';\n";
179 echo " document.getElementById('football_injury').style.display = fiadisp;\n";
182 function issue_football_injury_save($issue) {
183 global $arr_activity, $arr_sanction, $arr_weather;
184 $query = "REPLACE INTO lists_football_injury ( " .
185 "id, fiinjmin, fiinjtime, fimatchtype, ";
186 foreach ($arr_activity as $key => $value)
187 $query .= "fimech_$key, ";
188 foreach ($arr_sanction as $key => $value)
189 $query .= "fimech_$key, ";
190 foreach ($arr_weather as $key => $value)
191 $query .= "fiweather_$key, ";
192 $query .= "fimech_othercon, fimech_othernon, fiweather_temperature, " .
193 "fisurface, fiposition, fifootwear, firemoved, ficondition " .
194 ") VALUES ( " .
195 $issue . ", " .
196 invalue('form_injmin') . ", " .
197 rbvalue('form_injtime') . ", " .
198 rbvalue('form_matchtype') . ", ";
199 foreach ($arr_activity as $key => $value)
200 $query .= cbvalue("form_mech_$key") . ", ";
201 foreach ($arr_sanction as $key => $value)
202 $query .= cbvalue("form_mech_$key") . ", ";
203 foreach ($arr_weather as $key => $value)
204 $query .= cbvalue("form_weather_$key") . ", ";
205 $query .=
206 txvalue('form_mech_othercon') . ", " .
207 txvalue('form_mech_othernon') . ", " .
208 txvalue('form_weather_temperature') . ", " .
209 rbvalue('form_surface') . ", " .
210 rbvalue('form_position') . ", " .
211 rbvalue('form_footwear') . ", " .
212 // rbvalue('form_side') . ", " .
213 rbvalue('form_removed') . ", " .
214 rbvalue('form_condition') . " " .
215 ")";
216 sqlStatement($query);
219 function issue_football_injury_form($issue) {
220 global $firow, $arr_match_type, $arr_injtime, $arr_training_type;
221 global $arr_activity, $arr_activity_contact_count, $arr_position;
222 global $arr_surface, $arr_condition, $arr_weather, $arr_footwear;
224 if ($issue) {
225 $firow = sqlQuery ("SELECT * FROM lists_football_injury WHERE id = '$issue'");
226 } else {
227 $firow = array();
231 <table border='1' width='98%' id='football_injury' style='display:none;margin-top:6pt;'>
233 <tr bgcolor='#dddddd'>
234 <td colspan='2' align='center'><b>Timing of Injury</b></td>
235 </tr>
237 <tr>
238 <td nowrap>Match Play</td>
239 <td nowrap>
240 <table width='100%'>
241 <tr>
242 <td nowrap>
243 Min of Injury
244 <input type='text' name='form_injmin' size='4'
245 value='<?php echo addslashes($firow['fiinjmin']) ?>' />
246 </td>
247 <?php
248 $i = 1;
249 foreach ($arr_injtime as $key => $value) {
250 // Skip deprecated values except if currently selected.
251 if (stristr($value, 'deprecated') && $firow['fiinjtime'] != $key) continue;
253 if ($i % 4 == 0) echo " <tr>\n";
254 echo " " . rbficell('form_injtime', $key, $value, 'fiinjtime');
255 ++$i;
256 if ($i % 4 == 0) echo " </tr>\n";
258 while ($i % 4 > 0) {
259 echo " <td width='25%'>&nbsp;</td>\n";
260 ++$i;
261 if ($i % 4 == 0) echo " </tr>\n";
264 </tr>
265 </table>
266 </td>
267 </tr>
269 <!-- Training Type and Match Type are all a single set of radio buttons. -->
271 <tr>
272 <td nowrap>Training Type</td>
273 <td nowrap>
274 <table width='100%'>
275 <?php
276 $i = 0;
277 foreach ($arr_training_type as $key => $value) {
278 if ($i % 4 == 0) echo " <tr>\n";
279 echo " " . rbficell('form_matchtype', $key, $value, 'fimatchtype');
280 ++$i;
281 if ($i % 4 == 0) echo " </tr>\n";
283 while ($i % 4 > 0) {
284 echo " <td width='25%'>&nbsp;</td>\n";
285 ++$i;
286 if ($i % 4 == 0) echo " </tr>\n";
289 </table>
290 </td>
291 </tr>
293 <tr>
294 <td nowrap>Match Type</td>
295 <td nowrap>
296 <table width='100%'>
297 <?php
298 $i = 0;
299 foreach ($arr_match_type as $key => $value) {
300 // Skip deprecated values except if currently selected.
301 if (stristr($value, 'deprecated') && $firow['fimatchtype'] != $key) continue;
303 if ($i % 4 == 0) echo " <tr>\n";
304 echo " " . rbficell('form_matchtype', $key, $value, 'fimatchtype');
305 ++$i;
306 if ($i % 4 == 0) echo " </tr>\n";
308 while ($i % 4 > 0) {
309 echo " <td width='25%'>&nbsp;</td>\n";
310 ++$i;
311 if ($i % 4 == 0) echo " </tr>\n";
314 </table>
315 </td>
316 </tr>
318 <tr bgcolor='#dddddd'>
319 <td colspan='2' align='center'><b>Injury Mechanism</b></td>
320 </tr>
322 <tr>
323 <td nowrap>Contact</td>
324 <td nowrap>
325 <table width='100%'>
326 <?php
327 $i = 0;
328 $index = 0;
329 foreach ($arr_activity as $key => $value) {
330 if (++$index > $arr_activity_contact_count) break;
331 // Skip deprecated values except if currently selected.
332 if (stristr($value, 'deprecated') && empty($firow["fimech_$key"])) continue;
334 if ($i % 4 == 0) echo " <tr>\n";
335 echo " " . cbficell("form_mech_$key", $value, "fimech_$key");
336 ++$i;
337 if ($i % 4 == 0) echo " </tr>\n";
340 <td nowrap>
341 Other:
342 <input type='text' name='form_mech_othercon' size='8'
343 title='Describe other'
344 value='<?php echo addslashes($firow['fimech_othercon']) ?>' />
345 </td>
346 <?php
347 ++$i;
348 if ($i % 4 == 0) echo " </tr>\n";
349 while ($i % 4 > 0) {
350 echo " <td width='25%'>&nbsp;</td>\n";
351 ++$i;
352 if ($i % 4 == 0) echo " </tr>\n";
355 </table>
356 </td>
357 </tr>
359 <tr>
360 <td nowrap>Non Contact</td>
361 <td nowrap>
362 <table width='100%'>
363 <?php
364 $i = 0;
365 $index = 0;
366 foreach ($arr_activity as $key => $value) {
367 if (++$index <= $arr_activity_contact_count) continue;
368 // Skip deprecated values except if currently selected.
369 if (stristr($value, 'deprecated') && empty($firow["fimech_$key"])) continue;
371 if ($i % 4 == 0) echo " <tr>\n";
372 echo " " . cbficell("form_mech_$key", $value, "fimech_$key");
373 ++$i;
374 if ($i % 4 == 0) echo " </tr>\n";
377 <td nowrap>
378 Other:
379 <input type='text' name='form_mech_othernon' size='8'
380 title='Describe other'
381 value='<?php echo addslashes($firow['fimech_othernon']) ?>' />
382 </td>
383 <?php
384 ++$i;
385 if ($i % 4 == 0) echo " </tr>\n";
386 while ($i % 4 > 0) {
387 echo " <td width='25%'>&nbsp;</td>\n";
388 ++$i;
389 if ($i % 4 == 0) echo " </tr>\n";
392 </table>
393 </td>
394 </tr>
396 <tr bgcolor='#dddddd'>
397 <td colspan='2' align='center'><b>Additional Factors</b></td>
398 </tr>
400 <tr>
401 <td nowrap>Playing Position</td>
402 <td nowrap>
403 <table width='100%'>
404 <?php
405 $i = 0;
406 foreach ($arr_position as $key => $value) {
407 // Skip deprecated values except if currently selected.
408 if (stristr($value, 'deprecated') && $firow['fiposition'] != $key) continue;
410 if ($i % 4 == 0) echo " <tr>\n";
411 echo " " . rbficell('form_position', $key, $value, 'fiposition');
412 ++$i;
413 if ($i % 4 == 0) echo " </tr>\n";
415 while ($i % 4 > 0) {
416 echo " <td width='25%'>&nbsp;</td>\n";
417 ++$i;
418 if ($i % 4 == 0) echo " </tr>\n";
421 </table>
422 </td>
423 </tr>
425 <tr>
426 <td nowrap>Surface</td>
427 <td nowrap>
428 <table width='100%'>
429 <?php
430 $i = 0;
431 foreach ($arr_surface as $key => $value) {
432 // Skip deprecated values except if currently selected.
433 if (stristr($value, 'deprecated') && $firow['fisurface'] != $key) continue;
435 if ($i % 4 == 0) echo " <tr>\n";
436 echo " " . rbficell('form_surface', $key, $value, 'fisurface');
437 ++$i;
438 if ($i % 4 == 0) echo " </tr>\n";
440 while ($i % 4 > 0) {
441 echo " <td width='25%'>&nbsp;</td>\n";
442 ++$i;
443 if ($i % 4 == 0) echo " </tr>\n";
446 </table>
447 </td>
448 </tr>
450 <tr>
451 <td nowrap>Condition of Grass/Pitch</td>
452 <td nowrap>
453 <table width='100%'>
454 <?php
455 $i = 0;
456 foreach ($arr_condition as $key => $value) {
457 // Skip deprecated values except if currently selected.
458 if (stristr($value, 'deprecated') && $firow['ficondition'] != $key) continue;
460 if ($i % 4 == 0) echo " <tr>\n";
461 echo " " . rbficell('form_condition', $key, $value, 'ficondition');
462 ++$i;
463 if ($i % 4 == 0) echo " </tr>\n";
465 while ($i % 4 > 0) {
466 echo " <td width='25%'>&nbsp;</td>\n";
467 ++$i;
468 if ($i % 4 == 0) echo " </tr>\n";
471 </table>
472 </td>
473 </tr>
475 <tr>
476 <td nowrap>Weather Conditions</td>
477 <td nowrap>
478 <table width='100%'>
479 <?php
480 $i = 0;
481 foreach ($arr_weather as $key => $value) {
482 if ($i % 4 == 0) echo " <tr>\n";
483 echo " " . cbficell("form_weather_$key", $value, "fiweather_$key");
484 ++$i;
485 if ($i % 4 == 0) echo " </tr>\n";
488 <td nowrap>
489 Temperature:
490 <input type='text' name='form_weather_temperature' size='3'
491 title='Ambient temperature in degrees Celsius'
492 value='<?php echo addslashes($firow['fiweather_temperature']) ?>' />
493 </td>
494 <?php
495 ++$i;
496 if ($i % 4 == 0) echo " </tr>\n";
497 while ($i % 4 > 0) {
498 echo " <td width='25%'>&nbsp;</td>\n";
499 ++$i;
500 if ($i % 4 == 0) echo " </tr>\n";
503 </table>
504 </td>
505 </tr>
507 <tr>
508 <td nowrap>Footwear</td>
509 <td nowrap>
510 <table width='100%'>
511 <?php
512 $i = 0;
513 foreach ($arr_footwear as $key => $value) {
514 // Skip deprecated values except if currently selected.
515 if (stristr($value, 'deprecated') && $firow['fifootwear'] != $key) continue;
517 if ($i % 4 == 0) echo " <tr>\n";
518 echo " " . rbficell('form_footwear', $key, $value, 'fifootwear');
519 ++$i;
520 if ($i % 4 == 0) echo " </tr>\n";
522 while ($i % 4 > 0) {
523 echo " <td width='25%'>&nbsp;</td>\n";
524 ++$i;
525 if ($i % 4 == 0) echo " </tr>\n";
528 </table>
529 </td>
530 </tr>
532 <tr bgcolor='#dddddd'>
533 <td colspan='2' align='center'><b>Referee's Sanction</b></td>
534 </tr>
536 <tr>
537 <td nowrap>Referee's Sanction</td>
538 <td nowrap>
539 <table width='100%'>
540 <tr>
541 <?php echo cbficell('form_mech_nofoul' , 'No Foul' , 'fimech_nofoul' ) ?>
542 <?php echo cbficell('form_mech_oppfoul', 'Opponent Foul', 'fimech_oppfoul') ?>
543 <?php echo cbficell('form_mech_ownfoul', 'Own Foul' , 'fimech_ownfoul') ?>
544 <td width='25%'>&nbsp;</td>
545 </tr>
546 <tr>
547 <?php echo cbficell('form_mech_yellow' , 'Yellow Card' , 'fimech_yellow' ) ?>
548 <?php echo cbficell('form_mech_red' , 'Red Card' , 'fimech_red' ) ?>
549 <td width='25%'>&nbsp;</td>
550 <td width='25%'>&nbsp;</td>
551 </tr>
552 </table>
553 </td>
554 </tr>
556 <tr bgcolor='#dddddd'>
557 <td colspan='2' align='center'><b>Post Injury Sequelae</b></td>
558 </tr>
560 <tr>
561 <td nowrap>Removed from<br>Play/Training<br>after Injury</td>
562 <td nowrap>
563 <table width='100%'>
564 <tr>
565 <?php echo rbficell('form_removed', '1', 'Immediately', 'firemoved') ?>
566 <?php echo rbficell('form_removed', '2', 'Later' , 'firemoved') ?>
567 <?php echo rbficell('form_removed', '3', 'Not at All' , 'firemoved') ?>
568 <td width='25%'>&nbsp;</td>
569 </tr>
570 </table>
571 </td>
572 </tr>
574 </table>
576 <?php