source: WorldVistAEHR/trunk/r/INTEGRATED_BILLING-IB-PRQ--IBD--IBQ--PRQS/IBCEF21.m@ 949

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

revised back to 6/30/08 version

File size: 3.6 KB
Line 
1IBCEF21 ;ALB/TMP - FORMATTER SPECIFIC BILL FUNCTIONS CONTINUED ;06-FEB-96
2 ;;2.0;INTEGRATED BILLING;**51,296**;21-MAR-94
3 ;
4COID(IBIFN) ; Claim office ID
5 N IBCOID,IBCOID1,IBIN
6 S IBIN=$$CURR^IBCEF2(IBIFN),IBCOID1="",IBCOID=$P($$ADDRESS^IBCNSC0(IBIN,.11,5),U,11)
7 ;
8 I IBIN D
9 . I $D(^IBA(364.2,"C",IBIFN)) S IBCOID1=$P($$ADDRESS^IBCNSC0(IBIN,.18,5),U,11) Q ;Rx
10 . I $P($G(^DGCR(399,IBIFN,0)),U,5)<3 S IBCOID1=$P($$ADDRESS^IBCNSC0(IBIN,.12,5),U,11) Q ;Inpt
11 . I $P($G(^DGCR(399,IBIFN,0)),U,5)'<3 S IBCOID1=$P($$ADDRESS^IBCNSC0(IBIN,.16,5),U,11) Q ;Outpt
12 ;
13 Q $S(IBCOID1'="":IBCOID1,1:IBCOID)
14 ;
15ESGHPST(IBIFN,COB) ; return insureds employment status if the bill policy defined by COB is an Employer Sponsored Group Health Plan
16 ; ESGHP FLAG (2.312,2.1) ^ the employment status (2.312,2.11)
17 ;
18 N PPOL,DFN,X,Y S Y=""
19 S PPOL=$$PPOL^IBCEF2($G(IBIFN),$G(COB)),DFN=$P($G(^DGCR(399,+$G(IBIFN),0)),U,2)
20 I +PPOL,+DFN S X=$G(^DPT(DFN,.312,+PPOL,2)) S Y=+$P(X,U,10)_U_$P(X,U,11)
21 Q Y
22 ;
23ESGHPNL(IBIFN,COB) ; return employer name and location if the bill policy defined by COB is an Employer Sponsored Group Health Plan
24 ; ESGHP FLAG (2.312,2.1) ^ employer name (2.312,2.015) ^ employer city (2.312,2.05)
25 ; ^ employer state abbr (2.312,2.06) ^ employer state ifn (2.312,2.06)
26 ;
27 N PPOL,DFN,X,Y S Y=""
28 S PPOL=$$PPOL^IBCEF2($G(IBIFN),$G(COB)),DFN=$P($G(^DGCR(399,+$G(IBIFN),0)),U,2)
29 I +PPOL,+DFN S X=$G(^DPT(DFN,.312,+PPOL,2)) S Y=+$P(X,U,10)_U_$P(X,U,9)_U_$P(X,U,5)_U_$P($G(^DIC(5,+$P(X,U,6),0)),U,2)_U_$P(X,U,6)
30 Q Y
31 ;
32REMARKS(IBIFN) ; Compile array of bill remarks
33 ;IBIFN = bill ien
34 N Z,Z0,Z1,IBARRAY,IBSM
35 S Z=0
36 ;S:$P($G(^DGCR(399,IBIFN,"U1")),U,2) Z=Z+1,Z0=$P(^("U1"),U,2),IBXDATA(Z)="OFFSET AMOUNT: "_"$"_+$P(Z0,".")_"."_$E($P(Z0,".",2)_"00",1,2)
37 S:$P($G(^DGCR(399,IBIFN,"U1")),U,8)'="" Z=Z+1,IBXDATA(Z)=$P(^("U1"),U,8) ;Bill comment on bill
38 S Z0=$G(^DGCR(399,IBIFN,0)),Z1=$G(^DGCR(399.3,+$P(Z0,U,7),0))
39 D SET^IBCSC5B(IBIFN,.IBARRAY)
40 I $P($G(IBARRAY),U,2) D ;Prosthetics
41 . S Z0=0 F S Z0=$O(IBARRAY(Z0)) Q:Z0="" S Z1=0 F S Z1=$O(IBARRAY(Z0,Z1)) Q:'Z1 S Z=Z+1,IBXDATA(Z)="Prosthetic: "_$E($P($$PIN^IBCSC5B(Z1),U,2),1,39)_" "_$E(Z0,4,5)_"/"_$E(Z0,6,7)_"/"_$E(Z0,1,2)
42 Q
43 ;
44CREM(IBIFN) ; Compile array of bill remarks common to every bill
45 ;IBIFN = bill ien
46 N Z
47 S Z=0
48 S:$P($G(^IBE(350.9,1,1)),U,4)'="" Z=Z+1,IBXDATA(Z)=$P(^(1),U,4) ;Site specific 'every bill' comment
49 Q
50 ;
51ADMDT(IBIFN,NOOUTCK) ; Calculate admission/start of care date/time
52 ; IBIFN = bill ien
53 ; NOOUTCK = flag that will:
54 ; (1) no check for inpt episode overlap for outpt
55 ; (0 or null) performs check for inpt episode overlap for outpt
56 ;
57 ; Returns IBXDATA = fileman date format
58 N Z,Z0,Z1
59 S Z=$G(^DGCR(399,IBIFN,0)),Z1=$P($G(^("U")),U,20),Z0=$$INPAT^IBCEF(IBIFN,1)
60 S IBXDATA=$S(Z0&$P(Z,U,8):$P($G(^DGPT(+$P(Z,U,8),0)),U,2),1:"")
61 S:'IBXDATA IBXDATA=$P(Z,U,3)_$S(Z0&(Z1<25):"."_$E("0",$L(Z1))_Z1,1:"")
62 ; Check to see if outpt episode (date in event date) overlaps inpt
63 ; episode - use admit date if it does
64 I 'Z0,IBXDATA,'$G(NOOUTCK) D
65 . N VAINDT,VAIN,DFN
66 . S VAINDT=IBXDATA,DFN=$P($G(^DGCR(399,IBIFN,0)),U)
67 . D INP^VADPT S IBXDATA=+VAIN(7) S:'IBXDATA IBXDATA=""
68 I 'IBXDATA,'Z0 S IBXDATA=$$SERVDT^IBCEF(IBIFN,,2)
69 Q
70 ;
71DISDT(IBIFN) ; Calculate discharge date
72 ; IBIFN = bill ien
73 N Z,Z0
74 S Z=$$INPAT^IBCEF(IBIFN,1),Z0=$G(^DGCR(399,IBIFN,0))
75 I Z S IBXDATA=+$G(^DGPT(+$P(Z0,U,8),70)) S:'IBXDATA IBXDATA=$P(Z0,U,16)
76 I 'Z N VAINDT,VAIN,DFN S DFN=$P($G(^DGCR(399,IBIFN,0)),U,2) D INP^VADPT I VAIN(1) S IBXDATA=+$G(^DGPM(+$P($G(^DGPM(+VAIN(1),0)),U,17),0))
77 Q
78 ;
Note: See TracBrowser for help on using the repository browser.