Ignore:
Timestamp:
Sep 2, 2011, 5:18:06 PM (13 years ago)
Author:
George Lilly
Message:

added smoking status and cpoe calculation

File:
1 edited

Legend:

Unmodified
Added
Removed
  • qrda/C0Q/trunk/p/C0QPRML.m

    r1230 r1232  
    11C0QPRML ;JJOH/ZAG/GPL - Patient Reminder List ;7/5/11 8:50pm
    2         ;;1.0;MU PACKAGE;;;Build 14
     2        ;;1.0;MU PACKAGE;;;Build 19
    33        ;
    44        ;2011 Zach Gonzales<zach@linux.com> - Licensed under the terms of the GNU
     
    2727        N G1 ; ONE SET OF VALUES - RNF1 FORMAT
    2828        ; INITIALIZE LISTS
     29        ; this is done so that if there are no matching patients, the patient list
     30        ; will be zeroed out
    2931        S C0QLIST("HasDemographics")=""
    3032        S C0QLIST("Patient")=""
     
    3234        S C0QLIST("HasAllergy")=""
    3335        S C0QLIST("HasMed")=""
     36        S C0QLIST("HasVitalSigns")=""
     37        S C0QLIST("HasMedOrders")=""
     38        S C0QLIST("HasSmokingStatus")=""
    3439        D ALL ; all currently admitted patients in the hospital
    3540        D DIS ; all patients discharged since the reporting period began
     
    5459        . . . D ALLERGY
    5560        . . . D MEDS
     61        . . . D SMOKING
     62        . . . D VITALS
    5663        . . . I C0QPR D PRINT
    5764        . . . I C0QSS D SS
     
    7784        . Q:'ETHN
    7885        . S ETHNDSC=$P($G(^DIC(10.2,ETHN,0)),U) ;ethnincity description
    79         S RB=$P(^DPT(DFN,.101),U) ;room and bed
     86        S RB=$P($G(^DPT(DFN,.101)),U) ;room and bed
    8087        Q
    8188        ;
     
    97104        ;
    98105MEDS    ; MEDICATIONS
    99         D COVER^ORWPS(.MEDSL,DFN)
    100         S MDCNT=""
    101         F  S MDCNT=$O(MEDSL(MDCNT)) Q:MDCNT=""  D
    102         . Q:$P(MEDSL(MDCNT),U,4)'="ACTIVE"  ;active medications only
    103         . S MDDESC=$P(MEDSL(MDCNT),U,2) ;medication description
    104         . S MDITEM=$P($G(MEDSL(MDCNT)),U,3)
     106        ;
     107        I DFN=97 D  Q  ;
     108        . S MDCNT=271
    105109        K MEDSL
     110        D EN^C0CNHIN(.MEDSL,DFN,"MED;") ; GET THE MEDS FROM THE NHIN API
     111        ; can't use COVER^ORWPS even though it's fast.. we need to detect
     112        ; if the medications are Inpatient to compute the CPOE measure
     113        ; we will use the NHINV routines for this purpose
     114        ;D COVER^ORWPS(.MEDSL,DFN)
     115        S MDCNT="" S HASINP=0
     116        F  S MDCNT=$O(MEDSL("med",MDCNT)) Q:MDCNT=""  D
     117        . ;Q:$P(MEDSL(MDCNT),U,4)'="ACTIVE"  ;active medications only
     118        . Q:MEDSL("med",MDCNT,"status@value")'="active"
     119        . ;S MDDESC=$P(MEDSL(MDCNT),U,2) ;medication description
     120        . S MDDESC=$G(MEDSL("med",MDCNT,"products.product@name"))
     121        . ;S MDITEM=$P($G(MEDSL(MDCNT)),U,3)
     122        . S MDITEM=$G(MEDSL("med",MDCNT,"sig")) ; i think this is what meditem is
     123        . I MEDSL("med",MDCNT,"vaType@value")="I" S HASINP=1
     124        I HASINP D  ; THE PATIENT HAS AN INPATIENT MED
     125        . S C0QLIST("HasMedOrders",DFN)="" ; an inpatient drug indicates CPOE
     126        E  S C0QLIST("NoMedOrders",DFN)="" ; this will be different for outpatient
     127        K MEDSL
     128        Q
     129        ;
     130SMOKING ;
     131        N C0QSMOKE
     132        D HFCAT^C0QHF(.C0QSMOKE,DFN,"TOBACCO") ; GET ALL HEALTH FACTORS FOR THE
     133        ; PATIENT IN THE CATEGORY OF TOBACCO
     134        I $D(C0QSMOKE) S C0QLIST("HasSmokingStatus",DFN)=""
     135        E  S C0QLIST("NoSmokingStatus",DFN)=""
     136        Q
     137        ;
     138VITALS  ;
     139        ;
     140        N C0QSDT,C0QEDT
     141        D DT^DILF(,"JULY 3,2011",.C0QSDT) ; START DATE
     142        D DT^DILF(,"T",.C0QEDT) ; END DATE TODAY
     143        D VITALS^ORQQVI(.VITRSLT,DFN,C0QSDT,C0QEDT) ; CALL FAST VITALS
     144        I $D(VITRSLT) D  ;ZWR VITRSLT B  ;
     145        . I VITRSLT(1)["No vitals found." S C0QLIST("NoVitalSigns",DFN)=""
     146        . E  S C0QLIST("HasVitalSigns",DFN)=""
    106147        Q
    107148        ;
     
    207248        . . D ALLERGY
    208249        . . D MEDS
     250        . . D SMOKING
     251        . . D VITALS
    209252        . . I C0QPR D PRINT
    210253        . . I C0QSS D SS
Note: See TracChangeset for help on using the changeset viewer.