IBCEU7 ;ALB/DEM - EDI UTILITIES ;26-SEP-2010
;;2.0;INTEGRATED BILLING;**432,592,623**;21-MAR-94;Build 70
;;Per VA Directive 6402, this routine should not be modified.
Q
;
LNPRVOK(VAL,IBIFN) ; Check bill form & line prov function agree
; DEM;432 - New routine for Claim Line Provider.
; VAL = internal value of prov function
;
; Allowable line provider functions for UB04 (FORM TYPE = 3)
; Inpatient and UB04 Outpatient:
; - Rendering Provider(3).
; - Referring Provider(1).
; - Operating Physician(2).
; - Other Operating Physician(9).
;
; Allowable line provider functions for CMS 1500 (FORM TYPE = 2)
; Inpatient and CMS 1500 Outpatient:
; - Rendering Provider(3).
; - Referring Provider(1).
; - Supervising Provider(5).
;
;JWS;IB*2.0*592 US1108
; Allowable line provider functions for J430D Dental (FORM TYPE = 7)
; Inpatient and CMS 1500 Outpatient:
; - Rendering Provider(3).
; - Referring Provider(1).
; - Supervising Provider(5).
; - Assistant Surgeon (6). - Dental J430D only
;
N OK,IBUB
S VAL=$$UP^XLFSTR(VAL)
S OK=$S(VAL'="":1,1:0)
G:'OK!'$G(IBIFN) PRVQ
;
;JWS;IB*2.0*592 US1108 - 2 for form#7 Dental
S IBUB=$S($$FT^IBCEF(IBIFN)=7:2,1:($$FT^IBCEF(IBIFN)=3)) ; 1 if UB-04 ; 0 if CMS-1500 ; 2 if J430D Dental form
;
S OK=0
I IBUB=1,"1239"[VAL S OK=1 ; UB-04
I 'IBUB,"135"[VAL S OK=1 ; CMS-1500
;JWS;IB*2.0*592 US1108 J430D Dental
I IBUB=2,"1356"[VAL S OK=1
;
PRVQ Q OK
;
LNPRVHLP ;Helptext for line provider function.
;
N IBZ,IBQUIT,VALUE,FORMAT
F IBZ=1:1 S:$P($T(HLPTXT+IBZ),";;",2)="END" IBQUIT=1 Q:$G(IBQUIT) D
. S VALUE=$P($T(HLPTXT+IBZ),";;",2)
. S FORMAT=$S(VALUE="":"!",1:"")
. D EN^DDIOL(VALUE,"",FORMAT)
. Q
Q
;
HLPTXT ; Helptext for line provider function.
;;
;;Enter the name of the line level provider who provided this service.
;;Line level providers are optional and should only be entered if
;;different from the claim level provider.
;;
;;
;;END
;
HLPTXT2 ; ***Currently, not activated*** - Helptext for line provider function.
;;
;;LINE PROVIDER FUNCTION requirements:
;;
;;Allowable line provider functions for UB04 Inpatient and Outpatient:
;;
;; - Rendering Provider(3).
;; - Referring Provider(1).
;; - Operating Physician(2).
;; - Other Operating Physician(9).
;;
;;Allowable line provider functions for CMS 1500 Inpatient and Outpatient:
;;
;; - Rendering Provider(3).
;; - Referring Provider(1).
;; - Supervising Provider(5).
;;
;; Allowable line provider functions for J430D Dental (FORM TYPE = 7)
;; Inpatient and CMS 1500 Outpatient:
;; - Rendering Provider(3).
;; - Referring Provider(1).
;; - Supervising Provider(5).
;; - Assistant Surgeon (6).
;;
;;END
Q
;
LNPRVFT(IBFT,IBLNPRV) ; DEM;432 - Field Index "AK" (#301) on FORM TYPE field (399,.19).
;
; Description:
;
; This function is called by the FORM TYPE (399,.19) "AK" field index.
; In the case when the FORM TYPE field is changed, then the line
; provider types are checked to see if any, or all, line providers
; need to be deleted from the claim.
;
; Input:
;
; IBFT = FORM TYPE = 2 = (CMS-1500), or FORM TYPE = 3 = (UB-04).
; Must be either FORM TYPE 2, or FORM TYPE 3 to continue.
; See allowable line provider functions by FORM TYPE below.
; IBLNPRV = Array passed by reference.
;
; Output:
;
; OK = 1 = line providers to delete, OK = 0 = no line providers to delete.
; IBLNPRV Array = If line providers to delete, then array contains
; these line providers - IBLNPRV(399.0404,"IENS",.01)="@"
;
; Allowable line provider functions for UB04 (FORM TYPE = 3)
; Inpatient and UB04 Outpatient:
; - Rendering Provider(VAL=3).
; - Referring Provider(VAL=1).
; - Operating Physician(VAL=2).
; - Other Operating Physician(VAL=9).
;
; Allowable line provider functions for CMS 1500 (FORM TYPE = 2)
; Inpatient and CMS 1500 Outpatient:
; - Rendering Provider(VAL=3).
; - Referring Provider(VAL=1).
; - Supervising Provider(VAL=5).
;
; Allowable line provider functions for J430D (FORM TYPE = 7)
; Dental:
; - Rendering Provider(VAL=3).
; - Referring Provider(VAL=1).
; - Supervising Provider(VAL=5).
; - Assistant Surgeon(VAL=6).
;
Q:'$G(IBIFN) 0 ; QUIT 0 if no claim number.
Q:'$G(IBFT) 0 ; QUIT 0 if no FORM TYPE.
;JWS;IB*2.0*592 US1108
Q:(IBFT'=2)&(IBFT'=3)&(IBFT'=7) 0 ; QUIT 0 - Must be CMS-1500 (2) or UB-04 (3) or J430D (7) FORM TYPE.
;
N IBPRVFUN,OK
S:IBFT=3 IBPRVFUN("VAL",IBFT)="1239" ; Allowable LINE PROVIDER FUNCTIONs for UB-04.
S:IBFT=2 IBPRVFUN("VAL",IBFT)="135" ; Allowable LINE PROVIDER FUNCTIONs for CMS-1500.
;JWS;IB*2.0*592 US1108
S:IBFT=7 IBPRVFUN("VAL",IBFT)="1356" ;Allowable LINE PROVIDER FUNCTIONs for J430D.
;
S OK=0 ; Initialize OK=0.
;
N IBPROCP,IBLPIEN,IBLNPROV,DA
S IBPROCP=0 F S IBPROCP=$O(^DGCR(399,IBIFN,"CP",IBPROCP)) Q:'IBPROCP D ; Loop on PROCEDURES multiple.
. Q:'($D(^DGCR(399,IBIFN,"CP",IBPROCP,0))#10) ; No zero node for procedure.
. S IBPRVFUN=0 F S IBPRVFUN=$O(^DGCR(399,IBIFN,"CP",IBPROCP,"LNPRV","B",IBPRVFUN)) Q:'IBPRVFUN D:IBPRVFUN("VAL",IBFT)'[IBPRVFUN
. . S IBLPIEN=0 F S IBLPIEN=$O(^DGCR(399,IBIFN,"CP",IBPROCP,"LNPRV","B",IBPRVFUN,IBLPIEN)) Q:'IBLPIEN D
. . . Q:'($D(^DGCR(399,IBIFN,"CP",IBPROCP,"LNPRV",IBLPIEN,0))#10) ; No zero node for line level provider.
. . . S IBLNPROV=$P(^DGCR(399,IBIFN,"CP",IBPROCP,"LNPRV",IBLPIEN,0),U,2)
. . . Q:'IBLNPROV ; No line provider for this line provider function.
. . . S OK=1,IBLNPRV(399.0404,IBLPIEN_","_IBPROCP_","_IBIFN_",",.01)="@" ; We have at leaset one line provider to delete from claim.
. . . Q
. . Q
. Q
;
Q OK
;
REMOVE(IBIFN,IBFT) ; This will be used to remove all line level providers and all line level attachments from inpatient UB claims
;
; Input IBIFN - Claim Number
;
Q:IBFT'=3 ; Only worried about UBs
N IBINPAT
S IBINPAT=$$INPAT^IBCEF(IBIFN) Q:'IBINPAT ; Quit if it's not an inpatient
;
; If we got here, we have an inpatient UB
; In which case, we should not have any line level providers or line level attachment control numbers
; If we do, then let's remove them
;
N CPIEN,LNPRVIEN,FDA,ERR
S CPIEN=0 F S CPIEN=$O(^DGCR(399,IBIFN,"CP",CPIEN)) Q:'+CPIEN D
. ;
. ; Remove the Line level attachments
. S FDA(399.0304,CPIEN_","_IBIFN_",",70)="@"
. S FDA(399.0304,CPIEN_","_IBIFN_",",71)="@"
. S FDA(399.0304,CPIEN_","_IBIFN_",",72)="@"
. D FILE^DIE("E","FDA")
. ;
. K FDA
. S LNPRVIEN=0 F S LNPRVIEN=$O(^DGCR(399,IBIFN,"CP",CPIEN,"LNPRV",LNPRVIEN)) Q:'+LNPRVIEN D
.. ;
.. ;Remove the line level providers
.. S FDA(399.0404,LNPRVIEN_","_CPIEN_","_IBIFN_",",.01)="@"
. I $D(FDA) D FILE^DIE("E","FDA")
Q
;
; vd - IB*2.0*623 (US4995) - Added the following module of code for ROI validation.
ROIDTCK(IBIFN) ; Date validator for ROI checking
; INPUT:
; IBIFN is the internal Claim Number.
; OUTPUT:
; 0 means the Claim is NOT ROI eligible based upon the Date of Service
; 1 means the Claim IS ROI eligible based upon the Date of Service.
N IBDOS,IBTBD,ROIELG,X,Y
S ROIELG=0
S IBDOS=$$BDATE^IBACSV(IBIFN)
S X=20190128 D ^%DT S IBTBD=Y
; DOS prior to 1/28/19 with sensitive diagnosis requires ROI to bill
; DOS on or after 1/28/19 with sensitive diagnosis does not require ROI to bill
I IBDOS<IBTBD S ROIELG=1
Q ROIELG
;
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HIBCEU7 7538 printed Dec 13, 2024@02:12:38 Page 2
IBCEU7 ;ALB/DEM - EDI UTILITIES ;26-SEP-2010
+1 ;;2.0;INTEGRATED BILLING;**432,592,623**;21-MAR-94;Build 70
+2 ;;Per VA Directive 6402, this routine should not be modified.
+3 QUIT
+4 ;
LNPRVOK(VAL,IBIFN) ; Check bill form & line prov function agree
+1 ; DEM;432 - New routine for Claim Line Provider.
+2 ; VAL = internal value of prov function
+3 ;
+4 ; Allowable line provider functions for UB04 (FORM TYPE = 3)
+5 ; Inpatient and UB04 Outpatient:
+6 ; - Rendering Provider(3).
+7 ; - Referring Provider(1).
+8 ; - Operating Physician(2).
+9 ; - Other Operating Physician(9).
+10 ;
+11 ; Allowable line provider functions for CMS 1500 (FORM TYPE = 2)
+12 ; Inpatient and CMS 1500 Outpatient:
+13 ; - Rendering Provider(3).
+14 ; - Referring Provider(1).
+15 ; - Supervising Provider(5).
+16 ;
+17 ;JWS;IB*2.0*592 US1108
+18 ; Allowable line provider functions for J430D Dental (FORM TYPE = 7)
+19 ; Inpatient and CMS 1500 Outpatient:
+20 ; - Rendering Provider(3).
+21 ; - Referring Provider(1).
+22 ; - Supervising Provider(5).
+23 ; - Assistant Surgeon (6). - Dental J430D only
+24 ;
+25 NEW OK,IBUB
+26 SET VAL=$$UP^XLFSTR(VAL)
+27 SET OK=$SELECT(VAL'="":1,1:0)
+28 if 'OK!'$GET(IBIFN)
GOTO PRVQ
+29 ;
+30 ;JWS;IB*2.0*592 US1108 - 2 for form#7 Dental
+31 ; 1 if UB-04 ; 0 if CMS-1500 ; 2 if J430D Dental form
SET IBUB=$SELECT($$FT^IBCEF(IBIFN)=7:2,1:($$FT^IBCEF(IBIFN)=3))
+32 ;
+33 SET OK=0
+34 ; UB-04
IF IBUB=1
IF "1239"[VAL
SET OK=1
+35 ; CMS-1500
IF 'IBUB
IF "135"[VAL
SET OK=1
+36 ;JWS;IB*2.0*592 US1108 J430D Dental
+37 IF IBUB=2
IF "1356"[VAL
SET OK=1
+38 ;
PRVQ QUIT OK
+1 ;
LNPRVHLP ;Helptext for line provider function.
+1 ;
+2 NEW IBZ,IBQUIT,VALUE,FORMAT
+3 FOR IBZ=1:1
if $PIECE($TEXT(HLPTXT+IBZ),";;",2)="END"
SET IBQUIT=1
if $GET(IBQUIT)
QUIT
Begin DoDot:1
+4 SET VALUE=$PIECE($TEXT(HLPTXT+IBZ),";;",2)
+5 SET FORMAT=$SELECT(VALUE="":"!",1:"")
+6 DO EN^DDIOL(VALUE,"",FORMAT)
+7 QUIT
End DoDot:1
+8 QUIT
+9 ;
HLPTXT ; Helptext for line provider function.
+1 ;;
+2 ;;Enter the name of the line level provider who provided this service.
+3 ;;Line level providers are optional and should only be entered if
+4 ;;different from the claim level provider.
+5 ;;
+6 ;;
+7 ;;END
+8 ;
HLPTXT2 ; ***Currently, not activated*** - Helptext for line provider function.
+1 ;;
+2 ;;LINE PROVIDER FUNCTION requirements:
+3 ;;
+4 ;;Allowable line provider functions for UB04 Inpatient and Outpatient:
+5 ;;
+6 ;; - Rendering Provider(3).
+7 ;; - Referring Provider(1).
+8 ;; - Operating Physician(2).
+9 ;; - Other Operating Physician(9).
+10 ;;
+11 ;;Allowable line provider functions for CMS 1500 Inpatient and Outpatient:
+12 ;;
+13 ;; - Rendering Provider(3).
+14 ;; - Referring Provider(1).
+15 ;; - Supervising Provider(5).
+16 ;;
+17 ;; Allowable line provider functions for J430D Dental (FORM TYPE = 7)
+18 ;; Inpatient and CMS 1500 Outpatient:
+19 ;; - Rendering Provider(3).
+20 ;; - Referring Provider(1).
+21 ;; - Supervising Provider(5).
+22 ;; - Assistant Surgeon (6).
+23 ;;
+24 ;;END
+25 QUIT
+26 ;
LNPRVFT(IBFT,IBLNPRV) ; DEM;432 - Field Index "AK" (#301) on FORM TYPE field (399,.19).
+1 ;
+2 ; Description:
+3 ;
+4 ; This function is called by the FORM TYPE (399,.19) "AK" field index.
+5 ; In the case when the FORM TYPE field is changed, then the line
+6 ; provider types are checked to see if any, or all, line providers
+7 ; need to be deleted from the claim.
+8 ;
+9 ; Input:
+10 ;
+11 ; IBFT = FORM TYPE = 2 = (CMS-1500), or FORM TYPE = 3 = (UB-04).
+12 ; Must be either FORM TYPE 2, or FORM TYPE 3 to continue.
+13 ; See allowable line provider functions by FORM TYPE below.
+14 ; IBLNPRV = Array passed by reference.
+15 ;
+16 ; Output:
+17 ;
+18 ; OK = 1 = line providers to delete, OK = 0 = no line providers to delete.
+19 ; IBLNPRV Array = If line providers to delete, then array contains
+20 ; these line providers - IBLNPRV(399.0404,"IENS",.01)="@"
+21 ;
+22 ; Allowable line provider functions for UB04 (FORM TYPE = 3)
+23 ; Inpatient and UB04 Outpatient:
+24 ; - Rendering Provider(VAL=3).
+25 ; - Referring Provider(VAL=1).
+26 ; - Operating Physician(VAL=2).
+27 ; - Other Operating Physician(VAL=9).
+28 ;
+29 ; Allowable line provider functions for CMS 1500 (FORM TYPE = 2)
+30 ; Inpatient and CMS 1500 Outpatient:
+31 ; - Rendering Provider(VAL=3).
+32 ; - Referring Provider(VAL=1).
+33 ; - Supervising Provider(VAL=5).
+34 ;
+35 ; Allowable line provider functions for J430D (FORM TYPE = 7)
+36 ; Dental:
+37 ; - Rendering Provider(VAL=3).
+38 ; - Referring Provider(VAL=1).
+39 ; - Supervising Provider(VAL=5).
+40 ; - Assistant Surgeon(VAL=6).
+41 ;
+42 ; QUIT 0 if no claim number.
if '$GET(IBIFN)
QUIT 0
+43 ; QUIT 0 if no FORM TYPE.
if '$GET(IBFT)
QUIT 0
+44 ;JWS;IB*2.0*592 US1108
+45 ; QUIT 0 - Must be CMS-1500 (2) or UB-04 (3) or J430D (7) FORM TYPE.
if (IBFT'=2)&(IBFT'=3)&(IBFT'=7)
QUIT 0
+46 ;
+47 NEW IBPRVFUN,OK
+48 ; Allowable LINE PROVIDER FUNCTIONs for UB-04.
if IBFT=3
SET IBPRVFUN("VAL",IBFT)="1239"
+49 ; Allowable LINE PROVIDER FUNCTIONs for CMS-1500.
if IBFT=2
SET IBPRVFUN("VAL",IBFT)="135"
+50 ;JWS;IB*2.0*592 US1108
+51 ;Allowable LINE PROVIDER FUNCTIONs for J430D.
if IBFT=7
SET IBPRVFUN("VAL",IBFT)="1356"
+52 ;
+53 ; Initialize OK=0.
SET OK=0
+54 ;
+55 NEW IBPROCP,IBLPIEN,IBLNPROV,DA
+56 ; Loop on PROCEDURES multiple.
SET IBPROCP=0
FOR
SET IBPROCP=$ORDER(^DGCR(399,IBIFN,"CP",IBPROCP))
if 'IBPROCP
QUIT
Begin DoDot:1
+57 ; No zero node for procedure.
if '($DATA(^DGCR(399,IBIFN,"CP",IBPROCP,0))#10)
QUIT
+58 SET IBPRVFUN=0
FOR
SET IBPRVFUN=$ORDER(^DGCR(399,IBIFN,"CP",IBPROCP,"LNPRV","B",IBPRVFUN))
if 'IBPRVFUN
QUIT
if IBPRVFUN("VAL",IBFT)'[IBPRVFUN
Begin DoDot:2
+59 SET IBLPIEN=0
FOR
SET IBLPIEN=$ORDER(^DGCR(399,IBIFN,"CP",IBPROCP,"LNPRV","B",IBPRVFUN,IBLPIEN))
if 'IBLPIEN
QUIT
Begin DoDot:3
+60 ; No zero node for line level provider.
if '($DATA(^DGCR(399,IBIFN,"CP",IBPROCP,"LNPRV",IBLPIEN,0))#10)
QUIT
+61 SET IBLNPROV=$PIECE(^DGCR(399,IBIFN,"CP",IBPROCP,"LNPRV",IBLPIEN,0),U,2)
+62 ; No line provider for this line provider function.
if 'IBLNPROV
QUIT
+63 ; We have at leaset one line provider to delete from claim.
SET OK=1
SET IBLNPRV(399.0404,IBLPIEN_","_IBPROCP_","_IBIFN_",",.01)="@"
+64 QUIT
End DoDot:3
+65 QUIT
End DoDot:2
+66 QUIT
End DoDot:1
+67 ;
+68 QUIT OK
+69 ;
REMOVE(IBIFN,IBFT) ; This will be used to remove all line level providers and all line level attachments from inpatient UB claims
+1 ;
+2 ; Input IBIFN - Claim Number
+3 ;
+4 ; Only worried about UBs
if IBFT'=3
QUIT
+5 NEW IBINPAT
+6 ; Quit if it's not an inpatient
SET IBINPAT=$$INPAT^IBCEF(IBIFN)
if 'IBINPAT
QUIT
+7 ;
+8 ; If we got here, we have an inpatient UB
+9 ; In which case, we should not have any line level providers or line level attachment control numbers
+10 ; If we do, then let's remove them
+11 ;
+12 NEW CPIEN,LNPRVIEN,FDA,ERR
+13 SET CPIEN=0
FOR
SET CPIEN=$ORDER(^DGCR(399,IBIFN,"CP",CPIEN))
if '+CPIEN
QUIT
Begin DoDot:1
+14 ;
+15 ; Remove the Line level attachments
+16 SET FDA(399.0304,CPIEN_","_IBIFN_",",70)="@"
+17 SET FDA(399.0304,CPIEN_","_IBIFN_",",71)="@"
+18 SET FDA(399.0304,CPIEN_","_IBIFN_",",72)="@"
+19 DO FILE^DIE("E","FDA")
+20 ;
+21 KILL FDA
+22 SET LNPRVIEN=0
FOR
SET LNPRVIEN=$ORDER(^DGCR(399,IBIFN,"CP",CPIEN,"LNPRV",LNPRVIEN))
if '+LNPRVIEN
QUIT
Begin DoDot:2
+23 ;
+24 ;Remove the line level providers
+25 SET FDA(399.0404,LNPRVIEN_","_CPIEN_","_IBIFN_",",.01)="@"
End DoDot:2
+26 IF $DATA(FDA)
DO FILE^DIE("E","FDA")
End DoDot:1
+27 QUIT
+28 ;
+29 ; vd - IB*2.0*623 (US4995) - Added the following module of code for ROI validation.
ROIDTCK(IBIFN) ; Date validator for ROI checking
+1 ; INPUT:
+2 ; IBIFN is the internal Claim Number.
+3 ; OUTPUT:
+4 ; 0 means the Claim is NOT ROI eligible based upon the Date of Service
+5 ; 1 means the Claim IS ROI eligible based upon the Date of Service.
+6 NEW IBDOS,IBTBD,ROIELG,X,Y
+7 SET ROIELG=0
+8 SET IBDOS=$$BDATE^IBACSV(IBIFN)
+9 SET X=20190128
DO ^%DT
SET IBTBD=Y
+10 ; DOS prior to 1/28/19 with sensitive diagnosis requires ROI to bill
+11 ; DOS on or after 1/28/19 with sensitive diagnosis does not require ROI to bill
+12 IF IBDOS<IBTBD
SET ROIELG=1
+13 QUIT ROIELG
+14 ;