Changed query that gets the date of the last encounter for date calculations. It...
[openemr.git] / contrib / forms / hp_tje_primary / FormHpTjePrimary.class.php
blob231ded32cd76e6bf9899b145658d8c133ca1f737
1 <?php
3 require_once(dirname(__FILE__) . "/../../../library/classes/ORDataObject.class.php");
5 define("EVENT_VEHICLE",1);
6 define("EVENT_WORK_RELATED",2);
7 define("EVENT_SLIP_FALL",3);
8 define("EVENT_OTHER",4);
11 /**
12 * class FormHpTjePrimary
15 class FormHpTjePrimary extends ORDataObject {
17 /**
19 * @access public
23 /**
25 * static
27 var $event_array = array("","Vehicular Accident","Work Related Accident","Slip & Fall","Other");
29 /**
31 * @access private
34 var $id;
35 var $referred_by;
36 var $complaints;
37 var $date_of_onset;
38 var $event;
39 var $event_description;
40 var $prior_symptoms;
41 var $aggravated_symptoms;
42 var $comments;
43 var $date;
44 var $teeth_sore_number;
45 var $teeth_mobile_number;
46 var $teeth_fractured_number;
47 var $teeth_avulsed_number;
48 var $precipitating_factors_other_text;
49 var $checks;
50 var $pid;
51 var $activity;
52 var $history;
53 var $previous_accidents;
55 /**
56 * Constructor sets all Form attributes to their default value
59 function FormHpTjePrimary($id= "", $_prefix = "") {
60 if (is_numeric($id)) {
61 $this->id = $id;
63 else {
64 $id = "";
66 $this->date = date("Y-m-d H:i:s");
67 $this->date_of_onset = date("Y-m-d");
68 $this->_table = "form_hp_tje_primary";
69 $this->checks = array();
70 $this->activity = 1;
71 $this->pid = $GLOBALS['pid'];
72 if ($id != "") {
73 $this->populate();
76 function populate() {
77 parent::populate();
79 $sql = "SELECT name from form_hp_tje_checks where foreign_id = '" . mysql_real_escape_string($this->id) . "'";
80 $results = sqlQ($sql);
82 while ($row = mysql_fetch_array($results, MYSQL_ASSOC)) {
83 $this->checks[] = $row['name'];
87 $sql = "SELECT doctor,specialty,tx_rendered,effectiveness,date from form_hp_tje_history where foreign_id = '" . mysql_real_escape_string($this->id) . "'";
88 $results = sqlQ($sql);
90 while ($row = mysql_fetch_array($results, MYSQL_ASSOC)) {
91 $this->history[] = $row;
94 $sql = "SELECT nature_of_accident,injuries,date from form_hp_tje_previous_accidents where foreign_id = '" . mysql_real_escape_string($this->id) . "'";
95 $results = sqlQ($sql);
97 while ($row = mysql_fetch_array($results, MYSQL_ASSOC)) {
98 $this->previous_accidents[] = $row;
103 function toString($html = false) {
104 $string .= "\n"
105 ."ID: " . $this->id . "\n";
107 if ($html) {
108 return nl2br($string);
110 else {
111 return $string;
114 function set_id($id) {
115 if (!empty($id) && is_numeric($id)) {
116 $this->id = $id;
119 function get_id() {
120 return $this->id;
122 function set_pid($pid) {
123 if (!empty($pid) && is_numeric($pid)) {
124 $this->pid = $pid;
127 function get_pid() {
128 return $this->pid;
130 function set_activity($tf) {
131 if (!empty($tf) && is_numeric($tf)) {
132 $this->activity = $tf;
135 function get_activity() {
136 return $this->activity;
139 function get_date_of_onset_y() {
140 $ymd = split("-",$this->date_of_onset);
141 return $ymd[0];
144 function set_date_of_onset_y($year) {
145 if (is_numeric($year)) {
146 $ymd = split("-",$this->date_of_onset);
147 $ymd[0] = $year;
148 $this->date_of_onset = $ymd[0] ."-" . $ymd[1] ."-" . $ymd[2];
152 function get_date_of_onset_m() {
153 $ymd = split("-",$this->date_of_onset);
154 return $ymd[1];
157 function set_date_of_onset_m($month) {
158 if (is_numeric($month)) {
159 $ymd = split("-",$this->date_of_onset);
160 $ymd[1] = $month;
161 $this->date_of_onset = $ymd[0] ."-" . $ymd[1] ."-" . $ymd[2];
165 function get_date_of_onset_d() {
166 $ymd = split("-",$this->date_of_onset);
167 return $ymd[2];
170 function set_date_of_onset_d($day) {
171 if (is_numeric($day)) {
172 $ymd = split("-",$this->date_of_onset);
173 $ymd[2] = $day;
174 $this->date_of_onset = $ymd[0] ."-" . $ymd[1] ."-" . $ymd[2];
178 function get_date_of_onset() {
179 return $this->date_of_onset;
182 function set_date_of_onset($date) {
183 return $this->date_of_onset = $date;
186 function set_event($event) {
187 if (!is_numeric) {
188 return;
190 $this->event = $event;
193 function get_event() {
194 return $this->event;
197 function set_referred_by($string) {
198 $this->referred_by = $string;
201 function get_referred_by() {
202 return $this->referred_by;
205 function set_complaints($string) {
206 $this->complaints = $string;
209 function get_complaints() {
210 return $this->complaints;
213 function set_prior_symptoms($string) {
214 $this->prior_symptoms = $string;
217 function get_prior_symptoms() {
218 return $this->prior_symptoms;
221 function set_aggravated_symptoms($string) {
222 $this->aggravated_symptoms = $string;
225 function get_aggravated_symptoms() {
226 return $this->aggravated_symptoms;
229 function set_comments($string) {
230 $this->comments = $string;
233 function get_comments() {
234 return $this->comments;
237 function set_event_description($description) {
238 $this->event_description = $description;
241 function get_event_description() {
242 return $this->event_description;
244 function get_teeth_sore_number() {
245 return $this->teeth_sore_number;
248 function set_teeth_sore_number($num) {
249 $this->teeth_sore_number = $num;
252 function get_teeth_mobile_number() {
253 return $this->teeth_mobile_number;
256 function set_teeth_mobile_number($num) {
257 $this->teeth_mobile_number = $num;
260 function get_teeth_fractured_number() {
261 return $this->teeth_fractured_number;
264 function set_teeth_fractured_number($num) {
265 $this->teeth_fractured_number = $num;
268 function get_teeth_avulsed_number() {
269 return $this->teeth_avulsed_number;
272 function set_teeth_avulsed_number($num) {
273 $this->teeth_avulsed_number = $num;
276 function get_precipitating_factors_other_text() {
277 return $this->precipitating_factors_other_text;
280 function set_precipitating_factors_other_text($string) {
281 $this->precipitating_factors_other_text = $string;
284 function get_checks() {
285 return $this->checks;
288 function set_checks($check_array) {
289 $this->checks = $check_array;
292 function get_history() {
293 return $this->history;
296 function set_history($array) {
297 $this->history = $array;
300 function get_previous_accidents() {
301 return $this->previous_accidents;
304 function set_previous_accidents($array) {
305 $this->previous_accidents = $array;
308 function get_date() {
309 return $this->date;
313 function persist() {
315 parent::persist();
316 if (is_numeric($this->id) and !empty($this->checks)) {
317 $sql = "delete FROM form_hp_tje_checks where foreign_id = '" . $this->id . "'";
318 sqlQuery($sql);
319 foreach ($this->checks as $check) {
320 if (!empty($check)) {
321 $sql = "INSERT INTO form_hp_tje_checks set foreign_id='" . mysql_real_escape_string($this->id) . "', name = '" . mysql_real_escape_string($check) . "'";
322 sqlQuery($sql);
323 //echo "$sql<br>";
327 if (is_numeric($this->id) and !empty($this->history)) {
328 $sql = "delete FROM form_hp_tje_history where foreign_id = '" . $this->id . "'";
329 sqlQuery($sql);
330 foreach ($this->history as $history) {
331 if (!empty($history)) {
332 $sql = "INSERT INTO form_hp_tje_history set foreign_id='" . mysql_real_escape_string($this->id) ."'"
333 . ", doctor = '" . mysql_real_escape_string($history['doctor']) . "'"
334 . ", specialty = '" . mysql_real_escape_string($history['specialty']) . "'"
335 . ", tx_rendered = '" . mysql_real_escape_string($history['tx_rendered']) . "'"
336 . ", effectiveness = '" . mysql_real_escape_string($history['effectiveness']) . "'"
337 . ", date = '" . mysql_real_escape_string($history['date']) . "'";
338 sqlQuery($sql);
339 //echo "$sql<br>";
344 if (is_numeric($this->id) and !empty($this->previous_accidents)) {
345 $sql = "delete FROM form_hp_tje_previous_accidents where foreign_id = '" . $this->id . "'";
346 sqlQuery($sql);
348 foreach ($this->previous_accidents as $pa) {
349 if (!empty($pa)) {
350 $sql = "INSERT INTO form_hp_tje_previous_accidents set foreign_id='" . mysql_real_escape_string($this->id) .
351 "', nature_of_accident = '" . mysql_real_escape_string($pa['nature_of_accident']) . "'"
352 . ", injuries = '" . mysql_real_escape_string($pa['injuries']) . "'"
353 . ", date = '" . mysql_real_escape_string($pa['date']) . "'";
355 sqlQuery($sql);
356 //echo "$sql<br>";
363 function _form_layout() {
364 $a = array();
366 //at is array temp
367 //a is array
368 //a_bottom is the textually identified rows of a checkbox group
370 $at[1]['headache_facial_pain_frontal'] = "Frontal";
371 $at[1]['headache_facial_pain_frontal_l'] = "L";
372 $at[1]['headache_facial_pain_frontal_r'] = "R";
373 $at[1]['headache_facial_pain_temporal'] = "Temporal";
374 $at[1]['headache_facial_pain_temporal_l'] = "L";
375 $at[1]['headache_facial_pain_temporal_r'] = "R";
376 $at[1]['headache_facial_pain_retro_orbtal'] = "Retro-Orbital";
377 $at[1]['headache_facial_pain_retro_orbtal_l'] = "L";
378 $at[1]['headache_facial_pain_retro_orbtal_r'] = "R";
379 $at[1]['headache_facial_pain_zygoma'] = "Zygoma";
380 $at[1]['headache_facial_pain_zygoma_l'] = "L";
381 $at[1]['headache_facial_pain_zygoma_r'] = "R";
383 $at[2]['headache_facial_pain_crown'] = "Crown";
384 $at[2]['headache_facial_pain_crown_l'] = "L";
385 $at[2]['headache_facial_pain_crown_r'] = "R";
386 $at[2]['headache_facial_pain_occipital'] = "Occipital";
387 $at[2]['headache_facial_pain_occipital_l'] = "L";
388 $at[2]['headache_facial_pain_occipital_r'] = "R";
389 $at[2]['headache_facial_pain_mastoid'] = "Mastoid";
390 $at[2]['headache_facial_pain_mastoid_l'] = "L";
391 $at[2]['headache_facial_pain_mastoid_r'] = "R";
392 $at[2]['headache_facial_pain_jaw_muscles'] = "Jaw Muscles";
393 $at[2]['headache_facial_pain_jaw_muscles_l'] = "L";
394 $at[2]['headache_facial_pain_jaw_muscles_r'] = "R";
396 $a_bottom = $this->_name_rows("headache_facial_pain",array("onset","intensity","duration","frequency","quality of pain","aggravation","occurance"));
397 $a['Headaches / Facial Pain'] = array_merge($at, $a_bottom);
399 $at = array();
400 $a_bottom = array();
401 $at[1]['neck_pain_anterior'] = "Anterior";
402 $at[1]['neck_pain_anterior_l'] = "L";
403 $at[1]['neck_pain_anterior_r'] = "R";
404 $at[1]['neck_pain_posterior'] = "Posterior";
405 $at[1]['neck_pain_posterior_l'] = "L";
406 $at[1]['neck_pain_posterior_r'] = "R";
407 $at[1]['neck_pain_radiating_to_head'] = "Radiating to Head";
408 $at[1]['neck_pain_radiating_to_head_l'] = "L";
409 $at[1]['neck_pain_radiating_to_head_r'] = "R";
411 $a_bottom = $this->_name_rows("neck_pain",array("onset","intensity","duration","frequency","quality of pain","aggravation","occurance"));
412 $a['Neck Pain'] = array_merge($at, $a_bottom);
414 $at = array();
415 $a_bottom = array();
416 $at[1]['shoulder_back_or_chest_shoulder'] = "Shoulder";
417 $at[1]['shoulder_back_or_chest_shoulder_l'] = "L";
418 $at[1]['shoulder_back_or_chest_shoulder_r'] = "R";
419 $at[1]['shoulder_back_or_chest_back_upper'] = "Back/Upper";
420 $at[1]['shoulder_back_or_chest_back_upper_l'] = "L";
421 $at[1]['shoulder_back_or_chest_back_upper_r'] = "R";
422 $at[1]['shoulder_back_or_chest_back_lower'] = "Back/Lower";
423 $at[1]['shoulder_back_or_chest_back_lower_l'] = "L";
424 $at[1]['shoulder_back_or_chest_back_lower_r'] = "R";
425 $at[1]['shoulder_back_or_chest_chest'] = "Chest";
426 $at[1]['shoulder_back_or_chest_chest_l'] = "L";
427 $at[1]['shoulder_back_or_chest_chest_r'] = "R";
428 $at[1]['shoulder_back_or_radiating_to_arm_hand'] = "Radiating to arm/hand";
429 $at[1]['shoulder_back_or_radiating_to_arm_hand_l'] = "L";
430 $at[1]['shoulder_back_or_radiating_to_arm_hand_r'] = "R";
432 $a_bottom = $this->_name_rows("shoulder_back_or_chest",array("onset","intensity","duration","frequency","quality of pain","aggravation","occurance"));
433 $a['Shoulder, Back or Chest Pain'] = array_merge($at, $a_bottom);
435 $at = array();
436 $a_bottom = array();
437 $at[1]['ear_symptoms_pain'] = "Pain";
438 $at[1]['ear_symptoms_pain_l'] = "L";
439 $at[1]['ear_symptoms_pain_r'] = "R";
440 $at[1]['ear_symptoms_tinnitus'] = "Tinnitus";
441 $at[1]['ear_symptoms_tinnitus_l'] = "L";
442 $at[1]['ear_symptoms_tinnitus_r'] = "R";
443 $at[1]['ear_symptoms_stuffiness'] = "Stuffiness";
444 $at[1]['ear_symptoms_stuffiness_l'] = "L";
445 $at[1]['ear_symptoms_stuffiness_r'] = "R";
446 $at[1]['ear_symptoms_hearing_loss'] = "Hearing Loss";
447 $at[1]['ear_symptoms_hearing_loss_l'] = "L";
448 $at[1]['ear_symptoms_hearing_loss_r'] = "R";
450 $a_bottom = $this->_name_rows("ear_symptoms",array("onset","intensity","duration","frequency","quality of pain","aggravation","occurance"));
451 $a['Ear Symptoms'] = array_merge($at, $a_bottom);
453 $at = array();
454 $a_bottom = array();
455 $at[1]['eye_symptoms_pain'] = "Pain";
456 $at[1]['eye_symptoms_pain_l'] = "L";
457 $at[1]['eye_symptoms_pain_r'] = "R";
458 $at[1]['eye_symptoms_burning'] = "Burning";
459 $at[1]['eye_symptoms_burning_l'] = "L";
460 $at[1]['eye_symptoms_burning_r'] = "R";
461 $at[1]['eye_symptoms_tearing'] = "Tearing";
462 $at[1]['eye_symptoms_tearing_l'] = "L";
463 $at[1]['eye_symptoms_tearing_r'] = "R";
464 $at[1]['eye_symptoms_change_in_vision'] = "Change in Vision";
465 $at[1]['eye_symptoms_change_in_vision_l'] = "L";
466 $at[1]['eye_symptoms_change_in_vision_r'] = "R";
467 $at[1]['eye_symptoms_bluriness'] = "Bluriness";
468 $at[1]['eye_symptoms_bluriness_l'] = "L";
469 $at[1]['eye_symptoms_bluriness_r'] = "R";
471 $a_bottom = $this->_name_rows("eye_symptoms",array("onset","intensity","duration","frequency","quality of pain","aggravation","occurance"));
472 $a['Eye Symptoms'] = array_merge($at, $a_bottom);
474 $at = array();
475 $a_bottom = array();
476 $at[1]['teeth_sore'] = "Sore";
477 $at[1]['teeth_mobile'] = "Mobile";
478 $at[1]['teeth_fractured'] = "Fractured";
479 $at[1]['teeth_avulsed'] = "Avulsed";
480 //special actions are included for teeth in the template
482 $a_bottom = $this->_name_rows("teeth",array("onset","intensity","duration","frequency","quality of pain","aggravation","occurance"));
483 $a['Teeth'] = array_merge($at, $a_bottom);
485 $a['Change in Bite'] = $this->_name_rows("change_in_bite",array("onset","intensity"));
487 $at = array();
488 $a_bottom = array();
489 $at[1]['tmj_pain_l'] = "L";
490 $at[1]['tmp_pain_r'] = "R";
492 $a_bottom = $this->_name_rows("tmj_pain",array("onset","intensity","duration","frequency","quality of pain","aggravation","occurance"));
493 $a['TMJ Pain'] = array_merge($at, $a_bottom);
495 $at = array();
496 $a_bottom = array();
497 $at[1]['tmj_clicking_crepitation_clicking'] = "Clicking";
498 $at[1]['tmj_clicking_crepitation_clicking_l'] = "L";
499 $at[1]['tmj_clicking_crepitation_clicking_r'] = "R";
500 $at[1]['tmj_clicking_crepitation_crepitation'] = "Crepitation";
501 $at[1]['tmj_clicking_crepitation_crepitation_l'] = "L";
502 $at[1]['tmj_clicking_crepitation_crepitation_r'] = "R";
504 $a_bottom = $this->_name_rows("tmj_clicking_crepitation",array("onset","intensity","frequency","aggravation"));
505 $a['TMJ Clicking / Crepitation'] = array_merge($at, $a_bottom);
507 $at = array();
508 $a_bottom = array();
509 $at[1]['tmj_catching_locking_catching'] = "Catching";
510 $at[1]['tmj_catching_locking_catching_l'] = "L";
511 $at[1]['tmj_catching_locking_catching_r'] = "R";
512 $at[1]['tmj_catching_locking_locking_closed'] = "Locking Closed";
513 $at[1]['tmj_catching_locking_locking_closed_l'] = "L";
514 $at[1]['tmj_catching_locking_locking_closed_r'] = "R";
515 $at[1]['tmj_catching_locking_locking_open'] = "Locking Open";
516 $at[1]['tmj_catching_locking_locking_open_l'] = "L";
517 $at[1]['tmj_catching_locking_locking_open_r'] = "R";
519 $a_bottom = $this->_name_rows("tmj_catching_locking",array("onset","intensity","frequency","aggravation"));
520 $a['TMJ Catching / Locking'] = array_merge($at, $a_bottom);
522 $at = array();
523 $a_bottom = array();
524 $at[1]['tmj_chewing_swallowing_difficult'] = "Difficult";
525 $at[1]['tmj_chewing_swallowing_painful'] = "Painful";
527 $a_bottom = $this->_name_rows("tmj_chewing_swallowing",array("onset","intensity"));
528 $a['TMJ Chewing / Swallowing'] = array_merge($at, $a_bottom);
530 $at = array();
531 $a_bottom = array();
532 $at[1]['sinus_pain'] = "Pain";
533 $at[1]['sinus_pressure'] = "Pressure";
534 $at[1]['sinus_drainage'] = "Drainage";
535 $at[1]['sinus_infection'] = "Infection";
537 $a_bottom = $this->_name_rows("sinus",array("onset"));
538 $a['Sinus'] = array_merge($at, $a_bottom);
540 $at = array();
541 $a_bottom = array();
542 $at[1]['migraine_headache_aura'] = "Aura";
543 $at[1]['migraine_headache_nausea'] = "Nausea";
544 $at[1]['migraine_headache_relieved_by_vascular_drugs'] = "Relieved by Vascular Drugs";
545 $at[1]['migraine_headache_vertigo'] = "Vertigo";
547 $a_bottom = $this->_name_rows("migraine_headache",array("onset","intensity","duration","frequency","aggravation"));
548 $a['Migraine Headache'] = array_merge($at, $a_bottom);
550 $at = array();
551 $a_bottom = array();
552 $at[1]['dizziness_loss_of_balance'] = "Loss of Balance";
553 $at[1]['dizziness_vertigo'] = "Vertigo";
554 $at[1]['dizziness_spatial_distortion'] = "Spatial Distortion";
555 $at[1]['dizziness_syncope'] = "Syncope";
556 $at[1]['dizziness_nausea'] = "Nausea";
558 $a_bottom = $this->_name_rows("dizziness",array("onset","intensity","duration","frequency","aggravation"));
559 $a['Dizziness'] = array_merge($at, $a_bottom);
561 $at = array();
562 $a_bottom = array();
563 $at[1]['neuralgia_tic_doloreau'] = "Tic Doloreau";
564 $at[1]['neuralgia_tic_doloreau_l'] = "L";
565 $at[1]['neuralgia_tic_doloreau_r'] = "R";
566 $at[1]['neuralgia_parasthesis'] = "Parasthesis";
567 $at[1]['neuralgia_parasthesis_l'] = "L";
568 $at[1]['neuralgia_parasthesis_r'] = "R";
569 $at[1]['neuralgia_numbness'] = "Numbness";
570 $at[1]['neuralgia_numbness_l'] = "L";
571 $at[1]['neuralgia_numbness_r'] = "R";
573 $at[2]['neuralgia_cold_spots'] = "\"Cold Spots\"";
574 $at[2]['neuralgia_cold_spots_l'] = "L";
575 $at[2]['neuralgia_cold_spots_r'] = "R";
576 $at[2]['neuralgia_burning_tungue_lips_mouth'] = "Burning Lips/Tongue/Mouth";
577 $at[2]['neuralgia_burning_tungue_lips_mouth_l'] = "L";
578 $at[2]['neuralgia_burning_tungue_lips_mouth_r'] = "R";
579 $at[2]['neuralgia_hyperalgesia'] = "Hyperalgesia";
580 $at[2]['neuralgia_hyperalgesia_l'] = "L";
581 $at[2]['neuralgia_hyperalgesia_r'] = "R";
583 $a_bottom = $this->_name_rows("neuralgia",array("onset","intensity","duration","frequency","aggravation"));
584 $a['Neuralgia'] = array_merge($at, $a_bottom);
586 $at = array();
587 $a_bottom = array();
588 $at[1]['history_digenerative_joint_disease'] = "Degenerative Joint Disease";
589 $at[1]['history_rheumatoid_arthritis'] = "Rheumatoid Arthritis";
590 $at[1]['history_psioratic_arthritis'] = "Psioratic Arthiritis";
592 $at[2]['history_lupus_erythmatosis'] = "Lupus Erythmatosis";
593 $at[2]['history_scleroderma'] = "Scleroderma";
594 $at[2]['history_other'] = "Other";
596 $a['History'] = $at;
598 $at = array();
599 $a_bottom = array();
600 $at[1]['precipitating_factors_direct_trauma'] = "Direct Trauma";
601 $at[1]['precipitating_factors_airbag'] = "Airbag";
602 $at[1]['precipitating_factors_whiplash'] = "Whiplash";
603 $at[1]['precipitating_factors_biting_on_foreign_object'] = "Biting on Foreign Object";
605 $at[2]['precipitating_factors_intubation'] = "Intubation";
606 $at[2]['precipitating_factors_forced_hypertranslation'] = "Forced Hypertranslation";
607 $at[2]['precipitating_factors_medication'] = "Medication (Phenothiazines,etc.)";
608 $at[2]['precipitating_factors_other'] = "Other";
610 $a['Precipitating Factors'] = $at;
612 $at = array();
613 $a_bottom = array();
614 $at[1]['predisposing_factors_previous_injury_problem'] = "Previous Injury/Problem";
615 $at[1]['predisposing_factors_ligament_laxity'] = "Ligament Laxity";
616 $at[1]['predisposing_factors_deep_bite'] = "Deep Bite";
617 $at[1]['predisposing_factors_midline_division'] = "Midline Division";
619 $at[2]['predisposing_factors_loss_of_posterior_support'] = "Loss of Posterior Support";
620 $at[2]['predisposing_factors_mandibular_retrusion'] = "Mandibular Retrusion";
621 $at[2]['predisposing_factors_occlusal_alterations'] = "Occlusal Alterations";
622 $at[2]['predisposing_factors_clenching_bruxing'] = "Clenching/Bruxing";
624 $a['Predisposing Factors'] = $at;
626 $at = array();
627 $a_bottom = array();
628 $at[1]['perpetuating_factors_previous_injury_problem'] = "Previous Injury/Problem";
629 $at[1]['perpetuating_factors_ligament_laxity'] = "Ligament Laxity";
630 $at[1]['perpetuating_factors_deep_bite'] = "Deep Bite";
631 $at[1]['perpetuating_factors_midline_division'] = "Midline Division";
633 $at[2]['perpetuating_factors_loss_of_posterior_support'] = "Loss of Posterior Support";
634 $at[2]['perpetuating_factors_mandibular_retrusion'] = "Mandibular Retrusion";
635 $at[2]['perpetuating_factors_occlusal_alterations'] = "Occlusal Alterations";
636 $at[2]['perpetuating_factors_clenching_bruxing'] = "Clenching/Bruxing";
638 $a['Perpetuating Factors'] = $at;
640 return $a;
643 function _name_rows ($name,$row_array) {
644 $a = array();
645 foreach ($row_array as $row) {
646 switch(strtolower($row)) {
647 case "onset":
648 $a["Onset"][$name . '_onset_precipitated_by_accident'] = "Precipitated By Accident";
649 $a["Onset"][$name . '_onset_aggravated_by_accident'] = "Aggravated By Accident";
650 $a["Onset"][$name . '_onset_pre_existing'] = "Pre-existing";
651 $a["Onset"][$name . '_onset_other'] = "Other";
652 break;
653 case "intensity":
654 $a["Intensity"][$name . '_intensity_mild'] = "Mild";
655 $a["Intensity"][$name . '_intensity_moderate'] = "Moderate";
656 $a["Intensity"][$name . '_intensity_moderately_severe'] = "Moderately Severe";
657 $a["Intensity"][$name . '_intensity_severe'] = "Severe";
658 break;
659 case "duration":
660 $a["Duration"][$name . '_duration_minutes'] = "Minutes";
661 $a["Duration"][$name . '_duration_hours'] = "Hours";
662 $a["Duration"][$name . '_duration_days'] = "Days";
663 $a["Duration"][$name . '_duration_constant'] = "Constant";
664 break;
665 case "frequency":
666 $a["Frequency"][$name . '_frequency_no_pattern'] = "No Pattern";
667 $a["Frequency"][$name . '_frequency_1_week'] = "1/Week";
668 $a["Frequency"][$name . '_frequency_2_3_week'] = "2-3/Week";
669 $a["Frequency"][$name . '_frequency_daily'] = "Daily";
670 break;
671 case "quality of pain":
672 $a["Quality of Pain"][$name . '_quality_of_pain_dull'] = "Dull";
673 $a["Quality of Pain"][$name . '_quality_of_pain_deep'] = "Deep";
674 $a["Quality of Pain"][$name . '_quality_of_pain_aching'] = "Aching";
675 $a["Quality of Pain"][$name . '_quality_of_pain_triggered'] = "Triggered";
676 break;
677 case "aggravation":
678 $a["Aggravation"][$name . '_aggravation_chewing'] = "Chewing";
679 $a["Aggravation"][$name . '_aggravation_speaking'] = "Speaking";
680 $a["Aggravation"][$name . '_aggravation_clenching'] = "Clenching";
681 $a["Aggravation"][$name . '_aggravation_physical_activity'] = "Physical Activity";
682 break;
683 case "occurance":
684 $a["Occurance"][$name . '_occurance_at_walking'] = "At Walking";
685 $a["Occurance"][$name . '_occurance_mid_day'] = "Mid Day";
686 $a["Occurance"][$name . '_occurance_evening'] = "Evening";
687 $a["Occurance"][$name . '_occurance_variable'] = "Variable";
688 break;
693 return $a;
696 } // end of Form