ABME8SV2 ; IHS/ASDST/DMJ - 837 SV2 Segment
;;2.6;IHS 3P BILLING SYSTEM;;NOV 12, 2009
;Transaction Set Header
;
; IHS/SD/SDR - v2.5 p8 - IM13475/IM16216
; Modified to evaluate as string, not just numeric
;
; IHS/SD/SDR - v2.5 p8 - IM13693/IM17856
; Remove leading zeros
;
; IHS/SD/SDR - v2.5 p9 - IM16660
; 4-digit revenue codes
;
; IHS/SD/SDR - v2.5 p10 - IM20395
; Split out lines bundled by rev code
;
;
EP ;EP
K ABMREC("SV2"),ABMR("SV2")
S ABME("RTYPE")="SV2"
D LOOP
K ABME
Q
LOOP ;LOOP HERE
F I=10:10:110 D
.D @I
.I $D(^ABMEXLM("AA",+$G(ABMP("INS")),+$G(ABMP("EXP")),ABME("RTYPE"),I)) D @(^(I))
.I $G(ABMREC("SV2"))'="" S ABMREC("SV2")=ABMREC("SV2")_"*"
.S ABMREC("SV2")=$G(ABMREC("SV2"))_ABMR("SV2",I)
Q
10 ;segment
S ABMR("SV2",10)="SV2"
Q
20 ;SV201 - Product/Service ID
; Revenue code
S ABMR("SV2",20)=$P($G(^AUTTREVN(ABMREV,0)),U)
S ABMR("SV2",20)=$$FMT^ABMERUTL(ABMR("SV2",20),"4NR")
Q
30 ;SV202 - Composite Medical Procedure Identifier
;SV202-1 Product Service ID Qualifier
;SV202-2 Product Service ID (Procedure Code)
S ABMR("SV2",30)=""
I $P(ABMRV(ABMREV,ABMCODE,ABMCNTR),U,2)'="" D
.S ABMR("SV2",30)="HC"
.S $P(ABMR("SV2",30),":",2)=$P(ABMRV(ABMREV,ABMCODE,ABMCNTR),U,2)
.;modifiers
.N I,J
.S J=2
.F I=3,4,12,13 D
..Q:$P(ABMRV(ABMREV,ABMCODE,ABMCNTR),U,I)=""
..S J=J+1
..S $P(ABMR("SV2",30),":",J)=$P(ABMRV(ABMREV,ABMCODE,ABMCNTR),U,I)
.;SV202-7 Description (Not used)
Q
40 ;SV203 - Monetary Amount (Charges)
S ABMR("SV2",40)=$P(ABMRV(ABMREV,ABMCODE,ABMCNTR),U,6)
S ABMR("SV2",40)=$$TRIM^ABMUTLP($J(ABMR("SV2",40),0,2),"L","0")
Q
50 ;SV204 - Unit or Basis for Measurement Code
S ABMR("SV2",50)="UN"
I ABMP("ITYPE")="P",((ABMREV>"0100")&(ABMREV<"0229")) S ABMR("SV2",50)="DA"
Q
60 ;SV205 - Quantity
S ABMR("SV2",60)=$P(ABMRV(ABMREV,ABMCODE,ABMCNTR),U,5)
Q
70 ;SV206 - Unit Rate
S ABMR("SV2",70)=""
I ABMREV>99,ABMREV<220 D
.S ABMR("SV2",70)=$P(ABMRV(ABMREV,ABMCODE,ABMCNTR),U,8)
.S ABMR("SV2",70)=$J(ABMR("SV2",70),0,2)
Q
80 ;SV207 - Monetary Amount (Non covered charges)
S ABMR("SV2",80)=""
Q
90 ;SV208 - Yes/No Condition or Response Code (Not used)
S ABMR("SV2",90)=""
Q
100 ;SV209 - Nursing Home Residential Status Code (Not used)
S ABMR("SV2",100)=""
Q
110 ;SV210 - Leve of Care Code (Not used)
S ABMR("SV2",110)=""
Q
ABME8SV2 ; IHS/ASDST/DMJ - 837 SV2 Segment
+1 ;;2.6;IHS 3P BILLING SYSTEM;;NOV 12, 2009
+2 ;Transaction Set Header
+3 ;
+4 ; IHS/SD/SDR - v2.5 p8 - IM13475/IM16216
+5 ; Modified to evaluate as string, not just numeric
+6 ;
+7 ; IHS/SD/SDR - v2.5 p8 - IM13693/IM17856
+8 ; Remove leading zeros
+9 ;
+10 ; IHS/SD/SDR - v2.5 p9 - IM16660
+11 ; 4-digit revenue codes
+12 ;
+13 ; IHS/SD/SDR - v2.5 p10 - IM20395
+14 ; Split out lines bundled by rev code
+15 ;
+16 ;
EP ;EP
+1 KILL ABMREC("SV2"),ABMR("SV2")
+2 SET ABME("RTYPE")="SV2"
+3 DO LOOP
+4 KILL ABME
+5 QUIT
LOOP ;LOOP HERE
+1 FOR I=10:10:110
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("SV2"))'=""
SET ABMREC("SV2")=ABMREC("SV2")_"*"
+5 SET ABMREC("SV2")=$GET(ABMREC("SV2"))_ABMR("SV2",I)
End DoDot:1
+6 QUIT
10 ;segment
+1 SET ABMR("SV2",10)="SV2"
+2 QUIT
20 ;SV201 - Product/Service ID
+1 ; Revenue code
+2 SET ABMR("SV2",20)=$PIECE($GET(^AUTTREVN(ABMREV,0)),U)
+3 SET ABMR("SV2",20)=$$FMT^ABMERUTL(ABMR("SV2",20),"4NR")
+4 QUIT
30 ;SV202 - Composite Medical Procedure Identifier
+1 ;SV202-1 Product Service ID Qualifier
+2 ;SV202-2 Product Service ID (Procedure Code)
+3 SET ABMR("SV2",30)=""
+4 IF $PIECE(ABMRV(ABMREV,ABMCODE,ABMCNTR),U,2)'=""
Begin DoDot:1
+5 SET ABMR("SV2",30)="HC"
+6 SET $PIECE(ABMR("SV2",30),":",2)=$PIECE(ABMRV(ABMREV,ABMCODE,ABMCNTR),U,2)
+7 ;modifiers
+8 NEW I,J
+9 SET J=2
+10 FOR I=3,4,12,13
Begin DoDot:2
+11 IF $PIECE(ABMRV(ABMREV,ABMCODE,ABMCNTR),U,I)=""
QUIT
+12 SET J=J+1
+13 SET $PIECE(ABMR("SV2",30),":",J)=$PIECE(ABMRV(ABMREV,ABMCODE,ABMCNTR),U,I)
End DoDot:2
+14 ;SV202-7 Description (Not used)
End DoDot:1
+15 QUIT
40 ;SV203 - Monetary Amount (Charges)
+1 SET ABMR("SV2",40)=$PIECE(ABMRV(ABMREV,ABMCODE,ABMCNTR),U,6)
+2 SET ABMR("SV2",40)=$$TRIM^ABMUTLP($JUSTIFY(ABMR("SV2",40),0,2),"L","0")
+3 QUIT
50 ;SV204 - Unit or Basis for Measurement Code
+1 SET ABMR("SV2",50)="UN"
+2 IF ABMP("ITYPE")="P"
IF ((ABMREV>"0100")&(ABMREV<"0229"))
SET ABMR("SV2",50)="DA"
+3 QUIT
60 ;SV205 - Quantity
+1 SET ABMR("SV2",60)=$PIECE(ABMRV(ABMREV,ABMCODE,ABMCNTR),U,5)
+2 QUIT
70 ;SV206 - Unit Rate
+1 SET ABMR("SV2",70)=""
+2 IF ABMREV>99
IF ABMREV<220
Begin DoDot:1
+3 SET ABMR("SV2",70)=$PIECE(ABMRV(ABMREV,ABMCODE,ABMCNTR),U,8)
+4 SET ABMR("SV2",70)=$JUSTIFY(ABMR("SV2",70),0,2)
End DoDot:1
+5 QUIT
80 ;SV207 - Monetary Amount (Non covered charges)
+1 SET ABMR("SV2",80)=""
+2 QUIT
90 ;SV208 - Yes/No Condition or Response Code (Not used)
+1 SET ABMR("SV2",90)=""
+2 QUIT
100 ;SV209 - Nursing Home Residential Status Code (Not used)
+1 SET ABMR("SV2",100)=""
+2 QUIT
110 ;SV210 - Leve of Care Code (Not used)
+1 SET ABMR("SV2",110)=""
+2 QUIT