All messages should be posted in plain text.  HTML will be converted to
attachments.    The meditech-l web site is MTUsers.com
======================================


A quick and dirty solution for the Provider column is to try the following
query.  This is a 'C/S' based query, but the concept should work the same.
For the providers, you can incorporate it into each of the bar table queries
you build with the tables you indicated.  It provides the precedence in
Attending order first.  If it doesn't exist, then Admitting, then ER, then
'No Provider', etc.

If you are using the Abstracting table (AbstractProviders), you can also do
similar COALESCE coding by incorporating the respective columns you wish to 
Include (in order of precedence).  



SELECT TOP 100
        VISITS.AccountNumber,
        ATTENDING.Name  AS 'Attending',
        ADMITTING.Name  AS 'Admitting',
        ER.Name         AS 'ERP',


--      Precedence Attending, then Admitting, 
--                   then ER, then 'No Provider'

        COALESCE(
          COALESCE(ATTENDING.Name,
            COALESCE(ADMITTING.Name, ER.Name) ),
              'No Provider')    AS 'Attend_Admit_ER'


FROM BarVisits  VISITS

LEFT JOIN BarVisitProviders     ATTENDING
                ON
        VISITS.SourceID = ATTENDING.SourceID
                AND
        VISITS.VisitID = ATTENDING.VisitID
                AND
        ATTENDING.VisitProviderTypeID = 'Attending'

LEFT JOIN BarVisitProviders     ADMITTING
                ON
        VISITS.SourceID = ADMITTING.SourceID
                AND
        VISITS.VisitID = ADMITTING.VisitID
                AND
        ADMITTING.VisitProviderTypeID = 'Admitting'

LEFT JOIN BarVisitProviders     ER
                ON
        VISITS.SourceID = ER.SourceID
                AND
        VISITS.VisitID = ER.VisitID
                AND
        ER.VisitProviderTypeID = 'Emergency' -- or whatever the ER type is



________________________________________
Garry McAninch
        Principal
Dimensions Analysis

Phone: 905-704-1356
Mobile: 905-941-1356
Fax    : 905-688-2256
 
e-mail: [EMAIL PROTECTED]
web   : www.dimensionsanalysis.com
 
This communication is intended solely for the addressee(s) and contains
information that is privileged, confidential and subject to copyright. Any
unauthorized use, copying, review or disclosure is prohibited. If received
in error, please notify us immediately by return e-mail.
 
________________________________________




-----Original Message-----
From: dr [mailto:[EMAIL PROTECTED] 
Sent: Thursday, September 14, 2006 11:28 AM
To: [EMAIL PROTECTED]
Subject: ? BAR table queries

If you're working primarily with BAR data (tables such as BarVisits,
BarChargeTransactions, BarVisitFinancialData), what's the best method you've
found for:

1. Getting to physician fields - Attending/Admitting/ER (not ordering or
performing)
Do you join to abstracting tables or is there a better way?

2. getting the cpt code using the alt code field in the procedure dictionary
and the account's financial class and discharge date.

we're on 5.4 magic.

tia, ganesh seshadri, indiana regional medical center 



Email [EMAIL PROTECTED] to subscribe to this list
Email [EMAIL PROTECTED] to unsubscribe from this list
Email [EMAIL PROTECTED] to send an email to all other subscribers (broadcast)

_______________________________________________
meditech-l mailing list
[email protected]
http://mtusers.com/mailman/listinfo/meditech-l

Reply via email to