3 * this file's contents are included in both the encounter page as a 'quick summary' of a form, and in the medical records' reports page.
6 /* for $GLOBALS[], ?? */
7 require_once('../../globals.php');
8 /* for acl_check(), ?? */
9 require_once($GLOBALS['srcdir'].'/api.inc');
10 /* for generate_form_field, ?? */
11 require_once($GLOBALS['srcdir'].'/options.inc.php');
12 /* The name of the function is significant and must match the folder name */
13 function dub_soap_report( $pid, $encounter, $cols, $id) {
15 /** CHANGE THIS - name of the database table associated with this form **/
16 $table_name = 'form_dub_soap';
19 /* an array of all of the fields' names and their types. */
20 $field_names = array('menstrual_history' => 'checkbox_combo_list','previous_sonogram' => 'textfield','previous_blood_work' => 'textfield','previous_needs_rx' => 'textfield','other' => 'textarea','dub_objective' => 'checkbox_combo_list','a_dub' => 'checkbox_combo_list','plan_lab_work' => 'checkbox_combo_list','plan_tests_procedures' => 'checkbox_combo_list','plan_medications' => 'checkbox_combo_list');/* in order to use the layout engine's draw functions, we need a fake table of layout data. */
21 $manual_layouts = array(
22 'menstrual_history' =>
23 array( 'field_id' => 'menstrual_history',
25 'fld_length' => '140',
27 'list_id' => 'DUB_Menstrual_History' ),
28 'previous_sonogram' =>
29 array( 'field_id' => 'previous_sonogram',
31 'fld_length' => '163',
32 'max_length' => '255',
35 'previous_blood_work' =>
36 array( 'field_id' => 'previous_blood_work',
38 'fld_length' => '163',
39 'max_length' => '255',
42 'previous_needs_rx' =>
43 array( 'field_id' => 'previous_needs_rx',
45 'fld_length' => '163',
46 'max_length' => '255',
50 array( 'field_id' => 'other',
52 'fld_length' => '151',
57 array( 'field_id' => 'dub_objective',
59 'fld_length' => '140',
61 'list_id' => 'DUB_Objective' ),
63 array( 'field_id' => 'a_dub',
65 'fld_length' => '140',
67 'list_id' => 'DUB_Diagnosis' ),
69 array( 'field_id' => 'plan_lab_work',
71 'fld_length' => '140',
73 'list_id' => 'DUB_Lab_Work' ),
74 'plan_tests_procedures' =>
75 array( 'field_id' => 'plan_tests_procedures',
77 'fld_length' => '140',
79 'list_id' => 'DUB_Tests_Procedures' ),
81 array( 'field_id' => 'plan_medications',
83 'fld_length' => '140',
85 'list_id' => 'DUB_Medications' )
87 /* an array of the lists the fields may draw on. */
89 $data = formFetch($table_name, $id);
94 foreach($data as $key => $value) {
95 if ($key == 'id' ||
$key == 'pid' ||
$key == 'user' ||
96 $key == 'groupname' ||
$key == 'authorized' ||
97 $key == 'activity' ||
$key == 'date' ||
98 $value == '' ||
$value == '0000-00-00 00:00:00' ||
101 /* skip built-in fields and "blank data". */
105 /* display 'yes' instead of 'on'. */
106 if ($value == 'on') {
110 /* remove the time-of-day from the 'date' fields. */
111 if ($field_names[$key] == 'date')
113 $dateparts = split(' ', $value);
114 $value = $dateparts[0];
117 if ( $field_names[$key] == 'checkbox_combo_list' ) {
118 $value = generate_display_field( $manual_layouts[$key], $value );
121 /* replace underscores with spaces, and uppercase all words. */
122 /* this is a primitive form of converting the column names into something displayable. */
123 $key=ucwords(str_replace('_',' ',$key));
126 echo '<td><span class=bold>'.xl("$mykey").': </span><span class=text>'.xl("$myval").'</span></td>';
130 if ($count == $cols) {
132 echo '</tr><tr>' . PHP_EOL
;
136 echo '</tr></table><hr>';