ABMM2PV3 ;IHS/SD/SDR - MU Patient Volume EP Report ;
;;2.6;IHS 3P BILLING SYSTEM;**11,12,15**;NOV 12, 2009;Build 251
;IHS/SD/SDR 2.6*12 - Uncomp'd should be a separate detail line and s/be incl. in pt vol total, not as separate line.
;IHS/SD/SDR 2.6*12 - Incl. numer and msgs about numer. and denom.
;IHS/SD/SDR 2.6*15 - HEAT161159 - Changed PT LST to sort differently so there won't be duplicate vsts on pt lst. Also made
; change so it will correctly rpt category for pt on pt lst, and added record indicator.
;IHS/SD/SDR 2.6*15 - HEAT171490 - Added fac NPI and TIN to pt list host file
;IHS/SD/SDR 2.6*15 - HEAT183289 - Made changes to print tribal self-insured summary line
;IHS/SD/SDR 2.6*15 - Rearranged code so all prvs would print in HFS file instead of just first one
;IHS/SD/SDR 2.6*15 - HEAT188548 - Format vst dt to 4 digits
;IHS/SD/SDR 2.6*15 - If pt has MCD and CHIP and user runs report excluding CHIP, it will flag both so it can be counted in
; MCD enrolled; if they include CHIP it flags CHIP only so it doesn't get confusing.
;
PRINT ;EP
I ABMY("RTYP")="GRP" D GRPPRT^ABMM2PV4 Q
;start new abm*2.6*15
;Write all providers, not just first, to HFS file
I ABMY("RFMT")="P",$G(ABMFN)'="" D Q
.D OPEN^%ZISH("ABM",ABMPATH,ABMFN,"W")
.Q:POP
.U IO
.S ABMPRV=0
.F S ABMPRV=$O(ABMP(ABMPRV)) Q:'ABMPRV D D PAZ^ABMDRUTL Q:$D(DTOUT)!$D(DUOUT)!$D(DIROUT)
..S ABMPMET=0
..D PTHSTFL
.;
.D CLOSE^%ZISH("ABM")
;end new abm*2.6*15
;
S ABMPRV=0
F S ABMPRV=$O(ABMP(ABMPRV)) Q:'ABMPRV D D PAZ^ABMDRUTL Q:$D(DTOUT)!$D(DUOUT)!$D(DIROUT)
.S ABMPMET=0
.I ABMY("RFMT")="P" D PATIENT Q
.I +$G(^XTMP("ABM-PVP2",$J,"PRV TOP",ABMPRV))>29.5 S ABMPMET=1 D MET Q
.I +$G(^XTMP("ABM-PVP2",$J,"PRV TOP",ABMPRV))>19.5&($$DOCLASS^ABMDVST2(ABMPRV)["PEDIAT") S ABMPMET=1 D MET Q
.D NOTMET
K ^XTMP("ABM-PVP2",$J)
Q
MET ;
D MET^ABMM2PV9 ;split routine due to size
Q
NOTMET ;EP
D NOTMET^ABMM2PV5
Q
PATIENT ;EP
;I ABMY("RFMT")="P",$G(ABMFN)'="" D PTHSTFL Q ;abm*2.6*15 - was only printing first provider selected this way
S ABM("PG")=1
S ABMSDT=$P($G(^XTMP("ABM-PVP2",$J,"PRV TOP",ABMPRV)),U,2)
D HDR
Q:ABMSDT=""
S ABMVLOC=0
F S ABMVLOC=$O(^XTMP("ABM-PVP2",$J,"PT LST",ABMSDT,ABMPRV,ABMVLOC)) Q:'ABMVLOC D Q:(IOST["C")&((+$G(Y)=0)!($D(DIRUT)!$D(DIROUT)!$D(DTOUT)!$D(DUOUT)))
.D PTHDR
.;start old abm*2.6*15 HEAT161159
.;S ABMITYP=""
.;F S ABMITYP=$O(^XTMP("ABM-PVP2",$J,"PT LST",ABMSDT,ABMPRV,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-PVP2",$J,"PT LST",ABMSDT,ABMPRV,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-PVP2",$J,"PT LST",ABMSDT,ABMPRV,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-PVP2",$J,"PT LST",ABMSDT,ABMPRV,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-PVP2",$J,"PT LST",ABMSDT,ABMPRV,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=$O(^XTMP("ABM-PVP2",$J,"PT LST",ABMSDT,ABMPRV,ABMVLOC,ABMITYP,ABMINS,ABMPTL,ABMPTF,ABMVDT,0))
.;.....S ABMPT=$P($G(^XTMP("ABM-PVP2",$J,"PT LST",ABMSDT,ABMPRV,ABMVLOC,ABMITYP,ABMINS,ABMPTL,ABMPTF,ABMVDT,ABMVDFN)),U,2)
.;.....S ABMTRIEN=$P($G(^XTMP("ABM-PVP2",$J,"PT LST",ABMSDT,ABMPRV,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)
.;.....W ?18,ABMHRN
.;.....W ?25,$E($$GET1^DIQ(9000010,ABMVDFN,.07,"E"),1,3)
.;.....W ?29,$E($$GET1^DIQ(9000010,ABMVDFN,.08,"E"),1,8)
.;.....W ?39,$S(ABMITYP="X":"",1:ABMITYP)
.;.....W ?42,$S(ABMINS="NO BILL":"NOT BILLED",1:$E(ABMINS,1,10))
.;.....W ?53,$$CDT^ABMDUTL(ABMVDT)
.;.....W ?70,$S(+ABMTRIEN:$$SDTO^ABMDUTL(ABMTRIEN),1:"")
.;.....I $P($G(^XTMP("ABM-PVP2",$J,"PT LST",ABMSDT,ABMPRV,ABMVLOC,ABMITYP,ABMINS,ABMPTL,ABMPTF,ABMVDT,ABMVDFN)),U,4)'="" W ?79,$P(^(ABMVDFN),U,4)
.;.....I $Y+5>IOSL D HD,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-PVP2",$J,"PT LST",ABMSDT,ABMPRV,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-PVP2",$J,"PT LST",ABMSDT,ABMPRV,ABMVLOC,ABMVDT,ABMVDFN)) Q:'ABMVDFN D Q:(IOST["C")&((+$G(Y)=0)!($D(DIRUT)!$D(DIROUT)!$D(DTOUT)!$D(DUOUT)))
...S ABMPT=$P($G(^XTMP("ABM-PVP2",$J,"PT LST",ABMSDT,ABMPRV,ABMVLOC,ABMVDT,ABMVDFN)),U,2)
...S ABMTRIEN=$P($G(^XTMP("ABM-PVP2",$J,"PT LST",ABMSDT,ABMPRV,ABMVLOC,ABMVDT,ABMVDFN)),U,3)
...S ABMINS=$P($G(^XTMP("ABM-PVP2",$J,"PT LST",ABMSDT,ABMPRV,ABMVLOC,ABMVDT,ABMVDFN)),U,5)
...S IENS=ABMVLOC_","_ABMPT_","
...S ABMHRN=$$GET1^DIQ(9000001.41,IENS,.02)
...S ABMPTL=$P($G(^XTMP("ABM-PVP2",$J,"PT LST",ABMSDT,ABMPRV,ABMVLOC,ABMVDT,ABMVDFN)),U,10)
...S ABMPTF=$P($G(^XTMP("ABM-PVP2",$J,"PT LST",ABMSDT,ABMPRV,ABMVLOC,ABMVDT,ABMVDFN)),U,11)
...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":"NOT BILLED",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-PVP2",$J,"PT LST",ABMSDT,ABMPRV,ABMVLOC,ABMVDT,ABMVDFN)),U,4)'="" W ?79,$P(^(ABMVDFN),U,4)
...I $Y+5>IOSL D HD,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-PVP2",$J,"PRV TOP",ABMPRV)),U,2)
K ABMDCNT
;start old abm*2.6*15 moved up so all providers will print in one HFS file
;D OPEN^%ZISH("ABM",ABMPATH,ABMFN,"W")
;Q:POP
;U IO
;end old abm*2.6*15
S ABM("PG")=1
D HDR
W !,"Visit Location"_U_"Patient"_U_"Chart#"_U_"Policy Holder ID"_U_"Serv Cat"_U_"Clinic"_U_"Provider NPI"_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_"Tribal self-insured" ;abm*2.6*15 HEAT183289
W U_"MCD ST" ;abm*2.6*15 HEAT164125
W U_"Facility NPI"_U_"Facility TIN"_U_"Record Indicator" ;abm*2.6*15 HEAT171490 and HEAT161159
Q:ABMSDT=""
S ABMVLOC=0
F S ABMVLOC=$O(^XTMP("ABM-PVP2",$J,"PT LST",ABMSDT,ABMPRV,ABMVLOC)) Q:'ABMVLOC D
.;start old abm*2.6*15 HEAT161159
.;S ABMITYP=""
.;F S ABMITYP=$O(^XTMP("ABM-PVP2",$J,"PT LST",ABMSDT,ABMPRV,ABMVLOC,ABMITYP)) Q:ABMITYP="" D
.;.S ABMINS=""
.;.F S ABMINS=$O(^XTMP("ABM-PVP2",$J,"PT LST",ABMSDT,ABMPRV,ABMVLOC,ABMITYP,ABMINS)) Q:ABMINS="" D
.;..S ABMPTL=""
.;..F S ABMPTL=$O(^XTMP("ABM-PVP2",$J,"PT LST",ABMSDT,ABMPRV,ABMVLOC,ABMITYP,ABMINS,ABMPTL)) Q:ABMPTL="" D
.;...S ABMPTF=""
.;...F S ABMPTF=$O(^XTMP("ABM-PVP2",$J,"PT LST",ABMSDT,ABMPRV,ABMVLOC,ABMITYP,ABMINS,ABMPTL,ABMPTF)) Q:ABMPTF="" D
.;....S ABMVDT=0
.;....F S ABMVDT=$O(^XTMP("ABM-PVP2",$J,"PT LST",ABMSDT,ABMPRV,ABMVLOC,ABMITYP,ABMINS,ABMPTL,ABMPTF,ABMVDT)) Q:'ABMVDT D
.;.....S ABMP("VDT")=ABMVDT
.;.....S ABMVDFN=0
.;.....F S ABMVDFN=$O(^XTMP("ABM-PVP2",$J,"PT LST",ABMSDT,ABMPRV,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-PVP2",$J,"PT LST",ABMSDT,ABMPRV,ABMVLOC,ABMITYP,ABMINS,ABMPTL,ABMPTF,ABMVDT,ABMVDFN)),U,2)
.;......S ABMTRIEN=$P($G(^XTMP("ABM-PVP2",$J,"PT LST",ABMSDT,ABMPRV,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
.;......W U_ABMHRN
.;......K ABML
.;......D ELGCHK
.;......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
.;......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($P($$NPI^XUSNPI("Individual_ID",+ABMPRV),U)>0:$P($$NPI^XUSNPI("Individual_ID",+ABMPRV),U),1:"") ;provider NPI
.;......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-PVP2",$J,"PT LST",ABMSDT,ABMPRV,ABMVLOC,ABMITYP,ABMINS,ABMPTL,ABMPTF,ABMVDT,ABMVDFN))
.;......D ELGCHK
.;......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-PVP2",$J,"PT LST",ABMSDT,ABMPRV,ABMVLOC,ABMVDT)) Q:'ABMVDT D
..S ABMP("VDT")=ABMVDT
..S ABMVDFN=0
..F S ABMVDFN=$O(^XTMP("ABM-PVP2",$J,"PT LST",ABMSDT,ABMPRV,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-PVP2",$J,"PT LST",ABMSDT,ABMPRV,ABMVLOC,ABMVDT,ABMVDFN)),U,2)
...S ABMTRIEN=$P($G(^XTMP("ABM-PVP2",$J,"PT LST",ABMSDT,ABMPRV,ABMVLOC,ABMVDT,ABMVDFN)),U,3)
...S ABMREC=$G(^XTMP("ABM-PVP2",$J,"PT LST",ABMSDT,ABMPRV,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
...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
...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($P($$NPI^XUSNPI("Individual_ID",+ABMPRV),U)>0:$P($$NPI^XUSNPI("Individual_ID",+ABMPRV),U),1:"") ;provider NPI
...W U_$S(ABMITYP="X":"",1:ABMITYP) ;insurer type
...W U_$S(ABMINS="NO BILL":"NOT BILLED",1:ABMINS) ;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
...K ABMPI,ABMMCR,ABMMCD,ABMCHIP,ABMNI ;abm*2.6*15 HEAT161159
...D ELGCHK
...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 ;abm*2.6*15 HEAT183289
...W U_ABMPI_U_ABMMCR_U_ABMMCD_U_ABMCHIP_U_ABMNI_U_$G(ABMTSI) ;abm*2.6*15 HEAT183289
...W U_$G(ABMP("STATE")) ;abm*2.6*15 HEAT164125
...W U_$P(ABMREC,U,13) ;visit location NPI abm*2.6*15 HEAT171490
...W U_$P(ABMREC,U,14) ;visit location TIN abm*2.6*15 HEAT171490
...W U_$P(ABMREC,U,15) ;record indicator abm*2.6*15 HEAT161159
...;start new abm*2.6*15 HEAT183289
...I +$G(ABMFQHC)=1 D
....I +$G(ABMICNT)=1&($G(ABMTSI)="Y") D
.....W "TSI" ;write TSI if pt has TSI insurer only
.....I +$P($G(ABMREC),U,6)'=0 W "-PD" ;if TSI insurer paid
....I $G(ABMNI)="Y" W "UNC" ;write UNC if pt is needy individual
...;end new HEAT183289
;end new HEAT161159
I +$G(ABMDCNT)>0 W !!,"Duplicate visits for this period: "_ABMDCNT
;D CLOSE^%ZISH("ABM") ;abm*2.6*15 moved up so all providers will print in one file
Q
PRVTCHIP ;
S ABMMIEN=0
S ABMFINS=0
F S ABMMIEN=$O(^AUPNPRVT(ABMPT,11,ABMMIEN)) Q:'ABMMIEN D Q:ABMFINS
.Q:'$D(ABMI("INS",$P($G(^AUPNPRVT(ABMPT,11,ABMMIEN,0)),U)))
.S ABMFINS=1
.S IENS=ABMMIEN_","_ABMPT_","
.S ABMMCDN=$$GET1^DIQ(9000006.11,IENS,21)
.S:ABMMCDN="" ABMMCDN=$$GET1^DIQ(9000003.1,$P($G(^AUPNPRVT(ABMPT,11,ABMMIEN,0)),U,8),".04")
Q
PTHDR ;
I IOST["C",(ABM("PG")=1) D HD Q:$D(DTOUT)!$D(DUOUT)!$D(DIROUT) ;start data on 2nd page of report
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
HD D PAZ^ABMDRUTL Q:$D(DTOUT)!$D(DUOUT)!$D(DIROUT)
S ABM("PG")=+$G(ABM("PG"))+1
HDR ;EP
D HDR^ABMM2PV5
Q
ELGCHK ;EP
S ABML=""
D ELIG^ABMM2PV8
S (ABMMCR,ABMMCD,ABMPI,ABMCHIP,ABMNI)="N" ;abm*2.6*15
;start old abm*2.6*15 HEAT161159
;S ABMIT=""
;F S ABMIT=$O(ABMK(ABMIT)) Q:ABMIT="" D
;.I ABMIT="I"!(ABMIT="N") Q ;don't count ben and non-ben
;.I "^R^MH^MD^MC^MMC^"[("^"_ABMIT_"^") S ABMMCR="Y"
;.I ABMIT="D"!(ABMIT="FPL") S ABMMCD="Y"
;.I (ABMIT="K")!($D(ABMI("INS",ABMINS))) S ABMCHIP="Y"
;.;I (("^D^FPL^K^R^MH^MD^MC^MMC^"'[("^"_ABMIT_"^"))&('(ABMIT="P"&($D(ABMI("INS",ABMINS)))))) S ABMPI="Y"
;.I (("^D^FPL^K^R^MH^MD^MC^MMC^"'[("^"_ABMIT_"^"))&('($D(ABMI("INS",ABMINS))))) S ABMPI="Y"
;I ABMMCD="Y"&(ABMCHIP="Y") S ABMMCD="N" ;can't cnt in both
;I ABMMCR="N",ABMMCD="N",ABMPI="N",ABMCHIP="N" S ABMNI="Y"
;end old start new HEAT161159
S ABMJ("INS")=0
F S ABMJ("INS")=$O(ABMILST(ABMJ("INS"))) Q:'ABMJ("INS") D
.S ABMIT=$G(ABMILST(ABMJ("INS")))
.I ABMIT="I"!(ABMIT="N") Q ;don't count ben and non-ben
.I "^R^MH^MD^MC^MMC^"[("^"_ABMIT_"^") S ABMMCR="Y"
.;I ABMIT="D"!(ABMIT="FPL") S ABMMCD="Y"
.I ABMIT="D" S ABMMCD="Y",ABMP("STATE")=$G(ABMILST("STATE",ABMJ("INS")))
.I (ABMIT="K")!($D(ABMI("INS",ABMJ("INS")))) S ABMCHIP="Y"
.I (("^D^K^R^MH^MD^MC^MMC^"'[("^"_ABMIT_"^"))&('($D(ABMI("INS",ABMJ("INS")))))) S ABMPI="Y"
;I ABMMCD="Y"&(ABMCHIP="Y") S ABMMCD="N" ;can't cnt in both ;abm*2.6*15
I ABMMCD="Y"&(ABMCHIP="Y")&($D(ABMI("INS"))) S ABMMCD="N" ;can't cnt in both if counting CHIP ;abm*2.6*15
I ABMMCR="N",ABMMCD="N",ABMPI="N",ABMCHIP="N" S ABMNI="Y"
;end new HEAT161159
Q
ABMM2PV3 ;IHS/SD/SDR - MU Patient Volume EP Report ;
+1 ;;2.6;IHS 3P BILLING SYSTEM;**11,12,15**;NOV 12, 2009;Build 251
+2 ;IHS/SD/SDR 2.6*12 - Uncomp'd should be a separate detail line and s/be incl. in pt vol total, not as separate line.
+3 ;IHS/SD/SDR 2.6*12 - Incl. numer and msgs about numer. and denom.
+4 ;IHS/SD/SDR 2.6*15 - HEAT161159 - Changed PT LST to sort differently so there won't be duplicate vsts on pt lst. Also made
+5 ; change so it will correctly rpt category for pt on pt lst, and added record indicator.
+6 ;IHS/SD/SDR 2.6*15 - HEAT171490 - Added fac NPI and TIN to pt list host file
+7 ;IHS/SD/SDR 2.6*15 - HEAT183289 - Made changes to print tribal self-insured summary line
+8 ;IHS/SD/SDR 2.6*15 - Rearranged code so all prvs would print in HFS file instead of just first one
+9 ;IHS/SD/SDR 2.6*15 - HEAT188548 - Format vst dt to 4 digits
+10 ;IHS/SD/SDR 2.6*15 - If pt has MCD and CHIP and user runs report excluding CHIP, it will flag both so it can be counted in
+11 ; MCD enrolled; if they include CHIP it flags CHIP only so it doesn't get confusing.
+12 ;
PRINT ;EP
+1 IF ABMY("RTYP")="GRP"
DO GRPPRT^ABMM2PV4
QUIT
+2 ;start new abm*2.6*15
+3 ;Write all providers, not just first, to HFS file
+4 IF ABMY("RFMT")="P"
IF $GET(ABMFN)'=""
Begin DoDot:1
+5 DO OPEN^%ZISH("ABM",ABMPATH,ABMFN,"W")
+6 IF POP
QUIT
+7 USE IO
+8 SET ABMPRV=0
+9 FOR
SET ABMPRV=$ORDER(ABMP(ABMPRV))
IF 'ABMPRV
QUIT
Begin DoDot:2
+10 SET ABMPMET=0
+11 DO PTHSTFL
End DoDot:2
DO PAZ^ABMDRUTL
IF $DATA(DTOUT)!$DATA(DUOUT)!$DATA(DIROUT)
QUIT
+12 ;
+13 DO CLOSE^%ZISH("ABM")
End DoDot:1
QUIT
+14 ;end new abm*2.6*15
+15 ;
+16 SET ABMPRV=0
+17 FOR
SET ABMPRV=$ORDER(ABMP(ABMPRV))
IF 'ABMPRV
QUIT
Begin DoDot:1
+18 SET ABMPMET=0
+19 IF ABMY("RFMT")="P"
DO PATIENT
QUIT
+20 IF +$GET(^XTMP("ABM-PVP2",$JOB,"PRV TOP",ABMPRV))>29.5
SET ABMPMET=1
DO MET
QUIT
+21 IF +$GET(^XTMP("ABM-PVP2",$JOB,"PRV TOP",ABMPRV))>19.5&($$DOCLASS^ABMDVST2(ABMPRV)["PEDIAT")
SET ABMPMET=1
DO MET
QUIT
+22 DO NOTMET
End DoDot:1
DO PAZ^ABMDRUTL
IF $DATA(DTOUT)!$DATA(DUOUT)!$DATA(DIROUT)
QUIT
+23 KILL ^XTMP("ABM-PVP2",$JOB)
+24 QUIT
MET ;
+1 ;split routine due to size
DO MET^ABMM2PV9
+2 QUIT
NOTMET ;EP
+1 DO NOTMET^ABMM2PV5
+2 QUIT
PATIENT ;EP
+1 ;I ABMY("RFMT")="P",$G(ABMFN)'="" D PTHSTFL Q ;abm*2.6*15 - was only printing first provider selected this way
+2 SET ABM("PG")=1
+3 SET ABMSDT=$PIECE($GET(^XTMP("ABM-PVP2",$JOB,"PRV TOP",ABMPRV)),U,2)
+4 DO HDR
+5 IF ABMSDT=""
QUIT
+6 SET ABMVLOC=0
+7 FOR
SET ABMVLOC=$ORDER(^XTMP("ABM-PVP2",$JOB,"PT LST",ABMSDT,ABMPRV,ABMVLOC))
IF 'ABMVLOC
QUIT
Begin DoDot:1
+8 DO PTHDR
+9 ;start old abm*2.6*15 HEAT161159
+10 ;S ABMITYP=""
+11 ;F S ABMITYP=$O(^XTMP("ABM-PVP2",$J,"PT LST",ABMSDT,ABMPRV,ABMVLOC,ABMITYP)) Q:ABMITYP="" D Q:(IOST["C")&((+$G(Y)=0)!($D(DIRUT)!$D(DIROUT)!$D(DTOUT)!$D(DUOUT)))
+12 ;.S ABMINS=""
+13 ;.F S ABMINS=$O(^XTMP("ABM-PVP2",$J,"PT LST",ABMSDT,ABMPRV,ABMVLOC,ABMITYP,ABMINS)) Q:ABMINS="" D Q:(IOST["C")&((+$G(Y)=0)!($D(DIRUT)!$D(DIROUT)!$D(DTOUT)!$D(DUOUT)))
+14 ;..S ABMPTL=""
+15 ;..F S ABMPTL=$O(^XTMP("ABM-PVP2",$J,"PT LST",ABMSDT,ABMPRV,ABMVLOC,ABMITYP,ABMINS,ABMPTL)) Q:ABMPTL="" D Q:(IOST["C")&((+$G(Y)=0)!($D(DIRUT)!$D(DIROUT)!$D(DTOUT)!$D(DUOUT)))
+16 ;...S ABMPTF=""
+17 ;...F S ABMPTF=$O(^XTMP("ABM-PVP2",$J,"PT LST",ABMSDT,ABMPRV,ABMVLOC,ABMITYP,ABMINS,ABMPTL,ABMPTF)) Q:ABMPTF="" D Q:(IOST["C")&((+$G(Y)=0)!($D(DIRUT)!$D(DIROUT)!$D(DTOUT)!$D(DUOUT)))
+18 ;....S ABMVDT=0
+19 ;....F S ABMVDT=$O(^XTMP("ABM-PVP2",$J,"PT LST",ABMSDT,ABMPRV,ABMVLOC,ABMITYP,ABMINS,ABMPTL,ABMPTF,ABMVDT)) Q:'ABMVDT D Q:(IOST["C")&((+$G(Y)=0)!($D(DIRUT)!$D(DIROUT)!$D(DTOUT)!$D(DUOUT)))
+20 ;.....S ABMVDFN=$O(^XTMP("ABM-PVP2",$J,"PT LST",ABMSDT,ABMPRV,ABMVLOC,ABMITYP,ABMINS,ABMPTL,ABMPTF,ABMVDT,0))
+21 ;.....S ABMPT=$P($G(^XTMP("ABM-PVP2",$J,"PT LST",ABMSDT,ABMPRV,ABMVLOC,ABMITYP,ABMINS,ABMPTL,ABMPTF,ABMVDT,ABMVDFN)),U,2)
+22 ;.....S ABMTRIEN=$P($G(^XTMP("ABM-PVP2",$J,"PT LST",ABMSDT,ABMPRV,ABMVLOC,ABMITYP,ABMINS,ABMPTL,ABMPTF,ABMVDT,ABMVDFN)),U,3)
+23 ;.....S IENS=ABMVLOC_","_ABMPT_","
+24 ;.....S ABMHRN=$$GET1^DIQ(9000001.41,IENS,.02)
+25 ;.....W !,$E(ABMPTL_", "_ABMPTF,1,16)
+26 ;.....W ?18,ABMHRN
+27 ;.....W ?25,$E($$GET1^DIQ(9000010,ABMVDFN,.07,"E"),1,3)
+28 ;.....W ?29,$E($$GET1^DIQ(9000010,ABMVDFN,.08,"E"),1,8)
+29 ;.....W ?39,$S(ABMITYP="X":"",1:ABMITYP)
+30 ;.....W ?42,$S(ABMINS="NO BILL":"NOT BILLED",1:$E(ABMINS,1,10))
+31 ;.....W ?53,$$CDT^ABMDUTL(ABMVDT)
+32 ;.....W ?70,$S(+ABMTRIEN:$$SDTO^ABMDUTL(ABMTRIEN),1:"")
+33 ;.....I $P($G(^XTMP("ABM-PVP2",$J,"PT LST",ABMSDT,ABMPRV,ABMVLOC,ABMITYP,ABMINS,ABMPTL,ABMPTF,ABMVDT,ABMVDFN)),U,4)'="" W ?79,$P(^(ABMVDFN),U,4)
+34 ;.....I $Y+5>IOSL D HD,PTHDR Q:(IOST["C")&((+$G(Y)=0)!($D(DIRUT)!$D(DIROUT)!$D(DTOUT)!$D(DUOUT)))
+35 ;end old start new HEAT161159
+36 SET ABMVDT=0
+37 FOR
SET ABMVDT=$ORDER(^XTMP("ABM-PVP2",$JOB,"PT LST",ABMSDT,ABMPRV,ABMVLOC,ABMVDT))
IF 'ABMVDT
QUIT
Begin DoDot:2
+38 SET ABMVDFN=0
+39 FOR
SET ABMVDFN=$ORDER(^XTMP("ABM-PVP2",$JOB,"PT LST",ABMSDT,ABMPRV,ABMVLOC,ABMVDT,ABMVDFN))
IF 'ABMVDFN
QUIT
Begin DoDot:3
+40 SET ABMPT=$PIECE($GET(^XTMP("ABM-PVP2",$JOB,"PT LST",ABMSDT,ABMPRV,ABMVLOC,ABMVDT,ABMVDFN)),U,2)
+41 SET ABMTRIEN=$PIECE($GET(^XTMP("ABM-PVP2",$JOB,"PT LST",ABMSDT,ABMPRV,ABMVLOC,ABMVDT,ABMVDFN)),U,3)
+42 SET ABMINS=$PIECE($GET(^XTMP("ABM-PVP2",$JOB,"PT LST",ABMSDT,ABMPRV,ABMVLOC,ABMVDT,ABMVDFN)),U,5)
+43 SET IENS=ABMVLOC_","_ABMPT_","
+44 SET ABMHRN=$$GET1^DIQ(9000001.41,IENS,.02)
+45 SET ABMPTL=$PIECE($GET(^XTMP("ABM-PVP2",$JOB,"PT LST",ABMSDT,ABMPRV,ABMVLOC,ABMVDT,ABMVDFN)),U,10)
+46 SET ABMPTF=$PIECE($GET(^XTMP("ABM-PVP2",$JOB,"PT LST",ABMSDT,ABMPRV,ABMVLOC,ABMVDT,ABMVDFN)),U,11)
+47 ;pt name
WRITE !,$EXTRACT(ABMPTL_", "_ABMPTF,1,16)
+48 ;HRN
WRITE ?18,ABMHRN
+49 ;Category
WRITE ?25,$EXTRACT($$GET1^DIQ(9000010,ABMVDFN,.07,"E"),1,3)
+50 ;clinic
WRITE ?29,$EXTRACT($$GET1^DIQ(9000010,ABMVDFN,.08,"E"),1,8)
+51 ;insurer type
WRITE ?39,$SELECT(ABMITYP="X":"",1:ABMITYP)
+52 ;insurer
WRITE ?42,$SELECT(ABMINS="NO BILL":"NOT BILLED",1:$EXTRACT(ABMINS,1,10))
+53 ;visit date
WRITE ?53,$$CDT^ABMDUTL(ABMVDT)
+54 ;dt paid
WRITE ?70,$SELECT(+ABMTRIEN:$$SDTO^ABMDUTL(ABMTRIEN),1:"")
+55 IF $PIECE($GET(^XTMP("ABM-PVP2",$JOB,"PT LST",ABMSDT,ABMPRV,ABMVLOC,ABMVDT,ABMVDFN)),U,4)'=""
WRITE ?79,$PIECE(^(ABMVDFN),U,4)
+56 IF $Y+5>IOSL
DO HD
DO PTHDR
IF (IOST["C")&((+$GET(Y)=0)!($DATA(DIRUT)!$DATA(DIROUT)!$DATA(DTOUT)!$DATA(DUOUT)))
QUIT
End DoDot:3
IF (IOST["C")&((+$GET(Y)=0)!($DATA(DIRUT)!$DATA(DIROUT)!$DATA(DTOUT)!$DATA(DUOUT)))
QUIT
End DoDot:2
IF (IOST["C")&((+$GET(Y)=0)!($DATA(DIRUT)!$DATA(DIROUT)!$DATA(DTOUT)!$DATA(DUOUT)))
QUIT
End DoDot:1
IF (IOST["C")&((+$GET(Y)=0)!($DATA(DIRUT)!$DATA(DIROUT)!$DATA(DTOUT)!$DATA(DUOUT)))
QUIT
+57 ;end new HEAT161159
+58 QUIT
PTHSTFL ;EP
+1 SET ABMSDT=$PIECE($GET(^XTMP("ABM-PVP2",$JOB,"PRV TOP",ABMPRV)),U,2)
+2 KILL ABMDCNT
+3 ;start old abm*2.6*15 moved up so all providers will print in one HFS file
+4 ;D OPEN^%ZISH("ABM",ABMPATH,ABMFN,"W")
+5 ;Q:POP
+6 ;U IO
+7 ;end old abm*2.6*15
+8 SET ABM("PG")=1
+9 DO HDR
+10 WRITE !,"Visit Location"_U_"Patient"_U_"Chart#"_U_"Policy Holder ID"_U_"Serv Cat"_U_"Clinic"_U_"Provider NPI"_U_"InsType"_U_"BilledTo"
+11 WRITE 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."
+12 ;abm*2.6*15 HEAT183289
WRITE U_"Tribal self-insured"
+13 ;abm*2.6*15 HEAT164125
WRITE U_"MCD ST"
+14 ;abm*2.6*15 HEAT171490 and HEAT161159
WRITE U_"Facility NPI"_U_"Facility TIN"_U_"Record Indicator"
+15 IF ABMSDT=""
QUIT
+16 SET ABMVLOC=0
+17 FOR
SET ABMVLOC=$ORDER(^XTMP("ABM-PVP2",$JOB,"PT LST",ABMSDT,ABMPRV,ABMVLOC))
IF 'ABMVLOC
QUIT
Begin DoDot:1
+18 ;start old abm*2.6*15 HEAT161159
+19 ;S ABMITYP=""
+20 ;F S ABMITYP=$O(^XTMP("ABM-PVP2",$J,"PT LST",ABMSDT,ABMPRV,ABMVLOC,ABMITYP)) Q:ABMITYP="" D
+21 ;.S ABMINS=""
+22 ;.F S ABMINS=$O(^XTMP("ABM-PVP2",$J,"PT LST",ABMSDT,ABMPRV,ABMVLOC,ABMITYP,ABMINS)) Q:ABMINS="" D
+23 ;..S ABMPTL=""
+24 ;..F S ABMPTL=$O(^XTMP("ABM-PVP2",$J,"PT LST",ABMSDT,ABMPRV,ABMVLOC,ABMITYP,ABMINS,ABMPTL)) Q:ABMPTL="" D
+25 ;...S ABMPTF=""
+26 ;...F S ABMPTF=$O(^XTMP("ABM-PVP2",$J,"PT LST",ABMSDT,ABMPRV,ABMVLOC,ABMITYP,ABMINS,ABMPTL,ABMPTF)) Q:ABMPTF="" D
+27 ;....S ABMVDT=0
+28 ;....F S ABMVDT=$O(^XTMP("ABM-PVP2",$J,"PT LST",ABMSDT,ABMPRV,ABMVLOC,ABMITYP,ABMINS,ABMPTL,ABMPTF,ABMVDT)) Q:'ABMVDT D
+29 ;.....S ABMP("VDT")=ABMVDT
+30 ;.....S ABMVDFN=0
+31 ;.....F S ABMVDFN=$O(^XTMP("ABM-PVP2",$J,"PT LST",ABMSDT,ABMPRV,ABMVLOC,ABMITYP,ABMINS,ABMPTL,ABMPTF,ABMVDT,ABMVDFN)) Q:'ABMVDFN D
+32 ;......I +$G(^XTMP("ABM-PVP2",$J,"DUPS",ABMVDFN))=1 S ABMDCNT=+$G(ABMDCNT)+1
+33 ;......S ^XTMP("ABM-PVP2",$J,"DUPS",ABMVDFN)=1
+34 ;......S ABMPT=$P($G(^XTMP("ABM-PVP2",$J,"PT LST",ABMSDT,ABMPRV,ABMVLOC,ABMITYP,ABMINS,ABMPTL,ABMPTF,ABMVDT,ABMVDFN)),U,2)
+35 ;......S ABMTRIEN=$P($G(^XTMP("ABM-PVP2",$J,"PT LST",ABMSDT,ABMPRV,ABMVLOC,ABMITYP,ABMINS,ABMPTL,ABMPTF,ABMVDT,ABMVDFN)),U,3)
+36 ;......S IENS=ABMVLOC_","_ABMPT_","
+37 ;......S ABMHRN=$$GET1^DIQ(9000001.41,IENS,.02)
+38 ;......W !,$$GET1^DIQ(9999999.06,ABMVLOC,".02","E")
+39 ;......W U_ABMPTL_", "_ABMPTF
+40 ;......W U_ABMHRN
+41 ;......K ABML
+42 ;......D ELGCHK
+43 ;......S ABMMIEN=0
+44 ;......K ABMMCDN
+45 ;......I ($G(ABML("MCD"))!($G(ABML("CHIP")))) D
+46 ;.......S ABMMIEN=+$G(ABMP("SAVE"))
+47 ;.......I ABMMIEN D
+48 ;........S ABMMCDN=$P($G(^AUPNMCD(ABMMIEN,0)),U,3)
+49 ;.......I 'ABMMIEN D PRVTCHIP
+50 ;......I $G(ABMMCDN)'="" W U_ABMMCDN ;Medicaid # - policy holder ID
+51 ;......I 'ABMMIEN W U
+52 ;......W U_$$GET1^DIQ(9000010,ABMVDFN,.07,"E") ;Category
+53 ;......W U_$$GET1^DIQ(9000010,ABMVDFN,.08,"E") ;clinic
+54 ;......W U_$S($P($$NPI^XUSNPI("Individual_ID",+ABMPRV),U)>0:$P($$NPI^XUSNPI("Individual_ID",+ABMPRV),U),1:"") ;provider NPI
+55 ;......W U_$S(ABMITYP="X":"",1:ABMITYP) ;insurer type
+56 ;......W U_$S(ABMINS="NO BILL":"NOT BILLED",1:$E(ABMINS,1,10)) ;insurer
+57 ;......W U_$$CDT^ABMDUTL(ABMVDT) ;visit date
+58 ;......W U_$S(+ABMTRIEN:$$SDTO^ABMDUTL(ABMTRIEN),1:"") ;dt paid
+59 ;......S ABMREC=$G(^XTMP("ABM-PVP2",$J,"PT LST",ABMSDT,ABMPRV,ABMVLOC,ABMITYP,ABMINS,ABMPTL,ABMPTF,ABMVDT,ABMVDFN))
+60 ;......D ELGCHK
+61 ;......W U_$P($G(ABMREC),U,4)
+62 ;......W U_$P($G(ABMREC),U,5)
+63 ;......W U_$P($G(ABMREC),U,6)
+64 ;......W U_$P($G(ABMREC),U,7)
+65 ;......W U_ABMPI_U_ABMMCR_U_ABMMCD_U_ABMCHIP_U_ABMNI
+66 ;end old start new HEAT161159
+67 SET ABMVDT=0
+68 FOR
SET ABMVDT=$ORDER(^XTMP("ABM-PVP2",$JOB,"PT LST",ABMSDT,ABMPRV,ABMVLOC,ABMVDT))
IF 'ABMVDT
QUIT
Begin DoDot:2
+69 SET ABMP("VDT")=ABMVDT
+70 SET ABMVDFN=0
+71 FOR
SET ABMVDFN=$ORDER(^XTMP("ABM-PVP2",$JOB,"PT LST",ABMSDT,ABMPRV,ABMVLOC,ABMVDT,ABMVDFN))
IF 'ABMVDFN
QUIT
Begin DoDot:3
+72 IF +$GET(^XTMP("ABM-PVP2",$JOB,"DUPS",ABMVDFN))=1
SET ABMDCNT=+$GET(ABMDCNT)+1
+73 SET ^XTMP("ABM-PVP2",$JOB,"DUPS",ABMVDFN)=1
+74 SET ABMPT=$PIECE($GET(^XTMP("ABM-PVP2",$JOB,"PT LST",ABMSDT,ABMPRV,ABMVLOC,ABMVDT,ABMVDFN)),U,2)
+75 SET ABMTRIEN=$PIECE($GET(^XTMP("ABM-PVP2",$JOB,"PT LST",ABMSDT,ABMPRV,ABMVLOC,ABMVDT,ABMVDFN)),U,3)
+76 SET ABMREC=$GET(^XTMP("ABM-PVP2",$JOB,"PT LST",ABMSDT,ABMPRV,ABMVLOC,ABMVDT,ABMVDFN))
+77 SET ABMITYP=$PIECE(ABMREC,U,8)
+78 SET ABMINS=$PIECE(ABMREC,U,9)
+79 SET ABMPTL=$PIECE(ABMREC,U,10)
+80 SET ABMPTF=$PIECE(ABMREC,U,11)
+81 SET IENS=ABMVLOC_","_ABMPT_","
+82 SET ABMHRN=$$GET1^DIQ(9000001.41,IENS,.02)
+83 WRITE !,$$GET1^DIQ(9999999.06,ABMVLOC,".02","E")
+84 ;pt name
WRITE U_ABMPTL_", "_ABMPTF
+85 ;HRN
WRITE U_ABMHRN
+86 KILL ABML
+87 DO ELGCHK
+88 SET ABMMIEN=0
+89 KILL ABMMCDN
+90 IF ($GET(ABML("MCD"))!($GET(ABML("CHIP"))))
Begin DoDot:4
+91 SET ABMMIEN=+$GET(ABMP("SAVE"))
+92 IF ABMMIEN
Begin DoDot:5
+93 SET ABMMCDN=$PIECE($GET(^AUPNMCD(ABMMIEN,0)),U,3)
End DoDot:5
+94 IF 'ABMMIEN
DO PRVTCHIP
End DoDot:4
+95 ;Medicaid # - policy holder ID
IF $GET(ABMMCDN)'=""
WRITE U_ABMMCDN
+96 IF 'ABMMIEN
WRITE U
+97 ;Category
WRITE U_$$GET1^DIQ(9000010,ABMVDFN,.07,"E")
+98 ;clinic
WRITE U_$$GET1^DIQ(9000010,ABMVDFN,.08,"E")
+99 ;provider NPI
WRITE U_$SELECT($PIECE($$NPI^XUSNPI("Individual_ID",+ABMPRV),U)>0:$PIECE($$NPI^XUSNPI("Individual_ID",+ABMPRV),U),1:"")
+100 ;insurer type
WRITE U_$SELECT(ABMITYP="X":"",1:ABMITYP)
+101 ;insurer
WRITE U_$SELECT(ABMINS="NO BILL":"NOT BILLED",1:ABMINS)
+102 ;W U_$$CDT^ABMDUTL(ABMVDT) ;visit date ;abm*2.6*15 HEAT188548
+103 ;visit date ;abm*2.6*15 HEAT188548
WRITE U_$$BDT^ABMDUTL(ABMVDT)
+104 ;dt paid
WRITE U_$SELECT(+ABMTRIEN:$$SDTO^ABMDUTL(ABMTRIEN),1:"")
+105 ;abm*2.6*15 HEAT161159
KILL ABMPI,ABMMCR,ABMMCD,ABMCHIP,ABMNI
+106 DO ELGCHK
+107 WRITE U_$PIECE($GET(ABMREC),U,4)
+108 WRITE U_$PIECE($GET(ABMREC),U,5)
+109 WRITE U_$PIECE($GET(ABMREC),U,6)
+110 WRITE U_$PIECE($GET(ABMREC),U,7)
+111 ;W U_ABMPI_U_ABMMCR_U_ABMMCD_U_ABMCHIP_U_ABMNI ;abm*2.6*15 HEAT183289
+112 ;abm*2.6*15 HEAT183289
WRITE U_ABMPI_U_ABMMCR_U_ABMMCD_U_ABMCHIP_U_ABMNI_U_$GET(ABMTSI)
+113 ;abm*2.6*15 HEAT164125
WRITE U_$GET(ABMP("STATE"))
+114 ;visit location NPI abm*2.6*15 HEAT171490
WRITE U_$PIECE(ABMREC,U,13)
+115 ;visit location TIN abm*2.6*15 HEAT171490
WRITE U_$PIECE(ABMREC,U,14)
+116 ;record indicator abm*2.6*15 HEAT161159
WRITE U_$PIECE(ABMREC,U,15)
+117 ;start new abm*2.6*15 HEAT183289
+118 IF +$GET(ABMFQHC)=1
Begin DoDot:4
+119 IF +$GET(ABMICNT)=1&($GET(ABMTSI)="Y")
Begin DoDot:5
+120 ;write TSI if pt has TSI insurer only
WRITE "TSI"
+121 ;if TSI insurer paid
IF +$PIECE($GET(ABMREC),U,6)'=0
WRITE "-PD"
End DoDot:5
+122 ;write UNC if pt is needy individual
IF $GET(ABMNI)="Y"
WRITE "UNC"
End DoDot:4
+123 ;end new HEAT183289
End DoDot:3
End DoDot:2
End DoDot:1
+124 ;end new HEAT161159
+125 IF +$GET(ABMDCNT)>0
WRITE !!,"Duplicate visits for this period: "_ABMDCNT
+126 ;D CLOSE^%ZISH("ABM") ;abm*2.6*15 moved up so all providers will print in one file
+127 QUIT
PRVTCHIP ;
+1 SET ABMMIEN=0
+2 SET ABMFINS=0
+3 FOR
SET ABMMIEN=$ORDER(^AUPNPRVT(ABMPT,11,ABMMIEN))
IF 'ABMMIEN
QUIT
Begin DoDot:1
+4 IF '$DATA(ABMI("INS",$PIECE($GET(^AUPNPRVT(ABMPT,11,ABMMIEN,0)),U)))
QUIT
+5 SET ABMFINS=1
+6 SET IENS=ABMMIEN_","_ABMPT_","
+7 SET ABMMCDN=$$GET1^DIQ(9000006.11,IENS,21)
+8 IF ABMMCDN=""
SET ABMMCDN=$$GET1^DIQ(9000003.1,$PIECE($GET(^AUPNPRVT(ABMPT,11,ABMMIEN,0)),U,8),".04")
End DoDot:1
IF ABMFINS
QUIT
+9 QUIT
PTHDR ;
+1 ;start data on 2nd page of report
IF IOST["C"
IF (ABM("PG")=1)
DO HD
IF $DATA(DTOUT)!$DATA(DUOUT)!$DATA(DIROUT)
QUIT
+2 WRITE !,"VISIT LOCATION: ",$$GET1^DIQ(9999999.06,ABMVLOC,.02,"E"),!
+3 FOR ABM=1:1:80
WRITE "="
+4 WRITE !,?25,"Ser",?39,"I.",?42,"Billed",?53,"Date of",?70,"Date"
+5 WRITE !,"PATIENT NAME",?18,"CHART#",?25,"Cat",?29,"Clinic",?39,"T.",?42,"To",?53,"Service",?70,"Paid",!
+6 FOR ABM=1:1:80
WRITE "="
+7 QUIT
HD DO PAZ^ABMDRUTL
IF $DATA(DTOUT)!$DATA(DUOUT)!$DATA(DIROUT)
QUIT
+1 SET ABM("PG")=+$GET(ABM("PG"))+1
HDR ;EP
+1 DO HDR^ABMM2PV5
+2 QUIT
ELGCHK ;EP
+1 SET ABML=""
+2 DO ELIG^ABMM2PV8
+3 ;abm*2.6*15
SET (ABMMCR,ABMMCD,ABMPI,ABMCHIP,ABMNI)="N"
+4 ;start old abm*2.6*15 HEAT161159
+5 ;S ABMIT=""
+6 ;F S ABMIT=$O(ABMK(ABMIT)) Q:ABMIT="" D
+7 ;.I ABMIT="I"!(ABMIT="N") Q ;don't count ben and non-ben
+8 ;.I "^R^MH^MD^MC^MMC^"[("^"_ABMIT_"^") S ABMMCR="Y"
+9 ;.I ABMIT="D"!(ABMIT="FPL") S ABMMCD="Y"
+10 ;.I (ABMIT="K")!($D(ABMI("INS",ABMINS))) S ABMCHIP="Y"
+11 ;.;I (("^D^FPL^K^R^MH^MD^MC^MMC^"'[("^"_ABMIT_"^"))&('(ABMIT="P"&($D(ABMI("INS",ABMINS)))))) S ABMPI="Y"
+12 ;.I (("^D^FPL^K^R^MH^MD^MC^MMC^"'[("^"_ABMIT_"^"))&('($D(ABMI("INS",ABMINS))))) S ABMPI="Y"
+13 ;I ABMMCD="Y"&(ABMCHIP="Y") S ABMMCD="N" ;can't cnt in both
+14 ;I ABMMCR="N",ABMMCD="N",ABMPI="N",ABMCHIP="N" S ABMNI="Y"
+15 ;end old start new HEAT161159
+16 SET ABMJ("INS")=0
+17 FOR
SET ABMJ("INS")=$ORDER(ABMILST(ABMJ("INS")))
IF 'ABMJ("INS")
QUIT
Begin DoDot:1
+18 SET ABMIT=$GET(ABMILST(ABMJ("INS")))
+19 ;don't count ben and non-ben
IF ABMIT="I"!(ABMIT="N")
QUIT
+20 IF "^R^MH^MD^MC^MMC^"[("^"_ABMIT_"^")
SET ABMMCR="Y"
+21 ;I ABMIT="D"!(ABMIT="FPL") S ABMMCD="Y"
+22 IF ABMIT="D"
SET ABMMCD="Y"
SET ABMP("STATE")=$GET(ABMILST("STATE",ABMJ("INS")))
+23 IF (ABMIT="K")!($DATA(ABMI("INS",ABMJ("INS"))))
SET ABMCHIP="Y"
+24 IF (("^D^K^R^MH^MD^MC^MMC^"'[("^"_ABMIT_"^"))&('($DATA(ABMI("INS",ABMJ("INS"))))))
SET ABMPI="Y"
End DoDot:1
+25 ;I ABMMCD="Y"&(ABMCHIP="Y") S ABMMCD="N" ;can't cnt in both ;abm*2.6*15
+26 ;can't cnt in both if counting CHIP ;abm*2.6*15
IF ABMMCD="Y"&(ABMCHIP="Y")&($DATA(ABMI("INS")))
SET ABMMCD="N"
+27 IF ABMMCR="N"
IF ABMMCD="N"
IF ABMPI="N"
IF ABMCHIP="N"
SET ABMNI="Y"
+28 ;end new HEAT161159
+29 QUIT