ABMM2PH1 ;IHS/SD/SDR - MU Patient Volume Hospital Report ;
;;2.6;IHS 3P BILLING SYSTEM;**11,12,15**;NOV 12, 2009;Build 251
;IHS/SD/SDR - 2.6*12 - Included numerator and msgs about numerator and denominator.
;IHS/SD/SDR - 2.6*15 - HEAT161159 - Changed PT LST to sort differently so there won't be duplicate vsts on pt lst.
;IHS/SD/SDR - 2.6*15 - HEAT164125 - Added Medicaid State to patient list output
;IHS/SD/SDR - 2.6*15 - HEAT188548 - Format visit date to 4 digits
;
MET ;EP
W !!,"Patient Volume: ",+$P($G(^XTMP("ABM-PVH2",$J,"LOC TOP",ABMVLOC)),U)_"%"
;
S ABMLOC=$$GET1^DIQ(9999999.06,ABMVLOC,.02,"E")
;W !!,"Total Patient Encounters "_ABMLOC_": ",?70,$J(+$G(^XTMP("ABM-PVH2",$J,"LOC-DENOM",ABMSDT,ABMVLOC)),8) ;abm*2.6*12
W !!,"Total Patient Encounters (Denominator) "_ABMLOC_": ",?70,$J(+$G(^XTMP("ABM-PVH2",$J,"LOC-DENOM",ABMSDT,ABMVLOC)),8) ;abm*2.6*12
W !,"Total Numerator Encounters "_ABMLOC_": ",?70,$J(+$G(^XTMP("ABM-PVH2",$J,"LOC-NUM",ABMSDT,ABMVLOC)),8) ;abm*2.6*12
W !,"Total Medicaid Paid Encounters "_ABMLOC_": ",?70,$J(+$G(^XTMP("ABM-PVH2",$J,"LOC-NUM PD",ABMSDT,ABMVLOC,"MCD")),8)
W !,"Total Medicaid Zero Paid Encounters "_ABMLOC_": ",?70,$J(+$G(^XTMP("ABM-PVH2",$J,"LOC-NUM ZEROPD",ABMSDT,ABMVLOC,"MCD")),8)
W !,"Total Medicaid Enrolled (Not Billed) Encounters "_ABMLOC_": ",?70,$J(+$G(^XTMP("ABM-PVH2",$J,"LOC-NUM ENR",ABMSDT,ABMVLOC,"MCD")),8) ;abm*2.6*12
W !,"Total Kidscare/Chip Paid Encounters "_ABMLOC_": ",?70,$J(+$G(^XTMP("ABM-PVH2",$J,"LOC-NUM PD",ABMSDT,ABMVLOC,"CHIP")),8)
W !,"Total Kidscare/Chip Zero Paid Encounters "_ABMLOC_": ",?70,$J(+$G(^XTMP("ABM-PVH2",$J,"LOC-NUM ZEROPD",ABMSDT,ABMVLOC,"CHIP")),8)
;W !,"Total Kidscare/Chip Enrolled Encounters "_ABMLOC_": ",?70,$J(+$G(^XTMP("ABM-PVH2",$J,"LOC-NUM ENR",ABMSDT,ABMVLOC,"CHIP")),8) ;abm*2.6*12
W !,"Total Kidscare/Chip Enrolled (Not Billed) Encounters "_ABMLOC_": ",?70,$J(+$G(^XTMP("ABM-PVH2",$J,"LOC-NUM ENR",ABMSDT,ABMVLOC,"CHIP")),8) ;abm*2.6*12
;W !,"Total Other Encounters "_ABMLOC_": ",?70,$J(+$G(^XTMP("ABM-PVH2",$J,"LOC ENC CNT",ABMSDT,ABMVLOC,"OTHR")),8) ;abm*2.6*12
W !,"Total Other Encounters "_ABMLOC_" (*not included in numerator): ",?70,$J(+$G(^XTMP("ABM-PVH2",$J,"LOC ENC CNT",ABMSDT,ABMVLOC,"OTHR")),8) ;abm*2.6*12
Q
NOTMET ;EP
W !!,"The Patient Volume Threshold (10% for Hospitals) was not met for the"
W !,$S(("^A^B^C^"[("^"_ABMY("90")_"^")):"MU Qualification year",1:"timeframe entered")_". Details for the volumes that were achieved are"
W !,"provided for your information."
W !!,"Highest Patient Volume Met: ",+$P($G(^XTMP("ABM-PVH2",$J,"LOC TOP",ABMVLOC)),U)
W !,"First Day Highest Patient Volume Achieved: ",$$SDT^ABMDUTL(ABMSDT)
S ABMTHPV=0
S:ABMSDT ABMTHPV=+$G(^XTMP("ABM-PVH2",$J,"LOC-DENOM",ABMSDT,ABMVLOC))
S ABMMHPV=0
S:ABMSDT ABMMHPV=+$G(^XTMP("ABM-PVH2",$J,"LOC-NUM",ABMSDT,ABMVLOC))
W !!,"Total Patient Encounters of First Highest Patient Volume Period: ",ABMTHPV
W !,"Total Hospital"_$S(+$G(ABMER)=1:"/ER",1:"")_" Encounters of First Highest Patient Volume Period: ",ABMMHPV
S ABMCNT=0
K ABMLN
;
I +$G(ABMY("TVDTS"))'=0 D
.S ABMCNT=0
.S ABMDT=0
.F S ABMDT=$O(^XTMP("ABM-PVH2",$J,"LOC PERCENT",ABMDT)) Q:'ABMDT D
..S ABMCNT=ABMCNT+1
..S ABMPRC($G(^XTMP("ABM-PVH2",$J,"LOC PERCENT",ABMDT,ABMVLOC)),ABMCNT)=ABMDT
..S ABMP=""
..S ABMSAV=ABMCNT-ABMY("TVDTS")
..F S ABMP=$O(ABMPRC(ABMP)) Q:ABMP="" D
...S ABMCNT=0,ABMC=0
...F S ABMCNT=$O(ABMPRC(ABMP,ABMCNT)) Q:'ABMCNT D Q:(ABMC=ABMSAV)
....K ^XTMP("ABM-PVH2",$J,"LOC PERCENT",$G(ABMPRC(ABMP,ABMCNT)))
....S ABMC=ABMC+1
;
D NMHDR
S ABMSDT=0
S ABMDTCNT=0
F S ABMSDT=$O(^XTMP("ABM-PVH2",$J,"LOC-DENOM",ABMSDT)) Q:'ABMSDT D Q:(IOST["C")&((+$G(Y)=0)!($D(DIRUT)!$D(DIROUT)!$D(DTOUT)!$D(DUOUT)))
.I ABMY("90")'="A"&(ABMY("SDT")'=ABMSDT) Q ;only calculate whole year for automated
.I $Y+5>IOSL D HD^ABMM2PV3,NMHDR Q:(IOST["C")&((+$G(Y)=0)!($D(DIRUT)!$D(DIROUT)!$D(DTOUT)!$D(DUOUT)))
.S ABMDTCNT=+$G(ABMDTCNT)+1
.I +$G(ABMP("EDT"))=0 D
..S X1=ABMSDT
..S X2=89
..D C^%DTC
..S ABMEDT=X
.I +$G(ABMP("EDT"))'=0 S ABMEDT=ABMP("EDT")
.I (+$G(ABMEDT)>((ABMY("QYR")-1700)_"0930")) Q
.S ABMPD=$TR($P($$MDT^ABMDUTL(ABMSDT),"-",1,2),"-"," ")_"-"_$TR($P($$MDT^ABMDUTL(ABMEDT),"-",1,2),"-"," ") ;report period
.S ABMRT=$J(+$G(^XTMP("ABM-PVH2",$J,"LOC PERCENT",ABMSDT,ABMVLOC)),5)_"%" ;rate
.S ABMDEN=$J(+$G(^XTMP("ABM-PVH2",$J,"LOC-DENOM",ABMSDT,ABMVLOC)),6) ;denominator
.S ABMNUM=$J(+$G(^XTMP("ABM-PVH2",$J,"LOC-NUM",ABMSDT,ABMVLOC)),6) ;numerator
.S ABMMCDPD=$J(+$G(^XTMP("ABM-PVH2",$J,"LOC-NUM PD",ABMSDT,ABMVLOC,"MCD")),6)
.S ABMSCHPD=$J(+$G(^XTMP("ABM-PVH2",$J,"LOC-NUM PD",ABMSDT,ABMVLOC,"CHIP")),6)
.S ABMMCDZP=$J(+$G(^XTMP("ABM-PVH2",$J,"LOC-NUM ZEROPD",ABMSDT,ABMVLOC,"MCD")),6)
.S ABMMCDEN=$J(+$G(^XTMP("ABM-PVH2",$J,"LOC-NUM ENR",ABMSDT,ABMVLOC,"MCD")),6)
.S ABMSCHZP=$J(+$G(^XTMP("ABM-PVH2",$J,"LOC-NUM ZEROPD",ABMSDT,ABMVLOC,"CHIP")),6)
.S ABMSCHEN=$J(+$G(^XTMP("ABM-PVH2",$J,"LOC-NUM ENR",ABMSDT,ABMVLOC,"CHIP")),6)
.W !,ABMPD,?15,ABMRT,?20,ABMDEN,?28,ABMNUM,?35,ABMMCDPD,?41,ABMMCDZP,?50,ABMMCDEN,?57,ABMSCHPD,?63,ABMSCHZP,?73,ABMSCHEN
I ABMDTCNT=0 D
.W !!, "<< NO DATA FOUND FOR SELECTION >>"
Q
NMHDR ;EP
W !
F ABM=1:1:80 W "="
W !,"HOSPITAL"_$S($G(ABMER)=1:"/ER",1:"")_" PATIENT VOLUME - QUALIFICATION YEAR ",ABMY("QYR")
W !,"Report Period",?15,"Rate",?21,"Denom-",?30,"Numer-",?38,"Mcd",?44,"Mcd",?52,"Mcd",?58,"Schip",?64,"Schip",?73,"Schip"
W !?21,"inator",?30,"ator",?37,"Paid",?42,"ZeroPd",?49,"Enrolled",?59,"Paid",?64,"ZeroPd",?71,"Enrolled"
W !
F ABM=1:1:80 W "="
Q
PATIENT ;EP
S ABM("PG")=1
D HDR^ABMM2PV3
D PTHDR
;start old abm*2.6*15 HEAT161159
;S ABMITYP=""
;F S ABMITYP=$O(^XTMP("ABM-PVH2",$J,"PT LST",ABMSDT,ABMVLOC,ABMITYP)) Q:ABMITYP="" D Q:(IOST["C")&((+$G(Y)=0)!($D(DIRUT)!$D(DIROUT)!$D(DTOUT)!$D(DUOUT)))
;.S ABMINS=""
;.F S ABMINS=$O(^XTMP("ABM-PVH2",$J,"PT LST",ABMSDT,ABMVLOC,ABMITYP,ABMINS)) Q:ABMINS="" D Q:(IOST["C")&((+$G(Y)=0)!($D(DIRUT)!$D(DIROUT)!$D(DTOUT)!$D(DUOUT)))
;..S ABMPTL=""
;..F S ABMPTL=$O(^XTMP("ABM-PVH2",$J,"PT LST",ABMSDT,ABMVLOC,ABMITYP,ABMINS,ABMPTL)) Q:ABMPTL="" D Q:(IOST["C")&((+$G(Y)=0)!($D(DIRUT)!$D(DIROUT)!$D(DTOUT)!$D(DUOUT)))
;...S ABMPTF=""
;...F S ABMPTF=$O(^XTMP("ABM-PVH2",$J,"PT LST",ABMSDT,ABMVLOC,ABMITYP,ABMINS,ABMPTL,ABMPTF)) Q:ABMPTF="" D Q:(IOST["C")&((+$G(Y)=0)!($D(DIRUT)!$D(DIROUT)!$D(DTOUT)!$D(DUOUT)))
;....S ABMVDT=0
;....F S ABMVDT=$O(^XTMP("ABM-PVH2",$J,"PT LST",ABMSDT,ABMVLOC,ABMITYP,ABMINS,ABMPTL,ABMPTF,ABMVDT)) Q:'ABMVDT D Q:(IOST["C")&((+$G(Y)=0)!($D(DIRUT)!$D(DIROUT)!$D(DTOUT)!$D(DUOUT)))
;.....S ABMVDFN=0
;.....F S ABMVDFN=$O(^XTMP("ABM-PVH2",$J,"PT LST",ABMSDT,ABMVLOC,ABMITYP,ABMINS,ABMPTL,ABMPTF,ABMVDT,ABMVDFN)) Q:'ABMVDFN D
;......S ABMPT=$P($G(^XTMP("ABM-PVH2",$J,"PT LST",ABMSDT,ABMVLOC,ABMITYP,ABMINS,ABMPTL,ABMPTF,ABMVDT,ABMVDFN)),U,2)
;......S ABMTRIEN=$P($G(^XTMP("ABM-PVH2",$J,"PT LST",ABMSDT,ABMVLOC,ABMITYP,ABMINS,ABMPTL,ABMPTF,ABMVDT,ABMVDFN)),U,3)
;......S IENS=ABMVLOC_","_ABMPT_","
;......S ABMHRN=$$GET1^DIQ(9000001.41,IENS,.02)
;......W !,$E(ABMPTL_", "_ABMPTF,1,16) ;pt name
;......W ?18,ABMHRN ;HRN
;......W ?25,$E($$GET1^DIQ(9000010,ABMVDFN,.07,"E"),1,3) ;Category
;......W ?29,$E($$GET1^DIQ(9000010,ABMVDFN,.08,"E"),1,8) ;clinic
;......W ?39,$S(ABMITYP="X":"",1:ABMITYP) ;insurer type
;......W ?42,$S(ABMINS="NO BILL":"",1:$E(ABMINS,1,10)) ;insurer
;......W ?53,$$CDT^ABMDUTL(ABMVDT) ;visit date
;......W ?70,$S(+ABMTRIEN:$$SDTO^ABMDUTL(ABMTRIEN),1:"") ;dt paid
;......I $P($G(^XTMP("ABM-PVH2",$J,"PT LST",ABMSDT,ABMVLOC,ABMITYP,ABMINS,ABMPTL,ABMPTF,ABMVDT,ABMVDFN)),U,4)'="" W ?79,$P(^(ABMVDFN),U,4)
;......I $Y+5>IOSL D HD^ABMM2PV3,PTHDR Q:(IOST["C")&((+$G(Y)=0)!($D(DIRUT)!$D(DIROUT)!$D(DTOUT)!$D(DUOUT)))
;end old start new HEAT161159
S ABMVDT=0
F S ABMVDT=$O(^XTMP("ABM-PVH2",$J,"PT LST",ABMSDT,ABMVLOC,ABMVDT)) Q:'ABMVDT D Q:(IOST["C")&((+$G(Y)=0)!($D(DIRUT)!$D(DIROUT)!$D(DTOUT)!$D(DUOUT)))
.S ABMVDFN=0
.F S ABMVDFN=$O(^XTMP("ABM-PVH2",$J,"PT LST",ABMSDT,ABMVLOC,ABMVDT,ABMVDFN)) Q:'ABMVDFN D
..S ABMPT=$P($G(^XTMP("ABM-PVH2",$J,"PT LST",ABMSDT,ABMVLOC,ABMVDT,ABMVDFN)),U,2)
..S ABMTRIEN=$P($G(^XTMP("ABM-PVH2",$J,"PT LST",ABMSDT,ABMVLOC,ABMVDT,ABMVDFN)),U,3)
..S ABMPTL=$P($G(^XTMP("ABM-PVH2",$J,"PT LST",ABMSDT,ABMVLOC,ABMVDT,ABMVDFN)),U,10)
..S ABMPTF=$P($G(^XTMP("ABM-PVH2",$J,"PT LST",ABMSDT,ABMVLOC,ABMVDT,ABMVDFN)),U,11)
..S ABMITYP=$P($G(^XTMP("ABM-PVH2",$J,"PT LST",ABMSDT,ABMVLOC,ABMVDT,ABMVDFN)),U,8) ;abm*2.6*15
..S ABMINS=$P($G(^XTMP("ABM-PVH2",$J,"PT LST",ABMSDT,ABMVLOC,ABMVDT,ABMVDFN)),U,9) ;abm*2.6*15
..S IENS=ABMVLOC_","_ABMPT_","
..S ABMHRN=$$GET1^DIQ(9000001.41,IENS,.02)
..W !,$E(ABMPTL_", "_ABMPTF,1,16) ;pt name
..W ?18,ABMHRN ;HRN
..W ?25,$E($$GET1^DIQ(9000010,ABMVDFN,.07,"E"),1,3) ;Category
..W ?29,$E($$GET1^DIQ(9000010,ABMVDFN,.08,"E"),1,8) ;clinic
..W ?39,$S(ABMITYP="X":"",1:ABMITYP) ;insurer type
..W ?42,$S(ABMINS="NO BILL":"",1:$E(ABMINS,1,10)) ;insurer
..W ?53,$$CDT^ABMDUTL(ABMVDT) ;visit date
..W ?70,$S(+ABMTRIEN:$$SDTO^ABMDUTL(ABMTRIEN),1:"") ;dt paid
..I $P($G(^XTMP("ABM-PVH2",$J,"PT LST",ABMSDT,ABMVLOC,ABMVDT,ABMVDFN)),U,4)'="" W ?79,$P(^(ABMVDFN),U,4)
..I $Y+5>IOSL D HD^ABMM2PV3,PTHDR Q:(IOST["C")&((+$G(Y)=0)!($D(DIRUT)!$D(DIROUT)!$D(DTOUT)!$D(DUOUT)))
;end new HEAT161159
Q
PTHSTFL ;EP
S ABMSDT=$P($G(^XTMP("ABM-PVH2",$J,"LOC TOP")),U,2)
K ABMDCNT
D OPEN^%ZISH("ABM",ABMPATH,ABMFN,"W")
Q:POP
U IO
S ABM("PG")=1
D HDR^ABMM2PV3
S ABMPMET=0
W !,"Visit Location"_U_"Patient"_U_"Chart#"_U_"Policy Holder ID"_U_"Serv Cat"_U_"Clinic"_U_"InsType"_U_"BilledTo"
W U_"DateOfService"_U_"DatePaid"_U_"Medicaid/SchipPaid"_U_"Bill#"_U_"Payment"_U_"Primary POV"_U_"PRVT"_U_"MCR"_U_"MCD"_U_"CHIP"_U_"NEEDY INDIV"
W U_"MCD ST" ;abm*2.6*15 HEAT164125
Q:ABMSDT=""
S ABMVLOC=0
F S ABMVLOC=$O(^XTMP("ABM-PVH2",$J,"PT LST",ABMSDT,ABMVLOC)) Q:'ABMVLOC D
.;start old abm*2.6*15 HEAT161159
.;S ABMITYP=""
.;F S ABMITYP=$O(^XTMP("ABM-PVH2",$J,"PT LST",ABMSDT,ABMVLOC,ABMITYP)) Q:ABMITYP="" D
.;.S ABMINS=""
.;.F S ABMINS=$O(^XTMP("ABM-PVH2",$J,"PT LST",ABMSDT,ABMVLOC,ABMITYP,ABMINS)) Q:ABMINS="" D
.;..S ABMPTL=""
.;..F S ABMPTL=$O(^XTMP("ABM-PVH2",$J,"PT LST",ABMSDT,ABMVLOC,ABMITYP,ABMINS,ABMPTL)) Q:ABMPTL="" D
.;...S ABMPTF=""
.;...F S ABMPTF=$O(^XTMP("ABM-PVH2",$J,"PT LST",ABMSDT,ABMVLOC,ABMITYP,ABMINS,ABMPTL,ABMPTF)) Q:ABMPTF="" D
.;....S ABMVDT=0
.;....F S ABMVDT=$O(^XTMP("ABM-PVH2",$J,"PT LST",ABMSDT,ABMVLOC,ABMITYP,ABMINS,ABMPTL,ABMPTF,ABMVDT)) Q:'ABMVDT D
.;.....S ABMP("VDT")=ABMVDT
.;.....S ABMVDFN=0
.;.....F S ABMVDFN=$O(^XTMP("ABM-PVH2",$J,"PT LST",ABMSDT,ABMVLOC,ABMITYP,ABMINS,ABMPTL,ABMPTF,ABMVDT,ABMVDFN)) Q:'ABMVDFN D
.;......I +$G(^XTMP("ABM-PVP2",$J,"DUPS",ABMVDFN))=1 S ABMDCNT=+$G(ABMDCNT)+1
.;......S ^XTMP("ABM-PVP2",$J,"DUPS",ABMVDFN)=1
.;......S ABMPT=$P($G(^XTMP("ABM-PVH2",$J,"PT LST",ABMSDT,ABMVLOC,ABMITYP,ABMINS,ABMPTL,ABMPTF,ABMVDT,ABMVDFN)),U,2)
.;......S ABMTRIEN=$P($G(^XTMP("ABM-PVH2",$J,"PT LST",ABMSDT,ABMVLOC,ABMITYP,ABMINS,ABMPTL,ABMPTF,ABMVDT,ABMVDFN)),U,3)
.;......S IENS=ABMVLOC_","_ABMPT_","
.;......S ABMHRN=$$GET1^DIQ(9000001.41,IENS,.02)
.;......W !,$$GET1^DIQ(9999999.06,ABMVLOC,".02","E")
.;......W U_ABMPTL_", "_ABMPTF ;pt name
.;......W U_ABMHRN ;HRN
.;......K ABML
.;......D ELGCHK^ABMM2PV3
.;......S ABMMIEN=0
.;......K ABMMCDN
.;......I ($G(ABML("MCD"))!($G(ABML("CHIP")))) D
.;.......S ABMMIEN=+$G(ABMP("SAVE"))
.;.......I ABMMIEN D
.;........S ABMMCDN=$P($G(^AUPNMCD(ABMMIEN,0)),U,3)
.;.......I 'ABMMIEN D PRVTCHIP^ABMM2PV3
.;......I $G(ABMMCDN)'="" W U_ABMMCDN ;Medicaid # - policy holder ID
.;......I 'ABMMIEN W U
.;......W U_$$GET1^DIQ(9000010,ABMVDFN,.07,"E") ;Category
.;......W U_$$GET1^DIQ(9000010,ABMVDFN,.08,"E") ;clinic
.;......W U_$S(ABMITYP="X":"",1:ABMITYP) ;insurer type
.;......W U_$S(ABMINS="NO BILL":"NOT BILLED",1:$E(ABMINS,1,10)) ;insurer
.;......W U_$$CDT^ABMDUTL(ABMVDT) ;visit date
.;......W U_$S(+ABMTRIEN:$$SDTO^ABMDUTL(ABMTRIEN),1:"") ;dt paid
.;......S ABMREC=$G(^XTMP("ABM-PVH2",$J,"PT LST",ABMSDT,ABMVLOC,ABMITYP,ABMINS,ABMPTL,ABMPTF,ABMVDT,ABMVDFN))
.;......D ELGCHK^ABMM2PV3
.;......W U_$P($G(ABMREC),U,4)
.;......W U_$P($G(ABMREC),U,5)
.;......W U_$P($G(ABMREC),U,6)
.;......W U_$P($G(ABMREC),U,7)
.;......W U_ABMPI_U_ABMMCR_U_ABMMCD_U_ABMCHIP_U_ABMNI
.;end old start new HEAT161159
.S ABMVDT=0
.F S ABMVDT=$O(^XTMP("ABM-PVH2",$J,"PT LST",ABMSDT,ABMVLOC,ABMVDT)) Q:'ABMVDT D
..S ABMP("VDT")=ABMVDT
..S ABMVDFN=0
..F S ABMVDFN=$O(^XTMP("ABM-PVH2",$J,"PT LST",ABMSDT,ABMVLOC,ABMVDT,ABMVDFN)) Q:'ABMVDFN D
...I +$G(^XTMP("ABM-PVP2",$J,"DUPS",ABMVDFN))=1 S ABMDCNT=+$G(ABMDCNT)+1
...S ^XTMP("ABM-PVP2",$J,"DUPS",ABMVDFN)=1
...S ABMPT=$P($G(^XTMP("ABM-PVH2",$J,"PT LST",ABMSDT,ABMVLOC,ABMVDT,ABMVDFN)),U,2)
...S ABMTRIEN=$P($G(^XTMP("ABM-PVH2",$J,"PT LST",ABMSDT,ABMVLOC,ABMVDT,ABMVDFN)),U,3)
...S ABMREC=$G(^XTMP("ABM-PVH2",$J,"PT LST",ABMSDT,ABMVLOC,ABMVDT,ABMVDFN))
...S ABMITYP=$P(ABMREC,U,8)
...S ABMINS=$P(ABMREC,U,9)
...S ABMPTL=$P(ABMREC,U,10)
...S ABMPTF=$P(ABMREC,U,11)
...S IENS=ABMVLOC_","_ABMPT_","
...S ABMHRN=$$GET1^DIQ(9000001.41,IENS,.02)
...W !,$$GET1^DIQ(9999999.06,ABMVLOC,".02","E")
...W U_ABMPTL_", "_ABMPTF ;pt name
...W U_ABMHRN ;HRN
...K ABML
...D ELGCHK^ABMM2PV3
...S ABMMIEN=0
...K ABMMCDN
...I ($G(ABML("MCD"))!($G(ABML("CHIP")))) D
....S ABMMIEN=+$G(ABMP("SAVE"))
....I ABMMIEN D
.....S ABMMCDN=$P($G(^AUPNMCD(ABMMIEN,0)),U,3)
....I 'ABMMIEN D PRVTCHIP^ABMM2PV3
...I $G(ABMMCDN)'="" W U_ABMMCDN ;Medicaid # - policy holder ID
...I 'ABMMIEN W U
...W U_$$GET1^DIQ(9000010,ABMVDFN,.07,"E") ;Category
...W U_$$GET1^DIQ(9000010,ABMVDFN,.08,"E") ;clinic
...W U_$S(ABMITYP="X":"",1:ABMITYP) ;insurer type
...W U_$S(ABMINS="NO BILL":"NOT BILLED",1:$E(ABMINS,1,10)) ;insurer
...;W U_$$CDT^ABMDUTL(ABMVDT) ;visit date ;abm*2.6*15 HEAT188548
...W U_$$BDT^ABMDUTL(ABMVDT) ;visit date ;abm*2.6*15 HEAT188548
...W U_$S(+ABMTRIEN:$$SDTO^ABMDUTL(ABMTRIEN),1:"") ;dt paid
...S ABMREC=$G(^XTMP("ABM-PVH2",$J,"PT LST",ABMSDT,ABMVLOC,ABMVDT,ABMVDFN))
...D ELGCHK^ABMM2PV3
...W U_$P($G(ABMREC),U,4)
...W U_$P($G(ABMREC),U,5)
...W U_$P($G(ABMREC),U,6)
...W U_$P($G(ABMREC),U,7)
...W U_ABMPI_U_ABMMCR_U_ABMMCD_U_ABMCHIP_U_ABMNI
...W U_$G(ABMP("STATE")) ;abm*2.6*15 HEAT164125
;end new HEAT161159
I +$G(ABMDCNT)>0 W !!,"Duplicate visits for this period: "_ABMDCNT
D CLOSE^%ZISH("ABM")
Q
PTHDR ;
W !,"VISIT LOCATION: ",$$GET1^DIQ(9999999.06,ABMVLOC,.02,"E"),!
F ABM=1:1:80 W "="
W !,?25,"Ser",?39,"I.",?42,"Billed",?53,"Date of",?70,"Date"
W !,"PATIENT NAME",?18,"CHART#",?25,"Cat",?29,"Clinic",?39,"T.",?42,"To",?53,"Service",?70,"Paid",!
F ABM=1:1:80 W "="
Q
ABMM2PH1 ;IHS/SD/SDR - MU Patient Volume Hospital Report ;
+1 ;;2.6;IHS 3P BILLING SYSTEM;**11,12,15**;NOV 12, 2009;Build 251
+2 ;IHS/SD/SDR - 2.6*12 - Included numerator and msgs about numerator and denominator.
+3 ;IHS/SD/SDR - 2.6*15 - HEAT161159 - Changed PT LST to sort differently so there won't be duplicate vsts on pt lst.
+4 ;IHS/SD/SDR - 2.6*15 - HEAT164125 - Added Medicaid State to patient list output
+5 ;IHS/SD/SDR - 2.6*15 - HEAT188548 - Format visit date to 4 digits
+6 ;
MET ;EP
+1 WRITE !!,"Patient Volume: ",+$PIECE($GET(^XTMP("ABM-PVH2",$JOB,"LOC TOP",ABMVLOC)),U)_"%"
+2 ;
+3 SET ABMLOC=$$GET1^DIQ(9999999.06,ABMVLOC,.02,"E")
+4 ;W !!,"Total Patient Encounters "_ABMLOC_": ",?70,$J(+$G(^XTMP("ABM-PVH2",$J,"LOC-DENOM",ABMSDT,ABMVLOC)),8) ;abm*2.6*12
+5 ;abm*2.6*12
WRITE !!,"Total Patient Encounters (Denominator) "_ABMLOC_": ",?70,$JUSTIFY(+$GET(^XTMP("ABM-PVH2",$JOB,"LOC-DENOM",ABMSDT,ABMVLOC)),8)
+6 ;abm*2.6*12
WRITE !,"Total Numerator Encounters "_ABMLOC_": ",?70,$JUSTIFY(+$GET(^XTMP("ABM-PVH2",$JOB,"LOC-NUM",ABMSDT,ABMVLOC)),8)
+7 WRITE !,"Total Medicaid Paid Encounters "_ABMLOC_": ",?70,$JUSTIFY(+$GET(^XTMP("ABM-PVH2",$JOB,"LOC-NUM PD",ABMSDT,ABMVLOC,"MCD")),8)
+8 WRITE !,"Total Medicaid Zero Paid Encounters "_ABMLOC_": ",?70,$JUSTIFY(+$GET(^XTMP("ABM-PVH2",$JOB,"LOC-NUM ZEROPD",ABMSDT,ABMVLOC,"MCD")),8)
+9 ;abm*2.6*12
WRITE !,"Total Medicaid Enrolled (Not Billed) Encounters "_ABMLOC_": ",?70,$JUSTIFY(+$GET(^XTMP("ABM-PVH2",$JOB,"LOC-NUM ENR",ABMSDT,ABMVLOC,"MCD")),8)
+10 WRITE !,"Total Kidscare/Chip Paid Encounters "_ABMLOC_": ",?70,$JUSTIFY(+$GET(^XTMP("ABM-PVH2",$JOB,"LOC-NUM PD",ABMSDT,ABMVLOC,"CHIP")),8)
+11 WRITE !,"Total Kidscare/Chip Zero Paid Encounters "_ABMLOC_": ",?70,$JUSTIFY(+$GET(^XTMP("ABM-PVH2",$JOB,"LOC-NUM ZEROPD",ABMSDT,ABMVLOC,"CHIP")),8)
+12 ;W !,"Total Kidscare/Chip Enrolled Encounters "_ABMLOC_": ",?70,$J(+$G(^XTMP("ABM-PVH2",$J,"LOC-NUM ENR",ABMSDT,ABMVLOC,"CHIP")),8) ;abm*2.6*12
+13 ;abm*2.6*12
WRITE !,"Total Kidscare/Chip Enrolled (Not Billed) Encounters "_ABMLOC_": ",?70,$JUSTIFY(+$GET(^XTMP("ABM-PVH2",$JOB,"LOC-NUM ENR",ABMSDT,ABMVLOC,"CHIP")),8)
+14 ;W !,"Total Other Encounters "_ABMLOC_": ",?70,$J(+$G(^XTMP("ABM-PVH2",$J,"LOC ENC CNT",ABMSDT,ABMVLOC,"OTHR")),8) ;abm*2.6*12
+15 ;abm*2.6*12
WRITE !,"Total Other Encounters "_ABMLOC_" (*not included in numerator): ",?70,$JUSTIFY(+$GET(^XTMP("ABM-PVH2",$JOB,"LOC ENC CNT",ABMSDT,ABMVLOC,"OTHR")),8)
+16 QUIT
NOTMET ;EP
+1 WRITE !!,"The Patient Volume Threshold (10% for Hospitals) was not met for the"
+2 WRITE !,$SELECT(("^A^B^C^"[("^"_ABMY("90")_"^")):"MU Qualification year",1:"timeframe entered")_". Details for the volumes that were achieved are"
+3 WRITE !,"provided for your information."
+4 WRITE !!,"Highest Patient Volume Met: ",+$PIECE($GET(^XTMP("ABM-PVH2",$JOB,"LOC TOP",ABMVLOC)),U)
+5 WRITE !,"First Day Highest Patient Volume Achieved: ",$$SDT^ABMDUTL(ABMSDT)
+6 SET ABMTHPV=0
+7 IF ABMSDT
SET ABMTHPV=+$GET(^XTMP("ABM-PVH2",$JOB,"LOC-DENOM",ABMSDT,ABMVLOC))
+8 SET ABMMHPV=0
+9 IF ABMSDT
SET ABMMHPV=+$GET(^XTMP("ABM-PVH2",$JOB,"LOC-NUM",ABMSDT,ABMVLOC))
+10 WRITE !!,"Total Patient Encounters of First Highest Patient Volume Period: ",ABMTHPV
+11 WRITE !,"Total Hospital"_$SELECT(+$GET(ABMER)=1:"/ER",1:"")_" Encounters of First Highest Patient Volume Period: ",ABMMHPV
+12 SET ABMCNT=0
+13 KILL ABMLN
+14 ;
+15 IF +$GET(ABMY("TVDTS"))'=0
Begin DoDot:1
+16 SET ABMCNT=0
+17 SET ABMDT=0
+18 FOR
SET ABMDT=$ORDER(^XTMP("ABM-PVH2",$JOB,"LOC PERCENT",ABMDT))
IF 'ABMDT
QUIT
Begin DoDot:2
+19 SET ABMCNT=ABMCNT+1
+20 SET ABMPRC($GET(^XTMP("ABM-PVH2",$JOB,"LOC PERCENT",ABMDT,ABMVLOC)),ABMCNT)=ABMDT
+21 SET ABMP=""
+22 SET ABMSAV=ABMCNT-ABMY("TVDTS")
+23 FOR
SET ABMP=$ORDER(ABMPRC(ABMP))
IF ABMP=""
QUIT
Begin DoDot:3
+24 SET ABMCNT=0
SET ABMC=0
+25 FOR
SET ABMCNT=$ORDER(ABMPRC(ABMP,ABMCNT))
IF 'ABMCNT
QUIT
Begin DoDot:4
+26 KILL ^XTMP("ABM-PVH2",$JOB,"LOC PERCENT",$GET(ABMPRC(ABMP,ABMCNT)))
+27 SET ABMC=ABMC+1
End DoDot:4
IF (ABMC=ABMSAV)
QUIT
End DoDot:3
End DoDot:2
End DoDot:1
+28 ;
+29 DO NMHDR
+30 SET ABMSDT=0
+31 SET ABMDTCNT=0
+32 FOR
SET ABMSDT=$ORDER(^XTMP("ABM-PVH2",$JOB,"LOC-DENOM",ABMSDT))
IF 'ABMSDT
QUIT
Begin DoDot:1
+33 ;only calculate whole year for automated
IF ABMY("90")'="A"&(ABMY("SDT")'=ABMSDT)
QUIT
+34 IF $Y+5>IOSL
DO HD^ABMM2PV3
DO NMHDR
IF (IOST["C")&((+$GET(Y)=0)!($DATA(DIRUT)!$DATA(DIROUT)!$DATA(DTOUT)!$DATA(DUOUT)))
QUIT
+35 SET ABMDTCNT=+$GET(ABMDTCNT)+1
+36 IF +$GET(ABMP("EDT"))=0
Begin DoDot:2
+37 SET X1=ABMSDT
+38 SET X2=89
+39 DO C^%DTC
+40 SET ABMEDT=X
End DoDot:2
+41 IF +$GET(ABMP("EDT"))'=0
SET ABMEDT=ABMP("EDT")
+42 IF (+$GET(ABMEDT)>((ABMY("QYR")-1700)_"0930"))
QUIT
+43 ;report period
SET ABMPD=$TRANSLATE($PIECE($$MDT^ABMDUTL(ABMSDT),"-",1,2),"-"," ")_"-"_$TRANSLATE($PIECE($$MDT^ABMDUTL(ABMEDT),"-",1,2),"-"," ")
+44 ;rate
SET ABMRT=$JUSTIFY(+$GET(^XTMP("ABM-PVH2",$JOB,"LOC PERCENT",ABMSDT,ABMVLOC)),5)_"%"
+45 ;denominator
SET ABMDEN=$JUSTIFY(+$GET(^XTMP("ABM-PVH2",$JOB,"LOC-DENOM",ABMSDT,ABMVLOC)),6)
+46 ;numerator
SET ABMNUM=$JUSTIFY(+$GET(^XTMP("ABM-PVH2",$JOB,"LOC-NUM",ABMSDT,ABMVLOC)),6)
+47 SET ABMMCDPD=$JUSTIFY(+$GET(^XTMP("ABM-PVH2",$JOB,"LOC-NUM PD",ABMSDT,ABMVLOC,"MCD")),6)
+48 SET ABMSCHPD=$JUSTIFY(+$GET(^XTMP("ABM-PVH2",$JOB,"LOC-NUM PD",ABMSDT,ABMVLOC,"CHIP")),6)
+49 SET ABMMCDZP=$JUSTIFY(+$GET(^XTMP("ABM-PVH2",$JOB,"LOC-NUM ZEROPD",ABMSDT,ABMVLOC,"MCD")),6)
+50 SET ABMMCDEN=$JUSTIFY(+$GET(^XTMP("ABM-PVH2",$JOB,"LOC-NUM ENR",ABMSDT,ABMVLOC,"MCD")),6)
+51 SET ABMSCHZP=$JUSTIFY(+$GET(^XTMP("ABM-PVH2",$JOB,"LOC-NUM ZEROPD",ABMSDT,ABMVLOC,"CHIP")),6)
+52 SET ABMSCHEN=$JUSTIFY(+$GET(^XTMP("ABM-PVH2",$JOB,"LOC-NUM ENR",ABMSDT,ABMVLOC,"CHIP")),6)
+53 WRITE !,ABMPD,?15,ABMRT,?20,ABMDEN,?28,ABMNUM,?35,ABMMCDPD,?41,ABMMCDZP,?50,ABMMCDEN,?57,ABMSCHPD,?63,ABMSCHZP,?73,ABMSCHEN
End DoDot:1
IF (IOST["C")&((+$GET(Y)=0)!($DATA(DIRUT)!$DATA(DIROUT)!$DATA(DTOUT)!$DATA(DUOUT)))
QUIT
+54 IF ABMDTCNT=0
Begin DoDot:1
+55 WRITE !!,