- ABMDLCK1 ; IHS/ASDST/DMJ - check visit for elig - CONT'D ;
- ;;2.6;IHS 3P BILLING SYSTEM;**11,21**;NOV 12, 2009;Build 379
- ;;Y2K/OK - IHS/ADC/JLG 12-18-97
- ;Original;TMD;
- ; Code has been added to use the billing limit from the parameters file
- ; if no back billing limit has been set for the insurer. ;JLG 4/8/98
- ;
- ; IHS/DSD/JLG - 6/29/1999 - NOIS HQW-0798-100082 Patch 3 #4
- ; Modified to capture reason for ineligibility, for programmers use
- ;
- ; IHS/DSD/MRS - 8/27/1999 - NOIS XAA-0899-200058 Patch 3 #13
- ; Modified to prevent generating out-patient claims for Medicare
- ; with Part A only
- ;
- ; IHS/ASDS/LSL - 06/26/2001 - V2.4 Patch 9 - NOIS HQW-0798-100082
- ; Modified to expand no eligibility found. Reasons 42-58 can be
- ; found in this routine. Changes are not documented inside routine.
- ; I will take responsibility for the entire routine for patch 9.
- ;
- ; IHS/SD/SDR - v2.5 p10 - IM19802 - Fixed check for error 56 (user would get error if any provider met criteria
- ; IHS/SD/SDR - v2.5 p10 - IM20771 - Added check for outpatient visit and patient has MCR Part A only
- ;
- ;IHS/SD/SDR - 2.6*21 - HEAT127079 - Made change to show error 58 for POV correctly
- ;
- ; *********************************************************************
- ;
- CHK ;EP for setting elig hit
- N V,X,X1,X2,ABMNON,INSM
- ; If node 2 in the insurer file is missing no entry in ABML
- INS2 ;
- S ABM("INS2")=$G(^AUTNINS(ABM("INS"),2))
- I ABM("INS2")="" D Q
- .S $P(ABML(99,ABM("INS")),U,6)=42
- .S ABM("XIT")=1
- ;
- ; This is checking for insurer merged to another. It keeps looping
- ; until if finds an insurer that has not been merged to another. If it
- ; ever finds the "merged to" insurer is one that was previously found
- ; as "merged from" it quits and there is no entry in ABML.
- ;
- Q:$D(INSM(ABM("INS")))
- S INSM(ABM("INS"))=""
- I $P(ABM("INS2"),U,7)]"" D G INS2
- .S ABM("INS")=$P(ABM("INS2"),U,7)
- Q:$D(ABMLX(ABM("INS")))
- ; Piece 7 is the status field. No entry in ABML if status unbillable
- ; 43 ; Insurer designated as unbillable
- I $P($G(^AUTNINS(ABM("INS"),1)),U,7)=4 S $P(ABML(99,ABM("INS")),U,6)=43 Q
- ;
- ; Check both the default in the parameter file & in the insurer file
- ; for backbill limit. Use the one from the insurer file if it exists.
- ;
- N ABMDBBL,ABMBBL
- S ABMDBBL=$P(^ABMDPARM(DUZ(2),1,0),U,16)
- S ABMBBL=$S($P(ABM("INS2"),U,4):$P(ABM("INS2"),U,4),1:ABMDBBL)
- I ABMBBL>0 D I ABMVDT<X S ABMNON="B-BBL" G CHK2
- .S X1=DT
- .S X2=0-(ABMBBL*30.417)
- .D C^%DTC
- S:'$D(ABMVT) ABMVT=$$VTYP^ABMDVCK1(ABMVDFN,$G(SERVCAT),ABM("INS"),$G(ABMCLN))
- ;S V=$G(^ABMNINS(DUZ(2),ABM("INS"),1,+ABMVT,0)) ;abm*2.6*11 HEAT100200
- ;start new code abm*2.6*11 HEAT100200
- I $G(ABMP("LDFN"))="" D
- .I $G(ABMVDFN) S ABMP("LDFN")=$P($G(^AUPNVSIT(ABMVDFN,0)),U,6)
- .I $G(ABMP("CDFN")) S ABMP("LDFN")=$P($G(^ABMDCLM(DUZ(2),ABMP("CDFN"),0)),U,3)
- I $G(ABMP("LDFN"))'="" S V=$G(^ABMNINS(ABMP("LDFN"),ABM("INS"),1,+ABMVT,0))
- I $G(ABMP("LDFN"))="" S V=$G(^ABMNINS(DUZ(2),ABM("INS"),1,+ABMVT,0))
- ;end new code HEAT100200
- ;
- ; V is the Visit type multiple of the insurer file, p 7 billable
- ; If not billable set ABMNON
- ;
- I ABMVT,$P(V,U,7)="N" S ABMNON="UB-VT"
- I ABMVT,$P(V,U,14)>ABMVDT D
- .S ABMNON="BF-SD"
- .I '$O(ABML(ABM("PRI")),-1) S ABM("BEFSD")=1
- ;
- ; billing start date later than visit date & this insurer is primary
- G CHK2:'$G(ABMCLN) ;Jmp to CHK2 if no clinic
- I $P(ABM("INS2"),U,5)="O",$P(^DIC(40.7,ABMCLN,0),U,2)'=56 S ABMNON="OD-ND"
- ;
- ; ABM("INS2") is node 2 of insurer file. Checking dental billing status
- ; In piece 5 O means only dental billable, U means dental unbillable
- ; Clinic stop 56 is dental, 39 is pharmacy
- E I $P(^DIC(40.7,ABMCLN,0),U,2)=56,$P(ABM("INS2"),U,5)="U" S ABMNON="UB-D"
- E I $P(^DIC(40.7,ABMCLN,0),U,2)=39,$P(ABM("INS2"),U,3)="U" S ABMNON="UB-P"
- S ABM=0
- F S ABM=$O(^AUTNINS(ABM("INS"),17,ABM)) Q:'ABM D Q:$D(ABMNON)
- .I +^AUTNINS(ABM("INS"),17,ABM,0)=ABMCLN S ABMNON="UB-CL"
- CHK2 ;
- ;
- N T,P,SDT,EDT
- S (SDT,EDT)=""
- I ABM("TYP")?1(1"M",1"R"),$D(ABM("REC")) D
- .;check if patient only has part A; mark as unbillable if outpatient
- .S ABMCB="M"
- .S:$$PARTB^ABMDSPLB(DFN,ABMVDT) ABMCB=1
- .I $G(ABMCB)="M",($G(ABMP("VTYP"))'=111)&($G(ABMVT)'=111) S ABMNON="UB-PA"
- .Q:ABM("REC")<ABMVDT&((ABMDISDT<$P(ABM("REC"),U,2))!'$P(ABM("REC"),U,2))
- .S SDT=$S(ABMVDT<ABM("REC"):+ABM("REC"),1:"")
- .S EDT=$S($P(ABM("REC"),U,2)<ABMDISDT:$P(ABM("REC"),U,2),1:"")
- E I ABM("TYP")="D" D
- .Q:ABM("NDFN")=""
- .Q:ABM("NDFN")<ABMVDT&((ABMDISDT<$P(ABM("SUB"),U,2))!'$P(ABM("SUB"),U,2))
- .S SDT=$S(ABMVDT<ABM("NDFN"):ABM("NDFN"),1:"")
- .S EDT=$S($P(ABM("SUB"),U,2)<ABMDISDT:$P(ABM("SUB"),U,2),1:"")
- S T=$S(ABM("TYP")'="P":ABM("TYP"),$$ACCREL^ABMDLCK(ABM("MDFN")):"A",1:"P")
- I ABM("PRIMARY")=ABM("INS"),$P($G(ABML(1,+$O(ABML(1,"")))),U,3)'?1(1"W",1"A") S ABM("PRI")=1
- E I ABM("PRIMARY")=ABM("INS"),T="A" S ABM("PRI")=1
- N UBILL
- I $D(ABMNON) D
- .I ABMNON="UB-VT" S UBILL=44 Q ;Unbillable visit type
- .I ABMNON="B-BBL" S UBILL=45 Q ;Before back billing limit
- .I ABMNON="OD-ND" S UBILL=46 Q ;Non dental visit for dental ins.
- .I ABMNON="BF-SD" S UBILL=47 Q ;Before billing start date
- .I ABMNON="UB-D" S UBILL=48 Q ;Dental not billable
- .I ABMNON="UB-P" S UBILL=49 Q ;Pharmacy not billable
- .I ABMNON="UB-CL" S UBILL=50 Q ;Clinic not billable
- .I ABMNON="UB-PA" S UBILL=28 Q ;outpatient with MCR part A only
- I +$G(UBILL) D
- .S $P(ABML(99,ABM("INS")),"^",6)=UBILL
- .S ABM("XIT")=1
- S ABML(ABM("PRI"),ABM("INS"))=$S(T="D":ABM("MDFN"),1:"")_U_$S(T="D":ABM("NDFN"),T="W"&($G(ABMWCIEN)):ABMWCIEN,1:ABM("MDFN"))_U_T_U_SDT_U_EDT_U_$G(UBILL)
- I ABMVDFN D
- .S ABM=""
- .F S ABM=$O(^AUPNVPRV("AD",ABMVDFN,ABM)) Q:'ABM D Q:$$PRVX^ABMDLCK3(P)
- ..S P=+^AUPNVPRV(ABM,0)
- .I '$G(ABM("PRV")) D Q:'ABM("ORDPRV")
- ..S:'$D(ABM("ORDPRV")) ABM("ORDPRV")=$$ORPHAN^ABMDVCK2(ABMVDFN)
- ..S:'ABM("ORDPRV") ABMNON="NO-VP",$P(ABML(99,ABM("INS")),U,6)=56
- ; 56 ; Missing provider not allowed
- I $D(ABMNON) S ABM("XIT")=1 Q
- Q:'ABM("COV")
- S ABM("CV")=$O(ABML(ABM("PRI"),ABM("INS"),"COV",""))
- S:ABM("CV")="" ABM("CV")=$O(ABML(99,ABM("INS"),"COV",""))
- S ABML(ABM("PRI"),ABM("INS"),"COV",ABM("COV"))=$G(COV)
- Q:'$G(ABMVDFN)!'$G(ABMCLN)
- ;
- ; The code below here is checking to see if this visit is not
- ; covered. If not priority is changed to 99.
- ;
- Q:$G(ABM("EMPL REL"))=1 ;This is for workmans comp
- S:'$D(ABMVT) ABMVT=$$VTYP^ABMDVCK1(ABMVDFN,$G(SERVCAT),ABM("INS"),$G(ABMCLN))
- Q:ABMVT=111 ;If hospitalization
- Q:'$D(^AUTTPIC(ABM("COV")))
- Q:$G(COV)="A"
- ;
- ; This is checking to see if provider class is not covered
- ; Loops thru until it finds a provider not in the unbillable list
- ; or to the end of list.
- ; ABM("FLG") is set to 1 if provider not covered
- ; Provider not in coverage file means billable
- ; If BUB=B
- ; CPT code in one range is billable and done
- ; CPT code not in all ranges is billable
- ; If BUB=U
- ; all CPT codes in a range unbillable
- ; one CPT codes out of all ranges is billable
- ;
- N BUB,INRANGE,OUTOFRNG
- S ABM("PRV")=0
- S ABM=""
- F S ABM=$O(^AUPNVPRV("AD",ABMVDFN,ABM)) Q:'ABM D Q:'ABM("FLG")
- .S P=$P(^AUPNVPRV(ABM,0),U)
- .I $$PRVX^ABMDLCK3(P) D
- ..I $D(^AUTTPIC(ABM("COV"),15,ABM("PRV"))) D
- ...S BUB=$P(^AUTTPIC(ABM("COV"),15,ABM("PRV"),0),U,2)
- ...I BUB="" S ABM("FLG")=1,$P(ABML(99,ABM("INS")),U,6)=55 Q
- ...S ABM("FLG")=$$PROVSPEC^ABMDLCK3(ABM("COV"),ABM("PRV"),BUB)
- ...I ABM("FLG")=1 S $P(ABML(99,ABM("INS")),U,6)=51 Q
- ..E D
- ...I $P($G(ABML(99,ABM("INS"))),U,6)=51!($P($G(ABML(99,ABM("INS"))),U,6)=56) K ABML(99,ABM("INS"))
- ...S ABM("FLG")=0 ; Set to zero if not in list
- .E S ABM("FLG")=1,$P(ABML(99,ABM("INS")),U,6)=56 ;Set if default non covered provider
- ; If there are not entries in the V prov file same as flagging all
- ; providers unbillable
- I $G(ABM("FLG"),1),'$$ORPHAN^ABMDVCK2(ABMVDFN) D Q
- .S ABM("XIT")=1
- I $D(^AUTTPIC(ABM("COV"),11,ABMCLN,0)) D Q
- .S ABM("XIT")=1
- .S $P(ABML(99,ABM("INS")),U,6)=57
- S ABM("POV")=0,ABM("FLG")=0
- ;
- ; This code is checking to see if the coverage type represented by
- ; the ien ABM("COV") covers the POV for this visit. If it is not
- ; covered ABM("FLG") is set and UNCHK is run.
- ;
- S ABM=""
- F S ABM=$O(^AUPNVPOV("AD",ABMVDFN,ABM)) Q:'ABM D Q:'ABM("FLG")
- .S ABM("POV")=$P(^AUPNVPOV(ABM,0),U)
- .; Code to handle messed up .01 field in V POV file
- .I 'ABM("POV") S:ABM("FLG")=0 ABM("FLG")=-1 Q
- .I $D(^AUTTPIC(ABM("COV"),13,ABM("POV"))) S ABM("FLG")=1 Q
- .E S ABM("FLG")=0 ;Set to 0 if not in list
- Q:ABM("FLG")<1
- I ABM("FLG") D
- .S ABM("XIT")=11
- .S $P(ABML(99,ABM("INS")),U,6)=58
- I $G(ABM("XIT")) D UNCHK^ABMDLCK2 ;abm*2.6*21 IHS/SD/SDR HEAT127079
- Q
- ; ABM("XIT") serves as a flag that the priority needs to be 99
- ABMDLCK1 ; IHS/ASDST/DMJ - check visit for elig - CONT'D ;
- +1 ;;2.6;IHS 3P BILLING SYSTEM;**11,21**;NOV 12, 2009;Build 379
- +2 ;;Y2K/OK - IHS/ADC/JLG 12-18-97
- +3 ;Original;TMD;
- +4 ; Code has been added to use the billing limit from the parameters file
- +5 ; if no back billing limit has been set for the insurer. ;JLG 4/8/98
- +6 ;
- +7 ; IHS/DSD/JLG - 6/29/1999 - NOIS HQW-0798-100082 Patch 3 #4
- +8 ; Modified to capture reason for ineligibility, for programmers use
- +9 ;
- +10 ; IHS/DSD/MRS - 8/27/1999 - NOIS XAA-0899-200058 Patch 3 #13
- +11 ; Modified to prevent generating out-patient claims for Medicare
- +12 ; with Part A only
- +13 ;
- +14 ; IHS/ASDS/LSL - 06/26/2001 - V2.4 Patch 9 - NOIS HQW-0798-100082
- +15 ; Modified to expand no eligibility found. Reasons 42-58 can be
- +16 ; found in this routine. Changes are not documented inside routine.
- +17 ; I will take responsibility for the entire routine for patch 9.
- +18 ;
- +19 ; IHS/SD/SDR - v2.5 p10 - IM19802 - Fixed check for error 56 (user would get error if any provider met criteria
- +20 ; IHS/SD/SDR - v2.5 p10 - IM20771 - Added check for outpatient visit and patient has MCR Part A only
- +21 ;
- +22 ;IHS/SD/SDR - 2.6*21 - HEAT127079 - Made change to show error 58 for POV correctly
- +23 ;
- +24 ; *********************************************************************
- +25 ;
- CHK ;EP for setting elig hit
- +1 NEW V,X,X1,X2,ABMNON,INSM
- +2 ; If node 2 in the insurer file is missing no entry in ABML
- INS2 ;
- +1 SET ABM("INS2")=$GET(^AUTNINS(ABM("INS"),2))
- +2 IF ABM("INS2")=""
- Begin DoDot:1
- +3 SET $PIECE(ABML(99,ABM("INS")),U,6)=42
- +4 SET ABM("XIT")=1
- End DoDot:1
- QUIT
- +5 ;
- +6 ; This is checking for insurer merged to another. It keeps looping
- +7 ; until if finds an insurer that has not been merged to another. If it
- +8 ; ever finds the "merged to" insurer is one that was previously found
- +9 ; as "merged from" it quits and there is no entry in ABML.
- +10 ;
- +11 IF $DATA(INSM(ABM("INS")))
- QUIT
- +12 SET INSM(ABM("INS"))=""
- +13 IF $PIECE(ABM("INS2"),U,7)]""
- Begin DoDot:1
- +14 SET ABM("INS")=$PIECE(ABM("INS2"),U,7)
- End DoDot:1
- GOTO INS2
- +15 IF $DATA(ABMLX(ABM("INS")))
- QUIT
- +16 ; Piece 7 is the status field. No entry in ABML if status unbillable
- +17 ; 43 ; Insurer designated as unbillable
- +18 IF $PIECE($GET(^AUTNINS(ABM("INS"),1)),U,7)=4
- SET $PIECE(ABML(99,ABM("INS")),U,6)=43
- QUIT
- +19 ;
- +20 ; Check both the default in the parameter file & in the insurer file
- +21 ; for backbill limit. Use the one from the insurer file if it exists.
- +22 ;
- +23 NEW ABMDBBL,ABMBBL
- +24 SET ABMDBBL=$PIECE(^ABMDPARM(DUZ(2),1,0),U,16)
- +25 SET ABMBBL=$SELECT($PIECE(ABM("INS2"),U,4):$PIECE(ABM("INS2"),U,4),1:ABMDBBL)
- +26 IF ABMBBL>0
- Begin DoDot:1
- +27 SET X1=DT
- +28 SET X2=0-(ABMBBL*30.417)
- +29 DO C^%DTC
- End DoDot:1
- IF ABMVDT<X
- SET ABMNON="B-BBL"
- GOTO CHK2
- +30 IF '$DATA(ABMVT)
- SET ABMVT=$$VTYP^ABMDVCK1(ABMVDFN,$GET(SERVCAT),ABM("INS"),$GET(ABMCLN))
- +31 ;S V=$G(^ABMNINS(DUZ(2),ABM("INS"),1,+ABMVT,0)) ;abm*2.6*11 HEAT100200
- +32 ;start new code abm*2.6*11 HEAT100200
- +33 IF $GET(ABMP("LDFN"))=""
- Begin DoDot:1
- +34 IF $GET(ABMVDFN)
- SET ABMP("LDFN")=$PIECE($GET(^AUPNVSIT(ABMVDFN,0)),U,6)
- +35 IF $GET(ABMP("CDFN"))
- SET ABMP("LDFN")=$PIECE($GET(^ABMDCLM(DUZ(2),ABMP("CDFN"),0)),U,3)
- End DoDot:1
- +36 IF $GET(ABMP("LDFN"))'=""
- SET V=$GET(^ABMNINS(ABMP("LDFN"),ABM("INS"),1,+ABMVT,0))
- +37 IF $GET(ABMP("LDFN"))=""
- SET V=$GET(^ABMNINS(DUZ(2),ABM("INS"),1,+ABMVT,0))
- +38 ;end new code HEAT100200
- +39 ;
- +40 ; V is the Visit type multiple of the insurer file, p 7 billable
- +41 ; If not billable set ABMNON
- +42 ;
- +43 IF ABMVT
- IF $PIECE(V,U,7)="N"
- SET ABMNON="UB-VT"
- +44 IF ABMVT
- IF $PIECE(V,U,14)>ABMVDT
- Begin DoDot:1
- +45 SET ABMNON="BF-SD"
- +46 IF '$ORDER(ABML(ABM("PRI")),-1)
- SET ABM("BEFSD")=1
- End DoDot:1
- +47 ;
- +48 ; billing start date later than visit date & this insurer is primary
- +49 ;Jmp to CHK2 if no clinic
- IF '$GET(ABMCLN)
- GOTO CHK2
- +50 IF $PIECE(ABM("INS2"),U,5)="O"
- IF $PIECE(^DIC(40.7,ABMCLN,0),U,2)'=56
- SET ABMNON="OD-ND"
- +51 ;
- +52 ; ABM("INS2") is node 2 of insurer file. Checking dental billing status
- +53 ; In piece 5 O means only dental billable, U means dental unbillable
- +54 ; Clinic stop 56 is dental, 39 is pharmacy
- +55 IF '$TEST
- IF $PIECE(^DIC(40.7,ABMCLN,0),U,2)=56
- IF $PIECE(ABM("INS2"),U,5)="U"
- SET ABMNON="UB-D"
- +56 IF '$TEST
- IF $PIECE(^DIC(40.7,ABMCLN,0),U,2)=39
- IF $PIECE(ABM("INS2"),U,3)="U"
- SET ABMNON="UB-P"
- +57 SET ABM=0
- +58 FOR
- SET ABM=$ORDER(^AUTNINS(ABM("INS"),17,ABM))
- IF 'ABM
- QUIT
- Begin DoDot:1
- +59 IF +^AUTNINS(ABM("INS"),17,ABM,0)=ABMCLN
- SET ABMNON="UB-CL"
- End DoDot:1
- IF $DATA(ABMNON)
- QUIT
- CHK2 ;
- +1 ;
- +2 NEW T,P,SDT,EDT
- +3 SET (SDT,EDT)=""
- +4 IF ABM("TYP")?1(1"M",1"R")
- IF $DATA(ABM("REC"))
- Begin DoDot:1
- +5 ;check if patient only has part A; mark as unbillable if outpatient
- +6 SET ABMCB="M"
- +7 IF $$PARTB^ABMDSPLB(DFN,ABMVDT)
- SET ABMCB=1
- +8 IF $GET(ABMCB)="M"
- IF ($GET(ABMP("VTYP"))'=111)&($GET(ABMVT)'=111)
- SET ABMNON="UB-PA"
- +9 IF ABM("REC")<ABMVDT&((ABMDISDT<$PIECE(ABM("REC"),U,2))!'$PIECE(ABM("REC"),U,2))
- QUIT
- +10 SET SDT=$SELECT(ABMVDT<ABM("REC"):+ABM("REC"),1:"")
- +11 SET EDT=$SELECT($PIECE(ABM("REC"),U,2)<ABMDISDT:$PIECE(ABM("REC"),U,2),1:"")
- End DoDot:1
- +12 IF '$TEST
- IF ABM("TYP")="D"
- Begin DoDot:1
- +13 IF ABM("NDFN")=""
- QUIT
- +14 IF ABM("NDFN")<ABMVDT&((ABMDISDT<$PIECE(ABM("SUB"),U,2))!'$PIECE(ABM("SUB"),U,2))
- QUIT
- +15 SET SDT=$SELECT(ABMVDT<ABM("NDFN"):ABM("NDFN"),1:"")
- +16 SET EDT=$SELECT($PIECE(ABM("SUB"),U,2)<ABMDISDT:$PIECE(ABM("SUB"),U,2),1:"")
- End DoDot:1
- +17 SET T=$SELECT(ABM("TYP")'="P":ABM("TYP"),$$ACCREL^ABMDLCK(ABM("MDFN")):"A",1:"P")
- +18 IF ABM("PRIMARY")=ABM("INS")
- IF $PIECE($GET(ABML(1,+$ORDER(ABML(1,"")))),U,3)'?1(1"W",1"A")
- SET ABM("PRI")=1
- +19 IF '$TEST
- IF ABM("PRIMARY")=ABM("INS")
- IF T="A"
- SET ABM("PRI")=1
- +20 NEW UBILL
- +21 IF $DATA(ABMNON)
- Begin DoDot:1
- +22 ;Unbillable visit type
- IF ABMNON="UB-VT"
- SET UBILL=44
- QUIT
- +23 ;Before back billing limit
- IF ABMNON="B-BBL"
- SET UBILL=45
- QUIT
- +24 ;Non dental visit for dental ins.
- IF ABMNON="OD-ND"
- SET UBILL=46
- QUIT
- +25 ;Before billing start date
- IF ABMNON="BF-SD"
- SET UBILL=47
- QUIT
- +26 ;Dental not billable
- IF ABMNON="UB-D"
- SET UBILL=48
- QUIT
- +27 ;Pharmacy not billable
- IF ABMNON="UB-P"
- SET UBILL=49
- QUIT
- +28 ;Clinic not billable
- IF ABMNON="UB-CL"
- SET UBILL=50
- QUIT
- +29 ;outpatient with MCR part A only
- IF ABMNON="UB-PA"
- SET UBILL=28
- QUIT
- End DoDot:1
- +30 IF +$GET(UBILL)
- Begin DoDot:1
- +31 SET $PIECE(ABML(99,ABM("INS")),"^",6)=UBILL
- +32 SET ABM("XIT")=1
- End DoDot:1
- +33 SET ABML(ABM("PRI"),ABM("INS"))=$SELECT(T="D":ABM("MDFN"),1:"")_U_$SELECT(T="D":ABM("NDFN"),T="W"&($GET(ABMWCIEN)):ABMWCIEN,1:ABM("MDFN"))_U_T_U_SDT_U_EDT_U_$GET(UBILL)
- +34 IF ABMVDFN
- Begin DoDot:1
- +35 SET ABM=""
- +36 FOR
- SET ABM=$ORDER(^AUPNVPRV("AD",ABMVDFN,ABM))
- IF 'ABM
- QUIT
- Begin DoDot:2
- +37 SET P=+^AUPNVPRV(ABM,0)
- End DoDot:2
- IF $$PRVX^ABMDLCK3(P)
- QUIT
- +38 IF '$GET(ABM("PRV"))
- Begin DoDot:2
- +39 IF '$DATA(ABM("ORDPRV"))
- SET ABM("ORDPRV")=$$ORPHAN^ABMDVCK2(ABMVDFN)
- +40 IF 'ABM("ORDPRV")
- SET ABMNON="NO-VP"
- SET $PIECE(ABML(99,ABM("INS")),U,6)=56
- End DoDot:2
- IF 'ABM("ORDPRV")
- QUIT
- End DoDot:1
- +41 ; 56 ; Missing provider not allowed
- +42 IF $DATA(ABMNON)
- SET ABM("XIT")=1
- QUIT
- +43 IF 'ABM("COV")
- QUIT
- +44 SET ABM("CV")=$ORDER(ABML(ABM("PRI"),ABM("INS"),"COV",""))
- +45 IF ABM("CV")=""
- SET ABM("CV")=$ORDER(ABML(99,ABM("INS"),"COV",""))
- +46 SET ABML(ABM("PRI"),ABM("INS"),"COV",ABM("COV"))=$GET(COV)
- +47 IF '$GET(ABMVDFN)!'$GET(ABMCLN)
- QUIT
- +48 ;
- +49 ; The code below here is checking to see if this visit is not
- +50 ; covered. If not priority is changed to 99.
- +51 ;
- +52 ;This is for workmans comp
- IF $GET(ABM("EMPL REL"))=1
- QUIT
- +53 IF '$DATA(ABMVT)
- SET ABMVT=$$VTYP^ABMDVCK1(ABMVDFN,$GET(SERVCAT),ABM("INS"),$GET(ABMCLN))
- +54 ;If hospitalization
- IF ABMVT=111
- QUIT
- +55 IF '$DATA(^AUTTPIC(ABM("COV")))
- QUIT
- +56 IF $GET(COV)="A"
- QUIT
- +57 ;
- +58 ; This is checking to see if provider class is not covered
- +59 ; Loops thru until it finds a provider not in the unbillable list
- +60 ; or to the end of list.
- +61 ; ABM("FLG") is set to 1 if provider not covered
- +62 ; Provider not in coverage file means billable
- +63 ; If BUB=B
- +64 ; CPT code in one range is billable and done
- +65 ; CPT code not in all ranges is billable
- +66 ; If BUB=U
- +67 ; all CPT codes in a range unbillable
- +68 ; one CPT codes out of all ranges is billable
- +69 ;
- +70 NEW BUB,INRANGE,OUTOFRNG
- +71 SET ABM("PRV")=0
- +72 SET ABM=""
- +73 FOR
- SET ABM=$ORDER(^AUPNVPRV("AD",ABMVDFN,ABM))
- IF 'ABM
- QUIT
- Begin DoDot:1
- +74 SET P=$PIECE(^AUPNVPRV(ABM,0),U)
- +75 IF $$PRVX^ABMDLCK3(P)
- Begin DoDot:2
- +76 IF $DATA(^AUTTPIC(ABM("COV"),15,ABM("PRV")))
- Begin DoDot:3
- +77 SET BUB=$PIECE(^AUTTPIC(ABM("COV"),15,ABM("PRV"),0),U,2)
- +78 IF BUB=""
- SET ABM("FLG")=1
- SET $PIECE(ABML(99,ABM("INS")),U,6)=55
- QUIT
- +79 SET ABM("FLG")=$$PROVSPEC^ABMDLCK3(ABM("COV"),ABM("PRV"),BUB)
- +80 IF ABM("FLG")=1
- SET $PIECE(ABML(99,ABM("INS")),U,6)=51
- QUIT
- End DoDot:3
- +81 IF '$TEST
- Begin DoDot:3
- +82 IF $PIECE($GET(ABML(99,ABM("INS"))),U,6)=51!($PIECE($GET(ABML(99,ABM("INS"))),U,6)=56)
- KILL ABML(99,ABM("INS"))
- +83 ; Set to zero if not in list
- SET ABM("FLG")=0
- End DoDot:3
- End DoDot:2
- +84 ;Set if default non covered provider
- IF '$TEST
- SET ABM("FLG")=1
- SET $PIECE(ABML(99,ABM("INS")),U,6)=56
- End DoDot:1
- IF 'ABM("FLG")
- QUIT
- +85 ; If there are not entries in the V prov file same as flagging all
- +86 ; providers unbillable
- +87 IF $GET(ABM("FLG"),1)
- IF '$$ORPHAN^ABMDVCK2(ABMVDFN)
- Begin DoDot:1
- +88 SET ABM("XIT")=1
- End DoDot:1
- QUIT
- +89 IF $DATA(^AUTTPIC(ABM("COV"),11,ABMCLN,0))
- Begin DoDot:1
- +90 SET ABM("XIT")=1
- +91 SET $PIECE(ABML(99,ABM("INS")),U,6)=57
- End DoDot:1
- QUIT
- +92 SET ABM("POV")=0
- SET ABM("FLG")=0
- +93 ;
- +94 ; This code is checking to see if the coverage type represented by
- +95 ; the ien ABM("COV") covers the POV for this visit. If it is not
- +96 ; covered ABM("FLG") is set and UNCHK is run.
- +97 ;
- +98 SET ABM=""
- +99 FOR
- SET ABM=$ORDER(^AUPNVPOV("AD",ABMVDFN,ABM))
- IF 'ABM
- QUIT
- Begin DoDot:1
- +100 SET ABM("POV")=$PIECE(^AUPNVPOV(ABM,0),U)
- +101 ; Code to handle messed up .01 field in V POV file
- +102 IF 'ABM("POV")
- IF ABM("FLG")=0
- SET ABM("FLG")=-1
- QUIT
- +103 IF $DATA(^AUTTPIC(ABM("COV"),13,ABM("POV")))
- SET ABM("FLG")=1
- QUIT
- +104 ;Set to 0 if not in list
- IF '$TEST
- SET ABM("FLG")=0
- End DoDot:1
- IF 'ABM("FLG")
- QUIT
- +105 IF ABM("FLG")<1
- QUIT
- +106 IF ABM("FLG")
- Begin DoDot:1
- +107 SET ABM("XIT")=11
- +108 SET $PIECE(ABML(99,ABM("INS")),U,6)=58
- End DoDot:1
- +109 ;abm*2.6*21 IHS/SD/SDR HEAT127079
- IF $GET(ABM("XIT"))
- DO UNCHK^ABMDLCK2
- +110 QUIT
- +111 ; ABM("XIT") serves as a flag that the priority needs to be 99