Designing New Data Type

juggernautsei wrote on Tuesday, June 07, 2011:

vpsubramanian,

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.

  • Sherwin

juggernautsei wrote on Tuesday, June 07, 2011:

Hey!

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>&nbsp&nbsp\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) . ‘)’;
    }
  }

Thanks!

juggernautsei wrote on Tuesday, June 07, 2011:

Hey!

I forgot to mention that the afore going code is in the option.inc.php file in the library folder.

Thanks!

juggernautsei wrote on Tuesday, June 07, 2011:

Hey all,

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>&nbsp&nbsp\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) . ‘)’;
    }
  }

But now it returns an empty value. I was thinking that somewhere I need to set the PID = Patient_id

juggernautsei wrote on Tuesday, June 07, 2011:

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>&nbsp&nbsp\n”;  

            //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) . ‘)’;
    }
  }

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.

Does anyone know how to get the record to save?

Sherwin

juggernautsei wrote on Saturday, June 18, 2011:

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>&nbsp;&nbsp;’;

  }

  // 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>&nbsp&nbsp;’;
     
       // 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) . ‘)’;
     
    }
  }

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.

I have prepared a video of what this does. It is located in the option.inc.php file.
http://www.youtube.com/watch?v=IQoapHfHAF8

Thanlks for any help