Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: BQIIPOTC

BQIIPOTC.m

Go to the documentation of this file.
BQIIPOTC ;VNGT/HS/ALA-Outcome Bundle ; 18 Jul 2011  4:00 PM
 ;;2.4;ICARE MANAGEMENT SYSTEM;**3**;Apr 01, 2015;Build 5
 ;
EN(BQDATE) ;EP - Outcome Bundle Monthly
 NEW BQMON,BQDTE,BEGDT,EDAY,ENDT,PYR,CYR,ID,FAC,DFN,QFL,CRST
 S QFL=0
 S CRST=$P($G(^BQI(90508,1,11)),U,2) S:CRST="" CRST=1
 S CRST="0"_CRST
 ;
 I $G(BQDATE)'="" D
 . S BEGDT=$E(BQDATE,1,5)_"01",CYR=$E(BQDATE,1,3),BQMON=$E(BQDATE,4,5)
 . I $L(BQMON)=1 S BQMON="0"_BQMON
 . S EDAY="31^"_($$LEAP^XLFDT2(CYR)+28)_"^31^30^31^30^31^31^30^31^30^31"
 . S ENDT=$E(BQDATE,1,5)_$P(EDAY,U,+BQMON)
 ;
 I $G(BQDATE)="" D  Q:QFL
 . I $E(DT,6,7)'=CRST S QFL=1 Q
 . S BQMON=$E(DT,4,5)-1,CYR=$E(DT,1,3),PYR=CYR-1
 . S BQDTE=$P($T(BQM+BQMON),";;",2)
 . I $L(BQMON)=1 S BQMON="0"_BQMON
 . S BEGDT=@($P(BQDTE,U,2))_$P(BQDTE,U,1)_"01"
 . S EDAY="31^"_($$LEAP^XLFDT2(CYR)+28)_"^31^30^31^30^31^31^30^31^30^31"
 . S ENDT=@($P(BQDTE,U,2))_$P(BQDTE,U,1)_$P(EDAY,U,+$P(BQDTE,U,1))
 . S BQDATE=$S(BQMON="01":PYR,1:CYR)_BQMON_"00"
 ;
 ; Get current IPC
 S CRIPC=$P($G(^BQI(90508,1,11)),U,1)
 S CRN=$O(^BQI(90508,1,22,"B",CRIPC,"")) I CRN="" Q
 ;
 K ^XTMP("BQI OUTMON")
 S PRV=""
 F  S PRV=$O(^AUPNPAT("AK",PRV)) Q:PRV=""  D
 . I $P(^VA(200,PRV,0),U,13)'="" Q
 . S DFN=""
 . F  S DFN=$O(^AUPNPAT("AK",PRV,DFN)) Q:DFN=""  D
 .. I '$$HRN^BQIUL1(DFN) Q
 .. S NA=0,NO=0,YES=0,NDA=0,CNT=3,DEC=0,TOTP=0
 .. ;S TOTP=TOTP+1
 .. ;F CODE="IPC_DMCTRL","IPC_LDCTRL","IPC_BPCTRL" D
 .. F CODE="IPC_DMCTRL","IPC_BPCTRL" D
 ... S VAL=$$PAT(CRN,DFN,CODE)
 ... I VAL="{D}" S DEC=1 Q
 ... I VAL="N/A" S NA=NA+1 Q
 ... I VAL="NO" S NO=NO+1 Q
 ... I VAL="YES" S YES=YES+1 Q
 ... S NDA=NDA+1 Q
 .. I DEC Q
 .. I NA=CNT Q
 .. I NDA=CNT S ^XTMP("BQI OUTMON","PRV",PRV,"NO")=$G(^XTMP("BQI OUTMON","PRV",PRV,"NO"))+1 Q
 .. I YES=CNT S ^XTMP("BQI OUTMON","PRV",PRV,"YES")=$G(^XTMP("BQI OUTMON","PRV",PRV,"YES"))+1 Q
 .. I 'NO S ^XTMP("BQI OUTMON","PRV",PRV,"YES")=$G(^XTMP("BQI OUTMON","PRV",PRV,"YES"))+1 Q
 .. S ^XTMP("BQI OUTMON","PRV",PRV,"NO")=$G(^XTMP("BQI OUTMON","PRV",PRV,"NO"))+1 Q
 ;
 S CODE="IPC_OUTC"
 S FAC=$$HME^BQIGPUTL()
 ; Set NOs and YESs to get denominator value and store
 S PRV="",TDEN=0,TNUM=0
 F  S PRV=$O(^XTMP("BQI OUTMON","PRV",PRV)) Q:PRV=""  D
 . S TP=$G(^XTMP("BQI OUTMON","PRV",PRV,"NO"))+$G(^XTMP("BQI OUTMON","PRV",PRV,"YES"))
 . S PCT=+$G(^XTMP("BQI OUTMON","PRV",PRV,"YES"))
 . D STORP^BQIIPUTL(PRV,CODE,BQDATE,TP,PCT)
 . S TDEN=TDEN+TP,TNUM=TNUM+PCT
 S FAC=$$HME^BQIGPUTL()
 D STORF^BQIIPUTL(FAC,CODE,BQDATE,TDEN,TNUM)
 K ^XTMP("BQI OUTMON")
 Q
 ;
