not sure what you are after in this data_type you are requesting. Are you just looking to do radial buttons that the patient can select the severity of pain? I think that would be your best and quickest option to do what you want.
I am working on a new data_type and i am stuck on the SQL query. Could someone tell me what is wrong with the SQL statement?
// the list of active drugs for the current patient
// this is read-only!
else if ($data_type == 34) {
$query = "SELECT * FROM prescriptions WHERE " .
"patient_id = ? AND refills >= ‘1’;
//Modified by Sherwin to include short cut back to change or add drugs
echo “<a href=’/interface/patient_file/summary/rx_frameset.php’ onClick=‘showPopup(this.href);return(false);’>Click here to add</a>  \n”; // debugging
$lres = sqlStatement($query, array($GLOBALS));
$count = 0;
while ($lrow = sqlFetchArray($lres)) {
if ($count++) echo “<br />”;
echo htmlspecialchars( $lrow, ENT_NOQUOTES);
if ($lrow) echo ’ (’ . htmlspecialchars( $lrow, ENT_NOQUOTES) . ‘)’;
}
}
I found my error. I little sleep goes a long way. Here is the new code snippet
// the list of active drugs for the current patient
// this is read-only!
else if ($data_type == 34) {
$query = "SELECT drug FROM prescriptions WHERE " .
"patient_id = ? AND refills >= 1 " ;
//“ORDERED BY start_date”;
//Modified by Sherwin to include short cut back to change or add drugs
echo “<a href=’/interface/patient_file/summary/rx_frameset.php’ onClick=‘showPopup(this.href);return(false);’>Click here to add</a>  \n”;
Ok, now I have gotten through it and the base code works.
The working code is
// the list of active drugs for the current patient
// this is read-only!
else if ($data_type == 34) {
$query = "SELECT drug, note FROM prescriptions WHERE " .
"patient_id = “.$GLOBALS.” AND refills >= 1 ";
//“ORDERED BY start_date”;
//Modified by Sherwin to include short cut back to change or add drugs
echo “<a href=’/interface/patient_file/summary/rx_frameset.php’ onClick=‘showPopup(this.href);return(false);’>Click here to add</a>  \n”;
The problem is in the ability to add meds to the patient record. The line "<a href=’/interface/patient_file/summary/rx_frameset.php’ onClick=‘showPopup(this.href);return(false);’> does bring up the window to add a prescription but when I click save the record does not save to the patients record.
I know that I am having this conversation by myself at the moment but maybe it will encourage others to make a go at programming.
Here is the corrected code:
// this is read-only!
else if ($data_type == 34) {
$query = "SELECT drug, note FROM prescriptions WHERE " .
"patient_id = “.$GLOBALS.” AND refills >= 1 “;
//debugging
$lres = sqlStatement($query);
$count = 0;
while ($lrow = sqlFetchArray($lres)) {
if ($count++) echo “<br />”;
echo htmlspecialchars( $lrow, ENT_NOQUOTES);
if ($lrow) echo ’ (’ . htmlspecialchars( $lrow, ENT_NOQUOTES) . ‘)’;
}
echo '<br> <a href=”/interface/patient_file/summary/rx_frameset.php"target=“RTop”>Add new prescriptions</a> ’;
}
// the list of active ICD9’s for the current patient
// this is read-only!
else if ($data_type == 35) {
$query = “SELECT code, code_text FROM billing WHERE " .
“pid = ? AND code_type = ‘ICD9’ AND billed = 0”;
//“ORDER BY begdate”;
//mod added to create short cut back to add alergy
echo '<br> <a href=”/interface/patient_file/encounter/load_form.php?formname=fee_sheet"target=“RTop”>Add ICD9 codes</a>  ’;
// debugging
$lres = sqlStatement($query, array($GLOBALS));
$count = 0;
while ($lrow = sqlFetchArray($lres)) {
if ($count++) echo “<br />”;
They both pull data that is read only into the form bu t now I need to get the data from the list in to the textarea box.
Any ideas would be great. This is kind of crude but it helps with getting the doc to do the prescribing and billing at the same time. This is a not so fancy office not with some auto features while am waiting to find out some more information about the COMOS.