Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: IBCBB12

IBCBB12.m

Go to the documentation of this file.
  1. 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
  1. ;;Per VA Directive 6402, this routine should not be modified.
  1. Q
  1. ;
  1. LNPROV(IBIFN) ; DEM;432 - Edits for line level providers.
  1. ;
  1. ; Input:
  1. ; IBIFN - Claim number IEN.
  1. ;
  1. ; Output:
  1. ; OK - '1' Edits
  1. ; '0' No Edits.
  1. ; *Note: OK returned if called as function.
  1. ; Can be called as routine as well.
  1. ; IBER - Edit error string. Only updated if errors.
  1. ;
  1. ; Patch 432 EDITS:
  1. ;
  1. ; (1) Not all procedures have a Line Level Rendering Provider,
  1. ; and no Claim Level Rendering Provider.
  1. ; Error Message in Billing for Prof Rendering.
  1. ; *Note: Only applies to Rendering Provider Type.
  1. ;
  1. ; (2) All procedures have a Line Level Rendering Provider,
  1. ; and a Claim Level Rendering Provider who is different
  1. ; from any of the Line Level Rendering Providers.
  1. ; Error in Billing.
  1. ; *Note: Apply to all provider types (Rendering, Referring, Supervising, Attending, Operating, and Other Operating).
  1. ;
  1. N OK
  1. S OK=0 ; Initialize OK=0 for FALSE.
  1. Q:'$G(IBIFN) OK ; Need claim number IEN to continue.
  1. N IBPRVFUN,IBCLPRV,IBLNPRV,PRVFUN
  1. S:'$G(IBFT) IBFT=$$FT^IBCEF(IBIFN) ; Form Type for claim.
  1. ; JWS;IB*2.0*592 US1108 - Dental form check
  1. I IBFT'=2,IBFT'=3,IBFT'=7 Q OK ; Must be CMS-1500 (2) or UB-04 (3) or (7) Dental J430D Form Type.
  1. S:IBFT=2 PRVFUN(2)="RENDERING,REFERRING,SUPERVISING" ; Allowable line provider functions for CMS-1500.
  1. S:IBFT=3 PRVFUN(3)="RENDERING,REFERRING,OPERATING,OTHER OPERATING" ; Allowable line provider functions for UB-04.
  1. S:IBFT=7 PRVFUN(7)="RENDERING,REFERRING,SUPERVISING,ASSISTANT SURGEON" ; Allowable line provider functions for Dental form J430D.
  1. ; JWS;IB*2.0*592 US1108 - end
  1. F PRVFUN("CNT")=1:1:$L(PRVFUN(IBFT),",") S IBPRVFUN=$P(PRVFUN(IBFT),",",PRVFUN("CNT")) D
  1. . I IBFT=2,IBPRVFUN="RENDERING",'$$LNPRV2(IBPRVFUN),'$D(^DGCR(399,IBIFN,"PRV","C",IBPRVFUN)) D Q ; Edit Check (1).
  1. .. ;
  1. .. ;/Beginning of IB*2.0*608 - vd (US3214)
  1. .. ; Changed the following from and error to a warning.
  1. .. ;S OK=1 ; OK=1 indicates we have at least one error.
  1. .. ;S IBER=IBER_"IB333;"
  1. .. D WARN^IBCBB11("Claim has no Rendering Providers present.")
  1. .. ;/Ending of IB*2.0*608 - vd (US3214)
  1. .. Q
  1. . Q:'$$LNPRV2(IBPRVFUN,.IBLNPRV) ; Quit if not all the procedures have a line level provider of the same provider type.
  1. . Q:'$D(^DGCR(399,IBIFN,"PRV","C",IBPRVFUN)) ; No claim level provider for this provider type.
  1. . ;
  1. . Q:'$$CLPRV2(IBPRVFUN,.IBCLPRV) ; Must have provider for provider type IBPRVFUN to continue (Edit (2)).
  1. . ;
  1. . S IBCLPRV=0 F S IBCLPRV=$O(IBCLPRV(IBPRVFUN,IBCLPRV)) Q:'IBCLPRV D ; Edit Check (2).
  1. .. Q:$D(IBLNPRV(IBPRVFUN,IBCLPRV)) ; Check against line provider array IBLNPRV.
  1. .. S OK=1
  1. .. S IBER=IBER_$S(IBPRVFUN="ASSISTANT SURGEON":"IB335;",1:"IB334;")
  1. .. Q
  1. . Q
  1. ;
  1. Q OK
  1. ;
  1. LNPRV2(IBPRVFUN,IBLNPRV) ; Function - Edit Check (2) for line level provider.
  1. ; See Edit Check (2) at top of routine for details.
  1. ;
  1. ; Input:
  1. ; IBPRVFUN - Provider Type (FUNCTION). Example: RENDERING.
  1. ; IBLNPRV(Array) - Passed by reference. Intially undefined.
  1. ;
  1. ; Output:
  1. ; OK - If Edit Check (2) line level provider condition has
  1. ; been met, then OK will return '1' for TRUE, ELSE, '0'
  1. ; for FALSE.
  1. ; *See Edit Check (2) at top of routine for details.
  1. ; IBLNPRV(Array) - If Edit Check (2) condition has been met,
  1. ; then IBLNPRV will contain the provider type,
  1. ; and provider variable pointer as array
  1. ; subscripts, and array element is SET to
  1. ; NULL. => IBLNPRV(IBPRVFUN,IBLNPROV)="".
  1. ;
  1. N OK,IBPROCP,IBLPIEN,IBLNPROV
  1. S IBPROCP=0 F S IBPROCP=$O(^DGCR(399,IBIFN,"CP",IBPROCP)) Q:'IBPROCP D I $D(OK),'OK Q
  1. . Q:'($D(^DGCR(399,IBIFN,"CP",IBPROCP,0))#10)
  1. . I '$D(^DGCR(399,IBIFN,"CP",IBPROCP,"LNPRV","C",IBPRVFUN)) S OK=0 Q ; No line provider function for this procedure.
  1. . S IBLPIEN=$O(^DGCR(399,IBIFN,"CP",IBPROCP,"LNPRV","C",IBPRVFUN,0))
  1. . I 'IBLPIEN S OK=0 Q ; No line provider IEN for this line provider function.
  1. . I '($D(^DGCR(399,IBIFN,"CP",IBPROCP,"LNPRV",IBLPIEN,0))#10) S OK=0 Q ; No zero node for line level provider.
  1. . S IBLNPROV=$P(^DGCR(399,IBIFN,"CP",IBPROCP,"LNPRV",IBLPIEN,0),"^",2)
  1. . I 'IBLNPROV S OK=0 Q ; No line provider for this line provider function.
  1. . S IBLNPRV(IBPRVFUN,IBLNPROV)=""
  1. . Q
  1. ;
  1. Q:$D(OK) OK ; OK will never equal '1' for TRUE at this point.
  1. I '$D(OK),'$D(IBLNPRV(IBPRVFUN)) S OK=0 Q OK ; No line provider array for this line provider function.
  1. S OK=1 ; Edit Check (2) line provider condition has been met.
  1. Q OK
  1. ;
  1. CLPRV2(IBPRVFUN,IBCLPRV) ; Function - Edit Check (2) for claim level provider.
  1. ; See Edit Check (2) at top of routine for details.
  1. ;
  1. ; Input:
  1. ; IBPRVFUN - Provider Type (FUNCTION). Example: RENDERING.
  1. ; IBCLPRV(Array) - Passed by reference. Intially undefined.
  1. ;
  1. ; Output:
  1. ; OK - If Edit Check (2) claim level provider condition has
  1. ; been met, then OK will return '1' for TRUE, ELSE, '0'
  1. ; for FALSE.
  1. ; *See Edit Check (2) at top of routine for details.
  1. ; IBCLPRV(Array) - If Edit Check (2) condition has been met,
  1. ; then IBCLPRV will contain the provider type,
  1. ; and provider variable pointer as array
  1. ; subscripts, and array element is SET to
  1. ; NULL. => IBCLPRV(IBPRVFUN,IBCLPROV)="".
  1. ;
  1. N IBCLPIEN,IBCLPROV,OK
  1. S OK=0 ; Initialize OK=0 for FALSE.
  1. S IBCLPIEN=0 F S IBCLPIEN=$O(^DGCR(399,IBIFN,"PRV","C",IBPRVFUN,IBCLPIEN)) Q:'IBCLPIEN D Q:OK
  1. . Q:'($D(^DGCR(399,IBIFN,"PRV",IBCLPIEN,0))#10)
  1. . S IBCLPROV=$P(^DGCR(399,IBIFN,"PRV",IBCLPIEN,0),"^",2)
  1. . Q:'IBCLPROV
  1. . S IBCLPRV(IBPRVFUN,IBCLPROV)="" ; Set array for Edit Check (2) to compare claim level provider with line level provider.
  1. . S OK=1 ; At this point we have our claim level provider of provider type IBPRVFUN. Set OK=1 for TRUE.
  1. . Q
  1. ;
  1. Q:'OK OK
  1. S OK=1
  1. Q OK
  1. ;
  1. OPPROVCK(IBIFN) ; DEM;432 - Other Operating Provider edit checks.
  1. ;
  1. ; Input:
  1. ; IBIFN - Claim number IEN.
  1. ;
  1. ; Output:
  1. ; OK - '1' Edits
  1. ; '0' No Edits.
  1. ; *Note: OK returned if called as function ($$).
  1. ; Can be called as routine as well.
  1. ;
  1. ; Patch 432 line level Other Operating Provider Edit checks:
  1. ;
  1. ; (1) If claim level Other Operating Provider, then
  1. ; (1.1) claim must have claim level Operating Provider.
  1. ; OR
  1. ; (1.2) every line must have Operating Provider.
  1. ;
  1. ; If (1) Passes, then do edit check (2) below.
  1. ;
  1. ; (2) If any claim line has Other Operating Provider, then
  1. ; (2.1) must have Operating Provider on same claim line,
  1. ; OR
  1. ; (2.2) must have claim level Operating Provider.
  1. ;
  1. N OK
  1. S OK=0 ; Initialize OK=0 for FALSE.
  1. Q:'$G(IBIFN) OK ; Need claim number IEN to continue.
  1. S:'$G(IBFT) IBFT=$$FT^IBCEF(IBIFN) ; Form Type for claim.
  1. ; JWS;IB*2.0*592 US1108 - Dental form check
  1. I IBFT'=2,IBFT'=3,IBFT'=7 Q OK ; Must be CMS-1500 (2) or UB-04 (3) Form Type or (7) Dental J430D
  1. ;
  1. N IBPRVFUN,IBLNFLAG,IBLNPRV,CLOK,LNOK
  1. ;
  1. ; Note: Claim level provider - OTHER and OTHER OPERATING are the same.
  1. ; Check if condition (1) has been met.
  1. F IBPRVFUN="OTHER","OTHER OPERATING" S CLOK=$$CLOPPRV1(IBPRVFUN) Q:CLOK
  1. Q:'CLOK OK ; No claim level OTHER OPERATING PROVIDER, then QUIT, no further checks.
  1. S OK=0 ; Initialize OK=0 for FALSE.
  1. ; Condition (1) has been met, check condtion (1.1).
  1. S CLOK=0 ; Initialize CLOK=0 for FALSE.
  1. I $D(^DGCR(399,IBIFN,"PRV","C","OPERATING")) S IBPRVFUN="OPERATING",CLOK=$$CLOPPRV1(IBPRVFUN) ; Check condition (1.1).
  1. ; If CLOK at this point, then skip condition check (1.2) and continue to condition (2).
  1. S LNOK=0 ; Initialize LNOK=0 for FALSE.
  1. 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.
  1. ; If LNOK, then continue to condition check (2).
  1. S LNOK=0 ; Initialize LNOK=0 for FALSE.
  1. K IBLNPRV ; KILL IBLNPRV array before call to $$LNOPPRV1(IBPRVFUN,1,.IBLNPRV).
  1. S IBPRVFUN="OTHER OPERATING",LNOK=$$LNOPPRV1(IBPRVFUN,1,.IBLNPRV) ; Condition check (2) start.
  1. I '$D(IBLNPRV("PRVFUN")) S OK=0 Q OK ; If no data in IBLNPRV("PRVFUN") array, then skip rest of checks, no error.
  1. ; If data in IBLNPRV("PRVFUN") array, then check condition (2.1).
  1. S IBPRVFUN="OPERATING",LNOK=$$LNOPPRV1(IBPRVFUN,1,.IBLNPRV) ; Condition check (2.1) start.
  1. S LNOK=0 ; Initialize LNOK=0 for FALSE.
  1. D:$D(IBLNPRV("PRVFUN")) ; If data in IBLNPRV("PRVFUN") array, then continue condition check (2.1).
  1. . N IBPROCP
  1. . S IBPROCP=0 F S IBPROCP=$O(IBLNPRV("PROC",IBPROCP)) Q:'IBPROCP D Q:'LNOK
  1. . . I $D(IBLNPRV("PROC",IBPROCP,"OTHER OPERATING")),'$D(IBLNPRV("PROC",IBPROCP,"OPERATING")) S LNOK=0 Q
  1. . . 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.
  1. . . Q
  1. . Q
  1. I LNOK S OK=0 Q OK ; Conditions (2) and (2.1) are met (no error). SET OK=0 and QUIT.
  1. ; If 'LNOK, then continue to condition check (2.2).
  1. S CLOK=0 ; Initialize CLOK=0 for FALSE.
  1. S IBPRVFUN="OPERATING",CLOK=$$CLOPPRV1(IBPRVFUN) ; Condition check (2.2).
  1. I CLOK S OK=0 Q OK ; Conditions (2) and (2.2) are met (no error). SET OK=0 and QUIT.
  1. ; At this point, we have an error. SET OK=1, and QUIT.
  1. S OK=1
  1. Q OK
  1. ;
  1. CLOPPRV1(IBPRVFUN) ; Claim level provider/provider function check.
  1. ;
  1. ; Check if there is a claim level provider with provider function IBPRVFUN.
  1. ;
  1. ; Input:
  1. ; IBPRVFUN - PROVIDER FUNCTION.
  1. ;
  1. ; Output:
  1. ; OK - '1' Claim level provider exist for provider function IBPRVFUN.
  1. ; '0' No Claim level provider exist for provider function IBPRVFUN.
  1. ;
  1. N OK,IBCLPIEN,IBCLPROV
  1. S OK=0 ; Initialize OK=0 for FALSE.
  1. ;
  1. I $D(^DGCR(399,IBIFN,"PRV","C",IBPRVFUN)) D
  1. . S IBCLPIEN=0 F S IBCLPIEN=$O(^DGCR(399,IBIFN,"PRV","C",IBPRVFUN,IBCLPIEN)) Q:'IBCLPIEN D Q:OK
  1. . . Q:'($D(^DGCR(399,IBIFN,"PRV",IBCLPIEN,0))#10)
  1. . . S IBCLPROV=$P(^DGCR(399,IBIFN,"PRV",IBCLPIEN,0),U,2)
  1. . . Q:'IBCLPROV
  1. . . S OK=1 ; At this point we have claim level provider with provider function IBPRVFUN and can QUIT function/subroutine.
  1. . . Q
  1. . Q
  1. ;
  1. Q OK
  1. ;
  1. LNOPPRV1(IBPRVFUN,IBLNFLAG,IBLNPRV,IBPROCHK) ; Check every claim line for provider function IBPRVFUN.
  1. ;
  1. ;
  1. ; Input:
  1. ; IBPRVFUN - PROVIDER FUNCTION.
  1. ; IBLNFLAG(Optional) = 1 or 0. 1 indicates return IBLNPRV array passed by reference, otherwise '0' for NO.
  1. ; IBLNPRV(Optional) - Array passed by reference => IF SET OK=1, then
  1. ; I $G(IBLNFLAG) S IBLNPRV("PROC",IBPROCP,IBPRVFUN)="",IBLNPRV("PRVFUN",IBPRVFUN,IBPROCP)=""
  1. ; IBPROCHK - Condition on PROCEDURE (ICD, CPT, or HCFA procedure codes).
  1. ;
  1. ; Output:
  1. ; OK - '1' Every line level provider exist for provider function IBPRVFUN.
  1. ; '0' Not every line level provider exist for provider function IBPRVFUN.
  1. ;
  1. N OK
  1. S OK=0 ; Initialize OK=0 for FALSE.
  1. ;
  1. N IBLPIEN,IBLNPROV,IBPROCP
  1. 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)
  1. . Q:'($D(^DGCR(399,IBIFN,"CP",IBPROCP,0))#10) ; No procedure '0' node.
  1. . I $G(IBPROCHK)'="" Q:$P(^DGCR(399,IBIFN,"CP",IBPROCP,0),U,1)'[IBPROCHK
  1. . I '$D(^DGCR(399,IBIFN,"CP",IBPROCP,"LNPRV","C",IBPRVFUN)) S OK=0 Q ; No line provider function IBPRVFUN for this procedure.
  1. . S IBLPIEN=$O(^DGCR(399,IBIFN,"CP",IBPROCP,"LNPRV","C",IBPRVFUN,0))
  1. . I 'IBLPIEN S OK=0 Q ; No line provider IEN for this line provider function.
  1. . I '($D(^DGCR(399,IBIFN,"CP",IBPROCP,"LNPRV",IBLPIEN,0))#10) S OK=0 Q ; No '0' node for line level provider.
  1. . S IBLNPROV=$P(^DGCR(399,IBIFN,"CP",IBPROCP,"LNPRV",IBLPIEN,0),U,2)
  1. . I 'IBLNPROV S OK=0 Q ; No line provider for this line provider function.
  1. . ; At this point we have line level provider of type IBPRVFUN.
  1. . ; S OK=1 for this claim line. OK can be changed back to '0', for FALSE, if claim line fails condition.
  1. . ; We would not get to this point if any line level provider with provider function IBPRVFUN didn't exist.
  1. . S OK=1
  1. . I $G(IBLNFLAG) S IBLNPRV("PROC",IBPROCP,IBPRVFUN)="",IBLNPRV("PRVFUN",IBPRVFUN,IBPROCP)=""
  1. . Q
  1. ;
  1. Q OK
  1. ;
  1. UBPRVCK(IBIFN) ; DEM;432 - Check if claim requires operating provider.
  1. ;
  1. ; Description: This function checks if claim requires an operating provider.
  1. ;
  1. ; Checks:
  1. ;
  1. ; (1) If claim has a claim level operating provider,
  1. ; then no further checks (OK=1=TRUE).
  1. ; (2) If claim doesn't have a claim level operating provider,
  1. ; then check:
  1. ; (2.1) Is this a UB-04 claim? NO = QUIT (OK=1), YES = Continue to next check.
  1. ; (2.2) Check every claim line that includes HCPCS procs - operating provider.
  1. ; If every claim line that includes HCPCS procs has an operating provider,
  1. ; then we are OK and QUIT (OK=1).
  1. ; If any claim line that includes HCPCS procs doesn't have an operating
  1. ; provider, then we have an ERROR (OK=0).
  1. ;
  1. ; Input:
  1. ; IBIFN = Claim number IEN.
  1. ;
  1. ; Output:
  1. ; OK = 0 = claim doesn't have an operating provider
  1. ; when operating provider or rendering provider required.
  1. ; OK = 1 = claim has an operating provider, or,
  1. ; claim doesn't require operating provider.
  1. ;
  1. N OK
  1. ; If claim doesn't have any procedure codes, then no checks required.
  1. I '$O(^DGCR(399,IBIFN,"CP",0)) S OK=1 Q OK
  1. ;
  1. S OK=$$CLOPPRV1("OPERATING") ; Do we have a claim level OPERATING PROVIDER (OK=1=TRUE)?
  1. Q:OK OK ; QUIT, we have a claim level OPERATING PROVIDER (OK=1=TRUE).
  1. ;
  1. N IBFT
  1. S IBFT=($$FT^IBCEF(IBIFN)=3) ; UB-04 claim (1 = TRUE, 0 = FALSE)?
  1. S OK=1 ; Initialize OK=1.
  1. Q:'IBFT OK ; QUIT OK=1, not a UB-04 claim.
  1. ;
  1. ; Claim level check did not pass, check claim lines.
  1. ; No claim level OPERATING PROVIDER, so check every PROCEDURE for OPERATING PROVIDER.
  1. S OK=$$UBPRVCK1("") ; Does every procedure have an OPERATING PROVIDER(1=TRUE,0=FALSE)?
  1. ;
  1. Q OK
  1. ;
  1. UBPRVCK1(IBPROCHK,IBONE) ; DEM;432 - Continuation of UBPRVCK function.
  1. ;
  1. ; Input:
  1. ; IBPROCHK(Optional) - Optional condition on PROCEDURE CODE (ICD, CPT, or HCFA procedure codes).
  1. ; IBONE(Optional) - Quit if at least one line has an OPERATING
  1. ;
  1. ; Output:
  1. ; OK - '1' Every procedure code that contains IBPROCHK (optional check) has an OPERATING PROVIDER.
  1. ; or if IBONE, then at least one procedure code that contains IBPROCHK (optional check) has an OPERATING PROVIDER.
  1. ; '0' Not every procedure code that contains IBPROCHK (optional check) has an OPERATING PROVIDER.
  1. ; or if IBONE, then NO procedure codes that contain IBPROCHK (optional check) has an OPERATING PROVIDER.
  1. ;
  1. N OK
  1. S OK=0 ; Initialize OK=0 for FALSE.
  1. ;
  1. N IBLPIEN,IBLNPROV,IBPROCP
  1. 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
  1. . Q:'($D(^DGCR(399,IBIFN,"CP",IBPROCP,0))#10) ; No procedure '0' node.
  1. . I $G(IBPROCHK)'="" Q:$P(^DGCR(399,IBIFN,"CP",IBPROCP,0),U,1)'[IBPROCHK
  1. . I '$D(^DGCR(399,IBIFN,"CP",IBPROCP,"LNPRV","C","OPERATING")) S OK=0 Q ; No line OPERATING PROVIDER for this procedure.
  1. . S IBLPIEN=$O(^DGCR(399,IBIFN,"CP",IBPROCP,"LNPRV","C","OPERATING",0))
  1. . I 'IBLPIEN S OK=0 Q ; No line provider IEN for this line provider function.
  1. . I '($D(^DGCR(399,IBIFN,"CP",IBPROCP,"LNPRV",IBLPIEN,0))#10) S OK=0 Q ; No '0' node for line level provider.
  1. . S IBLNPROV=$P(^DGCR(399,IBIFN,"CP",IBPROCP,"LNPRV",IBLPIEN,0),U,2)
  1. . I 'IBLNPROV S OK=0 Q ; No line provider for this line provider function.
  1. . ; At this point we have line level provider of type OPERATING.
  1. . ; S OK=1 for this claim line. OK can be changed back to '0', for FALSE, if claim line fails condition.
  1. . ; We would not get to this point if any line level provider with provider function OPERATING didn't exist.
  1. . S OK=1
  1. . Q
  1. ;