Pastebin is 300% more awesome when you are logged in. Sign Up, it's FREE!
Guest

Untitled

By: a guest on Jul 26th, 2012  |  syntax: SQL  |  size: 1.54 KB  |  hits: 11  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1.     SELECT
  2.        c.rendering_id AS prov_number,
  3.        c.begin_date_of_service AS date_of_service,
  4.        c.practice_id AS group_number,
  5.        v.enc_nbr AS invoice,
  6.        p.person_nbr AS patient,
  7.        v.enc_nbr AS invoice_number,
  8.        c.charge_id AS transaction_number,
  9.        t.med_rec_nbr AS primary_mrn,
  10.        p.last_name,
  11.        p.first_name,
  12.        z.payer_id AS orig_fsc_number,
  13.        z.payer_id AS curr_fsc_number,
  14.        c.location_id AS location_number,
  15.        c.closing_date AS posting_date,
  16.        c.quantity AS service_units,
  17.        c.amt AS charge_amount,
  18.        c.cpt4_code_id AS procedure_code,
  19.        r.description AS procedure_name,
  20.        x.tran_code_id AS pay_code_number,
  21.        ISNULL([modifier_1],'')AS modifier_code_1,
  22.        ISNULL([modifier_2],'') AS modifier_code_2,
  23.        ISNULL([modifier_3],'') AS modifier_code_3,
  24.        ISNULL([icd9cm_code_id],'') AS dx_code_1,
  25.        ISNULL([icd9cm_code_id_2],'') AS dx_code_2,
  26.        ISNULL([icd9cm_code_id_3],'') AS dx_code_3,
  27.        ISNULL([icd9cm_code_id_4],'') AS dx_code_4
  28.     FROM       charges c
  29.     INNER JOIN person p            ON c.person_id = p.person_id
  30.     INNER JOIN patient t           ON c.person_id = t.person_id
  31.     INNER JOIN patient_encounter v ON c.person_id = v.person_id
  32.     INNER JOIN encounter_payer z   ON c.person_id = z.person_id
  33.     INNER JOIN cpt4_code_mstr r    ON c.cpt4_code_id = r.cpt4_code_id
  34.     INNER JOIN transactions x      ON c.person_id = x.person_id
  35.     WHERE c.practice_id ='0001'
  36.       AND c.closing_date >= GetDate() - 7