ABME8CLM ; IHS/ASDST/DMJ - 837 CLM Segment
;;2.6;IHS 3P BILLING SYSTEM;;NOV 12, 2009
;Health Claim
;
; IHS/SD/SDR - v2.5 p9 - IM18516
; Delayed Reason Code added inCLM20
;
; IHS/SD/SDR - v2.5 p10 - COB issue
; Added code to change CLM02 amount if COB claim (use original
; bill amount)
;
START ;EP - START HERE
K ABMREC("CLM"),ABMR("CLM")
S ABME("RTYPE")="CLM"
D LOOP
K ABME,ABM
Q
LOOP ;LOOP HERE
F I=10:10:210 D
.D @I
.I $D(^ABMEXLM("AA",+$G(ABMP("INS")),+$G(ABMP("EXP")),ABME("RTYPE"),I)) D @(^(I))
.I $G(ABMREC("CLM"))'="" S ABMREC("CLM")=ABMREC("CLM")_"*"
.S ABMREC("CLM")=$G(ABMREC("CLM"))_ABMR("CLM",I)
Q
10 ;segment
S ABMR("CLM",10)="CLM"
Q
20 ;CLM01 - Claim Submitter's Identifier
S ABMR("CLM",20)=ABMP("PCN")
Q
30 ;CLM02 - Monetary Amount
S ABMR("CLM",30)=$P(ABMB2,U) ;bill amount
I ABMPSQ'=1,(+$P(ABMB2,U,7)'=0) S ABMR("CLM",30)=$P(ABMB2,U,7)
S ABMR("CLM",30)=$J(ABMR("CLM",30),0,2)
Q
40 ;CLM03 - Claim Filing Indicator Code-not used
S ABMR("CLM",40)=""
Q
50 ;CLM04 - Non-Institutional Claim Type Code-not used
S ABMR("CLM",50)=""
Q
60 ;CLM05 - Health Care Service Location Information
I ABMP("EXP")=21 D ;837I
.S ABMR("CLM",60)=$E(ABMP("BTYP"),1,2)
.S $P(ABMR("CLM",60),":",2)="A"
.S $P(ABMR("CLM",60),":",3)=$E(ABMP("BTYP"),3)
I ABMP("EXP")'=21 D
.S ABMR("CLM",60)=$$POS^ABMERUTL()
.S $P(ABMR("CLM",60),":",3)=1
Q
70 ;CLM06 - Provider Signature on File
S ABMR("CLM",70)="Y"
Q
80 ;CLM07 - Provider Accept Assignment Code
S ABMR("CLM",80)="A"
Q
90 ;CLM08 - Assignment of Benefits Indicator
S ABMR("CLM",90)=$P(ABMB7,"^",5)
Q
100 ;CLM09 - Release of Information Code
S ABMR("CLM",100)=$P(ABMB7,"^",4)
I ABMR("CLM",100)="R" S ABMR("CLM",100)="M"
Q
110 ;CLM10 - Patient Signature Source-not used
I ABMP("EXP")'=22 D
.S ABMR("CLM",110)=""
I ABMP("EXP")=22 D
.S ABMR("CLM",110)=""
.I ABMR("CLM",90)="Y" S ABMR("CLM",110)="M"
.Q:ABMR("CLM",100)="N"
.I ABMR("CLM",90)="N" S ABMR("CLM",110)="S" Q
.S ABMR("CLM",110)="B"
Q
120 ;CLM11 - Related Causes Information
I ABMP("EXP")=21 S ABMR("CLM",120)="" Q
N X
S X=$P(ABMB8,"^",3)
I X="" S ABMR("CLM",120)="" Q
S ABMR("CLM",120)=$S(X=1:"AA",X=4:"EM",1:"OA")
I ABMR("CLM",120)="AA" D
.S X=$P(^AUTTLOC(ABMP("LDFN"),0),"^",14)
.S X=$P(^DIC(5,+X,0),"^",2)
.S ABMR("CLM",120)="AA:::"_X
Q
130 ;CLM12 - Special Programs Code
I ABMP("EXP")=21 S ABMR("CLM",130)="" Q
S ABMR("CLM",130)=$O(^ABMDBILL(DUZ(2),ABMP("BDFN"),59,0))
Q:ABMR("CLM",130)=""
S ABMR("CLM",130)=$P($G(^ABMDCODE(ABMR("CLM",130),0)),U)
Q
140 ;CLM13 - Yes/No-not used
S ABMR("CLM",140)=""
Q
150 ;CLM14 - Level of Service Code-not used
S ABMR("CLM",150)=""
Q
160 ;CLM15 - Yes/No-not used
S ABMR("CLM",160)=""
Q
170 ;CLM16 - Provider Agreement Code-not used
S ABMR("CLM",170)=""
Q
180 ;CLM17 - Claim Status Code-not used
S ABMR("CLM",180)=""
Q
190 ;CLM18 - Explanation of Benefits Indicator
I ABMP("EXP")=21 D
.S ABMR("CLM",190)="Y"
I ABMP("EXP")'=21 D
.S ABMR("CLM",190)=""
Q
200 ;CLM19 - Claim Submission Reason Code-not used
S ABMR("CLM",200)=""
Q
210 ;CLM20 - Delay Reason Code
S ABMR("CLM",210)=""
S ABMDRC=$P($G(^ABMDBILL(DUZ(2),ABMP("BDFN"),9)),"^",16)
I ABMDRC'="" S ABMR("CLM",210)=$P($G(^ABMDCODE(ABMDRC,0)),"^")
Q
ABME8CLM ; IHS/ASDST/DMJ - 837 CLM Segment
+1 ;;2.6;IHS 3P BILLING SYSTEM;;NOV 12, 2009
+2 ;Health Claim
+3 ;
+4 ; IHS/SD/SDR - v2.5 p9 - IM18516
+5 ; Delayed Reason Code added inCLM20
+6 ;
+7 ; IHS/SD/SDR - v2.5 p10 - COB issue
+8 ; Added code to change CLM02 amount if COB claim (use original
+9 ; bill amount)
+10 ;
START ;EP - START HERE
+1 KILL ABMREC("CLM"),ABMR("CLM")
+2 SET ABME("RTYPE")="CLM"
+3 DO LOOP
+4 KILL ABME,ABM
+5 QUIT
LOOP ;LOOP HERE
+1 FOR I=10:10:210
Begin DoDot:1
+2 DO @I
+3 IF $DATA(^ABMEXLM("AA",+$GET(ABMP("INS")),+$GET(ABMP("EXP")),ABME("RTYPE"),I))
DO @(^(I))
+4 IF $GET(ABMREC("CLM"))'=""
SET ABMREC("CLM")=ABMREC("CLM")_"*"
+5 SET ABMREC("CLM")=$GET(ABMREC("CLM"))_ABMR("CLM",I)
End DoDot:1
+6 QUIT
10 ;segment
+1 SET ABMR("CLM",10)="CLM"
+2 QUIT
20 ;CLM01 - Claim Submitter's Identifier
+1 SET ABMR("CLM",20)=ABMP("PCN")
+2 QUIT
30 ;CLM02 - Monetary Amount
+1 ;bill amount
SET ABMR("CLM",30)=$PIECE(ABMB2,U)
+2 IF ABMPSQ'=1
IF (+$PIECE(ABMB2,U,7)'=0)
SET ABMR("CLM",30)=$PIECE(ABMB2,U,7)
+3 SET ABMR("CLM",30)=$JUSTIFY(ABMR("CLM",30),0,2)
+4 QUIT
40 ;CLM03 - Claim Filing Indicator Code-not used
+1 SET ABMR("CLM",40)=""
+2 QUIT
50 ;CLM04 - Non-Institutional Claim Type Code-not used
+1 SET ABMR("CLM",50)=""
+2 QUIT
60 ;CLM05 - Health Care Service Location Information
+1 ;837I
IF ABMP("EXP")=21
Begin DoDot:1
+2 SET ABMR("CLM",60)=$EXTRACT(ABMP("BTYP"),1,2)
+3 SET $PIECE(ABMR("CLM",60),":",2)="A"
+4 SET $PIECE(ABMR("CLM",60),":",3)=$EXTRACT(ABMP("BTYP"),3)
End DoDot:1
+5 IF ABMP("EXP")'=21
Begin DoDot:1
+6 SET ABMR("CLM",60)=$$POS^ABMERUTL()
+7 SET $PIECE(ABMR("CLM",60),":",3)=1
End DoDot:1
+8 QUIT
70 ;CLM06 - Provider Signature on File
+1 SET ABMR("CLM",70)="Y"
+2 QUIT
80 ;CLM07 - Provider Accept Assignment Code
+1 SET ABMR("CLM",80)="A"
+2 QUIT
90 ;CLM08 - Assignment of Benefits Indicator
+1 SET ABMR("CLM",90)=$PIECE(ABMB7,"^",5)
+2 QUIT
100 ;CLM09 - Release of Information Code
+1 SET ABMR("CLM",100)=$PIECE(ABMB7,"^",4)
+2 IF ABMR("CLM",100)="R"
SET ABMR("CLM",100)="M"
+3 QUIT
110 ;CLM10 - Patient Signature Source-not used
+1 IF ABMP("EXP")'=22
Begin DoDot:1
+2 SET ABMR("CLM",110)=""
End DoDot:1
+3 IF ABMP("EXP")=22
Begin DoDot:1
+4 SET ABMR("CLM",110)=""
+5 IF ABMR("CLM",90)="Y"
SET ABMR("CLM",110)="M"
+6 IF ABMR("CLM",100)="N"
QUIT
+7 IF ABMR("CLM",90)="N"
SET ABMR("CLM",110)="S"
QUIT
+8 SET ABMR("CLM",110)="B"
End DoDot:1
+9 QUIT
120 ;CLM11 - Related Causes Information
+1 IF ABMP("EXP")=21
SET ABMR("CLM",120)=""
QUIT
+2 NEW X
+3 SET X=$PIECE(ABMB8,"^",3)
+4 IF X=""
SET ABMR("CLM",120)=""
QUIT
+5 SET ABMR("CLM",120)=$SELECT(X=1:"AA",X=4:"EM",1:"OA")
+6 IF ABMR("CLM",120)="AA"
Begin DoDot:1
+7 SET X=$PIECE(^AUTTLOC(ABMP("LDFN"),0),"^",14)
+8 SET X=$PIECE(^DIC(5,+X,0),"^",2)
+9 SET ABMR("CLM",120)="AA:::"_X
End DoDot:1
+10 QUIT
130 ;CLM12 - Special Programs Code
+1 IF ABMP("EXP")=21
SET ABMR("CLM",130)=""
QUIT
+2 SET ABMR("CLM",130)=$ORDER(^ABMDBILL(DUZ(2),ABMP("BDFN"),59,0))
+3 IF ABMR("CLM",130)=""
QUIT
+4 SET ABMR("CLM",130)=$PIECE($GET(^ABMDCODE(ABMR("CLM",130),0)),U)
+5 QUIT
140 ;CLM13 - Yes/No-not used
+1 SET ABMR("CLM",140)=""
+2 QUIT
150 ;CLM14 - Level of Service Code-not used
+1 SET ABMR("CLM",150)=""
+2 QUIT
160 ;CLM15 - Yes/No-not used
+1 SET ABMR("CLM",160)=""
+2 QUIT
170 ;CLM16 - Provider Agreement Code-not used
+1 SET ABMR("CLM",170)=""
+2 QUIT
180 ;CLM17 - Claim Status Code-not used
+1 SET ABMR("CLM",180)=""
+2 QUIT
190 ;CLM18 - Explanation of Benefits Indicator
+1 IF ABMP("EXP")=21
Begin DoDot:1
+2 SET ABMR("CLM",190)="Y"
End DoDot:1
+3 IF ABMP("EXP")'=21
Begin DoDot:1
+4 SET ABMR("CLM",190)=""
End DoDot:1
+5 QUIT
200 ;CLM19 - Claim Submission Reason Code-not used
+1 SET ABMR("CLM",200)=""
+2 QUIT
210 ;CLM20 - Delay Reason Code
+1 SET ABMR("CLM",210)=""
+2 SET ABMDRC=$PIECE($GET(^ABMDBILL(DUZ(2),ABMP("BDFN"),9)),"^",16)
+3 IF ABMDRC'=""
SET ABMR("CLM",210)=$PIECE($GET(^ABMDCODE(ABMDRC,0)),"^")
+4 QUIT