IBCU82 ;ALB/ARH - THIRD PARTY BILLING UTILITIES (AUTOMATED BILLER) ;02 JUL 93
;;Version 2.0 ; INTEGRATED BILLING ;; 21-MAR-94
;;Per VHA Directive 10-93-142, 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
;(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,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
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)'="N" S X="1^Need may be related to occupation, check "_IBY_" disposition." Q
. I $P(IBX,U,4)'="N" 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=$G(^SCE(+$P(IBTRND,U,4),0)) D G EVNTCQ ; outpatient specific
. I IBX="" S X="1^Outpatient Encounter not found." Q
. ; dental is generally billed differently
. 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
. ;outpatient visit was a disposition: application without exam is not billable
. I $P(IBX,U,8)=3 S IBY=$G(^DPT(DFN,"DIS",+$P(IBX,U,9),0)) D Q:+X
.. 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=$G(^PSRX(+$P(IBTRND,U,8),0)) D G EVNTCQ ; rx refills
. I IBX="" S X="1^Prescription not found in Pharmacy." Q
. S IBY=$G(^PSRX(+$P(IBTRND,U,8),1,+$P(IBTRND,U,10),0)) 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
IBCU82 ;ALB/ARH - THIRD PARTY BILLING UTILITIES (AUTOMATED BILLER) ;02 JUL 93
+1 ;;Version 2.0 ; INTEGRATED BILLING ;; 21-MAR-94
+2 ;;Per VHA Directive 10-93-142, 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
+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,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 DO ELIG^VADPT
SET X=0
IF 'VAEL(4)
SET X="1^Patient is not a veteran."
GOTO EVNTCQ
+15 ;
+16 ;check the last disposition before the episode to see if maybe workers comp or tort feasor
+17 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
+18 IF $PIECE(IBX,U,1)'="N"
SET X="1^Need may be related to occupation, check "_IBY_" disposition."
QUIT
+19 IF $PIECE(IBX,U,4)'="N"
SET X="1^Need may be related to an accident, check "_IBY_" disposition."
QUIT
End DoDot:1
IF +X
GOTO EVNTCQ
+20 ;
+21 ; inpatient specific
IF +$PIECE(IBTRND,U,5)
SET IBX=$GET(^DGPM(+$PIECE(IBTRND,U,5),0))
Begin DoDot:1
+22 IF IBX=""
SET X="1^Inpatient admission movement not found."
QUIT
+23 IF +$PIECE(IBX,U,11)
SET X="1^Admitted for an SC condition."
QUIT
End DoDot:1
GOTO EVNTCQ
+24 ;
+25 ; outpatient specific
IF +$PIECE(IBTRND,U,4)
SET IBX=$GET(^SCE(+$PIECE(IBTRND,U,4),0))
Begin DoDot:1
+26 IF IBX=""
SET X="1^Outpatient Encounter not found."
QUIT
+27 ; dental is generally billed differently
+28 IF $PIECE($GET(^DIC(40.7,+$PIECE(IBX,U,3),0)),U,1)["DENTAL"
SET X="1^Outpatient visit contains a dental stop code."
QUIT
+29 ;outpatient visit was a disposition: application without exam is not billable
+30 IF $PIECE(IBX,U,8)=3
SET IBY=$GET(^DPT(DFN,"DIS",+$PIECE(IBX,U,9),0))
Begin DoDot:2
+31 IF $PIECE(IBY,U,2)=2
SET X="1^Disposition was Application Without Exam."
QUIT
+32 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
+33 ;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)
+34 IF $$ADM^IBCU64(DFN,IBEVDT)
SET X="1^Not Billable: Patient was an inpatient on this visit date."
End DoDot:1
GOTO EVNTCQ
+35 ;
+36 ; rx refills
IF +$PIECE(IBTRND,U,8)
SET IBX=$GET(^PSRX(+$PIECE(IBTRND,U,8),0))
Begin DoDot:1
+37 IF IBX=""
SET X="1^Prescription not found in Pharmacy."
QUIT
+38 SET IBY=$GET(^PSRX(+$PIECE(IBTRND,U,8),1,+$PIECE(IBTRND,U,10),0))
IF IBY=""
SET X="1^Prescription refill not found in Pharmacy."
QUIT
+39 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