source: FOIAVistA/trunk/r/INTEGRATED_BILLING-IB-PRQ--IBD--IBQ--PRQS/IBCU81.m@ 1800

Last change on this file since 1800 was 628, checked in by George Lilly, 15 years ago

initial load of FOIAVistA 6/30/08 version

File size: 4.3 KB
Line 
1IBCU81 ;ALB/ARH - THIRD PARTY BILLING UTILITIES (AUTOMATED BILLER) ;02 JUL 93
2 ;;2.0;INTEGRATED BILLING;**55,91,106,124,160,174,260,347**;21-MAR-94;Build 24
3 ;;Per VHA Directive 2004-038, this routine should not be modified.
4 ;
5EABD(IBETYP,IBTDT) ; -- compute earliest auto bill date: date entered plus days delay for event type
6 ;the difference betwieen this and EABD^IBTUTL is that the autobill of the event type may be turned off
7 ;and this procedure will still return a date
8 ; -- input IBETYPE = pointer to type of entry file
9 ; IBTDT = episode date, if not passed in uses DT
10 ;
11 N X,X1,X2,Y,IBETYPD S Y="" I '$G(IBETYP) G EABDQ
12 S IBETYPD=$G(^IBE(356.6,+IBETYP,0)) I '$G(IBTDT) S IBTDT=DT
13 S X2=+$P(IBETYPD,"^",6) ;set earliest autobill date to entered date plus days delay
14 S X1=IBTDT D C^%DTC S Y=X\1
15EABDQ Q Y
16 ;
17EVBILL(IBTRN) ;check if event is auto billable, return EABD if it is, the difference between this and BILL^IBTUTL is that
18 ;this procedure will return a date if the auto biller is turned off for this event type
19 ;returns "^error message" if it is not billable
20 N X,Y,Z,E,IBTRND S (X,Y,E)="" S IBTRND=$G(^IBT(356,+$G(IBTRN),0)) I IBTRND="" G BILLQ
21 ;
22 ; -- billed and bill not cancelled and not inpt interim first or continuous
23 S Z=$$BILLED^IBCU8(IBTRN),Y=$P(Z,U,2) I +Z,'Y S E="^Event already billed on "_$P($G(^DGCR(399,+Z,0)),U,1)_"." G BILLQ
24 ;
25 ; -- special type (not riem. ins), not billable, inactive
26 I +$P(IBTRND,U,12) S E="^Bill may not be Reimbursable Insurance, possibly "_$$EXSET^IBEFUNC(+$P(IBTRND,U,12),356,.12)_"." G BILLQ
27 I +$P(IBTRND,U,19) S E="^Event has a Reason Not Billable: "_$P($G(^IBE(356.8,+$P(IBTRND,U,19),0)),U,1)_"." G BILLQ
28 I '$P(IBTRND,U,20) S E="^Event is Inactive." G BILLQ
29 I 'Y S Y=+$G(^IBT(356,+$G(IBTRN),1)) I 'Y S Y=DT
30 S X=$$EABD(+$P(IBTRND,U,18),Y)
31BILLQ Q X_E
32 ;
33RXRF(IBTRN) ; returns rx # and fill date for given claims tracking rx entry
34 N IBX,IBY,IBZ,X S (X,IBY)=""
35 S IBX=$G(^IBT(356,+$G(IBTRN),0)) I IBX'="" S IBY=$$FILE^IBRXUTL(+$P(IBX,U,8),.01)
36 I IBY'="",$P(IBX,U,10)=0 S IBZ=$$FILE^IBRXUTL(+$P(IBX,U,8),"22","I") I +IBZ S X=IBY_"^"_IBZ
37 I IBY'="",+$P(IBX,U,10) S IBZ=+$$ZEROSUB^IBRXUTL(+$P(IBX,U,2),+$P(IBX,U,8),+$P(IBX,U,10)) I +IBZ S X=IBY_"^"_IBZ
38 Q X
39 ;
40NABSCT(IBTRN) ; -- true if CT outpatient visit should NOT be auto billed, based only on stop (1) and clinic (2) auto billable
41 ; returns true only for those stops (352.3) and clinics (352.4) specifically flagged as not auto billable
42 N IBX,IBY,IBTRND S IBX=0,IBTRND="" I +$G(IBTRN) S IBTRND=$G(^IBT(356,+IBTRN,0))
43 I +$P(IBTRND,U,4) S IBY=$$SCE^IBSDU(+$P(IBTRND,U,4)) I +IBY D
44 . I +$P(IBY,U,3),$$NABST^IBEFUNC($P(IBY,U,3),DT) S IBX=1 Q
45 . I +$P(IBY,U,4),$$NABCT^IBEFUNC($P(IBY,U,4),DT) S IBX=2
46 Q IBX
47 ;
48NBOE(IBOE,IBOE0) ; returns true if outpatient encounter is non-billable, "" otherwise
49 ; input: IBOE - pointer to encounter (409.68)
50 ; IBOE0 - 0-node of the encounter (optional)
51 ; output: "" or x^message, where x=1 if SC, x=2 if NB Stop code, x=3 if NB Clinic, x=4 if NB Appt Status
52 N IBOED,IBOEP,IBX,IBCK,IBZ,IBPB,IBAPST,IBDT,DFN
53 S IBX=""
54 I $G(IBOE0)="" S IBOE0=$$SCE^IBSDU(IBOE)
55 I 'IBOE0 G NBOEQ
56 S DFN=$P(IBOE0,"^",2),IBDT=+IBOE0
57 F IBZ=7,12,13 S IBCK(IBZ)=""
58 S IBZ=$$BILLCK^IBAMTEDU(IBOE,IBOE0,.IBCK,.IBPB)
59 S IBAPST="" I $G(IBPB)=13 S IBAPST=$E($$EXPAND^IBTRE(409.68,.12,$P(IBOE0,U,12)),1,10)
60 ; check out sc and other questions
61 I $G(IBPB)="" S IBAPST=$$CL^IBTRKR41(IBOE0) I $L(IBAPST) S IBPB=$S(IBAPST="SC TREATMENT":11,1:13)
62 S:$G(IBPB)'="" IBX=$S(IBPB=11:"1^SC VISIT",IBPB=7:"2^NB STOP CODE",IBPB=12:"3^NB CLINIC",IBPB=13:"4^"_IBAPST,1:"")
63NBOEQ Q IBX
64 ;
65OEDX(IBOE,IBDXA,IBDXB) ; returns arrays containing encounters diagnosis (includes duplicates)
66 ; IBDXA(ORDER,DATE/TIME,IBOE,DX IFN)=DX ^ PCE ORDER ^ IBOE ^ DATE/TIME ^ TRUE IF NON-BILLABLE ^ NB MES ^ CLINIC
67 ; IBDXB(IBDX) = 1 for each billable dx found
68 ;
69 N IBNBOE,X,IBPOV,IBDXN,IBPCE,IBPCEI,IBDT,IBOE0,IBZERR
70 Q:'$G(IBOE)
71 S IBOE0=$$SCE^IBSDU(+IBOE),IBDT=+IBOE0 Q:'IBDT
72 I '$$BDSRC^IBEFUNC3($P(IBOE0,U,5)) Q ; non-billable visit data source
73 S IBNBOE=$$NBOE(IBOE,IBOE0)
74 ;
75 D GETDX^SDOE(IBOE,"IBPOV","IBZERR")
76 S IBDXN=0 F S IBDXN=$O(IBPOV(IBDXN)) Q:'IBDXN D
77 . S IBPCE=IBPOV(IBDXN),IBPCEI=$P(IBPCE,U,12)
78 . S IBDXA($S(IBPCEI="P":1,IBPCEI="S":2,1:999),IBDT,IBOE,IBDXN)=+IBPCE_U_IBPCEI_U_IBOE_U_IBDT_U_$P(IBNBOE,U,1)_U_$P(IBNBOE,U,2)_U_+$P(IBOE0,U,4)
79 . I 'IBNBOE S IBDXB(+IBPCE)=1
80 ;
81 Q
82 ;
Note: See TracBrowser for help on using the repository browser.