Patient Export For Rx Service


Back to Query Directory


I have just signed up for an e-prescribing system. It can upload/populate patients from a csv file rather than having to re-enter them. Is there a query or how can I get SOS to give me a csv file with just: ID, firstname, lastname, DOB, gender, and zipcode on patients which I have selected by way of clicking on a custom field (which I have not yet set up) so that once per week I can download a csv file for all newly entered patients who need med scripts?

Sure. You can do this with a very simple query. Everything you need can be found in the rv_patients view, so you don't even need any JOINs. In the example below, it is assumed that the custom field you are using is the patient User Defined Field 1. You would have to set the value of that field to "Y" for every patient to be exported. In addition, we are filtering out any patients who have already been discharged, and selecting those who have an intake date equal to, or after the specified date on the last line of the query. The OUTPUT statement below the query writes the results to the filename specified on that line. As written, the values will be separated by commas, with no quotation marks around the values. If you want quotes or some other delimiter around the string values, then insert the desired character between the two apostrophes at the end of the line.


SELECT
  id,firstname,lastname,dob,sex,zip
FROM
  rv_patients
WHERE
  dischargedate IS NULL
  AND FLD1 = 'Y'
  AND intakedate >= '2010-01-01'
;
OUTPUT TO c:\SOS\rxexport.csv FORMAT ASCII QUOTE ''
;




CategoryQueries
Valid XHTML 1.0 Transitional :: Valid CSS :: Powered by WikkaWiki