From fe7363b0440a8494ac689640daa276706e7f3eb7 Mon Sep 17 00:00:00 2001 From: bradymiller Date: Sun, 13 Dec 2009 11:43:58 +0000 Subject: [PATCH] more internationalization and input validation project --- interface/forms/CAMOS/notegen.php | 186 ++++++++++++++++++++++++++++++++++--- interface/forms/CAMOS/report.php | 4 +- interface/forms/CAMOS/rx_print.php | 116 +++++++++++++++++++---- 3 files changed, 277 insertions(+), 29 deletions(-) diff --git a/interface/forms/CAMOS/notegen.php b/interface/forms/CAMOS/notegen.php index 909c172fd..9c64c0479 100755 --- a/interface/forms/CAMOS/notegen.php +++ b/interface/forms/CAMOS/notegen.php @@ -1,10 +1,29 @@ - - + + + +<?php xl('Print Notes','e'); ?> + + + +

+
+'> +'> +
+ + + @@ -60,22 +79,167 @@ Calendar.setup({inputField:'end', ifFormat:'%Y-%m-%d', button:'img_end'}); -'> +'> +'> - + + + + <?php xl('Patient Notes','e'); ?> + + +
+ $dailynote) { + foreach ($dailynote as $note_id => $notecontents) { + preg_match('/(\d+)_(\d+)/', $note_id, $matches); //the unique note id contains the pid and encounter + $pid = $matches[1]; + $enc = $matches[2]; + if (!$first) { //generate a new page each time except first iteration when nothing has been printed yet + + //new page code here + + } + else { + $first = 0; + } + print xl("Date").": ".$notecontents['date'] . "
"; + print xl("Name").": ".$notecontents['name'] . "
"; + + $query = sqlStatement("select pubpid from patient_data where id=".$_GET['pid']); + if ($results = mysql_fetch_array($query, MYSQL_ASSOC)) { + $pubpid = $results['pubpid']; + } + print xl("Claim")."# ".$pubpid . "
"; + + print "
"; + print xl("Chief Complaint").": ".$notecontents['reason'] . "
"; + if ($notecontents['vitals']) { + print "
"; + print $notecontents['vitals'] . "
"; + } + if (count($notecontents['exam']) > 0) { + print "
"; + print "" . xl("Progress Notes") . "
"; + print "
"; + foreach($notecontents['exam'] as $examnote) { + print nl2br($examnote) . "
"; + } + } + if (count($notecontents['prescriptions']) > 0) { + print "
"; + print "" . xl("Prescriptions") . "
"; + print "
"; + foreach($notecontents['prescriptions'] as $rx) { + print nl2br($rx) . "
"; + } + } + if (count($notecontents['other']) > 0) { + print "
"; + print "" . xl("Other") . "
"; + print "
"; + foreach($notecontents['other'] as $other => $othercat) { + print nl2br($other) . "
"; + foreach($othercat as $items) { + print nl2br($items) . "
"; + } + } + } + if (count($notecontents['billing']) > 0) { + $tmp = array(); + foreach($notecontents['billing'] as $code) { + $tmp[$code]++; + } + if (count($tmp) > 0) { + print "
"; + print "" . xl("Coding") . "
"; + print "
"; + foreach($tmp as $code => $val) { + print nl2br($code) . "
"; + } + } + } + if (count($notecontents['calories']) > 0) { + $sum = 0; + print "
"; + print "" . xl("Calories") . "
"; + print "
"; + foreach($notecontents['calories'] as $calories => $value) { + print $value['content'].' - '.$value['item'].' - '.$value['date'] . "
"; + $sum += $value['content']; + } + print "--------" . "
"; + print $sum . "
"; + } + print "
"; + print "
"; + print "" . xl("Digitally Signed") . "
"; + + $query = sqlStatement("select t2.id, t2.fname, t2.lname, t2.title from forms as t1 join users as t2 on " . + "(t1.user like t2.username) where t1.pid=$pid and t1.encounter=$encounter"); + if ($results = mysql_fetch_array($query, MYSQL_ASSOC)) { + $name = $results['fname']." ".$results['lname'].", ".$results['title']; + $user_id = $results['id']; + } + $path = $GLOBALS['fileroot']."/interface/forms/CAMOS"; + if (file_exists($path."/sig".$user_id.".jpg")) { + //show the image here + } + print "" . $name . "
"; + } + } +?> + +
+ + +selectFont($depth.'library/fonts/Helvetica'); $pdf->ezSetCmMargins(3,1,1,1); - $output = getFormData($_POST['start'],$_POST['end'],$_POST['lname'],$_POST['fname']); - ksort($output); - $first = 1; foreach ($output as $datekey => $dailynote) { foreach ($dailynote as $note_id => $notecontents) { preg_match('/(\d+)_(\d+)/', $note_id, $matches); //the unique note id contains the pid and encounter @@ -89,7 +253,6 @@ if ($_POST['submit'] || ($_GET['pid'] && $_GET['encounter'])) { } $pdf->ezText(xl("Date").": ".$notecontents['date'],8); $pdf->ezText(xl("Name").": ".$notecontents['name'],8); -// $pdf->ezText("ID: ".$note_id,8); $query = sqlStatement("select pubpid from patient_data where id=".$_GET['pid']); if ($results = mysql_fetch_array($query, MYSQL_ASSOC)) { @@ -121,7 +284,7 @@ if ($_POST['submit'] || ($_GET['pid'] && $_GET['encounter'])) { } if (count($notecontents['other']) > 0) { $pdf->ezText("",8); - $pdf->ezText("Other",12); + $pdf->ezText(xl("Other"),12); $pdf->ezText("",8); foreach($notecontents['other'] as $other => $othercat) { $pdf->ezText($other,8); @@ -174,6 +337,7 @@ if ($_POST['submit'] || ($_GET['pid'] && $_GET['encounter'])) { } } $pdf->ezStream(); + } } function getFormData($start_date,$end_date,$lname,$fname) { //dates in sql format $lname = trim($lname); diff --git a/interface/forms/CAMOS/report.php b/interface/forms/CAMOS/report.php index cf00a438f..6d1305ccc 100755 --- a/interface/forms/CAMOS/report.php +++ b/interface/forms/CAMOS/report.php @@ -14,13 +14,13 @@ function CAMOS_report( $pid, $encounter, $cols, $id) { echo " | "; echo "" . xl('Signed Rx') . "\n"; - echo " | "; + echo "
"; echo "" . xl('Letterhead that patient signs') . "\n"; echo " | "; echo "" . xl('Letterhead that doctor signs') . "\n"; - echo " | "; + echo "
"; echo "" . xl('Print This Encounter') . "\n"; echo " | "; diff --git a/interface/forms/CAMOS/rx_print.php b/interface/forms/CAMOS/rx_print.php index 5a95746a4..38e803a1e 100755 --- a/interface/forms/CAMOS/rx_print.php +++ b/interface/forms/CAMOS/rx_print.php @@ -2,6 +2,7 @@ include_once ('../../globals.php'); include_once ('../../../library/sql.inc'); include_once ('../../../library/classes/Prescription.class.php'); +include_once("../../../library/formdata.inc.php"); //practice data $physician_name = ''; $practice_fname = ''; @@ -51,16 +52,16 @@ if ($result = mysql_fetch_array($query, MYSQL_ASSOC)) { //update user information if selected from form if ($_POST['update']) { // OPTION update practice inf $query = "update users set " . - "fname = '" . $_POST['practice_fname'] . "', " . - "lname = '" . $_POST['practice_lname'] . "', " . - "title = '" . $_POST['practice_title'] . "', " . - "street = '" . $_POST['practice_address'] . "', " . - "city = '" . $_POST['practice_city'] . "', " . - "state = '" . $_POST['practice_state'] . "', " . - "zip = '" . $_POST['practice_zip'] . "', " . - "phone = '" . $_POST['practice_phone'] . "', " . - "fax = '" . $_POST['practice_fax'] . "', " . - "federaldrugid = '" . $_POST['practice_dea'] . "' " . + "fname = '" . formData('practice_fname') . "', " . + "lname = '" . formData('practice_lname') . "', " . + "title = '" . formData('practice_title') . "', " . + "street = '" . formData('practice_address') . "', " . + "city = '" . formData('practice_city') . "', " . + "state = '" . formData('practice_state') . "', " . + "zip = '" . formData('practice_zip') . "', " . + "phone = '" . formData('practice_phone') . "', " . + "fax = '" . formData('practice_fax') . "', " . + "federaldrugid = '" . formData('practice_dea') . "' " . "where id =" . $_SESSION['authUserID']; sqlInsert($query); } @@ -79,14 +80,14 @@ if ($result = mysql_fetch_array($query, MYSQL_ASSOC)) { $practice_fax = $result['fax']; $practice_dea = $result['federaldrugid']; } -if ($_POST['print']) { +if ($_POST['print_pdf'] || $_POST['print_html']) { $camos_content = array(); foreach ($_POST as $key => $val) { if (substr($key,0,3) == 'ch_') { $query = sqlStatement("select content from form_CAMOS where id =" . substr($key,3)); if ($result = mysql_fetch_array($query, MYSQL_ASSOC)) { - if (!$_GET['letterhead']) { //do this change to formatting only for web output (rx output) + if ($_POST['print_html']) { //do this change to formatting only for html output $content = preg_replace('|\n|','
', $result['content']); $content = preg_replace('|

|','
', $content); } else { @@ -270,8 +271,80 @@ else { + + + + <?php xl('Letter','e'); ?> + + +
+"; + print $physician_name . "
\n"; + print $practice_address . "
\n"; + print $practice_city.', '.$practice_state.' '.$practice_zip . "
\n"; + print $practice_phone . ' (' . xl('Voice') . ')' . "
\n"; + print $practice_phone . ' ('. xl('Fax') . ')' . "
\n"; + print "
\n"; + print date("l, F jS, Y") . "
\n"; + print "
\n"; + print "
"; + //not bold + print "
"; + print $content; + print "
"; + //bold + print "
"; + print "
\n"; + print "
\n"; + if ($_GET['signer'] == 'patient') { + print "__________________________________________________________________________________" . "
\n"; + print xl("Print name, sign and date.") . "
\n"; + } + elseif ($_GET['signer'] == 'doctor') { + print xl('Sincerely,') . "
\n"; + print "
\n"; + print "
\n"; + print $physician_name . "
\n"; + } + print "
"; +?> + + + + +selectFont('../../../library/fonts/Times-Bold'); @@ -300,6 +373,7 @@ else { $pdf->ezText($physician_name,12); } $pdf->ezStream(); + } //end of html vs pdf print } } //end of if print else { //OPTION selection of what to print @@ -371,7 +445,12 @@ function cycle_engine(cb,seed) { ' onClick='cycle()'>
' onClick='checkall()'> ' onClick='uncheckall()'> -'> + + +'> + + +'> drug . ':' . $val->start_date . "
\n"; } ?> -'> + + +'> + + +'>

-- 2.11.4.GIT