OPAT(CRN,DFN) ;EP - Outcome Bundle by Patient
 NEW MSN,CODE,BQDATE
 K ^XTMP("BQI OUTCOME",$J)
 ;F CODE="IPC_DMCTRL","IPC_LDCTRL","IPC_BPCTRL" D
 F CODE="IPC_DMCTRL","IPC_BPCTRL" D
 . S MSN=$O(^BQI(90508,1,22,CRN,1,"B",CODE,""))
 . S BQDATE=""
 . ; Find and Store the results of each "sub-bundle"
 . S EXEC=$G(^BQI(90508,1,22,CRN,1,MSN,1)) I EXEC="" Q
 . X EXEC
 ;
 S MSN="",NA=0,NO=0,YES=0,NDA=0,CNT=3,DEC=0
 F  S MSN=$O(^XTMP("BQI OUTCOME",$J,"PT",DFN,MSN)) Q:MSN=""  D
 . I $G(^XTMP("BQI OUTCOME",$J,"PT",DFN,MSN))="{D}" S DEC=DEC+1 Q
 . I $G(^XTMP("BQI OUTCOME",$J,"PT",DFN,MSN))="N/A" S NA=NA+1 Q
 . I $G(^XTMP("BQI OUTCOME",$J,"PT",DFN,MSN))="NO" S NO=NO+1 Q
 . I $G(^XTMP("BQI OUTCOME",$J,"PT",DFN,MSN))="YES" S YES=YES+1 Q
 . I $G(^XTMP("BQI OUTCOME",$J,"PT",DFN,MSN))="NDA" S NO=NO+1 Q
 I DEC Q "{D}"
 I NDA Q "NO"
 I NA=CNT Q "N/A"
 I YES=CNT Q "YES"
 I 'NO Q "YES"
 Q "NO"
 ;
