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

BQIMURPT.m

Go to the documentation of this file.
BQIMURPT ;GDIT/HS/ALA-On Demand MU CQ Report ; 07 Nov 2011  10:59 AM
 ;;2.3;ICARE MANAGEMENT SYSTEM;;Apr 18, 2012;Build 59
 ;
 ;
EN(TDATA,PARMS) ;EP -- BQI PROV CQ MEAS REPORT
 NEW UID,II,HDR,LIST,BN,BQ,PDATA,NAME,VALUE,BM,MSN,IND,PRV,BP,BGPPROV
 NEW BGPBEN,BGPRTYPE,BGP0RPTH,BGPMUT,BGPMUYF,BGPBD,BGPED,PERIOD,BQIGREF
 NEW CDATA,CURR,CDEN,CNUM,CEXC,I,PROV,TMFRAME,BEGDT,MLIST,PLIST,DFN,NUM
 NEW BGPTP
 S UID=$S($G(ZTSK):"Z"_ZTSK,1:$J)
 S TDATA=$NA(^TMP("BQIMURPT",UID))
 K @TDATA
 S II=0
 NEW $ESTACK,$ETRAP S $ETRAP="D ERR^BQIMURPT D UNWIND^%ZTER" ; SAC 2006 2.2.3.3.2
 S HDR="T00050PROVIDER^T00030PERIOD^"
 K BGPIND,BQIND,PROV
 I $G(PARMS)="" D
 . S LIST="",BN=""
 . F  S BN=$O(PARMS(BN)) Q:BN=""  S LIST=LIST_PARMS(BN)
 . K PARMS
 . S PARMS=LIST
 . K LIST
 F BQ=1:1:$L(PARMS,$C(28)) D
 . S PDATA=$P(PARMS,$C(28),BQ) I PDATA="" Q
 . S NAME=$P(PDATA,"=",1),VALUE=$P(PDATA,"=",2)
 . I NAME="BEGDT" S @NAME=$$DATE^BQIUL1(VALUE) Q
 . I NAME="TMFRAME" S @NAME=VALUE Q
 . I NAME="MLIST" D  Q
 .. F BM=1:1:$L(VALUE,$C(29)) S ID=$P(VALUE,$C(29),BM) Q:ID=""  D
 ... S MSN=$O(^BGPMUIND(90596.11,"C",ID,"")) I MSN="" Q
 ... S IND=$P(^BGPMUIND(90596.11,MSN,0),U,1)
 ... S BGPIND(IND)="",BQIND(MSN)=""
 ... S HDR=HDR_"T00005"_ID_"^T00005HIDE_"_ID_"^"
 . I NAME="PLIST" D  Q
 .. F BP=1:1:$L(VALUE,$C(29)) S PRV=$P(VALUE,$C(29),BP) Q:PRV=""  S PROV(PRV)=""
 S HDR=$$TKO^BQIUL1(HDR,"^")
 S @TDATA@(II)=HDR_$C(30)
 ; For 90 day timeframe
 S BGPPROV=""
 F  S BGPPROV=$O(PROV(BGPPROV)) Q:BGPPROV=""  D
 . S BGPBEN=3
 . S BGPRTYPE=4,BGP0RPTH="A",BGPMUT="P",BGPMUYF=90595.11
 . S (BGPBD,BGPED,BGPTP,BGPINDT)=""
 . S BGPBD=$$DATE^BQIUL1(BEGDT),BGPED=$$FMADD^XLFDT(BGPBD,90)
 . S PERIOD=$$FMTE^BQIUL1(BGPBD)_" - "_$$FMTE^BQIUL1(BGPED)
 . ; Previous
 . ;S BGPPED=$$FMADD^XLFDT(BGPBD,-1),BGPPBD=$$FMADD^XLFDT(BGPPED,-90)
 . S BGPPBD="",BGPPED=""
 . ; Baseline
 . S BGPBBD=BGPPBD,BGPBED=BGPPED
 . S BQIGREF=$NA(^TMP("BQICQM",$J)) K @BQIGREF
 . ;
 . ; Get measures
 . D BQI^BGPMUEPD(.BQIGREF,BGPPROV)
 . K CDEN,CNUM,CEXC,PDEN,PNUM,PEXC,NUM
 . I '$D(@BQIGREF) D
 .. S CDATA=""
 .. F BM=3:2:($L(HDR,"^")-1) S CDATA=CDATA_"NDA"_U_"No Data Available"_U
 . S DFN=""
 . F  S DFN=$O(@BQIGREF@(BGPPROV,DFN)) Q:DFN=""  D
 .. S I=""
 .. F  S I=$O(@BQIGREF@(BGPPROV,DFN,"C",I)) Q:I=""  D
 ... S CDEN(I)=$G(CDEN(I))+$P($G(@BQIGREF@(BGPPROV,DFN,"C",I)),U,1)
 ... S NUM=$P($G(@BQIGREF@(BGPPROV,DFN,"C",I)),U,2)
 ... I NUM>1,$$FMTE^BQIUL1(NUM)'?.N S NUM=1
 ... S CNUM(I)=$G(CNUM(I))+NUM
 ... S CEXC(I)=$G(CEXC(I))+$P($G(@BQIGREF@(BGPPROV,DFN,"C",I)),U,3)
 ... ;S BQIND(I)=""
 .. S I="",CDATA=""
 .. F  S I=$O(BQIND(I)) Q:I=""  D
 ... S MSN=$P(^BGPMUIND(90596.11,I,0),U,1)
 ... I $G(^BGPMUIND(90595.11,MSN,0))="" Q
 ... I $P(^BGPMUIND(90595.11,MSN,0),U,4)="H" Q
 ... I +$G(CNUM(I))=0 S CURR="0%"_U_"Numerator: "_$G(CNUM(I))_" Denominator: "_$G(CDEN(I))
 ... I +$G(CDEN(I))'=0,+$G(CNUM(I))'=0 S CURR=(CNUM(I)/CDEN(I))*100,CURR=$J(CURR,3,0)_"%",CURR=$$TRIM^BQIUL1(CURR," ")_U_"Numerator: "_$G(CNUM(I))_" Denominator: "_$G(CDEN(I))
 ... I $G(CDEN(I))="",$G(CNUM(I))="",$G(CEXC(I))'="" S CURR="Excluded"_U_$G(CEXC(I))
 ... I $G(CDEN(I))="",$G(CNUM(I))="",$G(CEXC(I))="" S CURR="N/A^Not Applicable"
 ... S CDATA=CDATA_CURR_U
 . S CDATA=$$TKO^BQIUL1(CDATA,"^")
 . S II=II+1,@TDATA@(II)=BGPPROV_$C(28)_$P(^VA(200,BGPPROV,0),U,1)_U_PERIOD_U_CDATA_$C(30)
 ;
DONE ;
 S II=II+1,@TDATA@(II)=$C(31)
 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(TDATA) S II=II+1,@TDATA@(II)=$C(31)
 Q