ABME5L7 ; IHS/ASDST/DMJ - Header
;;2.6;IHS 3P BILLING SYSTEM;**6,8,9,10,21**;NOV 12, 2009;Build 379
;Header Segments
;IHS/SD/SDR - 2.6*21 - HEAT70826 - Modified to remove 2310B loop based on SGTM entry
;
EP ;START HERE
N ABM
D GETPRV^ABMEEPRV ; Build Claim Level Provider array
S ABMPAYER=ABMP("INS")
;
; Loop 2310A - Attending Physician Name
S ABMLOOP="2310A"
I $D(ABMP("PRV","A")) D
.Q:$G(ABMP("CLIN"))="A3"
.S ABM("PRV")=$O(ABMP("PRV","A",0))
.D EP^ABME5NM1("71")
.D WR^ABMUTL8("NM1")
.D EP^ABME5PRV("AT",ABM("PRV")) ;5010 837P
.D WR^ABMUTL8("PRV") ;5010 837P
.I ABMNPIU="N" D
..;Q:(ABMNPIU="N")&(ABMP("EXP")=21)&(($P($G(^AUTNINS(ABMP("INS"),0)),U)="OKLAHOMA MEDICAID")!($P($G(^AUTNINS(ABMP("INS"),0)),U)["OK MEDICAID")) ;Remove REF, OK Medicaid only ;abm*2.6*8 5010
..Q:(ABMNPIU="N")&(ABMP("EXP")=31)&(($P($G(^AUTNINS(ABMP("INS"),0)),U)="OKLAHOMA MEDICAID")!($P($G(^AUTNINS(ABMP("INS"),0)),U)["OK MEDICAID")) ;Remove REF, OK Medicaid only ;abm*2.6*8 5010
..Q:((ABMRCID="99999")!(ABMRCID="AHCCCS866004791")) ;AZ Medicaid
..;D EP^ABME5REF("EI",9999999.06,DUZ(2))
..;D WR^ABMUTL8("REF")
.I ABMNPIU'="N" D
..I ABMRCID="FHC&AFFILIATES"!($P($G(^AUTNINS(ABMP("INS"),0)),U)="NORTH DAKOTA MEDICAID") D
...;D EP^ABME5REF("LU",9999999.06,ABMP("LDFN")) ;abm*2.6*10 IHS/SD/AML 3/30/12 Change for ND MCD NOHEAT
...D EP^ABME5REF("G2",9999999.06,ABMP("LDFN")) ;abm*2.6*10 IHS/SD/AML 3/30/12 Change for ND MCD NOHEAT
...D WR^ABMUTL8("REF")
..E D EP^ABME5REF(ABMP("RTYPE"),200,ABM("PRV")),WR^ABMUTL8("REF")
K ABMLOOP
;
; Loop 2310B - Operating Physician Name
S ABMLOOP="2310B"
I $D(ABMP("PRV","O")) D
.Q:$$RCID^ABMUTLP(ABMP("INS"))=731476619
.;start new abm*2.6*21 IHS/SD/SDR HEAT70826
.S ABMOFLG=0
.I $D(^ABMNINS(ABMP("LDFN"),ABMP("INS"),2.5,"ASEND",ABMP("EXP"),"2310B","00","0","N"))>0 D
..S ABMO=0
..F S ABMO=$O(^ABMNINS(ABMP("LDFN"),ABMP("INS"),2.5,"ASEND",ABMP("EXP"),"2310B","00","0","N",ABMO)) Q:'ABMO D
...I $P($G(^ABMNINS(ABMP("LDFN"),ABMP("INS"),2.5,ABMO,0)),U,6)=""!($P($G(^ABMNINS(ABMP("LDFN"),ABMP("INS"),2.5,ABMO,0)),U,6)=ABMP("VTYP")) S ABMOFLG=1
.Q:ABMOFLG=1
.;end new abm*2.6*21 IHS/SD/SDR HEAT70826
.S ABM("PRV")=$O(ABMP("PRV","O",0))
.D EP^ABME5NM1("72")
.D WR^ABMUTL8("NM1")
.;start old code abm*2.6*10 IHS/SD/AML NOHEAT remove EI if NPI ONLY
.;I ABMNPIU="N" D
.;.;D EP^ABME5REF("EI",9999999.06,DUZ(2)) ;abm*2.6*9 HEAT57488 IHS/SD/AML - Removed "EI" qualifier as not allowed in 5010
.;.;Q:(ABMNPIU="N")&(ABMP("EXP")=21)&(($P($G(^AUTNINS(ABMP("INS"),0)),U)="OKLAHOMA MEDICAID")!($P($G(^AUTNINS(ABMP("INS"),0)),U)["OK MEDICAID")) ;Remove REF, OK Medicaid only ;abm*2.6*8 5010
.;.Q:(ABMNPIU="N")&(ABMP("EXP")=31)&(($P($G(^AUTNINS(ABMP("INS"),0)),U)="OKLAHOMA MEDICAID")!($P($G(^AUTNINS(ABMP("INS"),0)),U)["OK MEDICAID")) ;Remove REF, OK Medicaid only ;abm*2.6*8 5010
.;.Q:((ABMRCID="99999")!(ABMRCID="AHCCCS866004791")) ;AZ Medicaid
.;.;D WR^ABMUTL8("REF") ;abm*2.6*9 HEAT57488 IHS/SD/AML 1/20/2012
.;end old code abm*2.6*10 NO HEAT
.I ABMNPIU'="N" D
..I ABMRCID="FHC&AFFILIATES" D
...D EP^ABME5REF("LU",9999999.06,ABMP("LDFN"))
...D WR^ABMUTL8("REF")
..E D EP^ABME5REF(ABMP("RTYPE"),200,ABM("PRV")),WR^ABMUTL8("REF")
;
; Loop 2310C - Other Operating Physician
S ABMLOOP="2310C"
;
; Loop 2310D - Rendering Provider Name
S ABMLOOP="2310D"
I $D(ABMP("PRV","R")) D
.S ABM("PRV")=$O(ABMP("PRV","R",0))
.I $O(ABMP("PRV","R",0))=$O(ABMP("PRV","A",0)) Q ;don't write if Attending=Rendering
.D EP^ABME5NM1("82")
.D WR^ABMUTL8("NM1")
.I ABMNPIU'="N" D
..I ABMRCID="FHC&AFFILIATES"!($P($G(^AUTNINS(ABMP("INS"),0)),U)="NORTH DAKOTA MEDICAID") D
...D EP^ABME5REF("LU",9999999.06,ABMP("LDFN"))
...D WR^ABMUTL8("REF")
..E D EP^ABME5REF(ABMP("RTYPE"),200,ABM("PRV")),WR^ABMUTL8("REF")
;
; Loop 2310E - Service Facility Name
S ABMLOOP="2310E"
;I ABMP("LDFN")'=DUZ(2) D ;abm*2.6*9 HEAT57746
S ABMSLOC=$P($G(^ABMNINS(ABMP("LDFN"),ABMP("INS"),1,ABMP("VTYP"),1)),U,17) ;abm*2.6*9 HEAT57746
I ((ABMSLOC="S")!((ABMSLOC="D")!(ABMSLOC="")&($P($G(^DIC(4,DUZ(2),0)),U)'=$P($G(^DIC(4,ABMP("LDFN"),0)),U)))) D ;abm*2.6*8 ;abm*2.6*9 HEAT57746
.D EP^ABME5NM1("77")
.D WR^ABMUTL8("NM1")
.D EP^ABME5N3(4,ABMP("LDFN"))
.D WR^ABMUTL8("N3")
.D EP^ABME5N4(4,ABMP("LDFN"))
.D WR^ABMUTL8("N4")
.I ABMNPIU'="N" D
..I ABMP("ITYPE")="R" D
...D EP^ABME5REF("1C",9999999.06,ABMP("LDFN"))
...D WR^ABMUTL8("REF")
..I ABMP("ITYPE")="D"!(ABMP("ITYPE")="K") D
...D EP^ABME5REF("1D",9999999.06,ABMP("LDFN"))
...D WR^ABMUTL8("REF")
;
; Loop 2310F - Referrring Provider Name
S ABMLOOP="2310F"
I $D(ABMP("PRV","F")) D
.S ABM("PRV")=$O(ABMP("PRV","F",0))
.I $O(ABMP("PRV","A",0))=$O(ABMP("PRV","F",0)) Q ;don't write if Attending=Referring (from page 3)
.;don't write if attending NPI equals NPI entered on page 3 for referring
.I (+$O(ABMP("PRV","A",0))'=0),(+$O(ABMP("PRV","F",0))=0)&($D(ABMP("PRV","F"))),$P($$NPI^XUSNPI("Individual_ID",$O(ABMP("PRV","A",0))),U)=$P(ABMP("PRV","F",$O(ABMP("PRV","F",""))),U,3) Q ;abm*2.6*10 HEAT67469
.D EP^ABME5NM1("DN")
.D WR^ABMUTL8("NM1")
.I ABMNPIU'="N" D
..I ABMRCID="FHC&AFFILIATES"!($P($G(^AUTNINS(ABMP("INS"),0)),U)="NORTH DAKOTA MEDICAID") D
...D EP^ABME5REF("LU",9999999.06,ABMP("LDFN"))
...D WR^ABMUTL8("REF")
..E D EP^ABME5REF(ABMP("RTYPE"),200,ABM("PRV")),WR^ABMUTL8("REF")
Q
ABME5L7 ; IHS/ASDST/DMJ - Header
+1 ;;2.6;IHS 3P BILLING SYSTEM;**6,8,9,10,21**;NOV 12, 2009;Build 379
+2 ;Header Segments
+3 ;IHS/SD/SDR - 2.6*21 - HEAT70826 - Modified to remove 2310B loop based on SGTM entry
+4 ;
EP ;START HERE
+1 NEW ABM
+2 ; Build Claim Level Provider array
DO GETPRV^ABMEEPRV
+3 SET ABMPAYER=ABMP("INS")
+4 ;
+5 ; Loop 2310A - Attending Physician Name
+6 SET ABMLOOP="2310A"
+7 IF $DATA(ABMP("PRV","A"))
Begin DoDot:1
+8 IF $GET(ABMP("CLIN"))="A3"
QUIT
+9 SET ABM("PRV")=$ORDER(ABMP("PRV","A",0))
+10 DO EP^ABME5NM1("71")
+11 DO WR^ABMUTL8("NM1")
+12 ;5010 837P
DO EP^ABME5PRV("AT",ABM("PRV"))
+13 ;5010 837P
DO WR^ABMUTL8("PRV")
+14 IF ABMNPIU="N"
Begin DoDot:2
+15 ;Q:(ABMNPIU="N")&(ABMP("EXP")=21)&(($P($G(^AUTNINS(ABMP("INS"),0)),U)="OKLAHOMA MEDICAID")!($P($G(^AUTNINS(ABMP("INS"),0)),U)["OK MEDICAID")) ;Remove REF, OK Medicaid only ;abm*2.6*8 5010
+16 ;Remove REF, OK Medicaid only ;abm*2.6*8 5010
IF (ABMNPIU="N")&(ABMP("EXP")=31)&(($PIECE($GET(^AUTNINS(ABMP("INS"),0)),U)="OKLAHOMA MEDICAID")!($PIECE($GET(^AUTNINS(ABMP("INS"),0)),U)["OK MEDICAID"))
QUIT
+17 ;AZ Medicaid
IF ((ABMRCID="99999")!(ABMRCID="AHCCCS866004791"))
QUIT
+18 ;D EP^ABME5REF("EI",9999999.06,DUZ(2))
+19 ;D WR^ABMUTL8("REF")
End DoDot:2
+20 IF ABMNPIU'="N"
Begin DoDot:2
+21 IF ABMRCID="FHC&AFFILIATES"!($PIECE($GET(^AUTNINS(ABMP("INS"),0)),U)="NORTH DAKOTA MEDICAID")
Begin DoDot:3
+22 ;D EP^ABME5REF("LU",9999999.06,ABMP("LDFN")) ;abm*2.6*10 IHS/SD/AML 3/30/12 Change for ND MCD NOHEAT
+23 ;abm*2.6*10 IHS/SD/AML 3/30/12 Change for ND MCD NOHEAT
DO EP^ABME5REF("G2",9999999.06,ABMP("LDFN"))
+24 DO WR^ABMUTL8("REF")
End DoDot:3
+25 IF '$TEST
DO EP^ABME5REF(ABMP("RTYPE"),200,ABM("PRV"))
DO WR^ABMUTL8("REF")
End DoDot:2
End DoDot:1
+26 KILL ABMLOOP
+27 ;
+28 ; Loop 2310B - Operating Physician Name
+29 SET ABMLOOP="2310B"
+30 IF $DATA(ABMP("PRV","O"))
Begin DoDot:1
+31 IF $$RCID^ABMUTLP(ABMP("INS"))=731476619
QUIT
+32 ;start new abm*2.6*21 IHS/SD/SDR HEAT70826
+33 SET ABMOFLG=0
+34 IF $DATA(^ABMNINS(ABMP("LDFN"),ABMP("INS"),2.5,"ASEND",ABMP("EXP"),"2310B","00","0","N"))>0
Begin DoDot:2
+35 SET ABMO=0
+36 FOR
SET ABMO=$ORDER(^ABMNINS(ABMP("LDFN"),ABMP("INS"),2.5,"ASEND",ABMP("EXP"),"2310B","00","0","N",ABMO))
IF 'ABMO
QUIT
Begin DoDot:3
+37 IF $PIECE($GET(^ABMNINS(ABMP("LDFN"),ABMP("INS"),2.5,ABMO,0)),U,6)=""!($PIECE($GET(^ABMNINS(ABMP("LDFN"),ABMP("INS"),2.5,ABMO,0)),U,6)=ABMP("VTYP"))
SET ABMOFLG=1
End DoDot:3
End DoDot:2
+38 IF ABMOFLG=1
QUIT
+39 ;end new abm*2.6*21 IHS/SD/SDR HEAT70826
+40 SET ABM("PRV")=$ORDER(ABMP("PRV","O",0))
+41 DO EP^ABME5NM1("72")
+42 DO WR^ABMUTL8("NM1")
+43 ;start old code abm*2.6*10 IHS/SD/AML NOHEAT remove EI if NPI ONLY
+44 ;I ABMNPIU="N" D
+45 ;.;D EP^ABME5REF("EI",9999999.06,DUZ(2)) ;abm*2.6*9 HEAT57488 IHS/SD/AML - Removed "EI" qualifier as not allowed in 5010
+46 ;.;Q:(ABMNPIU="N")&(ABMP("EXP")=21)&(($P($G(^AUTNINS(ABMP("INS"),0)),U)="OKLAHOMA MEDICAID")!($P($G(^AUTNINS(ABMP("INS"),0)),U)["OK MEDICAID")) ;Remove REF, OK Medicaid only ;abm*2.6*8 5010
+47 ;.Q:(ABMNPIU="N")&(ABMP("EXP")=31)&(($P($G(^AUTNINS(ABMP("INS"),0)),U)="OKLAHOMA MEDICAID")!($P($G(^AUTNINS(ABMP("INS"),0)),U)["OK MEDICAID")) ;Remove REF, OK Medicaid only ;abm*2.6*8 5010
+48 ;.Q:((ABMRCID="99999")!(ABMRCID="AHCCCS866004791")) ;AZ Medicaid
+49 ;.;D WR^ABMUTL8("REF") ;abm*2.6*9 HEAT57488 IHS/SD/AML 1/20/2012
+50 ;end old code abm*2.6*10 NO HEAT
+51 IF ABMNPIU'="N"
Begin DoDot:2
+52 IF ABMRCID="FHC&AFFILIATES"
Begin DoDot:3
+53 DO EP^ABME5REF("LU",9999999.06,ABMP("LDFN"))
+54 DO WR^ABMUTL8("REF")
End DoDot:3
+55 IF '$TEST
DO EP^ABME5REF(ABMP("RTYPE"),200,ABM("PRV"))
DO WR^ABMUTL8("REF")
End DoDot:2
End DoDot:1
+56 ;
+57 ; Loop 2310C - Other Operating Physician
+58 SET ABMLOOP="2310C"
+59 ;
+60 ; Loop 2310D - Rendering Provider Name
+61 SET ABMLOOP="2310D"
+62 IF $DATA(ABMP("PRV","R"))
Begin DoDot:1
+63 SET ABM("PRV")=$ORDER(ABMP("PRV","R",0))
+64 ;don't write if Attending=Rendering
IF $ORDER(ABMP("PRV","R",0))=$ORDER(ABMP("PRV","A",0))
QUIT
+65 DO EP^ABME5NM1("82")
+66 DO WR^ABMUTL8("NM1")
+67 IF ABMNPIU'="N"
Begin DoDot:2
+68 IF ABMRCID="FHC&AFFILIATES"!($PIECE($GET(^AUTNINS(ABMP("INS"),0)),U)="NORTH DAKOTA MEDICAID")
Begin DoDot:3
+69 DO EP^ABME5REF("LU",9999999.06,ABMP("LDFN"))
+70 DO WR^ABMUTL8("REF")
End DoDot:3
+71 IF '$TEST
DO EP^ABME5REF(ABMP("RTYPE"),200,ABM("PRV"))
DO WR^ABMUTL8("REF")
End DoDot:2
End DoDot:1
+72 ;
+73 ; Loop 2310E - Service Facility Name
+74 SET ABMLOOP="2310E"
+75 ;I ABMP("LDFN")'=DUZ(2) D ;abm*2.6*9 HEAT57746
+76 ;abm*2.6*9 HEAT57746
SET ABMSLOC=$PIECE($GET(^ABMNINS(ABMP("LDFN"),ABMP("INS"),1,ABMP("VTYP"),1)),U,17)
+77 ;abm*2.6*8 ;abm*2.6*9 HEAT57746
IF ((ABMSLOC="S")!((ABMSLOC="D")!(ABMSLOC="")&($PIECE($GET(^DIC(4,DUZ(2),0)),U)'=$PIECE($GET(^DIC(4,ABMP("LDFN"),0)),U))))
Begin DoDot:1
+78 DO EP^ABME5NM1("77")
+79 DO WR^ABMUTL8("NM1")
+80 DO EP^ABME5N3(4,ABMP("LDFN"))
+81 DO WR^ABMUTL8("N3")
+82 DO EP^ABME5N4(4,ABMP("LDFN"))
+83 DO WR^ABMUTL8("N4")
+84 IF ABMNPIU'="N"
Begin DoDot:2
+85 IF ABMP("ITYPE")="R"
Begin DoDot:3
+86 DO EP^ABME5REF("1C",9999999.06,ABMP("LDFN"))
+87 DO WR^ABMUTL8("REF")
End DoDot:3
+88 IF ABMP("ITYPE")="D"!(ABMP("ITYPE")="K")
Begin DoDot:3
+89 DO EP^ABME5REF("1D",9999999.06,ABMP("LDFN"))
+90 DO WR^ABMUTL8("REF")
End DoDot:3
End DoDot:2
End DoDot:1
+91 ;
+92 ; Loop 2310F - Referrring Provider Name
+93 SET ABMLOOP="2310F"
+94 IF $DATA(ABMP("PRV","F"))
Begin DoDot:1
+95 SET ABM("PRV")=$ORDER(ABMP("PRV","F",0))
+96 ;don't write if Attending=Referring (from page 3)
IF $ORDER(ABMP("PRV","A",0))=$ORDER(ABMP("PRV","F",0))
QUIT
+97 ;don't write if attending NPI equals NPI entered on page 3 for referring
+98 ;abm*2.6*10 HEAT67469
IF (+$ORDER(ABMP("PRV","A",0))'=0)
IF (+$ORDER(ABMP("PRV","F",0))=0)&($DATA(ABMP("PRV","F")))
IF $PIECE($$NPI^XUSNPI("Individual_ID",$ORDER(ABMP("PRV","A",0))),U)=$PIECE(ABMP("PRV","F",$ORDER(ABMP("PRV","F",""))),U,3)
QUIT
+99 DO EP^ABME5NM1("DN")
+100 DO WR^ABMUTL8("NM1")
+101 IF ABMNPIU'="N"
Begin DoDot:2
+102 IF ABMRCID="FHC&AFFILIATES"!($PIECE($GET(^AUTNINS(ABMP("INS"),0)),U)="NORTH DAKOTA MEDICAID")
Begin DoDot:3
+103 DO EP^ABME5REF("LU",9999999.06,ABMP("LDFN"))
+104 DO WR^ABMUTL8("REF")
End DoDot:3
+105 IF '$TEST
DO EP^ABME5REF(ABMP("RTYPE"),200,ABM("PRV"))
DO WR^ABMUTL8("REF")
End DoDot:2
End DoDot:1
+106 QUIT