DM(CRN,MSN,BQDATE,CODE,DFN) ;EP - do the DM bundle for monthly update
 ; Input
 ;   CRN  - Current IPC IEN
 ;   MSN - Bundle IEN
 ;   CODE  - Code name
 ;   BQI(90508,1,22,CRN,1,BNIEN,1
 ;
 NEW TDEN,TNUM,CNT,XX,PRV,BQIDOD,CD,IEN,NUM,DEN,PCT,TP,FAC
 S TDEN=0,TNUM=0,CNT=0
 D BUN(CRN,MSN,.XX)
 ;
 I $G(DFN)'="" D  Q
 . S PRV=$P(^AUPNPAT(DFN,0),U,14)
 . D DMP(DFN,MSN,PRV) Q
 ;
 S PRV=""
 F  S PRV=$O(^AUPNPAT("AK",PRV)) Q:PRV=""  D
 . I $P(^VA(200,PRV,0),U,13)'="" Q
 . S DFN=""
 . F  S DFN=$O(^AUPNPAT("AK",PRV,DFN)) Q:DFN=""  D
 .. I '$$HRN^BQIUL1(DFN) Q
 .. D DMP(DFN,MSN,PRV)
 . S TP=$G(^XTMP("BQI OUTCOME",$J,"PRV",PRV,"NO"))+$G(^XTMP("BQI OUTCOME",$J,"PRV",PRV,"NDA"))+$G(^XTMP("BQI OUTCOME",$J,"PRV",PRV,"YES"))
 . S PCT=+$G(^XTMP("BQI OUTCOME",$J,"PRV",PRV,"YES"))
 . D STORP^BQIIPUTL(PRV,CODE,BQDATE,TP,PCT)
 . S TDEN=TDEN+TP,TNUM=TNUM+PCT
 S FAC=$$HME^BQIGPUTL()
 D STORF^BQIIPUTL(FAC,CODE,BQDATE,TDEN,TNUM)
 ;
 Q
 ;
DMP(DFN,MSN,BPROV) ;EP
 I $$DEC(DFN,MSN,$G(BPROV)) Q
 S CD=""
 F  S CD=$O(XX(CD)) Q:CD=""  D
 . S IEN=$O(^BQIPAT(DFN,30,"B",CD,"")) I IEN="" D NDA(DFN,MSN,BPROV) Q
 . I $$PTV(DFN,CD)="N/A" D NA(DFN,MSN,BPROV) Q
 . I $$PTV(DFN,CD)="NO" D NO(DFN,MSN,BPROV) Q
 . I $$PTV(DFN,CD)="YES" D YES(DFN,MSN,BPROV)
 Q
 ;
LD(CRN,MSN,BQDATE,CODE,DFN) ;EP - do the LDL bundle for monthly update
 ; Input
 ;   CRN  - Current IPC IEN
 ;   MSN - Bundle IEN
 ;   CODE  - Code name
 ;   BQI(90508,1,22,CRN,1,BNIEN,1
 ;
 NEW TDEN,TNUM,CNT,XX,PRV,BQIDOD,CD,IEN,NUM,DEN,PCT,TP,FAC
 K ^XTMP("BQI OUTCOME",$J,"PRV")
 S TDEN=0,TNUM=0,CNT=0
 ;
 I $G(DFN)'="" D  Q
 . S PRV=$P(^AUPNPAT(DFN,0),U,14)
 . D LDP(DFN,MSN,PRV)
 ;
 S PRV=""
 F  S PRV=$O(^AUPNPAT("AK",PRV)) Q:PRV=""  D
 . I $P(^VA(200,PRV,0),U,13)'="" Q
 . S DFN=""
 . F  S DFN=$O(^AUPNPAT("AK",PRV,DFN)) Q:DFN=""  D
 .. I '$$HRN^BQIUL1(DFN) Q
 .. D LDP(DFN,MSN,PRV)
 . S TP=$G(^XTMP("BQI OUTCOME",$J,"PRV",PRV,"NO"))+$G(^XTMP("BQI OUTCOME",$J,"PRV",PRV,"NDA"))+$G(^XTMP("BQI OUTCOME",$J,"PRV",PRV,"YES"))
 . S PCT=+$G(^XTMP("BQI OUTCOME",$J,"PRV",PRV,"YES"))
 . D STORP^BQIIPUTL(PRV,CODE,BQDATE,TP,PCT)
 . S TDEN=TDEN+TP,TNUM=TNUM+PCT
 S FAC=$$HME^BQIGPUTL()
 D STORF^BQIIPUTL(FAC,CODE,BQDATE,TDEN,TNUM)
 ;
 Q
 ;
LDP(DFN,MSN,BPROV) ;EP
 I $$DEC(DFN,MSN,$G(BPROV)) Q
 I $O(^BQIPAT(DFN,30,0))="" D NDA(DFN,MSN,$G(BPROV)) Q
 ;
 NEW BQIH,BQIYR
 S BQIH=$$SPM^BQIGPUTL(),BQIYR=$$GET1^DIQ(90508,BQIH_",",2,"E")
 ;
 I $$PTV(DFN,BQIYR_"_99")="YES" D  Q
 . D YES(DFN,MSN,$G(BPROV))
 I $$PTV(DFN,BQIYR_"_810")="YES"!($$PTV(DFN,BQIYR_"_810")="NO") D  Q
 . NEW BCODE,IEN,BGPVALUE
 . S BCODE=BQIYR_"_810",IEN=$O(^BQIPAT(DFN,30,"B",BCODE,"")) I IEN="" Q
 . S BGPVALUE=$P(^BQIPAT(DFN,30,IEN,0),"^",2)
 . I $P(BGPVALUE,"|",1)'["CHD" D NA(DFN,MSN,$G(BPROV)) Q
 . D YES(DFN,MSN,$G(BPROV)) Q
 ;
 ;Check ICD
 NEW BQICD
 S BQICD=$$DXC()
 S RESULT=$$DX^BQIIPDXC("T-12M",DFN,BQCODE)
 I RESULT D YES(DFN,MSN,$G(BPROV)) Q
 I $$PTV(DFN,BQIYR_"_99")="N/A",$$PTV(DFN,BQIYR_"_810")="N/A" D NA(DFN,MSN,$G(BPROV)) Q
 D NO(DFN,MSN,$G(BPROV))
 Q
 ;
DXC() ;EP
 I $$VERSION^XPDUTL("AICD")<4.0 S BQCODE="V77.91"
 I $$VERSION^XPDUTL("AICD")>3.51 D
 . I DT<$$IMP^ICDEXA(30) S BQCODE="V77.91" Q
 . S BQCODE="Z13.220"
 Q BQCODE
 ;
BP(CRN,MSN,BQDATE,CODE,DFN) ;EP - do the BP bundle
 ; Input
 ;   CRN  - Current IPC IEN
 ;   MSN - Bundle IEN
 ;   CODE  - Code name
 ;   BQI(90508,1,22,CRN,1,BNIEN,1
 ;
 NEW TDEN,TNUM,CNT,XX,PRV,BQIDOD,CD,IEN,NUM,DEN,PCT,TP,FAC
 K ^XTMP("BQI OUTCOME",$J,"PRV")
 S TDEN=0,TNUM=0,CNT=0
 D BUN(CRN,MSN,.XX)
 ;
 I $G(DFN)'="" D  Q
 . S PRV=$P(^AUPNPAT(DFN,0),U,14)
 . D BPP(DFN,MSN,PRV)
 ;
 S PRV=""
 F  S PRV=$O(^AUPNPAT("AK",PRV)) Q:PRV=""  D
 . I $P(^VA(200,PRV,0),U,13)'="" Q
 . S DFN=""
 . F  S DFN=$O(^AUPNPAT("AK",PRV,DFN)) Q:DFN=""  D
 .. I '$$HRN^BQIUL1(DFN) Q
 .. D BPP(DFN,MSN,PRV)
 . S TP=$G(^XTMP("BQI OUTCOME",$J,"PRV",PRV,"NO"))+$G(^XTMP("BQI OUTCOME",$J,"PRV",PRV,"NDA"))+$G(^XTMP("BQI OUTCOME",$J,"PRV",PRV,"YES"))
 . S PCT=+$G(^XTMP("BQI OUTCOME",$J,"PRV",PRV,"YES"))
 . D STORP^BQIIPUTL(PRV,CODE,BQDATE,TP,PCT)
 . S TDEN=TDEN+TP,TNUM=TNUM+PCT
 S FAC=$$HME^BQIGPUTL()
 D STORF^BQIIPUTL(FAC,CODE,BQDATE,TDEN,TNUM)
 Q
 ;
BPP(DFN,MSN,BPROV) ;EP
 I $$DEC(DFN,MSN,$G(BPROV)) Q
 ;
 NEW BQIH,BQIYR,BQIRES
 S BQIH=$$SPM^BQIGPUTL(),BQIYR=$$GET1^DIQ(90508,BQIH_",",2,"E")
 ;
 S TAG=$$ATAG^BQITDUTL(DFN,"Hypertension")
 ; DM: BP <140/90 = BQIYR_2636
 S CD=BQIYR_"_2636",QFL=0 D  Q:QFL
 . I $$PTV(DFN,CD)="NDA" D NDA(DFN,MSN,BPROV) S QFL=1 Q
 . I $$PTV(DFN,CD)="YES" D YES(DFN,MSN,BPROV) S QFL=1 Q
 . I $$PTV(DFN,CD)="NO" D NO(DFN,MSN,BPROV) S QFL=1 Q
 . ; If it is not applicable, check other BPs
 . ;I $$PTV(DFN,CD)="N/A" D  Q:QFL
 . ; If CRS 15
 . I $$VERSION^XPDUTL("BGP")>14.9 D  Q
 .. S BQIRES=$$PAT^BQIIPCBP(DFN)
 .. I BQIRES="YES" D YES(DFN,MSN,$G(BPROV)) S QFL=1 Q
 .. I BQIRES="NO" D NO(DFN,MSN,$G(BPROV)) S QFL=1 Q
 .. I BQIRES="N/A" D NA(DFN,MSN,$G(BPROV)) S QFL=1 Q
 .. D NO(DFN,MSN,$G(BPROV)) S QFL=1 Q
 . D  Q:QFL
 .. ; CHD: Pre-HTN I BP = BQIYR_909   CHD: Normal BP = BQIYR_908    CHD: Pre-HTN II BP
 .. I $$PTV(DFN,BQIYR_"_909")="YES"!($$PTV(DFN,BQIYR_"_908")="YES")!($$PTV(DFN,BQIYR_"_910")="YES") D YES(DFN,MSN,$G(BPROV)) S QFL=1 Q
 .. I $$PTV(DFN,BQIYR_"_909")="NO"!($$PTV(DFN,BQIYR_"_908")="NO")!($$PTV(DFN,BQIYR_"_910")="NO") D NO(DFN,MSN,$G(BPROV)) S QFL=1 Q
 .. I $$PTV(DFN,BQIYR_"_909")="N/A"!($$PTV(DFN,BQIYR_"_908")="N/A")!($$PTV(DFN,BQIYR_"_910")="N/A") D
 ... ; If tag is no
 ... I 'TAG,$$PTV(DFN,BQIYR_"_907")="N/A" D NA(DFN,MSN,$G(BPROV)) S QFL=1 Q
 ... I TAG
 ... ; 20+: Normal BP = BQIYR_872 20+: Pre-HTN I BP = BQIYR_873  20+: Pre-HTN II BP = BQIYR_874
 ... I $$PTV(DFN,BQIYR_"_872")="YES"!($$PTV(DFN,BQIYR_"_873")="YES")!($$PTV(DFN,BQIYR_"_874")="YES") D YES(DFN,MSN,$G(BPROV)) S QFL=1 Q
 ... D NO(DFN,MSN,$G(BPROV)) S QFL=1 Q
 Q
 ;
BUN(CRN,MSN,XX) ;EP - Get values for bundle
 NEW BN,BCODE
 S BN=0
 F  S BN=$O(^BQI(90508,1,22,CRN,1,MSN,2,BN)) Q:'BN  D
 . S BCODE=$P(^BQI(90508,1,22,CRN,1,MSN,2,BN,0),U,1),GP=$P(^BQI(90508,1,22,CRN,1,MSN,2,BN,0),U,2)
 . I GP="" S XX(BCODE)="" Q
 . I GP'="" S XX(GP,BCODE)=""
 Q
 ;
PAT(CRN,DFN,CODE) ;EP - See if patient meets bundle criteria
 ; Input
 ;  CODE="IPC_DMCTRL" or "IPC_LDCTRL" or "IPC_BPCTRL"
 NEW MSN,BQDATE
 K ^XTMP("BQI OUTCOME",$J)
 S MSN=$O(^BQI(90508,1,22,CRN,1,"B",CODE,""))
 S BQDATE=""
 ; Find and Store the results of each "sub-bundle"
 S EXEC=$G(^BQI(90508,1,22,CRN,1,MSN,1)) I EXEC="" Q
 X EXEC
 ;
 I $G(^XTMP("BQI OUTCOME",$J,"PT",DFN,MSN))="{D}" Q "{D}"
 I $G(^XTMP("BQI OUTCOME",$J,"PT",DFN,MSN))="N/A" Q "N/A"
 I $G(^XTMP("BQI OUTCOME",$J,"PT",DFN,MSN))="NO" Q "NO"
 I $G(^XTMP("BQI OUTCOME",$J,"PT",DFN,MSN))="YES" Q "YES"
 I $G(^XTMP("BQI OUTCOME",$J,"PT",DFN,MSN))="LDL Result Not Entered" Q "LDL Result Not Entered"
 Q "NDA"
 ;
PROC ;EP - Process data
 S IEN=$O(^BQIPAT(DFN,30,"B",CD,"")) I IEN="" D NDA(DFN,MSN) Q
 S NUM=$P(^BQIPAT(DFN,30,IEN,0),U,3)
 S DEN=$P(^BQIPAT(DFN,30,IEN,0),U,4)
 I NUM="",DEN="" D NA(DFN,MSN) Q
 I DEN'="",NUM="" D NO(DFN,MSN) Q
 I DEN'="",NUM'="" D YES(DFN,MSN) Q
 Q
 ;
CMPR ;EP - Combo process
 NEW CD,TCT,IEN,BQTMP,BCT,DEN,NUM,NA,NO,YES
 S CD="",TCT=0 K BQTMP
 F  S CD=$O(XX(NN,CD)) Q:CD=""  D
 . S IEN=$O(^BQIPAT(DFN,30,"B",CD,"")) I IEN="" D  Q
 .. S BQTMP("PT",DFN,CD)="NDA",TCT=TCT+1
 S BCT=0
 F  S CD=$O(BQTMP("PT",DFN,CD)) Q:CD=""  I BQTMP("PT",DFN,CD)="NDA" S BCT=BCT+1
 I $D(BQTMP),BCT=TCT D NDA(DFN,MSN) Q
 ;
 S CD="",TCT=0 K BQTMP
 F  S CD=$O(XX(NN,CD)) Q:CD=""  D
 . S IEN=$O(^BQIPAT(DFN,30,"B",CD,""))
 . S NUM=$P(^BQIPAT(DFN,30,IEN,0),U,3)
 . S DEN=$P(^BQIPAT(DFN,30,IEN,0),U,4)
 . S TCT=TCT+1
 . I DEN="",NUM="" S BQTMP("PT",DFN,CD)="N/A"
 . I DEN'="",NUM="" S BQTMP("PT",DFN,CD)="NO"
 . I DEN'="",NUM'="" S BQTMP("PT",DFN,CD)="YES"
 S NA=0,NO=0,YES=0
 F  S CD=$O(BQTMP("PT",DFN,CD)) Q:CD=""  D
 . I BQTMP("PT",DFN,CD)="N/A" S NA=NA+1
 . I BQTMP("PT",DFN,CD)="NO" S NO=NO+1
 . I BQTMP("PT",DFN,CD)="YES" S YES=YES+1
 I NA=TCT D NA(DFN,MSN)
 I NA+NO=TCT D NO(DFN,MSN)
 I NA+YES=TCT D YES(DFN,MSN)
 ;
 K BQTMP
 ;
 Q
 ;
PTV(BQDFN,BCODE) ;EP
 NEW IEN
 I $O(^BQIPAT(BQDFN,30,0))="" Q "NDA"
 S IEN=$O(^BQIPAT(BQDFN,30,"B",BCODE,"")) I IEN="" Q "N/A"
 S NUM=$P(^BQIPAT(BQDFN,30,IEN,0),U,3)
 S DEN=$P(^BQIPAT(BQDFN,30,IEN,0),U,4)
 I DEN="",NUM="" Q "N/A"
 I DEN'="",NUM="" Q "NO"
 I DEN'="",NUM'="" Q "YES"
 Q ""
 ;
YES(DFN,MSN,PROV) ;EP
 I $G(MSN)'="" S ^XTMP("BQI OUTCOME",$J,"PT",DFN,MSN)="YES"
 I $G(PROV)'="" S ^XTMP("BQI OUTCOME",$J,"PRV",PROV,"YES")=$G(^XTMP("BQI OUTCOME",$J,"PRV",PROV,"YES"))+1
 Q
 ;
NO(DFN,MSN,PROV) ;EP
 I $G(MSN)'="" S ^XTMP("BQI OUTCOME",$J,"PT",DFN,MSN)="NO"
 I $G(PROV)'="" S ^XTMP("BQI OUTCOME",$J,"PRV",PROV,"NO")=$G(^XTMP("BQI OUTCOME",$J,"PRV",PROV,"NO"))+1
 Q
 ;
NA(DFN,MSN,PROV) ;EP
 S ^XTMP("BQI OUTCOME",$J,"PT",DFN,MSN)="N/A"
 I $G(PROV)'="" S ^XTMP("BQI OUTCOME",$J,"PRV",PROV,"N/A")=$G(^XTMP("BQI OUTCOME",$J,"PRV",PROV,"N/A"))+1
 Q
 ;
NDA(DFN,MSN,PROV) ;EP
 I $G(MSN)'="" S ^XTMP("BQI OUTCOME",$J,"PT",DFN,MSN)="NDA"
 I $G(PROV)'="" S ^XTMP("BQI OUTCOME",$J,"PRV",PROV,"NDA")=$G(^XTMP("BQI OUTCOME",$J,"PRV",PROV,"NDA"))+1
 Q
 ;
DEC(DFN,MSN,PROV) ;EP - Deceased check
 NEW BQIDOD,FLAG
 S BQIDOD=$$GET1^DIQ(2,DFN_",",.351,"I"),FLAG=0
 I BQIDOD'="" D
 . I $G(MSN)'="" S ^XTMP("BQI OUTCOME",$J,"PT",DFN,MSN)="{D}"
 . S FLAG=1
 . I $G(PROV)'="" S ^XTMP("BQI OUTCOME",$J,"PRV",PROV,"DEC")=$G(^XTMP("BQI OUTCOME",$J,"PRV",PROV,"DEC"))+1
 Q FLAG
 ;
BQM ;
 ;;12^PYR
 ;;01^CYR
 ;;02^CYR
 ;;03^CYR
 ;;04^CYR
 ;;05^CYR
 ;;06^CYR
 ;;07^CYR
 ;;08^CYR
 ;;09^CYR
 ;;10^CYR
 ;;11^CYR