ABMPSPLT ; IHS/SD/SDR - Split claim based on Insurer setup ;
;;2.6;IHS 3P BILLING SYSTEM;**22**;NOV 12, 2009;Build 418
;
;IHS/SD/SDR 2.6*22 HEAT335246 New routine; uses setup from 3P Insurer file to see if claim should be split so
; there is one charge per claim or one page (from the claim editor) per claim.
;
I "^H^I^"[("^"_SERVCAT_"^") Q ;skip claims that have a service category of H or I
I $O(^ABMNINS(ABMP("LDFN"),ABMP("INS"),6,"B",""))="" Q ;there aren't any splits setup for this insurer
;build list of pages that should be split with dates and how to split them
S ABMP("PG")=""
F S ABMP("PG")=$O(^ABMNINS(ABMP("LDFN"),ABMP("INS"),6,"B",ABMP("PG"))) Q:$G(ABMP("PG"))="" D
.S ABMP("PGIEN")=0
.F S ABMP("PGIEN")=$O(^ABMNINS(ABMP("LDFN"),ABMP("INS"),6,"B",ABMP("PG"),ABMP("PGIEN"))) Q:'ABMP("PGIEN") D
..S ABMPREC=$G(^ABMNINS(ABMP("LDFN"),ABMP("INS"),6,ABMP("PGIEN"),0))
..I $P(ABMPREC,U,2)'="",$P(ABMPREC,U,3)'="",$P(ABMPREC,U,2)=$P(ABMPREC,U,3) Q ;there is a start and end date but they are the same; entry is 'deleted'
..Q:$P(ABMPREC,U,3)=0 ;don't split
..S ABMP("SPGS",ABMP("PG"))=$P(ABMPREC,U,2)_U_$P(ABMPREC,U,4)_U_$P(ABMPREC,U,3) ;start date ^ end date ^ split how (by charge or by claim-editor-page)
;
;check that there's actually something in the what-should-split array, and split the claim if there is
I $O(ABMP("SPGS",""))="" Q ;nothing to split
S ABMPGS=""
F S ABMPGS=$O(ABMP("SPGS",ABMPGS)) Q:$G(ABMPGS)="" D
.S ABMMLT=$S(ABMPGS="8D":23,ABMPGS="8E":37,ABMPGS="8F":35,1:43)
.I +$O(^ABMDCLM(ABMP("LDFN"),ABMP("CDFN"),ABMMLT,0))=0 Q ;no entries for multiple
.I ABMP("VDT")<($P(ABMP("SPGS",ABMPGS),U)) Q ;visit date is before start date
.I $P(ABMP("SPGS",ABMPGS),U,2)'=""&(ABMP("VDT")>$P(ABMP("SPGS",ABMPGS),U,2)) Q ;there is an end date and the visit date is after that
.I $P($G(^ABMDCLM(DUZ(2),ABMP("CDFN"),ABMMLT,0)),U,4)<2 Q ;must have multiple entries on a split page that need to be split
.;if it gets here there is data on this page to split
.S ABMY("SPLITHOW")=$P(ABMP("SPGS",ABMPGS),U,3)
.S ABMY("INS")=ABMP("INS")
.S ABMY("PGS")="^"_ABMPGS_"^"
.S ^TMP("ABM-SPIN",$J,"VLST",ABMP("CDFN"),ABMPGS)=$P($G(^ABMDCLM(ABMP("LDFN"),ABMP("CDFN"),ABMMLT,0)),U,4)
.S ABMY("SPLIT")="A" ;this makes it label the split claims as auto-split, not manual
.I +$G(ABMY("AUTODT"))=0 D
..D NOW^%DTC
..S ABMY("AUTODT")=%
.S ABMY("INS",ABMY("INS"))=""
.S ABMY("DT")="C"
.D SPLITCLM^ABMRSTI2 ;split claim
.D INSSTMP^ABMRSTI4
.K ^TMP("ABM-SPIN",$J)
Q
ABMPSPLT ; IHS/SD/SDR - Split claim based on Insurer setup ;
+1 ;;2.6;IHS 3P BILLING SYSTEM;**22**;NOV 12, 2009;Build 418
+2 ;
+3 ;IHS/SD/SDR 2.6*22 HEAT335246 New routine; uses setup from 3P Insurer file to see if claim should be split so
+4 ; there is one charge per claim or one page (from the claim editor) per claim.
+5 ;
+6 ;skip claims that have a service category of H or I
IF "^H^I^"[("^"_SERVCAT_"^")
QUIT
+7 ;there aren't any splits setup for this insurer
IF $ORDER(^ABMNINS(ABMP("LDFN"),ABMP("INS"),6,"B",""))=""
QUIT
+8 ;build list of pages that should be split with dates and how to split them
+9 SET ABMP("PG")=""
+10 FOR
SET ABMP("PG")=$ORDER(^ABMNINS(ABMP("LDFN"),ABMP("INS"),6,"B",ABMP("PG")))
IF $GET(ABMP("PG"))=""
QUIT
Begin DoDot:1
+11 SET ABMP("PGIEN")=0
+12 FOR
SET ABMP("PGIEN")=$ORDER(^ABMNINS(ABMP("LDFN"),ABMP("INS"),6,"B",ABMP("PG"),ABMP("PGIEN")))
IF 'ABMP("PGIEN")
QUIT
Begin DoDot:2
+13 SET ABMPREC=$GET(^ABMNINS(ABMP("LDFN"),ABMP("INS"),6,ABMP("PGIEN"),0))
+14 ;there is a start and end date but they are the same; entry is 'deleted'
IF $PIECE(ABMPREC,U,2)'=""
IF $PIECE(ABMPREC,U,3)'=""
IF $PIECE(ABMPREC,U,2)=$PIECE(ABMPREC,U,3)
QUIT
+15 ;don't split
IF $PIECE(ABMPREC,U,3)=0
QUIT
+16 ;start date ^ end date ^ split how (by charge or by claim-editor-page)
SET ABMP("SPGS",ABMP("PG"))=$PIECE(ABMPREC,U,2)_U_$PIECE(ABMPREC,U,4)_U_$PIECE(ABMPREC,U,3)
End DoDot:2
End DoDot:1
+17 ;
+18 ;check that there's actually something in the what-should-split array, and split the claim if there is
+19 ;nothing to split
IF $ORDER(ABMP("SPGS",""))=""
QUIT
+20 SET ABMPGS=""
+21 FOR
SET ABMPGS=$ORDER(ABMP("SPGS",ABMPGS))
IF $GET(ABMPGS)=""
QUIT
Begin DoDot:1
+22 SET ABMMLT=$SELECT(ABMPGS="8D":23,ABMPGS="8E":37,ABMPGS="8F":35,1:43)
+23 ;no entries for multiple
IF +$ORDER(^ABMDCLM(ABMP("LDFN"),ABMP("CDFN"),ABMMLT,0))=0
QUIT
+24 ;visit date is before start date
IF ABMP("VDT")<($PIECE(ABMP("SPGS",ABMPGS),U))
QUIT
+25 ;there is an end date and the visit date is after that
IF $PIECE(ABMP("SPGS",ABMPGS),U,2)'=""&(ABMP("VDT")>$PIECE(ABMP("SPGS",ABMPGS),U,2))
QUIT
+26 ;must have multiple entries on a split page that need to be split
IF $PIECE($GET(^ABMDCLM(DUZ(2),ABMP("CDFN"),ABMMLT,0)),U,4)<2
QUIT
+27 ;if it gets here there is data on this page to split
+28 SET ABMY("SPLITHOW")=$PIECE(ABMP("SPGS",ABMPGS),U,3)
+29 SET ABMY("INS")=ABMP("INS")
+30 SET ABMY("PGS")="^"_ABMPGS_"^"
+31 SET ^TMP("ABM-SPIN",$JOB,"VLST",ABMP("CDFN"),ABMPGS)=$PIECE($GET(^ABMDCLM(ABMP("LDFN"),ABMP("CDFN"),ABMMLT,0)),U,4)
+32 ;this makes it label the split claims as auto-split, not manual
SET ABMY("SPLIT")="A"
+33 IF +$GET(ABMY("AUTODT"))=0
Begin DoDot:2
+34 DO NOW^%DTC
+35 SET ABMY("AUTODT")=%
End DoDot:2
+36 SET ABMY("INS",ABMY("INS"))=""
+37 SET ABMY("DT")="C"
+38 ;split claim
DO SPLITCLM^ABMRSTI2
+39 DO INSSTMP^ABMRSTI4
+40 KILL ^TMP("ABM-SPIN",$JOB)
End DoDot:1
+41 QUIT