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

BQIGPHLP.m

Go to the documentation of this file.
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