IBCBB12 ;ALB/DEM - PROCEDURE AND LINE LEVEL PROVIDER EDITS ;17-OCT-2010
;;2.0;INTEGRATED BILLING;**432,592,608**;21-MAR-94;Build 90
;;Per VA Directive 6402, this routine should not be modified.
Q
;
LNPROV(IBIFN) ; DEM;432 - Edits for line level providers.
;
; Input:
; IBIFN - Claim number IEN.
;
; Output:
; OK - '1' Edits
; '0' No Edits.
; *Note: OK returned if called as function.
; Can be called as routine as well.
; IBER - Edit error string. Only updated if errors.
;
; Patch 432 EDITS:
;
; (1) Not all procedures have a Line Level Rendering Provider,
; and no Claim Level Rendering Provider.
; Error Message in Billing for Prof Rendering.
; *Note: Only applies to Rendering Provider Type.
;
; (2) All procedures have a Line Level Rendering Provider,
; and a Claim Level Rendering Provider who is different
; from any of the Line Level Rendering Providers.
; Error in Billing.
; *Note: Apply to all provider types (Rendering, Referring, Supervising, Attending, Operating, and Other Operating).
;
N OK
S OK=0 ; Initialize OK=0 for FALSE.
Q:'$G(IBIFN) OK ; Need claim number IEN to continue.
N IBPRVFUN,IBCLPRV,IBLNPRV,PRVFUN
S:'$G(IBFT) IBFT=$$FT^IBCEF(IBIFN) ; Form Type for claim.
; JWS;IB*2.0*592 US1108 - Dental form check
I IBFT'=2,IBFT'=3,IBFT'=7 Q OK ; Must be CMS-1500 (2) or UB-04 (3) or (7) Dental J430D Form Type.
S:IBFT=2 PRVFUN(2)="RENDERING,REFERRING,SUPERVISING" ; Allowable line provider functions for CMS-1500.
S:IBFT=3 PRVFUN(3)="RENDERING,REFERRING,OPERATING,OTHER OPERATING" ; Allowable line provider functions for UB-04.
S:IBFT=7 PRVFUN(7)="RENDERING,REFERRING,SUPERVISING,ASSISTANT SURGEON" ; Allowable line provider functions for Dental form J430D.
; JWS;IB*2.0*592 US1108 - end
F PRVFUN("CNT")=1:1:$L(PRVFUN(IBFT),",") S IBPRVFUN=$P(PRVFUN(IBFT),",",PRVFUN("CNT")) D
. I IBFT=2,IBPRVFUN="RENDERING",'$$LNPRV2(IBPRVFUN),'$D(^DGCR(399,IBIFN,"PRV","C",IBPRVFUN)) D Q ; Edit Check (1).
.. ;
.. ;/Beginning of IB*2.0*608 - vd (US3214)
.. ; Changed the following from and error to a warning.
.. ;S OK=1 ; OK=1 indicates we have at least one error.
.. ;S IBER=IBER_"IB333;"
.. D WARN^IBCBB11("Claim has no Rendering Providers present.")
.. ;/Ending of IB*2.0*608 - vd (US3214)
.. Q
. Q:'$$LNPRV2(IBPRVFUN,.IBLNPRV) ; Quit if not all the procedures have a line level provider of the same provider type.
. Q:'$D(^DGCR(399,IBIFN,"PRV","C",IBPRVFUN)) ; No claim level provider for this provider type.
. ;
. Q:'$$CLPRV2(IBPRVFUN,.IBCLPRV) ; Must have provider for provider type IBPRVFUN to continue (Edit (2)).
. ;
. S IBCLPRV=0 F S IBCLPRV=$O(IBCLPRV(IBPRVFUN,IBCLPRV)) Q:'IBCLPRV D ; Edit Check (2).
.. Q:$D(IBLNPRV(IBPRVFUN,IBCLPRV)) ; Check against line provider array IBLNPRV.
.. S OK=1
.. S IBER=IBER_$S(IBPRVFUN="ASSISTANT SURGEON":"IB335;",1:"IB334;")
.. Q
. Q
;
Q OK
;
LNPRV2(IBPRVFUN,IBLNPRV) ; Function - Edit Check (2) for line level provider.
; See Edit Check (2) at top of routine for details.
;
; Input:
; IBPRVFUN - Provider Type (FUNCTION). Example: RENDERING.
; IBLNPRV(Array) - Passed by reference. Intially undefined.
;
; Output:
; OK - If Edit Check (2) line level provider condition has
; been met, then OK will return '1' for TRUE, ELSE, '0'
; for FALSE.
; *See Edit Check (2) at top of routine for details.
; IBLNPRV(Array) - If Edit Check (2) condition has been met,
; then IBLNPRV will contain the provider type,
; and provider variable pointer as array
; subscripts, and array element is SET to
; NULL. => IBLNPRV(IBPRVFUN,IBLNPROV)="".
;
N OK,IBPROCP,IBLPIEN,IBLNPROV
S IBPROCP=0 F S IBPROCP=$O(^DGCR(399,IBIFN,"CP",IBPROCP)) Q:'IBPROCP D I $D(OK),'OK Q
. Q:'($D(^DGCR(399,IBIFN,"CP",IBPROCP,0))#10)
. I '$D(^DGCR(399,IBIFN,"CP",IBPROCP,"LNPRV","C",IBPRVFUN)) S OK=0 Q ; No line provider function for this procedure.
. S IBLPIEN=$O(^DGCR(399,IBIFN,"CP",IBPROCP,"LNPRV","C",IBPRVFUN,0))
. I 'IBLPIEN S OK=0 Q ; No line provider IEN for this line provider function.
. I '($D(^DGCR(399,IBIFN,"CP",IBPROCP,"LNPRV",IBLPIEN,0))#10) S OK=0 Q ; No zero node for line level provider.
. S IBLNPROV=$P(^DGCR(399,IBIFN,"CP",IBPROCP,"LNPRV",IBLPIEN,0),"^",2)
. I 'IBLNPROV S OK=0 Q ; No line provider for this line provider function.
. S IBLNPRV(IBPRVFUN,IBLNPROV)=""
. Q
;
Q:$D(OK) OK ; OK will never equal '1' for TRUE at this point.
I '$D(OK),'$D(IBLNPRV(IBPRVFUN)) S OK=0 Q OK ; No line provider array for this line provider function.
S OK=1 ; Edit Check (2) line provider condition has been met.
Q OK
;
CLPRV2(IBPRVFUN,IBCLPRV) ; Function - Edit Check (2) for claim level provider.
; See Edit Check (2) at top of routine for details.
;
; Input:
; IBPRVFUN - Provider Type (FUNCTION). Example: RENDERING.
; IBCLPRV(Array) - Passed by reference. Intially undefined.
;
; Output:
; OK - If Edit Check (2) claim level provider condition has
; been met, then OK will return '1' for TRUE, ELSE, '0'
; for FALSE.
; *See Edit Check (2) at top of routine for details.
; IBCLPRV(Array) - If Edit Check (2) condition has been met,
; then IBCLPRV will contain the provider type,
; and provider variable pointer as array
; subscripts, and array element is SET to
; NULL. => IBCLPRV(IBPRVFUN,IBCLPROV)="".
;
N IBCLPIEN,IBCLPROV,OK
S OK=0 ; Initialize OK=0 for FALSE.
S IBCLPIEN=0 F S IBCLPIEN=$O(^DGCR(399,IBIFN,"PRV","C",IBPRVFUN,IBCLPIEN)) Q:'IBCLPIEN D Q:OK
. Q:'($D(^DGCR(399,IBIFN,"PRV",IBCLPIEN,0))#10)
. S IBCLPROV=$P(^DGCR(399,IBIFN,"PRV",IBCLPIEN,0),"^",2)
. Q:'IBCLPROV
. S IBCLPRV(IBPRVFUN,IBCLPROV)="" ; Set array for Edit Check (2) to compare claim level provider with line level provider.
. S OK=1 ; At this point we have our claim level provider of provider type IBPRVFUN. Set OK=1 for TRUE.
. Q
;
Q:'OK OK
S OK=1
Q OK
;
OPPROVCK(IBIFN) ; DEM;432 - Other Operating Provider edit checks.
;
; Input:
; IBIFN - Claim number IEN.
;
; Output:
; OK - '1' Edits
; '0' No Edits.
; *Note: OK returned if called as function ($$).
; Can be called as routine as well.
;
; Patch 432 line level Other Operating Provider Edit checks:
;
; (1) If claim level Other Operating Provider, then
; (1.1) claim must have claim level Operating Provider.
; OR
; (1.2) every line must have Operating Provider.
;
; If (1) Passes, then do edit check (2) below.
;
; (2) If any claim line has Other Operating Provider, then
; (2.1) must have Operating Provider on same claim line,
; OR
; (2.2) must have claim level Operating Provider.
;
N OK
S OK=0 ; Initialize OK=0 for FALSE.
Q:'$G(IBIFN) OK ; Need claim number IEN to continue.
S:'$G(IBFT) IBFT=$$FT^IBCEF(IBIFN) ; Form Type for claim.
; JWS;IB*2.0*592 US1108 - Dental form check
I IBFT'=2,IBFT'=3,IBFT'=7 Q OK ; Must be CMS-1500 (2) or UB-04 (3) Form Type or (7) Dental J430D
;
N IBPRVFUN,IBLNFLAG,IBLNPRV,CLOK,LNOK
;
; Note: Claim level provider - OTHER and OTHER OPERATING are the same.
; Check if condition (1) has been met.
F IBPRVFUN="OTHER","OTHER OPERATING" S CLOK=$$CLOPPRV1(IBPRVFUN) Q:CLOK
Q:'CLOK OK ; No claim level OTHER OPERATING PROVIDER, then QUIT, no further checks.
S OK=0 ; Initialize OK=0 for FALSE.
; Condition (1) has been met, check condtion (1.1).
S CLOK=0 ; Initialize CLOK=0 for FALSE.
I $D(^DGCR(399,IBIFN,"PRV","C","OPERATING")) S IBPRVFUN="OPERATING",CLOK=$$CLOPPRV1(IBPRVFUN) ; Check condition (1.1).
; If CLOK at this point, then skip condition check (1.2) and continue to condition (2).
S LNOK=0 ; Initialize LNOK=0 for FALSE.
I 'CLOK S IBPRVFUN="OPERATING",LNOK=$$LNOPPRV1(IBPRVFUN) I 'LNOK S OK=1 Q OK ; Check condition (1.2). If 'LNOK, then we have an error and QUIT.
; If LNOK, then continue to condition check (2).
S LNOK=0 ; Initialize LNOK=0 for FALSE.
K IBLNPRV ; KILL IBLNPRV array before call to $$LNOPPRV1(IBPRVFUN,1,.IBLNPRV).
S IBPRVFUN="OTHER OPERATING",LNOK=$$LNOPPRV1(IBPRVFUN,1,.IBLNPRV) ; Condition check (2) start.
I '$D(IBLNPRV("PRVFUN")) S OK=0 Q OK ; If no data in IBLNPRV("PRVFUN") array, then skip rest of checks, no error.
; If data in IBLNPRV("PRVFUN") array, then check condition (2.1).
S IBPRVFUN="OPERATING",LNOK=$$LNOPPRV1(IBPRVFUN,1,.IBLNPRV) ; Condition check (2.1) start.
S LNOK=0 ; Initialize LNOK=0 for FALSE.
D:$D(IBLNPRV("PRVFUN")) ; If data in IBLNPRV("PRVFUN") array, then continue condition check (2.1).
. N IBPROCP
. S IBPROCP=0 F S IBPROCP=$O(IBLNPRV("PROC",IBPROCP)) Q:'IBPROCP D Q:'LNOK
. . I $D(IBLNPRV("PROC",IBPROCP,"OTHER OPERATING")),'$D(IBLNPRV("PROC",IBPROCP,"OPERATING")) S LNOK=0 Q
. . S LNOK=1 ; At this point, we have at least one match. If there wasn't a match, then LNOK=0 and we would have QUIT.
. . Q
. Q
I LNOK S OK=0 Q OK ; Conditions (2) and (2.1) are met (no error). SET OK=0 and QUIT.
; If 'LNOK, then continue to condition check (2.2).
S CLOK=0 ; Initialize CLOK=0 for FALSE.
S IBPRVFUN="OPERATING",CLOK=$$CLOPPRV1(IBPRVFUN) ; Condition check (2.2).
I CLOK S OK=0 Q OK ; Conditions (2) and (2.2) are met (no error). SET OK=0 and QUIT.
; At this point, we have an error. SET OK=1, and QUIT.
S OK=1
Q OK
;
CLOPPRV1(IBPRVFUN) ; Claim level provider/provider function check.
;
; Check if there is a claim level provider with provider function IBPRVFUN.
;
; Input:
; IBPRVFUN - PROVIDER FUNCTION.
;
; Output:
; OK - '1' Claim level provider exist for provider function IBPRVFUN.
; '0' No Claim level provider exist for provider function IBPRVFUN.
;
N OK,IBCLPIEN,IBCLPROV
S OK=0 ; Initialize OK=0 for FALSE.
;
I $D(^DGCR(399,IBIFN,"PRV","C",IBPRVFUN)) D
. S IBCLPIEN=0 F S IBCLPIEN=$O(^DGCR(399,IBIFN,"PRV","C",IBPRVFUN,IBCLPIEN)) Q:'IBCLPIEN D Q:OK
. . Q:'($D(^DGCR(399,IBIFN,"PRV",IBCLPIEN,0))#10)
. . S IBCLPROV=$P(^DGCR(399,IBIFN,"PRV",IBCLPIEN,0),U,2)
. . Q:'IBCLPROV
. . S OK=1 ; At this point we have claim level provider with provider function IBPRVFUN and can QUIT function/subroutine.
. . Q
. Q
;
Q OK
;
LNOPPRV1(IBPRVFUN,IBLNFLAG,IBLNPRV,IBPROCHK) ; Check every claim line for provider function IBPRVFUN.
;
;
; Input:
; IBPRVFUN - PROVIDER FUNCTION.
; IBLNFLAG(Optional) = 1 or 0. 1 indicates return IBLNPRV array passed by reference, otherwise '0' for NO.
; IBLNPRV(Optional) - Array passed by reference => IF SET OK=1, then
; I $G(IBLNFLAG) S IBLNPRV("PROC",IBPROCP,IBPRVFUN)="",IBLNPRV("PRVFUN",IBPRVFUN,IBPROCP)=""
; IBPROCHK - Condition on PROCEDURE (ICD, CPT, or HCFA procedure codes).
;
; Output:
; OK - '1' Every line level provider exist for provider function IBPRVFUN.
; '0' Not every line level provider exist for provider function IBPRVFUN.
;
N OK
S OK=0 ; Initialize OK=0 for FALSE.
;
N IBLPIEN,IBLNPROV,IBPROCP
S IBPROCP=0 F S IBPROCP=$O(^DGCR(399,IBIFN,"CP",IBPROCP)) Q:'IBPROCP D Q:($D(^DGCR(399,IBIFN,"CP",IBPROCP,0))#10)&('OK)
. Q:'($D(^DGCR(399,IBIFN,"CP",IBPROCP,0))#10) ; No procedure '0' node.
. I $G(IBPROCHK)'="" Q:$P(^DGCR(399,IBIFN,"CP",IBPROCP,0),U,1)'[IBPROCHK
. I '$D(^DGCR(399,IBIFN,"CP",IBPROCP,"LNPRV","C",IBPRVFUN)) S OK=0 Q ; No line provider function IBPRVFUN for this procedure.
. S IBLPIEN=$O(^DGCR(399,IBIFN,"CP",IBPROCP,"LNPRV","C",IBPRVFUN,0))
. I 'IBLPIEN S OK=0 Q ; No line provider IEN for this line provider function.
. I '($D(^DGCR(399,IBIFN,"CP",IBPROCP,"LNPRV",IBLPIEN,0))#10) S OK=0 Q ; No '0' node for line level provider.
. S IBLNPROV=$P(^DGCR(399,IBIFN,"CP",IBPROCP,"LNPRV",IBLPIEN,0),U,2)
. I 'IBLNPROV S OK=0 Q ; No line provider for this line provider function.
. ; At this point we have line level provider of type IBPRVFUN.
. ; S OK=1 for this claim line. OK can be changed back to '0', for FALSE, if claim line fails condition.
. ; We would not get to this point if any line level provider with provider function IBPRVFUN didn't exist.
. S OK=1
. I $G(IBLNFLAG) S IBLNPRV("PROC",IBPROCP,IBPRVFUN)="",IBLNPRV("PRVFUN",IBPRVFUN,IBPROCP)=""
. Q
;
Q OK
;
UBPRVCK(IBIFN) ; DEM;432 - Check if claim requires operating provider.
;
; Description: This function checks if claim requires an operating provider.
;
; Checks:
;
; (1) If claim has a claim level operating provider,
; then no further checks (OK=1=TRUE).
; (2) If claim doesn't have a claim level operating provider,
; then check:
; (2.1) Is this a UB-04 claim? NO = QUIT (OK=1), YES = Continue to next check.
; (2.2) Check every claim line that includes HCPCS procs - operating provider.
; If every claim line that includes HCPCS procs has an operating provider,
; then we are OK and QUIT (OK=1).
; If any claim line that includes HCPCS procs doesn't have an operating
; provider, then we have an ERROR (OK=0).
;
; Input:
; IBIFN = Claim number IEN.
;
; Output:
; OK = 0 = claim doesn't have an operating provider
; when operating provider or rendering provider required.
; OK = 1 = claim has an operating provider, or,
; claim doesn't require operating provider.
;
N OK
; If claim doesn't have any procedure codes, then no checks required.
I '$O(^DGCR(399,IBIFN,"CP",0)) S OK=1 Q OK
;
S OK=$$CLOPPRV1("OPERATING") ; Do we have a claim level OPERATING PROVIDER (OK=1=TRUE)?
Q:OK OK ; QUIT, we have a claim level OPERATING PROVIDER (OK=1=TRUE).
;
N IBFT
S IBFT=($$FT^IBCEF(IBIFN)=3) ; UB-04 claim (1 = TRUE, 0 = FALSE)?
S OK=1 ; Initialize OK=1.
Q:'IBFT OK ; QUIT OK=1, not a UB-04 claim.
;
; Claim level check did not pass, check claim lines.
; No claim level OPERATING PROVIDER, so check every PROCEDURE for OPERATING PROVIDER.
S OK=$$UBPRVCK1("") ; Does every procedure have an OPERATING PROVIDER(1=TRUE,0=FALSE)?
;
Q OK
;
UBPRVCK1(IBPROCHK,IBONE) ; DEM;432 - Continuation of UBPRVCK function.
;
; Input:
; IBPROCHK(Optional) - Optional condition on PROCEDURE CODE (ICD, CPT, or HCFA procedure codes).
; IBONE(Optional) - Quit if at least one line has an OPERATING
;
; Output:
; OK - '1' Every procedure code that contains IBPROCHK (optional check) has an OPERATING PROVIDER.
; or if IBONE, then at least one procedure code that contains IBPROCHK (optional check) has an OPERATING PROVIDER.
; '0' Not every procedure code that contains IBPROCHK (optional check) has an OPERATING PROVIDER.
; or if IBONE, then NO procedure codes that contain IBPROCHK (optional check) has an OPERATING PROVIDER.
;
N OK
S OK=0 ; Initialize OK=0 for FALSE.
;
N IBLPIEN,IBLNPROV,IBPROCP
S IBPROCP=0 F S IBPROCP=$O(^DGCR(399,IBIFN,"CP",IBPROCP)) Q:'IBPROCP D Q:($D(^DGCR(399,IBIFN,"CP",IBPROCP,0))#10)&('OK)&('$G(IBONE)) I $G(IBONE),$G(OK) Q
. Q:'($D(^DGCR(399,IBIFN,"CP",IBPROCP,0))#10) ; No procedure '0' node.
. I $G(IBPROCHK)'="" Q:$P(^DGCR(399,IBIFN,"CP",IBPROCP,0),U,1)'[IBPROCHK
. I '$D(^DGCR(399,IBIFN,"CP",IBPROCP,"LNPRV","C","OPERATING")) S OK=0 Q ; No line OPERATING PROVIDER for this procedure.
. S IBLPIEN=$O(^DGCR(399,IBIFN,"CP",IBPROCP,"LNPRV","C","OPERATING",0))
. I 'IBLPIEN S OK=0 Q ; No line provider IEN for this line provider function.
. I '($D(^DGCR(399,IBIFN,"CP",IBPROCP,"LNPRV",IBLPIEN,0))#10) S OK=0 Q ; No '0' node for line level provider.
. S IBLNPROV=$P(^DGCR(399,IBIFN,"CP",IBPROCP,"LNPRV",IBLPIEN,0),U,2)
. I 'IBLNPROV S OK=0 Q ; No line provider for this line provider function.
. ; At this point we have line level provider of type OPERATING.
. ; S OK=1 for this claim line. OK can be changed back to '0', for FALSE, if claim line fails condition.
. ; We would not get to this point if any line level provider with provider function OPERATING didn't exist.
. S OK=1
. Q
;
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HIBCBB12 16662 printed Dec 13, 2024@02:08:48 Page 2
IBCBB12 ;ALB/DEM - PROCEDURE AND LINE LEVEL PROVIDER EDITS ;17-OCT-2010
+1 ;;2.0;INTEGRATED BILLING;**432,592,608**;21-MAR-94;Build 90
+2 ;;Per VA Directive 6402, this routine should not be modified.
+3 QUIT
+4 ;
LNPROV(IBIFN) ; DEM;432 - Edits for line level providers.
+1 ;
+2 ; Input:
+3 ; IBIFN - Claim number IEN.
+4 ;
+5 ; Output:
+6 ; OK - '1' Edits
+7 ; '0' No Edits.
+8 ; *Note: OK returned if called as function.
+9 ; Can be called as routine as well.
+10 ; IBER - Edit error string. Only updated if errors.
+11 ;
+12 ; Patch 432 EDITS:
+13 ;
+14 ; (1) Not all procedures have a Line Level Rendering Provider,
+15 ; and no Claim Level Rendering Provider.
+16 ; Error Message in Billing for Prof Rendering.
+17 ; *Note: Only applies to Rendering Provider Type.
+18 ;
+19 ; (2) All procedures have a Line Level Rendering Provider,
+20 ; and a Claim Level Rendering Provider who is different
+21 ; from any of the Line Level Rendering Providers.
+22 ; Error in Billing.
+23 ; *Note: Apply to all provider types (Rendering, Referring, Supervising, Attending, Operating, and Other Operating).
+24 ;
+25 NEW OK
+26 ; Initialize OK=0 for FALSE.
SET OK=0
+27 ; Need claim number IEN to continue.
if '$GET(IBIFN)
QUIT OK
+28 NEW IBPRVFUN,IBCLPRV,IBLNPRV,PRVFUN
+29 ; Form Type for claim.
if '$GET(IBFT)
SET IBFT=$$FT^IBCEF(IBIFN)
+30 ; JWS;IB*2.0*592 US1108 - Dental form check
+31 ; Must be CMS-1500 (2) or UB-04 (3) or (7) Dental J430D Form Type.
IF IBFT'=2
IF IBFT'=3
IF IBFT'=7
QUIT OK
+32 ; Allowable line provider functions for CMS-1500.
if IBFT=2
SET PRVFUN(2)="RENDERING,REFERRING,SUPERVISING"
+33 ; Allowable line provider functions for UB-04.
if IBFT=3
SET PRVFUN(3)="RENDERING,REFERRING,OPERATING,OTHER OPERATING"
+34 ; Allowable line provider functions for Dental form J430D.
if IBFT=7
SET PRVFUN(7)="RENDERING,REFERRING,SUPERVISING,ASSISTANT SURGEON"
+35 ; JWS;IB*2.0*592 US1108 - end
+36 FOR PRVFUN("CNT")=1:1:$LENGTH(PRVFUN(IBFT),",")
SET IBPRVFUN=$PIECE(PRVFUN(IBFT),",",PRVFUN("CNT"))
Begin DoDot:1
+37 ; Edit Check (1).
IF IBFT=2
IF IBPRVFUN="RENDERING"
IF '$$LNPRV2(IBPRVFUN)
IF '$DATA(^DGCR(399,IBIFN,"PRV","C",IBPRVFUN))
Begin DoDot:2
+38 ;
+39 ;/Beginning of IB*2.0*608 - vd (US3214)
+40 ; Changed the following from and error to a warning.
+41 ;S OK=1 ; OK=1 indicates we have at least one error.
+42 ;S IBER=IBER_"IB333;"
+43 DO WARN^IBCBB11("Claim has no Rendering Providers present.")
+44 ;/Ending of IB*2.0*608 - vd (US3214)
+45 QUIT
End DoDot:2
QUIT
+46 ; Quit if not all the procedures have a line level provider of the same provider type.
if '$$LNPRV2(IBPRVFUN,.IBLNPRV)
QUIT
+47 ; No claim level provider for this provider type.
if '$DATA(^DGCR(399,IBIFN,"PRV","C",IBPRVFUN))
QUIT
+48 ;
+49 ; Must have provider for provider type IBPRVFUN to continue (Edit (2)).
if '$$CLPRV2(IBPRVFUN,.IBCLPRV)
QUIT
+50 ;
+51 ; Edit Check (2).
SET IBCLPRV=0
FOR
SET IBCLPRV=$ORDER(IBCLPRV(IBPRVFUN,IBCLPRV))
if 'IBCLPRV
QUIT
Begin DoDot:2
+52 ; Check against line provider array IBLNPRV.
if $DATA(IBLNPRV(IBPRVFUN,IBCLPRV))
QUIT
+53 SET OK=1
+54 SET IBER=IBER_$SELECT(IBPRVFUN="ASSISTANT SURGEON":"IB335;",1:"IB334;")
+55 QUIT
End DoDot:2
+56 QUIT
End DoDot:1
+57 ;
+58 QUIT OK
+59 ;
LNPRV2(IBPRVFUN,IBLNPRV) ; Function - Edit Check (2) for line level provider.
+1 ; See Edit Check (2) at top of routine for details.
+2 ;
+3 ; Input:
+4 ; IBPRVFUN - Provider Type (FUNCTION). Example: RENDERING.
+5 ; IBLNPRV(Array) - Passed by reference. Intially undefined.
+6 ;
+7 ; Output:
+8 ; OK - If Edit Check (2) line level provider condition has
+9 ; been met, then OK will return '1' for TRUE, ELSE, '0'
+10 ; for FALSE.
+11 ; *See Edit Check (2) at top of routine for details.
+12 ; IBLNPRV(Array) - If Edit Check (2) condition has been met,
+13 ; then IBLNPRV will contain the provider type,
+14 ; and provider variable pointer as array
+15 ; subscripts, and array element is SET to
+16 ; NULL. => IBLNPRV(IBPRVFUN,IBLNPROV)="".
+17 ;
+18 NEW OK,IBPROCP,IBLPIEN,IBLNPROV
+19 SET IBPROCP=0
FOR
SET IBPROCP=$ORDER(^DGCR(399,IBIFN,"CP",IBPROCP))
if 'IBPROCP
QUIT
Begin DoDot:1
+20 if '($DATA(^DGCR(399,IBIFN,"CP",IBPROCP,0))#10)
QUIT
+21 ; No line provider function for this procedure.
IF '$DATA(^DGCR(399,IBIFN,"CP",IBPROCP,"LNPRV","C",IBPRVFUN))
SET OK=0
QUIT
+22 SET IBLPIEN=$ORDER(^DGCR(399,IBIFN,"CP",IBPROCP,"LNPRV","C",IBPRVFUN,0))
+23 ; No line provider IEN for this line provider function.
IF 'IBLPIEN
SET OK=0
QUIT
+24 ; No zero node for line level provider.
IF '($DATA(^DGCR(399,IBIFN,"CP",IBPROCP,"LNPRV",IBLPIEN,0))#10)
SET OK=0
QUIT
+25 SET IBLNPROV=$PIECE(^DGCR(399,IBIFN,"CP",IBPROCP,"LNPRV",IBLPIEN,0),"^",2)
+26 ; No line provider for this line provider function.
IF 'IBLNPROV
SET OK=0
QUIT
+27 SET IBLNPRV(IBPRVFUN,IBLNPROV)=""
+28 QUIT
End DoDot:1
IF $DATA(OK)
IF 'OK
QUIT
+29 ;
+30 ; OK will never equal '1' for TRUE at this point.
if $DATA(OK)
QUIT OK
+31 ; No line provider array for this line provider function.
IF '$DATA(OK)
IF '$DATA(IBLNPRV(IBPRVFUN))
SET OK=0
QUIT OK
+32 ; Edit Check (2) line provider condition has been met.
SET OK=1
+33 QUIT OK
+34 ;
CLPRV2(IBPRVFUN,IBCLPRV) ; Function - Edit Check (2) for claim level provider.
+1 ; See Edit Check (2) at top of routine for details.
+2 ;
+3 ; Input:
+4 ; IBPRVFUN - Provider Type (FUNCTION). Example: RENDERING.
+5 ; IBCLPRV(Array) - Passed by reference. Intially undefined.
+6 ;
+7 ; Output:
+8 ; OK - If Edit Check (2) claim level provider condition has
+9 ; been met, then OK will return '1' for TRUE, ELSE, '0'
+10 ; for FALSE.
+11 ; *See Edit Check (2) at top of routine for details.
+12 ; IBCLPRV(Array) - If Edit Check (2) condition has been met,
+13 ; then IBCLPRV will contain the provider type,
+14 ; and provider variable pointer as array
+15 ; subscripts, and array element is SET to
+16 ; NULL. => IBCLPRV(IBPRVFUN,IBCLPROV)="".
+17 ;
+18 NEW IBCLPIEN,IBCLPROV,OK
+19 ; Initialize OK=0 for FALSE.
SET OK=0
+20 SET IBCLPIEN=0
FOR
SET IBCLPIEN=$ORDER(^DGCR(399,IBIFN,"PRV","C",IBPRVFUN,IBCLPIEN))
if 'IBCLPIEN
QUIT
Begin DoDot:1
+21 if '($DATA(^DGCR(399,IBIFN,"PRV",IBCLPIEN,0))#10)
QUIT
+22 SET IBCLPROV=$PIECE(^DGCR(399,IBIFN,"PRV",IBCLPIEN,0),"^",2)
+23 if 'IBCLPROV
QUIT
+24 ; Set array for Edit Check (2) to compare claim level provider with line level provider.
SET IBCLPRV(IBPRVFUN,IBCLPROV)=""
+25 ; At this point we have our claim level provider of provider type IBPRVFUN. Set OK=1 for TRUE.
SET OK=1
+26 QUIT
End DoDot:1
if OK
QUIT
+27 ;
+28 if 'OK
QUIT OK
+29 SET OK=1
+30 QUIT OK
+31 ;
OPPROVCK(IBIFN) ; DEM;432 - Other Operating Provider edit checks.
+1 ;
+2 ; Input:
+3 ; IBIFN - Claim number IEN.
+4 ;
+5 ; Output:
+6 ; OK - '1' Edits
+7 ; '0' No Edits.
+8 ; *Note: OK returned if called as function ($$).
+9 ; Can be called as routine as well.
+10 ;
+11 ; Patch 432 line level Other Operating Provider Edit checks:
+12 ;
+13 ; (1) If claim level Other Operating Provider, then
+14 ; (1.1) claim must have claim level Operating Provider.
+15 ; OR
+16 ; (1.2) every line must have Operating Provider.
+17 ;
+18 ; If (1) Passes, then do edit check (2) below.
+19 ;
+20 ; (2) If any claim line has Other Operating Provider, then
+21 ; (2.1) must have Operating Provider on same claim line,
+22 ; OR
+23 ; (2.2) must have claim level Operating Provider.
+24 ;
+25 NEW OK
+26 ; Initialize OK=0 for FALSE.
SET OK=0
+27 ; Need claim number IEN to continue.
if '$GET(IBIFN)
QUIT OK
+28 ; Form Type for claim.
if '$GET(IBFT)
SET IBFT=$$FT^IBCEF(IBIFN)
+29 ; JWS;IB*2.0*592 US1108 - Dental form check
+30 ; Must be CMS-1500 (2) or UB-04 (3) Form Type or (7) Dental J430D
IF IBFT'=2
IF IBFT'=3
IF IBFT'=7
QUIT OK
+31 ;
+32 NEW IBPRVFUN,IBLNFLAG,IBLNPRV,CLOK,LNOK
+33 ;
+34 ; Note: Claim level provider - OTHER and OTHER OPERATING are the same.
+35 ; Check if condition (1) has been met.
+36 FOR IBPRVFUN="OTHER","OTHER OPERATING"
SET CLOK=$$CLOPPRV1(IBPRVFUN)
if CLOK
QUIT
+37 ; No claim level OTHER OPERATING PROVIDER, then QUIT, no further checks.
if 'CLOK
QUIT OK
+38 ; Initialize OK=0 for FALSE.
SET OK=0
+39 ; Condition (1) has been met, check condtion (1.1).
+40 ; Initialize CLOK=0 for FALSE.
SET CLOK=0
+41 ; Check condition (1.1).
IF $DATA(^DGCR(399,IBIFN,"PRV","C","OPERATING"))
SET IBPRVFUN="OPERATING"
SET CLOK=$$CLOPPRV1(IBPRVFUN)
+42 ; If CLOK at this point, then skip condition check (1.2) and continue to condition (2).
+43 ; Initialize LNOK=0 for FALSE.
SET LNOK=0
+44 ; Check condition (1.2). If 'LNOK, then we have an error and QUIT.
IF 'CLOK
SET IBPRVFUN="OPERATING"
SET LNOK=$$LNOPPRV1(IBPRVFUN)
IF 'LNOK
SET OK=1
QUIT OK
+45 ; If LNOK, then continue to condition check (2).
+46 ; Initialize LNOK=0 for FALSE.
SET LNOK=0
+47 ; KILL IBLNPRV array before call to $$LNOPPRV1(IBPRVFUN,1,.IBLNPRV).
KILL IBLNPRV
+48 ; Condition check (2) start.
SET IBPRVFUN="OTHER OPERATING"
SET LNOK=$$LNOPPRV1(IBPRVFUN,1,.IBLNPRV)
+49 ; If no data in IBLNPRV("PRVFUN") array, then skip rest of checks, no error.
IF '$DATA(IBLNPRV("PRVFUN"))
SET OK=0
QUIT OK
+50 ; If data in IBLNPRV("PRVFUN") array, then check condition (2.1).
+51 ; Condition check (2.1) start.
SET IBPRVFUN="OPERATING"
SET LNOK=$$LNOPPRV1(IBPRVFUN,1,.IBLNPRV)
+52 ; Initialize LNOK=0 for FALSE.
SET LNOK=0
+53 ; If data in IBLNPRV("PRVFUN") array, then continue condition check (2.1).
if $DATA(IBLNPRV("PRVFUN"))
Begin DoDot:1
+54 NEW IBPROCP
+55 SET IBPROCP=0
FOR
SET IBPROCP=$ORDER(IBLNPRV("PROC",IBPROCP))
if 'IBPROCP
QUIT
Begin DoDot:2
+56 IF $DATA(IBLNPRV("PROC",IBPROCP,"OTHER OPERATING"))
IF '$DATA(IBLNPRV("PROC",IBPROCP,"OPERATING"))
SET LNOK=0
QUIT
+57 ; At this point, we have at least one match. If there wasn't a match, then LNOK=0 and we would have QUIT.
SET LNOK=1
+58 QUIT
End DoDot:2
if 'LNOK
QUIT
+59 QUIT
End DoDot:1
+60 ; Conditions (2) and (2.1) are met (no error). SET OK=0 and QUIT.
IF LNOK
SET OK=0
QUIT OK
+61 ; If 'LNOK, then continue to condition check (2.2).
+62 ; Initialize CLOK=0 for FALSE.
SET CLOK=0
+63 ; Condition check (2.2).
SET IBPRVFUN="OPERATING"
SET CLOK=$$CLOPPRV1(IBPRVFUN)
+64 ; Conditions (2) and (2.2) are met (no error). SET OK=0 and QUIT.
IF CLOK
SET OK=0
QUIT OK
+65 ; At this point, we have an error. SET OK=1, and QUIT.
+66 SET OK=1
+67 QUIT OK
+68 ;
CLOPPRV1(IBPRVFUN) ; Claim level provider/provider function check.
+1 ;
+2 ; Check if there is a claim level provider with provider function IBPRVFUN.
+3 ;
+4 ; Input:
+5 ; IBPRVFUN - PROVIDER FUNCTION.
+6 ;
+7 ; Output:
+8 ; OK - '1' Claim level provider exist for provider function IBPRVFUN.
+9 ; '0' No Claim level provider exist for provider function IBPRVFUN.
+10 ;
+11 NEW OK,IBCLPIEN,IBCLPROV
+12 ; Initialize OK=0 for FALSE.
SET OK=0
+13 ;
+14 IF $DATA(^DGCR(399,IBIFN,"PRV","C",IBPRVFUN))
Begin DoDot:1
+15 SET IBCLPIEN=0
FOR
SET IBCLPIEN=$ORDER(^DGCR(399,IBIFN,"PRV","C",IBPRVFUN,IBCLPIEN))
if 'IBCLPIEN
QUIT
Begin DoDot:2
+16 if '($DATA(^DGCR(399,IBIFN,"PRV",IBCLPIEN,0))#10)
QUIT
+17 SET IBCLPROV=$PIECE(^DGCR(399,IBIFN,"PRV",IBCLPIEN,0),U,2)
+18 if 'IBCLPROV
QUIT
+19 ; At this point we have claim level provider with provider function IBPRVFUN and can QUIT function/subroutine.
SET OK=1
+20 QUIT
End DoDot:2
if OK
QUIT
+21 QUIT
End DoDot:1
+22 ;
+23 QUIT OK
+24 ;
LNOPPRV1(IBPRVFUN,IBLNFLAG,IBLNPRV,IBPROCHK) ; Check every claim line for provider function IBPRVFUN.
+1 ;
+2 ;
+3 ; Input:
+4 ; IBPRVFUN - PROVIDER FUNCTION.
+5 ; IBLNFLAG(Optional) = 1 or 0. 1 indicates return IBLNPRV array passed by reference, otherwise '0' for NO.
+6 ; IBLNPRV(Optional) - Array passed by reference => IF SET OK=1, then
+7 ; I $G(IBLNFLAG) S IBLNPRV("PROC",IBPROCP,IBPRVFUN)="",IBLNPRV("PRVFUN",IBPRVFUN,IBPROCP)=""
+8 ; IBPROCHK - Condition on PROCEDURE (ICD, CPT, or HCFA procedure codes).
+9 ;
+10 ; Output:
+11 ; OK - '1' Every line level provider exist for provider function IBPRVFUN.
+12 ; '0' Not every line level provider exist for provider function IBPRVFUN.
+13 ;
+14 NEW OK
+15 ; Initialize OK=0 for FALSE.
SET OK=0
+16 ;
+17 NEW IBLPIEN,IBLNPROV,IBPROCP
+18 SET IBPROCP=0
FOR
SET IBPROCP=$ORDER(^DGCR(399,IBIFN,"CP",IBPROCP))
if 'IBPROCP
QUIT
Begin DoDot:1
+19 ; No procedure '0' node.
if '($DATA(^DGCR(399,IBIFN,"CP",IBPROCP,0))#10)
QUIT
+20 IF $GET(IBPROCHK)'=""
if $PIECE(^DGCR(399,IBIFN,"CP",IBPROCP,0),U,1)'[IBPROCHK
QUIT
+21 ; No line provider function IBPRVFUN for this procedure.
IF '$DATA(^DGCR(399,IBIFN,"CP",IBPROCP,"LNPRV","C",IBPRVFUN))
SET OK=0
QUIT
+22 SET IBLPIEN=$ORDER(^DGCR(399,IBIFN,"CP",IBPROCP,"LNPRV","C",IBPRVFUN,0))
+23 ; No line provider IEN for this line provider function.
IF 'IBLPIEN
SET OK=0
QUIT
+24 ; No '0' node for line level provider.
IF '($DATA(^DGCR(399,IBIFN,"CP",IBPROCP,"LNPRV",IBLPIEN,0))#10)
SET OK=0
QUIT
+25 SET IBLNPROV=$PIECE(^DGCR(399,IBIFN,"CP",IBPROCP,"LNPRV",IBLPIEN,0),U,2)
+26 ; No line provider for this line provider function.
IF 'IBLNPROV
SET OK=0
QUIT
+27 ; At this point we have line level provider of type IBPRVFUN.
+28 ; S OK=1 for this claim line. OK can be changed back to '0', for FALSE, if claim line fails condition.
+29 ; We would not get to this point if any line level provider with provider function IBPRVFUN didn't exist.
+30 SET OK=1
+31 IF $GET(IBLNFLAG)
SET IBLNPRV("PROC",IBPROCP,IBPRVFUN)=""
SET IBLNPRV("PRVFUN",IBPRVFUN,IBPROCP)=""
+32 QUIT
End DoDot:1
if ($DATA(^DGCR(399,IBIFN,"CP",IBPROCP,0))#10)&('OK)
QUIT
+33 ;
+34 QUIT OK
+35 ;
UBPRVCK(IBIFN) ; DEM;432 - Check if claim requires operating provider.
+1 ;
+2 ; Description: This function checks if claim requires an operating provider.
+3 ;
+4 ; Checks:
+5 ;
+6 ; (1) If claim has a claim level operating provider,
+7 ; then no further checks (OK=1=TRUE).
+8 ; (2) If claim doesn't have a claim level operating provider,
+9 ; then check:
+10 ; (2.1) Is this a UB-04 claim? NO = QUIT (OK=1), YES = Continue to next check.
+11 ; (2.2) Check every claim line that includes HCPCS procs - operating provider.
+12 ; If every claim line that includes HCPCS procs has an operating provider,
+13 ; then we are OK and QUIT (OK=1).
+14 ; If any claim line that includes HCPCS procs doesn't have an operating
+15 ; provider, then we have an ERROR (OK=0).
+16 ;
+17 ; Input:
+18 ; IBIFN = Claim number IEN.
+19 ;
+20 ; Output:
+21 ; OK = 0 = claim doesn't have an operating provider
+22 ; when operating provider or rendering provider required.
+23 ; OK = 1 = claim has an operating provider, or,
+24 ; claim doesn't require operating provider.
+25 ;
+26 NEW OK
+27 ; If claim doesn't have any procedure codes, then no checks required.
+28 IF '$ORDER(^DGCR(399,IBIFN,"CP",0))
SET OK=1
QUIT OK
+29 ;
+30 ; Do we have a claim level OPERATING PROVIDER (OK=1=TRUE)?
SET OK=$$CLOPPRV1("OPERATING")
+31 ; QUIT, we have a claim level OPERATING PROVIDER (OK=1=TRUE).
if OK
QUIT OK
+32 ;
+33 NEW IBFT
+34 ; UB-04 claim (1 = TRUE, 0 = FALSE)?
SET IBFT=($$FT^IBCEF(IBIFN)=3)
+35 ; Initialize OK=1.
SET OK=1
+36 ; QUIT OK=1, not a UB-04 claim.
if 'IBFT
QUIT OK
+37 ;
+38 ; Claim level check did not pass, check claim lines.
+39 ; No claim level OPERATING PROVIDER, so check every PROCEDURE for OPERATING PROVIDER.
+40 ; Does every procedure have an OPERATING PROVIDER(1=TRUE,0=FALSE)?
SET OK=$$UBPRVCK1("")
+41 ;
+42 QUIT OK
+43 ;
UBPRVCK1(IBPROCHK,IBONE) ; DEM;432 - Continuation of UBPRVCK function.
+1 ;
+2 ; Input:
+3 ; IBPROCHK(Optional) - Optional condition on PROCEDURE CODE (ICD, CPT, or HCFA procedure codes).
+4 ; IBONE(Optional) - Quit if at least one line has an OPERATING
+5 ;
+6 ; Output:
+7 ; OK - '1' Every procedure code that contains IBPROCHK (optional check) has an OPERATING PROVIDER.
+8 ; or if IBONE, then at least one procedure code that contains IBPROCHK (optional check) has an OPERATING PROVIDER.
+9 ; '0' Not every procedure code that contains IBPROCHK (optional check) has an OPERATING PROVIDER.
+10 ; or if IBONE, then NO procedure codes that contain IBPROCHK (optional check) has an OPERATING PROVIDER.
+11 ;
+12 NEW OK
+13 ; Initialize OK=0 for FALSE.
SET OK=0
+14 ;
+15 NEW IBLPIEN,IBLNPROV,IBPROCP
+16 SET IBPROCP=0
FOR
SET IBPROCP=$ORDER(^DGCR(399,IBIFN,"CP",IBPROCP))
if 'IBPROCP
QUIT
Begin DoDot:1
+17 ; No procedure '0' node.
if '($DATA(^DGCR(399,IBIFN,"CP",IBPROCP,0))#10)
QUIT
+18 IF $GET(IBPROCHK)'=""
if $PIECE(^DGCR(399,IBIFN,"CP",IBPROCP,0),U,1)'[IBPROCHK
QUIT
+19 ; No line OPERATING PROVIDER for this procedure.
IF '$DATA(^DGCR(399,IBIFN,"CP",IBPROCP,"LNPRV","C","OPERATING"))
SET OK=0
QUIT
+20 SET IBLPIEN=$ORDER(^DGCR(399,IBIFN,"CP",IBPROCP,"LNPRV","C","OPERATING",0))
+21 ; No line provider IEN for this line provider function.
IF 'IBLPIEN
SET OK=0
QUIT
+22 ; No '0' node for line level provider.
IF '($DATA(^DGCR(399,IBIFN,"CP",IBPROCP,"LNPRV",IBLPIEN,0))#10)
SET OK=0
QUIT
+23 SET IBLNPROV=$PIECE(^DGCR(399,IBIFN,"CP",IBPROCP,"LNPRV",IBLPIEN,0),U,2)
+24 ; No line provider for this line provider function.
IF 'IBLNPROV
SET OK=0
QUIT
+25 ; At this point we have line level provider of type OPERATING.
+26 ; S OK=1 for this claim line. OK can be changed back to '0', for FALSE, if claim line fails condition.
+27 ; We would not get to this point if any line level provider with provider function OPERATING didn't exist.
+28 SET OK=1
+29 QUIT
End DoDot:1
if ($DATA(^DGCR(399,IBIFN,"CP",IBPROCP,0))#10)&('OK)&('$GET(IBONE))
QUIT
IF $GET(IBONE)
IF $GET(OK)
QUIT
+30 ;