BQIGPHLP ;PRXM/HC/ALA-Get GPRA Help Text ; 08 Oct 2007 3:58 PM
;;2.1;ICARE MANAGEMENT SYSTEM;;Feb 07, 2011
;
Q
;
GET(DATA,YEAR,MEAS,COL) ;EP -- BQI GET GPRA HELP TEXT
;
;Input
; YEAR - the CRS year
; MEAS - A specific measure. If null, gets all measures
; COL - If the data needs to be put in a different column size
;
NEW UID,II,BKM,GMEAS,BQIH,BQIYR,BQIINDG,BQIMEASG,BQIINDF,BQIMEASF
NEW BQM,BR,DND,NMD,X,TMGLB,ORDER,ORD,SUM,TITLE,N,BQCODE,CAT,CLIN
NEW VER,BQMM,TIT
;
S UID=$S($G(ZTSK):"Z"_ZTSK,1:$J)
S DATA=$NA(^TMP("BQIGPHLP",UID))
K @DATA
;
S II=0
NEW $ESTACK,$ETRAP S $ETRAP="D ERR^BQIGPHLP D UNWIND^%ZTER" ; SAC 2006 2.2.3.3.2
;
S MEAS=$G(MEAS,""),YEAR=$G(YEAR,"")
;
I $G(YEAR)="" D
. I $G(OWNR)'="",$G(PLIEN)'="" D
.. NEW DA,IENS
.. S DA(1)=$S(OWNR=DUZ:DUZ,1:OWNR)
.. S DA=PLIEN,IENS=$$IENS^DILF(.DA)
.. S YEAR=$$GET1^DIQ(90505.01,IENS,3.3,"E")
. S BQIH=$$SPM^BQIGPUTL()
. I $G(YEAR)="" S YEAR=$$GET1^DIQ(90508,BQIH_",",2,"E")
;
S @DATA@(II)="T00004GPRA_YEAR^I00010MEAS_IEN^T00015CODE^T00030CATEGORY^T00030CLIN_GROUP^T01024REPORT_TEXT"_$C(30)
S BQIYR=$$LKP^BQIGPUTL(YEAR)
D GFN^BQIGPUTL(BQIH,BQIYR)
S BQIINDG=$$ROOT^DILFD(BQIINDF,"",1)
S BQIMEASG=$$ROOT^DILFD(BQIMEASF,"",1)
S VER=$$VERSION^XPDUTL("BGP")
;
I MEAS'="" D GETDATA(MEAS,VER) G DONE
;
; Put help text in indicator order
S TMGLB=$NA(^TMP("BQIGPORD",UID))
K @TMGLB
;
I VER<8.0 D
. S BQM=0
. F S BQM=$O(^BQI(90508,BQIH,20,BQIYR,20,BQM)) Q:'BQM D
.. S MEAS=$P(^BQI(90508,BQIH,20,BQIYR,20,BQM,0),U,1)
.. S GPMEAS=YEAR_"_"_MEAS
.. S BQMM=$O(^BQI(90506.1,"B",GPMEAS,""))
.. S TITLE=$P(^BQI(90506.1,BQMM,0),U,3)
.. I $P(^BQI(90506.1,BQMM,0),U,10)=1 Q
.. D SM
;
I VER>7.0 D
. S BQM=""
. F S BQM=$O(^BQI(90506.1,"AC","G",BQM)) Q:BQM="" D
.. S BQCODE=$P(^BQI(90506.1,BQM,0),U,1),TITLE=$P(^(0),U,3)
.. I $P(^BQI(90506.1,BQM,0),U,10)=1 Q
.. S MEAS=$P(BQCODE,"_",2)
.. D SM
;
S SUM=""
F S SUM=$O(@TMGLB@(SUM)) Q:SUM="" D
. S TIT=""
. F S TIT=$O(@TMGLB@(SUM,TIT)) Q:TIT="" D
.. S ORD=""
.. F S ORD=$O(@TMGLB@(SUM,TIT,ORD)) Q:ORD="" D
... S MEAS=@TMGLB@(SUM,TIT,ORD)
.. D GETDATA(MEAS,VER)
;
DONE ;
S II=II+1,@DATA@(II)=$C(31)
Q
;
SM ;
I VER<8.0 D
. S ORDER=$$GET1^DIQ(BQIMEASF,MEAS_",",1406,"E"),SUM="NA"
. I ORDER="" S ORDER=$$GET1^DIQ(BQIMEASF,MEAS_",",1506,"E"),SUM="NN"
. S @TMGLB@(SUM,ORDER,MEAS)=MEAS
;
I VER>7.0 D
. S SUM=$$GET1^DIQ(BQIMEASF,MEAS_",",1706,"I")
. I SUM="" Q
. S ORDER=TITLE
. S @TMGLB@(SUM,ORDER,MEAS)=MEAS
Q
;
ERR ;
D ^%ZTER
NEW Y,ERRDTM
S Y=$$NOW^XLFDT() X ^DD("DD") S ERRDTM=Y
S BMXSEC="Recording that an error occurred at "_ERRDTM
I $D(II),$D(DATA) S II=II+1,@DATA@(II)=$C(31)
Q
;
GETDATA(GMEAS,VER) ;EP - Get GPRA measure
;
I VER<8.0 D
. S BQM=$O(^BQI(90508,BQIH,20,BQIYR,20,"B",GMEAS,""))
. S BQCODE=YEAR_"_"_GMEAS
. S GMEAS=$O(^BQI(90506.1,"B",BQCODE,""))
. ;S CAT=$$GET1^DIQ(90506.1,GMEAS_",",2.02,"E")
. S CAT=$$GET1^DIQ(90506.1,GMEAS_",",3.03,"E")
. S CLIN=$$GET1^DIQ(90506.1,GMEAS_",",3.02,"E")
. ;S CLIN=$$GET1^DIQ(90506.1,GMEAS_",",2.06,"E")
. ;
. S N=0
. I $O(^BQI(90508,BQIH,20,BQIYR,20,BQM,1,N))="" S TITLE="No tooltip available"
. I $O(^BQI(90508,BQIH,20,BQIYR,20,BQM,1,N))'="" S TITLE="" D
.. F S N=$O(^BQI(90508,BQIH,20,BQIYR,20,BQM,1,N)) Q:'N D
... S TITLE=TITLE_^BQI(90508,BQIH,20,BQIYR,20,BQM,1,N,0)_$C(10)
;
I VER>7.0 D
. S BQCODE=YEAR_"_"_GMEAS
. S GMEAS=$O(^BQI(90506.1,"B",BQCODE,""))
. S MEAS=$P(BQCODE,"_",2)
. ;S CAT=$$GET1^DIQ(90506.1,GMEAS_",",2.02,"E")
. ;S CLIN=$$GET1^DIQ(90506.1,GMEAS_",",2.06,"E")
. S CAT=$$GET1^DIQ(90506.1,GMEAS_",",3.03,"E")
. S CLIN=$$GET1^DIQ(90506.1,GMEAS_",",3.02,"E")
. S TPI=0,TITLE=""
. F S TPI=$O(@BQIMEASG@(MEAS,18,TPI)) Q:'TPI D
.. S TITLE=TITLE_@BQIMEASG@(MEAS,18,TPI,0)_$C(10)
;
S II=II+1,@DATA@(II)=YEAR_"^"_GMEAS_"^"_BQCODE_"^"_CAT_"^"_CLIN_"^"_TITLE_$C(30)
Q
;
GLOS(DATA,YEAR,MEAS,COL) ;EP -- BQI GET GPRA GLOSSARY
;
;Input
; YEAR - the CRS year
; MEAS - A specific measure. If null, gets all measures
; COL - If the data needs to be put in a different column size
;
NEW UID,II,BKM,GMEAS,BQIH,BQIYR,BQIINDG,BQIMEASG,BQIINDF,BQIMEASF
NEW BQM,BR,DND,NMD,X,TMGLB,ORDER,ORD,SUM,TITLE,N,CAT,CLIN,TIT
;
S UID=$S($G(ZTSK):"Z"_ZTSK,1:$J)
S DATA=$NA(^TMP("BQIGPHLP",UID))
K @DATA
;
S II=0
NEW $ESTACK,$ETRAP S $ETRAP="D ERR^BQIGPHLP D UNWIND^%ZTER" ; SAC 2006 2.2.3.3.2
;
S MEAS=$G(MEAS,""),YEAR=$G(YEAR,"")
;
I $G(YEAR)="" D
. I $G(OWNR)'="",$G(PLIEN)'="" D
.. NEW DA,IENS
.. S DA(1)=$S(OWNR=DUZ:DUZ,1:OWNR)
.. S DA=PLIEN,IENS=$$IENS^DILF(.DA)
.. S YEAR=$$GET1^DIQ(90505.01,IENS,3.3,"E")
. S BQIH=$$SPM^BQIGPUTL()
. I $G(YEAR)="" S YEAR=$$GET1^DIQ(90508,BQIH_",",2,"E")
;
S @DATA@(II)="T00004GPRA_YEAR^I00010MEAS_IEN^T00015CODE^T00030CATEGORY^T00030CLIN_GROUP^T01024REPORT_TEXT"_$C(30)
S BQIYR=$$LKP^BQIGPUTL(YEAR)
D GFN^BQIGPUTL(BQIH,BQIYR)
S BQIINDG=$$ROOT^DILFD(BQIINDF,"")
S BQIMEASG=$$ROOT^DILFD(BQIMEASF,"")
S VER=$$VERSION^XPDUTL("BGP")
;
I MEAS'="" D GETGLS(MEAS,VER) G DDON
;
; Put help text in indicator order
S TMGLB=$NA(^TMP("BQIGPORD",UID))
K @TMGLB
I VER>7.0 D
. S BQM=""
. F S BQM=$O(^BQI(90506.1,"AC","G",BQM)) Q:BQM="" D
.. S BQCODE=$P(^BQI(90506.1,BQM,0),U,1),TITLE=$P(^(0),U,3)
.. I $P(^BQI(90506.1,BQM,0),U,10)=1 Q
.. S MEAS=$P(BQCODE,"_",2)
.. D SSM
;
I VER<8.0 D
. S BQM=0
. F S BQM=$O(^BQI(90508,BQIH,20,BQIYR,20,BQM)) Q:'BQM D
.. S MEAS=$P(^BQI(90508,BQIH,20,BQIYR,20,BQM,0),U,1)
.. S GPMEAS=YEAR_"_"_MEAS
.. S BQMM=$O(^BQI(90506.1,"B",GPMEAS,""))
.. S TITLE=$P(^BQI(90506.1,BQMM,0),U,3)
.. D SSM
;
S SUM=""
F S SUM=$O(@TMGLB@(SUM)) Q:SUM="" D
. S TIT=""
. F S TIT=$O(@TMGLB@(SUM,TIT)) Q:TIT="" D
.. S ORD=""
.. F S ORD=$O(@TMGLB@(SUM,TIT,ORD)) Q:ORD="" D
... S MEAS=@TMGLB@(SUM,TIT,ORD)
.. D GETGLS(MEAS,VER)
;
DDON ;
S II=II+1,@DATA@(II)=$C(31)
Q
;
SSM ;
I VER<8.0 D
. S ORDER=$$GET1^DIQ(BQIMEASF,MEAS_",",1406,"E"),SUM="NA"
. I ORDER="" S ORDER=$$GET1^DIQ(BQIMEASF,MEAS_",",1506,"E"),SUM="NN"
. I ORDER'="" S @TMGLB@(SUM,ORDER,MEAS)=MEAS
;
I VER>7.0 D
. S SUM=$$GET1^DIQ(BQIMEASF,MEAS_",",1706,"I")
. I SUM="" Q
. S ORDER=TITLE
. S @TMGLB@(SUM,ORDER,MEAS)=MEAS
Q
;
GETGLS(GMEAS,VER) ;EP - Get GPRA measure
;
NEW IENS,DA,IND,TITLE,LOGIC,DESC,DEND,NUMD,N,TDATA,CT,BJ,BQCODE,CAT,CLIN
S IND=$$GET1^DIQ(BQIMEASF,GMEAS_",",.01,"I")
S BQCODE=YEAR_"_"_GMEAS
S GMEAS=$O(^BQI(90506.1,"B",BQCODE,""))
;S CAT=$$GET1^DIQ(90506.1,GMEAS_",",2.02,"E")
;S CLIN=$$GET1^DIQ(90506.1,GMEAS_",",2.06,"E")
S CAT=$$GET1^DIQ(90506.1,GMEAS_",",3.03,"E")
S CLIN=$$GET1^DIQ(90506.1,GMEAS_",",3.02,"E")
S DA=IND,IENS=$$IENS^DILF(.DA)
I VER<8.0,$$GET1^DIQ(BQIINDF,IENS,.07,"I")'=1 Q
S TDATA=BQIINDG_IND_")"
;
S TITLE=$$GET1^DIQ(BQIINDF,IENS,.03,"E")
;
S N=0,CT=0 F S N=$O(@TDATA@(11,N)) Q:'N S CT=CT+1,LOGIC(CT)=@TDATA@(11,N,0)
;
S N=0,CT=0 F S N=$O(@TDATA@(51,N)) Q:'N S CT=CT+1,DESC(CT)=@TDATA@(51,N,0)
;
S N=0,DND=""
F S N=$O(@TDATA@(61,N)) Q:'N D
. S BR=0
. F S BR=$O(@TDATA@(61,N,1,BR)) Q:'BR D
.. I @TDATA@(61,N,1,BR,0)["GPRA Denominator:" S DND=DND_N_","
. ;
I DND'="" S CT=0 F BJ=1:1 S N=$P(DND,",",BJ) Q:N="" D
. S BR=0 F S BR=$O(@TDATA@(61,N,1,BR)) Q:'BR S CT=CT+1,DEND(CT)=@TDATA@(61,N,1,BR,0)
;
S N=0,NMD=""
F S N=$O(@TDATA@(62,N)) Q:'N D
. S BR=0
. F S BR=$O(@TDATA@(62,N,1,BR)) Q:'BR D
.. I @TDATA@(62,N,1,BR,0)["GPRA Numerator:" S NMD=NMD_N_","
. ;
I NMD'="" S CT=0 F BJ=1:1 S N=$P(NMD,",",BJ) Q:N="" D
. S BR=0 F S BR=$O(@TDATA@(62,N,1,BR)) Q:'BR S CT=CT+1,NUMD(CT)=@TDATA@(62,N,1,BR,0)
;
S II=II+1,@DATA@(II)=YEAR_"^"_GMEAS_"^"_BQCODE_"^"_CAT_"^"_CLIN_"^"_TITLE_$C(10)
S N=0 F S N=$O(DESC(N)) Q:'N S II=II+1,@DATA@(II)=DESC(N)_$C(10)
S N=0 F S N=$O(DEND(N)) Q:'N S II=II+1,@DATA@(II)=DEND(N)_$C(10)
S N=0 F S N=$O(NUMD(N)) Q:'N S II=II+1,@DATA@(II)=NUMD(N)_$C(10)
S N=0 F S N=$O(LOGIC(N)) Q:'N S II=II+1,@DATA@(II)=LOGIC(N)_$C(10)
S II=II+1,@DATA@(II)=$C(30)
Q
BQIGPHLP ;PRXM/HC/ALA-Get GPRA Help Text ; 08 Oct 2007 3:58 PM
+1 ;;2.1;ICARE MANAGEMENT SYSTEM;;Feb 07, 2011
+2 ;
+3 QUIT
+4 ;
GET(DATA,YEAR,MEAS,COL) ;EP -- BQI GET GPRA HELP TEXT
+1 ;
+2 ;Input
+3 ; YEAR - the CRS year
+4 ; MEAS - A specific measure. If null, gets all measures
+5 ; COL - If the data needs to be put in a different column size
+6 ;
+7 NEW UID,II,BKM,GMEAS,BQIH,BQIYR,BQIINDG,BQIMEASG,BQIINDF,BQIMEASF
+8 NEW BQM,BR,DND,NMD,X,TMGLB,ORDER,ORD,SUM,TITLE,N,BQCODE,CAT,CLIN
+9 NEW VER,BQMM,TIT
+10 ;
+11 SET UID=$SELECT($GET(ZTSK):"Z"_ZTSK,1:$JOB)
+12 SET DATA=$NAME(^TMP("BQIGPHLP",UID))
+13 KILL @DATA
+14 ;
+15 SET II=0
+16 ; SAC 2006 2.2.3.3.2
NEW $ESTACK,$ETRAP
SET $ETRAP="D ERR^BQIGPHLP D UNWIND^%ZTER"
+17 ;
+18 SET MEAS=$GET(MEAS,"")
SET YEAR=$GET(YEAR,"")
+19 ;
+20 IF $GET(YEAR)=""
Begin DoDot:1
+21 IF $GET(OWNR)'=""
IF $GET(PLIEN)'=""
Begin DoDot:2
+22 NEW DA,IENS
+23 SET DA(1)=$SELECT(OWNR=DUZ:DUZ,1:OWNR)
+24 SET DA=PLIEN
SET IENS=$$IENS^DILF(.DA)
+25 SET YEAR=$$GET1^DIQ(90505.01,IENS,3.3,"E")
End DoDot:2
+26 SET BQIH=$$SPM^BQIGPUTL()
+27 IF $GET(YEAR)=""
SET YEAR=$$GET1^DIQ(90508,BQIH_",",2,"E")
End DoDot:1
+28 ;
+29 SET @DATA@(II)="T00004GPRA_YEAR^I00010MEAS_IEN^T00015CODE^T00030CATEGORY^T00030CLIN_GROUP^T01024REPORT_TEXT"_$CHAR(30)
+30 SET BQIYR=$$LKP^BQIGPUTL(YEAR)
+31 DO GFN^BQIGPUTL(BQIH,BQIYR)
+32 SET BQIINDG=$$ROOT^DILFD(BQIINDF,"",1)
+33 SET BQIMEASG=$$ROOT^DILFD(BQIMEASF,"",1)
+34 SET VER=$$VERSION^XPDUTL("BGP")
+35 ;
+36 IF MEAS'=""
DO GETDATA(MEAS,VER)
GOTO DONE
+37 ;
+38 ; Put help text in indicator order
+39 SET TMGLB=$NAME(^TMP("BQIGPORD",UID))
+40 KILL @TMGLB
+41 ;
+42 IF VER<8.0
Begin DoDot:1
+43 SET BQM=0
+44 FOR
SET BQM=$ORDER(^BQI(90508,BQIH,20,BQIYR,20,BQM))
IF 'BQM
QUIT
Begin DoDot:2
+45 SET MEAS=$PIECE(^BQI(90508,BQIH,20,BQIYR,20,BQM,0),U,1)
+46 SET GPMEAS=YEAR_"_"_MEAS
+47 SET BQMM=$ORDER(^BQI(90506.1,"B",GPMEAS,""))
+48 SET TITLE=$PIECE(^BQI(90506.1,BQMM,0),U,3)
+49 IF $PIECE(^BQI(90506.1,BQMM,0),U,10)=1
QUIT
+50 DO SM
End DoDot:2
End DoDot:1
+51 ;
+52 IF VER>7.0
Begin DoDot:1
+53 SET BQM=""
+54 FOR
SET BQM=$ORDER(^BQI(90506.1,"AC","G",BQM))
IF BQM=""
QUIT
Begin DoDot:2
+55 SET BQCODE=$PIECE(^BQI(90506.1,BQM,0),U,1)
SET TITLE=$PIECE(^(0),U,3)
+56 IF $PIECE(^BQI(90506.1,BQM,0),U,10)=1
QUIT
+57 SET MEAS=$PIECE(BQCODE,"_",2)
+58 DO SM
End DoDot:2
End DoDot:1
+59 ;
+60 SET SUM=""
+61 FOR
SET SUM=$ORDER(@TMGLB@(SUM))
IF SUM=""
QUIT
Begin DoDot:1
+62 SET TIT=""
+63 FOR
SET TIT=$ORDER(@TMGLB@(SUM,TIT))
IF TIT=""
QUIT
Begin DoDot:2
+64 SET ORD=""
+65 FOR
SET ORD=$ORDER(@TMGLB@(SUM,TIT,ORD))
IF ORD=""
QUIT
Begin DoDot:3
+66 SET MEAS=@TMGLB@(SUM,TIT,ORD)
End DoDot:3
+67 DO GETDATA(MEAS,VER)
End DoDot:2
End DoDot:1
+68 ;
DONE ;
+1 SET II=II+1
SET @DATA@(II)=$CHAR(31)
+2 QUIT
+3 ;
SM ;
+1 IF VER<8.0
Begin DoDot:1
+2 SET ORDER=$$GET1^DIQ(BQIMEASF,MEAS_",",1406,"E")
SET SUM="NA"
+3 IF ORDER=""
SET ORDER=$$GET1^DIQ(BQIMEASF,MEAS_",",1506,"E")
SET SUM="NN"
+4 SET @TMGLB@(SUM,ORDER,MEAS)=MEAS
End DoDot:1
+5 ;
+6 IF VER>7.0
Begin DoDot:1
+7 SET SUM=$$GET1^DIQ(BQIMEASF,MEAS_",",1706,"I")
+8 IF SUM=""
QUIT
+9 SET ORDER=TITLE
+10 SET @TMGLB@(SUM,ORDER,MEAS)=MEAS
End DoDot:1
+11 QUIT
+12 ;
ERR ;
+1 DO ^%ZTER
+2 NEW Y,ERRDTM
+3 SET Y=$$NOW^XLFDT()
XECUTE ^DD("DD")
SET ERRDTM=Y
+4 SET BMXSEC="Recording that an error occurred at "_ERRDTM
+5 IF $DATA(II)
IF $DATA(DATA)
SET II=II+1
SET @DATA@(II)=$CHAR(31)
+6 QUIT
+7 ;
GETDATA(GMEAS,VER) ;EP - Get GPRA measure
+1 ;
+2 IF VER<8.0
Begin DoDot:1
+3 SET BQM=$ORDER(^BQI(90508,BQIH,20,BQIYR,20,"B",GMEAS,""))
+4 SET BQCODE=YEAR_"_"_GMEAS
+5 SET GMEAS=$ORDER(^BQI(90506.1,"B",BQCODE,""))
+6 ;S CAT=$$GET1^DIQ(90506.1,GMEAS_",",2.02,"E")
+7 SET CAT=$$GET1^DIQ(90506.1,GMEAS_",",3.03,"E")
+8 SET CLIN=$$GET1^DIQ(90506.1,GMEAS_",",3.02,"E")
+9 ;S CLIN=$$GET1^DIQ(90506.1,GMEAS_",",2.06,"E")
+10 ;
+11 SET N=0
+12 IF $ORDER(^BQI(90508,BQIH,20,BQIYR,20,BQM,1,N))=""
SET TITLE="No tooltip available"
+13 IF $ORDER(^BQI(90508,BQIH,20,BQIYR,20,BQM,1,N))'=""
SET TITLE=""
Begin DoDot:2
+14 FOR
SET N=$ORDER(^BQI(90508,BQIH,20,BQIYR,20,BQM,1,N))
IF 'N
QUIT
Begin DoDot:3
+15 SET TITLE=TITLE_^BQI(90508,BQIH,20,BQIYR,20,BQM,1,N,0)_$CHAR(10)
End DoDot:3
End DoDot:2
End DoDot:1
+16 ;
+17 IF VER>7.0
Begin DoDot:1
+18 SET BQCODE=YEAR_"_"_GMEAS
+19 SET GMEAS=$ORDER(^BQI(90506.1,"B",BQCODE,""))
+20 SET MEAS=$PIECE(BQCODE,"_",2)
+21 ;S CAT=$$GET1^DIQ(90506.1,GMEAS_",",2.02,"E")
+22 ;S CLIN=$$GET1^DIQ(90506.1,GMEAS_",",2.06,"E")
+23 SET CAT=$$GET1^DIQ(90506.1,GMEAS_",",3.03,"E")
+24 SET CLIN=$$GET1^DIQ(90506.1,GMEAS_",",3.02,"E")
+25 SET TPI=0
SET TITLE=""
+26 FOR
SET TPI=$ORDER(@BQIMEASG@(MEAS,18,TPI))
IF 'TPI
QUIT
Begin DoDot:2
+27 SET TITLE=TITLE_@BQIMEASG@(MEAS,18,TPI,0)_$CHAR(10)
End DoDot:2
End DoDot:1
+28 ;
+29 SET II=II+1
SET @DATA@(II)=YEAR_"^"_GMEAS_"^"_BQCODE_"^"_CAT_"^"_CLIN_"^"_TITLE_$CHAR(30)
+30 QUIT
+31 ;
GLOS(DATA,YEAR,MEAS,COL) ;EP -- BQI GET GPRA GLOSSARY
+1 ;
+2 ;Input
+3 ; YEAR - the CRS year
+4 ; MEAS - A specific measure. If null, gets all measures
+5 ; COL - If the data needs to be put in a different column size
+6 ;
+7 NEW UID,II,BKM,GMEAS,BQIH,BQIYR,BQIINDG,BQIMEASG,BQIINDF,BQIMEASF
+8 NEW BQM,BR,DND,NMD,X,TMGLB,ORDER,ORD,SUM,TITLE,N,CAT,CLIN,TIT
+9 ;
+10 SET UID=$SELECT($GET(ZTSK):"Z"_ZTSK,1:$JOB)
+11 SET DATA=$NAME(^TMP("BQIGPHLP",UID))
+12 KILL @DATA
+13 ;
+14 SET II=0
+15 ; SAC 2006 2.2.3.3.2
NEW $ESTACK,$ETRAP
SET $ETRAP="D ERR^BQIGPHLP D UNWIND^%ZTER"
+16 ;
+17 SET MEAS=$GET(MEAS,"")
SET YEAR=$GET(YEAR,"")
+18 ;
+19 IF $GET(YEAR)=""
Begin DoDot:1
+20 IF $GET(OWNR)'=""
IF $GET(PLIEN)'=""
Begin DoDot:2
+21 NEW DA,IENS
+22 SET DA(1)=$SELECT(OWNR=DUZ:DUZ,1:OWNR)
+23 SET DA=PLIEN
SET IENS=$$IENS^DILF(.DA)
+24 SET YEAR=$$GET1^DIQ(90505.01,IENS,3.3,"E")
End DoDot:2
+25 SET BQIH=$$SPM^BQIGPUTL()
+26 IF $GET(YEAR)=""
SET YEAR=$$GET1^DIQ(90508,BQIH_",",2,"E")
End DoDot:1
+27 ;
+28 SET @DATA@(II)="T00004GPRA_YEAR^I00010MEAS_IEN^T00015CODE^T00030CATEGORY^T00030CLIN_GROUP^T01024REPORT_TEXT"_$CHAR(30)
+29 SET BQIYR=$$LKP^BQIGPUTL(YEAR)
+30 DO GFN^BQIGPUTL(BQIH,BQIYR)
+31 SET BQIINDG=$$ROOT^DILFD(BQIINDF,"")
+32 SET BQIMEASG=$$ROOT^DILFD(BQIMEASF,"")
+33 SET VER=$$VERSION^XPDUTL("BGP")
+34 ;
+35 IF MEAS'=""
DO GETGLS(MEAS,VER)
GOTO DDON
+36 ;
+37 ; Put help text in indicator order
+38 SET TMGLB=$NAME(^TMP("BQIGPORD",UID))
+39 KILL @TMGLB
+40 IF VER>7.0
Begin DoDot:1
+41 SET BQM=""
+42 FOR
SET BQM=$ORDER(^BQI(90506.1,"AC","G",BQM))
IF BQM=""
QUIT
Begin DoDot:2
+43 SET BQCODE=$PIECE(^BQI(90506.1,BQM,0),U,1)
SET TITLE=$PIECE(^(0),U,3)
+44 IF $PIECE(^BQI(90506.1,BQM,0),U,10)=1
QUIT
+45 SET MEAS=$PIECE(BQCODE,"_",2)
+46 DO SSM
End DoDot:2
End DoDot:1
+47 ;
+48 IF VER<8.0
Begin DoDot:1
+49 SET BQM=0
+50 FOR
SET BQM=$ORDER(^BQI(90508,BQIH,20,BQIYR,20,BQM))
IF 'BQM
QUIT
Begin DoDot:2
+51 SET MEAS=$PIECE(^BQI(90508,BQIH,20,BQIYR,20,BQM,0),U,1)
+52 SET GPMEAS=YEAR_"_"_MEAS
+53 SET BQMM=$ORDER(^BQI(90506.1,"B",GPMEAS,""))
+54 SET TITLE=$PIECE(^BQI(90506.1,BQMM,0),U,3)
+55 DO SSM
End DoDot:2
End DoDot:1
+56 ;
+57 SET SUM=""
+58 FOR
SET SUM=$ORDER(@TMGLB@(SUM))
IF SUM=""
QUIT
Begin DoDot:1
+59 SET TIT=""
+60 FOR
SET TIT=$ORDER(@TMGLB@(SUM,TIT))
IF TIT=""
QUIT
Begin DoDot:2
+61 SET ORD=""
+62 FOR
SET ORD=$ORDER(@TMGLB@(SUM,TIT,ORD))
IF ORD=""
QUIT
Begin DoDot:3
+63 SET MEAS=@TMGLB@(SUM,TIT,ORD)
End DoDot:3
+64 DO GETGLS(MEAS,VER)
End DoDot:2
End DoDot:1
+65 ;
DDON ;
+1 SET II=II+1
SET @DATA@(II)=$CHAR(31)
+2 QUIT
+3 ;
SSM ;
+1 IF VER<8.0
Begin DoDot:1
+2 SET ORDER=$$GET1^DIQ(BQIMEASF,MEAS_",",1406,"E")
SET SUM="NA"
+3 IF ORDER=""
SET ORDER=$$GET1^DIQ(BQIMEASF,MEAS_",",1506,"E")
SET SUM="NN"
+4 IF ORDER'=""
SET @TMGLB@(SUM,ORDER,MEAS)=MEAS
End DoDot:1
+5 ;
+6 IF VER>7.0
Begin DoDot:1
+7 SET SUM=$$GET1^DIQ(BQIMEASF,MEAS_",",1706,"I")
+8 IF SUM=""
QUIT
+9 SET ORDER=TITLE
+10 SET @TMGLB@(SUM,ORDER,MEAS)=MEAS
End DoDot:1
+11 QUIT
+12 ;
GETGLS(GMEAS,VER) ;EP - Get GPRA measure
+1 ;
+2 NEW IENS,DA,IND,TITLE,LOGIC,DESC,DEND,NUMD,N,TDATA,CT,BJ,BQCODE,CAT,CLIN
+3 SET IND=$$GET1^DIQ(BQIMEASF,GMEAS_",",.01,"I")
+4 SET BQCODE=YEAR_"_"_GMEAS
+5 SET GMEAS=$ORDER(^BQI(90506.1,"B",BQCODE,""))
+6 ;S CAT=$$GET1^DIQ(90506.1,GMEAS_",",2.02,"E")
+7 ;S CLIN=$$GET1^DIQ(90506.1,GMEAS_",",2.06,"E")
+8 SET CAT=$$GET1^DIQ(90506.1,GMEAS_",",3.03,"E")
+9 SET CLIN=$$GET1^DIQ(90506.1,GMEAS_",",3.02,"E")
+10 SET DA=IND
SET IENS=$$IENS^DILF(.DA)
+11 IF VER<8.0
IF $$GET1^DIQ(BQIINDF,IENS,.07,"I")'=1
QUIT
+12 SET TDATA=BQIINDG_IND_")"
+13 ;
+14 SET TITLE=$$GET1^DIQ(BQIINDF,IENS,.03,"E")
+15 ;
+16 SET N=0
SET CT=0
FOR
SET N=$ORDER(@TDATA@(11,N))
IF 'N
QUIT
SET CT=CT+1
SET LOGIC(CT)=@TDATA@(11,N,0)
+17 ;
+18 SET N=0
SET CT=0
FOR
SET N=$ORDER(@TDATA@(51,N))
IF 'N
QUIT
SET CT=CT+1
SET DESC(CT)=@TDATA@(51,N,0)
+19 ;
+20 SET N=0
SET DND=""
+21 FOR
SET N=$ORDER(@TDATA@(61,N))
IF 'N
QUIT
Begin DoDot:1
+22 SET BR=0
+23 FOR
SET BR=$ORDER(@TDATA@(61,N,1,BR))
IF 'BR
QUIT
Begin DoDot:2
+24 IF @TDATA@(61,N,1,BR,0)["GPRA Denominator:"
SET DND=DND_N_","
End DoDot:2
+25 ;
End DoDot:1
+26 IF DND'=""
SET CT=0
FOR BJ=1:1
SET N=$PIECE(DND,",",BJ)
IF N=""
QUIT
Begin DoDot:1
+27 SET BR=0
FOR
SET BR=$ORDER(@TDATA@(61,N,1,BR))
IF 'BR
QUIT
SET CT=CT+1
SET DEND(CT)=@TDATA@(61,N,1,BR,0)
End DoDot:1
+28 ;
+29 SET N=0
SET NMD=""
+30 FOR
SET N=$ORDER(@TDATA@(62,N))
IF 'N
QUIT
Begin DoDot:1
+31 SET BR=0
+32 FOR
SET BR=$ORDER(@TDATA@(62,N,1,BR))
IF 'BR
QUIT
Begin DoDot:2
+33 IF @TDATA@(62,N,1,BR,0)["GPRA Numerator:"
SET NMD=NMD_N_","
End DoDot:2
+34 ;
End DoDot:1
+35 IF NMD'=""
SET CT=0
FOR BJ=1:1
SET N=$PIECE(NMD,",",BJ)
IF N=""
QUIT
Begin DoDot:1
+36 SET BR=0
FOR
SET BR=$ORDER(@TDATA@(62,N,1,BR))
IF 'BR
QUIT
SET CT=CT+1
SET NUMD(CT)=@TDATA@(62,N,1,BR,0)
End DoDot:1
+37 ;
+38 SET II=II+1
SET @DATA@(II)=YEAR_"^"_GMEAS_"^"_BQCODE_"^"_CAT_"^"_CLIN_"^"_TITLE_$CHAR(10)
+39 SET N=0
FOR
SET N=$ORDER(DESC(N))
IF 'N
QUIT
SET II=II+1
SET @DATA@(II)=DESC(N)_$CHAR(10)
+40 SET N=0
FOR
SET N=$ORDER(DEND(N))
IF 'N
QUIT
SET II=II+1
SET @DATA@(II)=DEND(N)_$CHAR(10)
+41 SET N=0
FOR
SET N=$ORDER(NUMD(N))
IF 'N
QUIT
SET II=II+1
SET @DATA@(II)=NUMD(N)_$CHAR(10)
+42 SET N=0
FOR
SET N=$ORDER(LOGIC(N))
IF 'N
QUIT
SET II=II+1
SET @DATA@(II)=LOGIC(N)_$CHAR(10)
+43 SET II=II+1
SET @DATA@(II)=$CHAR(30)
+44 QUIT