IBCU82 ;ALB/ARH - THIRD PARTY BILLING UTILITIES (AUTOMATED BILLER) ;02 JUL 93
;;2.0;INTEGRATED BILLING;**43,55,91,124,160,304,347,432,592**;21-MAR-94;Build 58
;;Per VA Directive 6402, this routine should not be modified.
;
;
EVNTCHK(IBTRN) ;special checks to determine if event should be auto billed
;checks for INS, non-veteran patient, possible workers comp and tort feasor, admitted for sc cond., outp dental stop, optv while inpt, category covered by ins, non-billable stop or clinic
;(assumes that Claims Tracking does the SC check for Outpatients)
;input: IBTRN - claims tracking event
; DISP - if true then any error message will be displayed on exit.
;output: returns "1^error message" if one of the checks failed, 0 otherwise
;
N X,IBX,IBY,IBZ,IBTRND,IBCAT,IBCOV,DFN,IBEVDT,VAEL,VADMVT,VAINDT S X=0,IBTRND=$G(^IBT(356,+$G(IBTRN),0)) G:IBTRND="" EVNTCQ
I +$P(IBTRND,U,18)=1,'+$P(IBTRND,U,5) S X="1^Claims Tracking event does not have an associated Inpatient Admission." G EVNTCQ
I +$P(IBTRND,U,18)=2,'+$P(IBTRND,U,4) S X="1^Claims Tracking event does not have an associated Outpatient Visit." G EVNTCQ
I +$P(IBTRND,U,18)=4,'+$P(IBTRND,U,8) S X="1^Claims Tracking event does not have an associated prescription in Pharmacy." G EVNTCQ
I +$P(IBTRND,U,18)=4,$P(IBTRND,U,10)="" S X="1^Claims Tracking event does not have an associated prescription refill in Pharmacy." G EVNTCQ
;
S DFN=+$P(IBTRND,U,2),IBEVDT=$P(IBTRND,U,6) I '$$INSURED^IBCNS1(DFN,IBEVDT) S X="1^Patient not insured for event date." G EVNTCQ
; Check filing timeframe
I '$$PTFTF^IBCNSU31(DFN,IBEVDT) S X="1^Filing timeframe not met" G EVNTCQ
S IBCAT=$S($P(IBTRND,U,18)=1!($P(IBTRND,U,18)=5):"INPATIENT",$P(IBTRND,U,18)=2:"OUTPATIENT",$P(IBTRND,U,18)=4:"PHARMACY",1:"")
I IBCAT'="",'$$PTCOV^IBCNSU3(DFN,IBEVDT,IBCAT) S X="1^Patient insurance does not cover "_IBCAT_"." G EVNTCQ
D ELIG^VADPT S X=0 I 'VAEL(4) S X="1^Patient is not a veteran." G EVNTCQ
;
;check the last disposition before the episode to see if maybe workers comp or tort feasor
S IBX=9999999-(IBEVDT\1+1),IBX=$O(^DPT(+DFN,"DIS",IBX)) I +IBX S IBY=$$DT(IBX),IBX=$G(^DPT(DFN,"DIS",IBX,2)) D G:+X EVNTCQ
. I $P(IBX,U,1)="Y" S X="1^Need may be related to occupation, check "_IBY_" disposition." Q
. I $P(IBX,U,4)="Y" S X="1^Need may be related to an accident, check "_IBY_" disposition." Q
;
I +$P(IBTRND,U,5) S IBX=$G(^DGPM(+$P(IBTRND,U,5),0)) D G EVNTCQ ; inpatient specific
. I IBX="" S X="1^Inpatient admission movement not found." Q
. I +$P(IBX,U,11) S X="1^Admitted for an SC condition." Q
;
I +$P(IBTRND,U,4) S IBX=$$SCE^IBSDU(+$P(IBTRND,U,4)) D G EVNTCQ ; outpatient specific
. I IBX="" S X="1^Outpatient Encounter not found." Q
. S IBY=$$NBOE^IBCU81(+$P(IBTRND,U,4),IBX) I +IBY D Q:+X
.. ;I +IBY=1 S X="1^Service Connected visit." Q
.. I +IBY=2 S X="1^Non-billable Stop Code." Q
.. I +IBY=3 S X="1^Non-billable Clinic." Q
.. I +IBY=4 S X="1^Non-billable Status: "_$P(IBY,U,2) Q
. ; dental is generally billed differently
. ;JWS;IB*2.0*592;US1109;allow dental events to be processed and billed.
. ;;I $P($G(^DIC(40.7,+$P(IBX,U,3),0)),U,1)["DENTAL" S X="1^Outpatient visit contains a dental stop code." Q
. ;JWS;IB*2.0*592;USXXXX;added ability to turn off Dental Claims processing in site parameters
. I $P(^IBE(350.9,1,8),U,20)=0 S X="1^Dental Claims processing is disabled in IB Site Parameters." Q
. ;outpatient visit was a disposition: application without exam is not billable
. I $P(IBX,U,8)=3 D Q:X
.. S IBY=$$DISND^IBSDU(+$P(IBTRND,U,4),IBX) ; 0-node of "DIS"
.. I $P(IBY,U,2)=2 S X="1^Disposition was Application Without Exam." Q
.. I $P($G(^DIC(37,+$P(IBY,U,7),0)),U,1)="CANCEL WITHOUT EXAM" S X="1^Disposition was Cancel Without Exam." Q
. ;can not bill twice for same day so ignore outpatient visits if patient was an inpatient at end of day (this means that outpatient visits on the date of discharge will be billed)
. I $$ADM^IBCU64(DFN,IBEVDT) S X="1^Not Billable: Patient was an inpatient on this visit date."
;
I +$P(IBTRND,U,8) S IBX=$$RXZERO^IBRXUTL(+$P(IBTRND,U,2),+$P(IBTRND,U,8)) D G EVNTCQ ; rx refills
. I IBX="" S X="1^Prescription not found in Pharmacy." Q
. I +$P(IBTRND,U,10)>0 S IBY=$$ZEROSUB^IBRXUTL(+$P(IBTRND,U,2),+$P(IBTRND,U,8),+$P(IBTRND,U,10)) I IBY="" S X="1^Prescription refill not found in Pharmacy." Q
. S IBZ=$$DBLCHK^IBTRKR31(IBTRN) I 'IBZ S X="1^Can not auto bill this refill, check Claims Tracking." Q
EVNTCQ Q X
;
DT(X) ;convert disposition type date/time to external format (9999999-date)
N Y S Y=0 I +X S Y=9999999-X X ^DD("DD")
Q Y
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HIBCU82 4651 printed Oct 16, 2024@18:21:39 Page 2
IBCU82 ;ALB/ARH - THIRD PARTY BILLING UTILITIES (AUTOMATED BILLER) ;02 JUL 93
+1 ;;2.0;INTEGRATED BILLING;**43,55,91,124,160,304,347,432,592**;21-MAR-94;Build 58
+2 ;;Per VA Directive 6402, this routine should not be modified.
+3 ;
+4 ;
EVNTCHK(IBTRN) ;special checks to determine if event should be auto billed
+1 ;checks for INS, non-veteran patient, possible workers comp and tort feasor, admitted for sc cond., outp dental stop, optv while inpt, category covered by ins, non-billable stop or clinic
+2 ;(assumes that Claims Tracking does the SC check for Outpatients)
+3 ;input: IBTRN - claims tracking event
+4 ; DISP - if true then any error message will be displayed on exit.
+5 ;output: returns "1^error message" if one of the checks failed, 0 otherwise
+6 ;
+7 NEW X,IBX,IBY,IBZ,IBTRND,IBCAT,IBCOV,DFN,IBEVDT,VAEL,VADMVT,VAINDT
SET X=0
SET IBTRND=$GET(^IBT(356,+$GET(IBTRN),0))
if IBTRND=""
GOTO EVNTCQ
+8 IF +$PIECE(IBTRND,U,18)=1
IF '+$PIECE(IBTRND,U,5)
SET X="1^Claims Tracking event does not have an associated Inpatient Admission."
GOTO EVNTCQ
+9 IF +$PIECE(IBTRND,U,18)=2
IF '+$PIECE(IBTRND,U,4)
SET X="1^Claims Tracking event does not have an associated Outpatient Visit."
GOTO EVNTCQ
+10 IF +$PIECE(IBTRND,U,18)=4
IF '+$PIECE(IBTRND,U,8)
SET X="1^Claims Tracking event does not have an associated prescription in Pharmacy."
GOTO EVNTCQ
+11 IF +$PIECE(IBTRND,U,18)=4
IF $PIECE(IBTRND,U,10)=""
SET X="1^Claims Tracking event does not have an associated prescription refill in Pharmacy."
GOTO EVNTCQ
+12 ;
+13 SET DFN=+$PIECE(IBTRND,U,2)
SET IBEVDT=$PIECE(IBTRND,U,6)
IF '$$INSURED^IBCNS1(DFN,IBEVDT)
SET X="1^Patient not insured for event date."
GOTO EVNTCQ
+14 ; Check filing timeframe
+15 IF '$$PTFTF^IBCNSU31(DFN,IBEVDT)
SET X="1^Filing timeframe not met"
GOTO EVNTCQ
+16 SET IBCAT=$SELECT($PIECE(IBTRND,U,18)=1!($PIECE(IBTRND,U,18)=5):"INPATIENT",$PIECE(IBTRND,U,18)=2:"OUTPATIENT",$PIECE(IBTRND,U,18)=4:"PHARMACY",1:"")
+17 IF IBCAT'=""
IF '$$PTCOV^IBCNSU3(DFN,IBEVDT,IBCAT)
SET X="1^Patient insurance does not cover "_IBCAT_"."
GOTO EVNTCQ
+18 DO ELIG^VADPT
SET X=0
IF 'VAEL(4)
SET X="1^Patient is not a veteran."
GOTO EVNTCQ
+19 ;
+20 ;check the last disposition before the episode to see if maybe workers comp or tort feasor
+21 SET IBX=9999999-(IBEVDT\1+1)
SET IBX=$ORDER(^DPT(+DFN,"DIS",IBX))
IF +IBX
SET IBY=$$DT(IBX)
SET IBX=$GET(^DPT(DFN,"DIS",IBX,2))
Begin DoDot:1
+22 IF $PIECE(IBX,U,1)="Y"
SET X="1^Need may be related to occupation, check "_IBY_" disposition."
QUIT
+23 IF $PIECE(IBX,U,4)="Y"
SET X="1^Need may be related to an accident, check "_IBY_" disposition."
QUIT
End DoDot:1
if +X
GOTO EVNTCQ
+24 ;
+25 ; inpatient specific
IF +$PIECE(IBTRND,U,5)
SET IBX=$GET(^DGPM(+$PIECE(IBTRND,U,5),0))
Begin DoDot:1
+26 IF IBX=""
SET X="1^Inpatient admission movement not found."
QUIT
+27 IF +$PIECE(IBX,U,11)
SET X="1^Admitted for an SC condition."
QUIT
End DoDot:1
GOTO EVNTCQ
+28 ;
+29 ; outpatient specific
IF +$PIECE(IBTRND,U,4)
SET IBX=$$SCE^IBSDU(+$PIECE(IBTRND,U,4))
Begin DoDot:1
+30 IF IBX=""
SET X="1^Outpatient Encounter not found."
QUIT
+31 SET IBY=$$NBOE^IBCU81(+$PIECE(IBTRND,U,4),IBX)
IF +IBY
Begin DoDot:2
+32 ;I +IBY=1 S X="1^Service Connected visit." Q
+33 IF +IBY=2
SET X="1^Non-billable Stop Code."
QUIT
+34 IF +IBY=3
SET X="1^Non-billable Clinic."
QUIT
+35 IF +IBY=4
SET X="1^Non-billable Status: "_$PIECE(IBY,U,2)
QUIT
End DoDot:2
if +X
QUIT
+36 ; dental is generally billed differently
+37 ;JWS;IB*2.0*592;US1109;allow dental events to be processed and billed.
+38 ;;I $P($G(^DIC(40.7,+$P(IBX,U,3),0)),U,1)["DENTAL" S X="1^Outpatient visit contains a dental stop code." Q
+39 ;JWS;IB*2.0*592;USXXXX;added ability to turn off Dental Claims processing in site parameters
+40 IF $PIECE(^IBE(350.9,1,8),U,20)=0
SET X="1^Dental Claims processing is disabled in IB Site Parameters."
QUIT
+41 ;outpatient visit was a disposition: application without exam is not billable
+42 IF $PIECE(IBX,U,8)=3
Begin DoDot:2
+43 ; 0-node of "DIS"
SET IBY=$$DISND^IBSDU(+$PIECE(IBTRND,U,4),IBX)
+44 IF $PIECE(IBY,U,2)=2
SET X="1^Disposition was Application Without Exam."
QUIT
+45 IF $PIECE($GET(^DIC(37,+$PIECE(IBY,U,7),0)),U,1)="CANCEL WITHOUT EXAM"
SET X="1^Disposition was Cancel Without Exam."
QUIT
End DoDot:2
if X
QUIT
+46 ;can not bill twice for same day so ignore outpatient visits if patient was an inpatient at end of day (this means that outpatient visits on the date of discharge will be billed)
+47 IF $$ADM^IBCU64(DFN,IBEVDT)
SET X="1^Not Billable: Patient was an inpatient on this visit date."
End DoDot:1
GOTO EVNTCQ
+48 ;
+49 ; rx refills
IF +$PIECE(IBTRND,U,8)
SET IBX=$$RXZERO^IBRXUTL(+$PIECE(IBTRND,U,2),+$PIECE(IBTRND,U,8))
Begin DoDot:1
+50 IF IBX=""
SET X="1^Prescription not found in Pharmacy."
QUIT
+51 IF +$PIECE(IBTRND,U,10)>0
SET IBY=$$ZEROSUB^IBRXUTL(+$PIECE(IBTRND,U,2),+$PIECE(IBTRND,U,8),+$PIECE(IBTRND,U,10))
IF IBY=""
SET X="1^Prescription refill not found in Pharmacy."
QUIT
+52 SET IBZ=$$DBLCHK^IBTRKR31(IBTRN)
IF 'IBZ
SET X="1^Can not auto bill this refill, check Claims Tracking."
QUIT
End DoDot:1
GOTO EVNTCQ
EVNTCQ QUIT X
+1 ;
DT(X) ;convert disposition type date/time to external format (9999999-date)
+1 NEW Y
SET Y=0
IF +X
SET Y=9999999-X
XECUTE ^DD("DD")
+2 QUIT Y