Fix for previous commit to work when uploading encrypted files to couchdb
[openemr.git] / contrib / forms / well_child / FormWellChild.class.php
bloba9e55da57cb46510c7842aec620cf1ffb0a36e2f
1 <?php
3 require_once(dirname(__FILE__) . "/../../../library/classes/ORDataObject.class.php");
5 /**
6 * class FormWellChild
8 */
9 class FormWellChild extends ORDataObject {
11 /**
13 * @access private
16 var $id;
17 var $wt;
18 var $ht;
19 var $bp;
20 var $t;
21 var $years;
22 var $months;
23 var $wt_percentile;
24 var $ht_percentile;
25 var $history;
26 var $drug_allergy;
27 var $school_development;
28 var $additional_findings;
29 var $assesment;
30 var $ua_dip;
31 var $hct;
32 var $lead;
33 var $ppd;
34 var $rx;
35 var $rtc;
37 var $ou_corrected;
38 var $ou_uncorrected;
39 var $od_corrected;
40 var $od_uncorrected;
41 var $os_corrected;
42 var $os_uncorrected;
43 var $right_ear_1000;
44 var $right_ear_2000;
45 var $right_ear_4000;
46 var $left_ear_1000;
47 var $left_ear_2000;
48 var $left_ear_4000;
50 var $checks;
51 var $checks2;
52 var $checks3;
54 var $tanner_stage_array = array (" ", "I", "II", "III", "IV", "V");
55 /**
56 * Constructor sets all Form attributes to their default value
59 function FormWellChild($id= "", $_prefix = "") {
60 if (is_numeric($id)) {
61 $this->id = $id;
63 else {
64 $id = "";
67 $this->_table = "form_well_child";
68 $this->date = date("Y-m-d H:i:s");
69 $this->checks = array();
70 $this->activity = 1;
71 $this->pid = $GLOBALS['pid'];
73 if ($id != "") {
74 $this->populate();
78 function populate() {
79 parent::populate();
81 $sql = "SELECT name from form_well_child_checks where foreign_id = '" . mysql_real_escape_string($this->id) . "'";
82 $results = sqlQ($sql);
84 while ($row = mysql_fetch_array($results, MYSQL_ASSOC)) {
85 $this->checks[] = $row['name'];
87 $this->checks2 = $this->checks;
88 $this->checks3 = $this->checks;
91 function toString($html = false) {
92 $string .= "\n"
93 ."ID: " . $this->id . "\n";
95 if ($html) {
96 return nl2br($string);
98 else {
99 return $string;
102 function set_id($id) {
103 if (!empty($id) && is_numeric($id)) {
104 $this->id = $id;
107 function get_id() {
108 return $this->id;
110 function set_pid($pid) {
111 if (!empty($pid) && is_numeric($pid)) {
112 $this->pid = $pid;
115 function get_pid() {
116 return $this->pid;
118 function set_activity($tf) {
119 if (!empty($tf) && is_numeric($tf)) {
120 $this->activity = $tf;
123 function get_activity() {
124 return $this->activity;
127 function get_date() {
128 return $this->date;
131 function set_date($string) {
132 $this->date = $string;
135 function get_wt() {
136 return $this->wt;
139 function set_wt($string) {
140 $this->wt = $string;
143 function get_ht() {
144 return $this->ht;
147 function set_ht($string) {
148 $this->ht = $string;
151 function get_bp() {
152 return $this->bp;
155 function set_bp($string) {
156 $this->bp = $string;
159 function get_t() {
160 return $this->t;
163 function set_t($string) {
164 $this->t = $string;
167 function get_years() {
168 return $this->years;
171 function set_years($string) {
172 $this->years = $string;
175 function get_months() {
176 return $this->months;
179 function set_months($string) {
180 $this->months = $string;
183 function get_wt_percentile() {
184 return $this->wt_percentile;
187 function set_wt_percentile($string) {
188 $this->wt_percentile = $string;
191 function get_ht_percentile() {
192 return $this->ht_percentile;
195 function set_ht_percentile($string) {
196 $this->ht_percentile = $string;
199 function get_history() {
200 return $this->history;
203 function set_history($string) {
204 $this->history = $string;
207 function get_breast_tanner() {
208 return $this->breast_tanner;
211 function set_breast_tanner($string) {
212 $this->breast_tanner = $string;
215 function get_male_tanner() {
216 return $this->male_tanner;
219 function set_male_tanner($string) {
220 $this->male_tanner = $string;
223 function get_female_tanner() {
224 return $this->female_tanner;
227 function set_female_tanner($string) {
228 $this->female_tanner = $string;
231 function get_drug_allergy() {
232 return $this->drug_allergy;
235 function set_drug_allergy($string) {
236 $this->drug_allergy = $string;
239 function get_school_development() {
240 return $this->school_development;
243 function set_school_development($string) {
244 $this->school_development = $string;
247 function get_additional_findings() {
248 return $this->additional_findings;
251 function set_additional_findings($string) {
252 $this->additional_findings = $string;
255 function set_assesment($string) {
256 $this->assesment = $string;
259 function get_assesment() {
260 return $this->assesment;
263 function get_ua_dip() {
264 return $this->ua_dip;
267 function set_ua_dip($string) {
268 $this->ua_dip = $string;
271 function get_hct() {
272 return $this->hct;
275 function set_hct($string) {
276 $this->hct = $string;
279 function get_lead() {
280 return $this->lead;
283 function set_lead($string) {
284 $this->lead = $string;
287 function get_ppd() {
288 return $this->ppd;
291 function set_ppd($string) {
292 $this->ppd = $string;
295 function get_rx() {
296 return $this->rx;
299 function set_rx($string) {
300 $this->rx = $string;
303 function get_rtc() {
304 return $this->rtc;
307 function set_rtc($string) {
308 $this->rtc = $string;
311 function get_ou_corrected() {
312 return $this->ou_corrected;
315 function set_ou_corrected($string) {
316 $this->ou_corrected = $string;
319 function get_ou_uncorrected() {
320 return $this->ou_uncorrected;
323 function set_ou_uncorrected($string) {
324 $this->ou_uncorrected = $string;
327 function get_od_corrected() {
328 return $this->od_corrected;
331 function set_od_corrected($string) {
332 $this->od_corrected = $string;
335 function get_od_uncorrected() {
336 return $this->od_uncorrected;
339 function set_od_uncorrected($string) {
340 $this->od_uncorrected = $string;
343 function get_os_corrected() {
344 return $this->os_corrected;
347 function set_os_corrected($string) {
348 $this->os_corrected = $string;
351 function get_os_uncorrected() {
352 return $this->os_uncorrected;
355 function set_os_uncorrected($string) {
356 $this->os_uncorrected = $string;
359 function get_right_ear_1000() {
360 return $this->right_ear_1000;
363 function set_right_ear_1000($string) {
364 $this->right_ear_1000 = $string;
367 function get_right_ear_2000() {
368 return $this->right_ear_2000;
371 function set_right_ear_2000($string) {
372 $this->right_ear_2000 = $string;
375 function get_right_ear_4000() {
376 return $this->right_ear_4000;
379 function set_right_ear_4000($string) {
380 $this->right_ear_4000 = $string;
383 function get_left_ear_1000() {
384 return $this->left_ear_1000;
387 function set_left_ear_1000($string) {
388 $this->left_ear_1000 = $string;
391 function get_left_ear_2000() {
392 return $this->left_ear_2000;
395 function set_left_ear_2000($string) {
396 $this->left_ear_2000 = $string;
399 function get_left_ear_4000() {
400 return $this->left_ear_4000;
403 function set_left_ear_4000($string) {
404 $this->left_ear_4000 = $string;
407 function get_checks() {
408 return $this->checks;
411 function set_checks($check_array) {
412 $this->checks = $check_array;
415 function get_checks2() {
416 return $this->checks2;
419 function set_checks2($check_array) {
420 $this->checks2 = $check_array;
423 function get_checks3() {
424 return $this->checks3;
427 function set_checks3($check_array) {
428 $this->checks3 = $check_array;
431 function persist() {
433 parent::persist();
434 if (is_numeric($this->id) and (!empty($this->checks) || !empty($this->checks2) || !empty($this->checks3))) {
435 $sql = "delete FROM form_well_child_checks where foreign_id = '" . $this->id . "'";
436 sqlQuery($sql);
438 if (!empty($this->checks)) {
440 foreach ($this->checks as $check) {
441 if (!empty($check)) {
442 $sql = "INSERT INTO form_well_child_checks set foreign_id='" . mysql_real_escape_string($this->id) . "', name = '" . mysql_real_escape_string($check) . "'";
443 sqlQuery($sql);
444 //echo "$sql<br>";
449 if (!empty($this->checks2)) {
450 foreach ($this->checks2 as $check) {
451 if (!empty($check)) {
452 $sql = "INSERT INTO form_well_child_checks set foreign_id='" . mysql_real_escape_string($this->id) . "', name = '" . mysql_real_escape_string($check) . "'";
453 sqlQuery($sql);
454 //echo "$sql<br>";
459 if (!empty($this->checks3)) {
460 foreach ($this->checks3 as $check) {
461 if (!empty($check)) {
462 $sql = "INSERT INTO form_well_child_checks set foreign_id='" . mysql_real_escape_string($this->id) . "', name = '" . mysql_real_escape_string($check) . "'";
463 sqlQuery($sql);
464 //echo "$sql<br>";
472 function _form_layout() {
473 $a = array();
475 //at is array temp
476 //a is array
477 //a_bottom is the textually identified rows of a checkbox group
478 $at = array();
479 $at[1]['appearance_well_nourished_and_developed'] = "Well Nourished and Developed";
480 $a['Gen. Appearance'] = $at;
482 $at = array();
483 $at[1]['head_no_lesions'] = "No Lesions";
484 $a["Head"] = $at;
486 $at = array();
487 $at[1]['eyes_perl_conjunctiva_sclera_clear'] = "Perl, Conjunctiva & Sclera Clear";
488 $at[1]['eyes_vision_grossly_normal'] = "Vision Grossly Normal";
489 $a["Eyes"] = $at;
491 $at = array();
492 $at[1]['ears_ext_canals_clear_tms_normal'] = "EXT. Canals Clear - TMS Normal";
493 $at[1]['ears_hearing_grossly_normal'] = "Hearing Grossly Normal";
494 $a["Ears"] = $at;
496 $at = array();
497 $at[1]['nose_passages_patent'] = "Passages Patent";
498 $a["Nose"] = $at;
500 $at = array();
501 $at[1]['mouth_throat_passages_clear_mm_pink_no_lesions'] = "Passages Clear, MM Pink. No Lesions";
502 $a['Mouth/Throat'] = $at;
504 $at = array();
505 $at[1]['teeth_grossly_normal'] = "Grossly Normal";
506 $a["Teeth"] = $at;
508 $at = array();
509 $at[1]['neck_throat_supple_no_masses_thyroid_normal'] = "Supple, No Masses, Thyroid Normal";
510 $a["Neck"] = $at;
512 $at = array();
513 $at[1]['chest_symmetrical'] = "Symmetrical";
514 $a["Chest"] = $at;
516 $at = array();
517 $at[1]['breast_no_masses'] = "No Masses";
518 $a["Breast:(FEMALE)"] = $at;
520 $at = array();
521 $at[1]['lungs_clear_to_auscultation_bilat'] = "Clear to Auscultation Bilat";
522 $a["Lungs"] = $at;
524 $at = array();
525 $at[1]['heart_reg_rhythm_no_organic_murmurs'] = "Reg. Rhythm, No Organic Murmurs";
526 $a["Heart"] = $at;
528 $at = array();
529 $at[1]['abdomen_soft_no_masses_liver_spleen_normal'] = "Soft. No Masses, Liver & Spleen NL";
530 $a["Abdomen"] = $at;
532 $at = array();
533 $at[1]['femoral_pulses_normal'] = "Normal";
534 $a["Femoral Pulses"] = $at;
536 $at = array();
537 $at[1]['genitalia_grossly_normal'] = "Grossly Normal";
538 $at["Male"]['genitalia_male_circ_uncirc_testes_scrotum_rt_lt'] = "CIRC UNCIRC Testes in Scrotum RT LT";
539 $at["Female"] = null;
540 $a["Genitalia"] = $at;
542 $at = array();
543 $at[1]['extremeties_full_rom_no_deformaties_lesions'] = "Full ROM, No Deformaties or Lesions";
544 $a["Extremeties"] = $at;
546 $at = array();
547 $at[1]['lymph_not_enlarged'] = "Not Enlarged";
548 $a["Lymph Nodes"] = $at;
550 $at = array();
551 $at[1]['back_no_scoliosis'] = "No Scoliosis";
552 $a["Back"] = $at;
554 $at = array();
555 $at[1]['skin_clear_no_significant_lesions'] = "Clear, No Significant Lesions";
556 $a["Skin"] = $at;
558 $at = array();
559 $at[1]['nuerologic_alert_no_gross_sens_motor_deficit'] = "Alert, No Gross Ses/Motor Deficit";
560 $a["Nuerologic"] = $at;
562 $at = array();
563 $at[1]['advice_nutrition'] = "Nutrition";
564 $at[1]['advice_dental_care'] = "Dental Care";
565 $at[1]['advice_accident_prev_auto_safety'] = "Accident Prev./Auto Safety";
566 $at[1]['advice_sexuality_birth_control'] = "Sexuality/Birth Control";
567 $a["Advice"] = $at;
570 return $a;
573 function _form_layout2() {
574 $a = array();
576 //at is array temp
577 //a is array
578 //a_bottom is the textually identified rows of a checkbox group
580 $at = array();
581 $at[1]['dpt_1'] = "1";
582 $at[1]['dpt_2'] = "2";
583 $at[1]['dpt_3'] = "3";
584 $at[1]['dpt_4'] = "4";
585 $at[1]['dpt_5'] = "5";
586 $a["DPT"] = $at;
588 $at = array();
589 $at[1]['dt_1'] = "1";
590 $at[1]['dt_2'] = "2";
591 $at[1]['dt_3'] = "3";
592 $at[1]['dt_4'] = "4";
593 $at[1]['dt_5'] = "5";
594 $a["DT"] = $at;
596 $at = array();
597 $at[1]['opv_1'] = "1";
598 $at[1]['opv_2'] = "2";
599 $at[1]['opv_3'] = "3";
600 $at[1]['opv_4'] = "4";
601 $at[1]['opv_5'] = "5";
602 $a["OPV"] = $at;
604 $at = array();
605 $at[1]['hepb_1'] = "1";
606 $at[1]['hepb_2'] = "2";
607 $at[1]['hepb_3'] = "3";
608 $a["HEP. B"] = $at;
610 $at = array();
611 $at[1]['hib_1'] = "1";
612 $at[1]['hib_2'] = "2";
613 $at[1]['hib_3'] = "3";
614 $at[1]['hib_4'] = "4";
615 $at[1]['hib_5'] = "5";
616 $a["HIB"] = $at;
618 $at = array();
619 $at[1]['mmr_1'] = "1";
620 $at[1]['mmr_2'] = "2";
621 $a["MMR"] = $at;
623 $at = array();
624 $at[1]['td_1'] = "1";
625 $at[1]['td_2'] = "2";
626 $a["Td"] = $at;
628 return $a;
632 function _form_layout3() {
633 $a = array();
635 //at is array temp
636 //a is array
637 //a_bottom is the textually identified rows of a checkbox group
639 $at = array();
640 $at[1]['3_4_years_car_safety'] = "Car Safety";
641 $at[1]['3_4_years_truck_safety'] = "Truck Safety";
642 $at[1]['3_4_years_ipecac'] = "Ipecac";
643 $at[1]['3_4_years_poison_control_number'] = "Poison Control Number";
644 $at[1]['3_4_years_swimming_pool_safety'] = "Swimming Pool Safety";
645 $at[1]['3_4_years_pediatric_cpr'] = "Pediatric CPR";
646 $a["3 To 4 Years"] = $at;
648 $at = array();
649 $at[1]['5_10_years_car_safety'] = "Car Safety";
650 $at[1]['5_10_years_truck_safety'] = "Truck Safety";
651 $at[1]['5_10_years_swimming_pool_safety'] = "Swimming Pool Safety";
652 $at[1]['5_10_years_pediatric_cpr'] = "Pediatric CPR";
653 $at[1]['5_10_years_bike_skateboard_safety'] = "Bike / Skateboard Safety";
654 $at[1]['5_10_years_stranger_safety'] = "Stranger Safety";
655 $at[1]['5_10_years_substance_abuse'] = "Substance Abuse";
657 $a["5 To 10 Years"] = $at;
659 $at = array();
660 $at[1]['10_15_years_car_safety'] = "Car Safety";
661 $at[1]['10_15_years_truck_safety'] = "Truck Safety";
662 $at[1]['10_15_years_substance_abuse'] = "Substance Abuse";
663 $at[1]['10_15_years_safe_sex'] = "Safe Sex";
664 $at[1]['10_15_years_bike_skateboard_safety'] = "Bike / Skateboard Safety";
665 $at[1]['10_15_years_swimming_pool_safety'] = "Swimming Pool Safety";
666 $at[1]['10_15_years_cpr'] = "CPR";
667 $a["10 To 15 Years"] = $at;
669 $at = array();
670 $at[1]['15_20_years_car_safety'] = "Car Safety";
671 $at[1]['15_20_years_truck_safety'] = "Truck Safety";
672 $at[1]['15_20_years_substance_abuse'] = "Substance Abuse";
673 $at[1]['15_20_years_safe_sex'] = "Safe Sex";
674 $at[1]['15_20_years_cpr'] = "CPR";
675 $a["15 To 20 Years"] = $at;
677 return $a;
681 } // end of Form