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

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

initial load of FOIAVistA 6/30/08 version

File size: 8.0 KB
Line 
1IBCEP2B ;ALB/TMP - EDI UTILITIES for provider ID ;18-MAY-04
2 ;;2.0;INTEGRATED BILLING;**232,320**;21-MAR-94
3 ;
4PROVID(IBIFN,IBPRIEN,IBCOBN,DIPA) ; Provider id entry on billing screen 8
5 ; IBIFN = ien file 399
6 ; IBPRIEN = ien file 399.0222
7 ; IBCOBN = the COB number of the id being edited
8 ; DIPA = passed by ref, returned with id data
9 ; DIPA("EDIT")=-1 if no id editing = 1 if edit id = 2 if stuff id
10 ; DIPA("PRID")= id to stuff DIPA("PRIDT")= id type to stuff
11 N PRN0,Z
12 Q:'$G(^DGCR(399,IBIFN,"I1"))
13 S PRN0=$G(^DGCR(399,IBIFN,"PRV",IBPRIEN,0))
14 S DIPA("EDIT")=1,(DIPA("PRID"),DIPA("PRIDT"))=""
15 W @IOF
16 W !,?19,"**** SECONDARY PERFORMING PROVIDER IDs ****"
17 W !!,$P("PRIMARY^SECONDARY^TERTIARY",U,IBCOBN)_" INSURANCE CO: "_$P($G(^DIC(36,+$G(^DGCR(399,IBIFN,"I"_IBCOBN)),0)),U)
18 W !,"PROVIDER: "_$$EXTERNAL^DILFD(399.0222,.02,"",$P(PRN0,U,2))_" ("_$$EXTERNAL^DILFD(399.0222,.01,"",+PRN0)_")",!
19 ;
20 I $P(PRN0,U,4+IBCOBN)="" K DIPA("PRID"),DIPA("PRIDT") D NEWID(IBIFN,IBPRIEN,IBCOBN,.DIPA) ; No id currently exists for the ins seq/prov
21 ;
22 Q
23 ;
24NEWID(IBIFN,IBPRIEN,IBCOBN,DIPA) ;
25 N IBDEF,IBCT,IBNUM,IBINS,IBFRM,IBCAR,IBARR,IBARRS,IB0,IBM,IBQUIT,IBSEL,PRN,PRT,PRN,PRN0,DIR,X,Y,Z,Z0,IBZ,IBZ1,IBTYP,IBREQ,IBREQT,IBTYPN,IBID,IBUSED
26 S IBREQ=0,IBREQT=""
27 S PRN0=$G(^DGCR(399,IBIFN,"PRV",IBPRIEN,0))
28 S Z(IBCOBN)=$S($G(DIPA("I"_IBCOBN)):$$GETTYP^IBCEP2A(IBIFN,IBCOBN,$P(PRN0,U)),1:"")
29 S IBINS=+$G(^DGCR(399,IBIFN,"I"_IBCOBN)),IB0=$G(^DGCR(399,IBIFN,"PRV",IBPRIEN,0))
30 S IBCAR=$$INPAT^IBCEF(IBIFN,1),IBCAR=$S('IBCAR:2,1:1)
31 S IBFRM=$$FT^IBCEF(IBIFN),IBFRM=$S(IBFRM=2:2,1:1)
32 I $P(Z(IBCOBN),U) D
33 . W !,"INS. COMPANY'S DEFAULT SECONDARY ID TYPE IS: "_$$EXTERNAL^DILFD(36,4.01,"",$P(Z(IBCOBN),U)) S IBREQT=+Z(IBCOBN)
34 . I $P(Z(IBCOBN),U,2) W !,?2," AND IS REQUIRED TO BE ENTERED FOR THIS CLAIM" S IBREQ=1
35 I $$CUNEED^IBCEP3(IBIFN,IBCOBN) W !,"CARE UNITS ARE DEFINED"_$S($P($G(^DIC(36,IBINS,4)),U,9)'="":" AS "_$P(^(4),U,9),1:"")_" FOR THESE IDs"
36 D PRACT^IBCEF71(IBINS,IBFRM,IBCAR,$P(IB0,U,2),.IBARR,$P(IB0,U),$S($$COBN^IBCEF(IBIFN)=IBCOBN:"C",1:"O"),355.9,1)
37 S (IBNUM,IBCT)=0,IBDEF=""
38 I $O(IBARR(""))="" S IBCT=IBCT+1,DIR("A",IBCT)="NO SECONDARY IDS ARE DEFINED FOR THIS PROV THAT ARE VALID FOR THIS CLAIM"
39 S IBCT=IBCT+1,DIR("A",IBCT)="SELECT A SECONDARY ID OR ACTION FROM THE LIST BELOW: ",IBCT=IBCT+1,DIR("A",IBCT)=" "
40 ;
41 S IBCT=IBCT+1,IBNUM=IBNUM+1,DIR("A",IBCT)=" "_$E(IBNUM_$J("",3),1,3)_" - NO SECONDARY ID NEEDED",IBNUM=IBNUM+1,IBCT=IBCT+1,DIR("A",IBCT)=" "_$E(IBNUM_$J("",3),1,3)_" - ADD AN ID FOR THIS CLAIM ONLY"
42 I $O(IBARR(""))="" S IBDEF=1,DIPA("EDIT")=$$SELID(.DIR,IBDEF,.IBID,.DIPA,IBNUM) Q
43 ;
44 S PRN=$$GETID^IBCEP2(IBIFN,2,$P(PRN0,U,2),IBCOBN,.PRT,,$P(PRN0,U)),IBDEF=""
45 ;
46 I PRN'="",PRT D
47 . N PRT1
48 . S PRT1=$P($G(^IBE(355.97,+PRT,0)),U)
49 . I $P($G(^IBE(355.97,+PRT,1)),U,3) S PRT1="ST LIC("_$P($G(^DIC(5,+$$CAREST^IBCEP2A(IBIFN),0)),U,2)_")"
50 . S IBCT=IBCT+1,IBNUM=IBNUM+1
51 . S DIR("A",IBCT)=" "_$E(IBNUM_$J("",3),1,3)_" - "_$E("<DEFAULT> "_PRN_$J("",29),1,29)_" "_$E(PRT1_$J("",15),1,15)
52 . S DIR("A",IBCT)=DIR("A",IBCT)_" "_$S($P(PRT,U,3)'["355.9":"",$P($G(^IBA(+$P(PRT,U,3),+$P(PRT,U,2),0)),U,3)'="":$$EXTERNAL^DILFD(355.9,.03,"",$P($G(^IBA(+$P(PRT,U,3),+$P(PRT,U,2),0)),U,3)),1:"")
53 . S IBID(IBNUM)=PRN_U_+PRT,IBDEF=IBNUM,IBID(IBNUM,1)=DIR("A",IBCT),IBDEF=IBNUM,IBDEF("IEN")=$P(PRT,U,2,3)
54 . S IBUSED(PRT,PRN,0)=""
55 ;
56 S IBQUIT=0,IBSEL=1
57 ; Sort ids by id type
58 S IBZ="" F S IBZ=$O(IBARR(IBZ)) Q:IBZ="" S IBZ1="" F S IBZ1=$O(IBARR(IBZ,IBZ1)) Q:IBZ1="" D
59 . S IBTYP=+$P(IBARR(IBZ,IBZ1),U,9)
60 . I $P(IBARR(IBZ,IBZ1),U,4)]"" Q:$D(IBUSED(IBTYP,$P(IBARR(IBZ,IBZ1),U,4),+$P(IBARR(IBZ,IBZ1),U,7)))
61 . I $P($G(IBDEF("IEN")),U,2)["355.9",$P(IBARR(IBZ,IBZ1),U,8),$P(IBARR(IBZ,IBZ1),U,8)=+$G(IBDEF("IEN")) Q:$S($P(IBZ1,U)'["INS DEF":$P($G(IBDEF("IEN")),U,2)=355.9,1:$P($G(IBDEF("IEN")),U,2)=355.91)
62 . S IBARRS(IBTYP,IBZ,IBZ1)=IBARR(IBZ,IBZ1)
63 . I $P(IBARR(IBZ,IBZ1),U,4)]"" S IBUSED(IBTYP,$P(IBARR(IBZ,IBZ1),U,4),+$P(IBARR(IBZ,IBZ1),U,7))=""
64 S IBTYP="" F S IBTYP=$O(IBARRS(IBTYP)) Q:IBTYP="" S IBZ="" F S IBZ=$O(IBARRS(IBTYP,IBZ)) Q:IBZ="" D Q:IBQUIT
65 . S IBZ1="" F S IBZ1=$O(IBARRS(IBTYP,IBZ,IBZ1)) Q:IBZ1="" S IBCT=IBCT+1,IBNUM=IBNUM+1 D Q:IBQUIT
66 .. S Z0=IBARRS(IBTYP,IBZ,IBZ1)
67 .. S IBARR=$S($P(Z0,U,8)&(IBZ1'["LIC"):$G(^IBA("355.9"_$S($P(IBZ1,U)'="INS DEF":"",1:1),+$P(Z0,U,8),0)),1:"")
68 .. S IBTYPN=$S(IBTYP=+$$STLIC^IBCEP8():"ST LIC ("_$P($G(^DIC(5,+$P(Z0,U,7),0)),U,2)_")",1:$P($G(^IBE(355.97,IBTYP,0)),U))
69 .. S DIR("A",IBCT)=" "_$E(IBNUM_$J("",3),1,3)_" - "_$E($S($P(IBZ1,U)="INS DEF":"<INS DEF> ",1:"")_$P(Z0,U,4)_$J("",29),1,29)_" "_$E(IBTYPN_$J("",15),1,15)_" "_$S($P(IBARR,U,3):$$EXTERNAL^DILFD(355.9,.03,"",$P(IBARR,U,3)),1:"")
70 .. S IBID(IBNUM,1)=DIR("A",IBCT),IBID(IBNUM)=$P(Z0,U,4)_U_IBTYP
71 .. I (IBNUM#15)=0 S IBM=$$MORE(.DIR) D Q:IBQUIT
72 ... I IBM<0 S IBQUIT=1,IBSEL=0 Q ; User aborted list
73 ... I 'IBM S IBQUIT=1 Q ; User wants to select
74 ... W ! K DIR S IBCT=1
75 I 'IBSEL S DIPA("EDIT")=-1
76 I IBSEL S:IBDEF=""&$G(IBREQ) IBDEF=2 S DIPA("EDIT")=$$SELID(.DIR,IBDEF,.IBID,.DIPA,IBNUM)
77 Q
78 ;
79SELID(DIR,IBDEF,IBID,DIPA,IBNUM) ; Returns the selection from the array of possible IDs/ID actions
80 N IDACT,IDSEL,X,Y
81 S IDACT=""
82 S DIR("B")=$S('$G(IBDEF):1,1:IBDEF),DIR("A",+$O(DIR("A",""),-1)+1)=" "
83 S DIR(0)="NA^1:"_IBNUM,DIR("A")="Selection: " W ! D ^DIR K DIR
84 I $D(DTOUT)!$D(DUOUT)!(Y=1) S IDACT=-1 G SELIDQ
85 I Y=2 S IDACT=1 G SELIDQ
86 S IDSEL=Y
87 S DIR("A",1)="ID SELECTED:",DIR("A",2)=" "_$G(IBID(+Y,1)),DIR("A")="IS THIS CORRECT?: ",DIR("B")="YES",DIR(0)="YA" W ! D ^DIR K DIR
88 I Y'=1 S IDACT=-1 G SELIDQ
89 S DIPA("PRID")=$P(IBID(IDSEL),U),DIPA("PRIDT")=$P(IBID(IDSEL),U,2),IDACT=2
90 ;
91SELIDQ Q IDACT
92 ;
93MORE(DIR) ;
94 N DIR,X,Y,DUOUT,DTOUT
95 S DIR(0)="YA",DIR("A")="MORE?: ",DIR("B")="NO" W ! D ^DIR K DIR("B")
96 Q $S($D(DTOUT)!$D(DUOUT):-1,1:Y)
97 ;
98 ; IBFIDFL = E = Electronic Form Type
99 ; A = Additional ID's
100 ; LF - VA Lab/Facility
101FACID(IBINS,IBFIDFL) ; Enter/edit billing facility ids
102 ; IBINS = ien of ins co (file 36)
103 N IBID,Z,Z0,Y
104 K ^TMP($J,"IBBF_ID")
105 W @IOF
106 D GETBPNUM(IBINS)
107 K ^TMP("IBCE_PRVFAC_MAINT_INS",$J)
108 S ^TMP("IBCE_PRVFAC_MAINT_INS",$J)=IBFIDFL_U_IBINS_U_"1"
109 D EN^VALM("IBCE PRVFAC MAINT")
110 K ^TMP("IBCE_PRVFAC_MAINT_INS",$J)
111 W @IOF
112 D FULL^VALM1
113 Q
114 ;
115GETBPNUM(IBINS) ;
116 N Z,Z0,IBID,IBMAIN
117 S IBMAIN=$$MAIN(),^TMP($J,"IBBF_ID")=IBMAIN
118 S IBID=$$BF^IBCU()
119 S Z=0 F S Z=$O(^IBA(355.92,"B",IBINS,Z)) Q:'Z D
120 . S Z0=$G(^IBA(355.92,Z,0))
121 . Q:$P(Z0,U,8)'="E" ; WCJ 1/13/06 There are several ID types in this file
122 . Q:$P(Z0,U,3)]""
123 .; I $P(Z0,U,6)=IBID S ^TMP($J,"IBBF_ID",$S($P(Z0,U,5)=IBMAIN:0,1:+$P(Z0,U,5)),+$P(Z0,U,4))=$P(Z0,U,7)
124 . S ^TMP($J,"IBBF_ID",$S($P(Z0,U,5)=IBMAIN:0,1:+$P(Z0,U,5)),+$P(Z0,U,4))=$P(Z0,U,7)
125 . S ^TMP($J,"IBBF_ID",$S($P(Z0,U,5)=IBMAIN:0,1:+$P(Z0,U,5)),+$P(Z0,U,4),"QUAL")=$P(Z0,U,6)
126 Q
127 ;
128MAIN() ; Returns ien of default division or the main division for facility if
129 ; no IB DEFAULT DIVISION set
130 N IBMAIN
131 S IBMAIN=$P($G(^IBE(350.9,1,1)),U,25) S:'IBMAIN IBMAIN=+$$PRIM^VASITE()
132 Q IBMAIN
133 ;
134FACNUM(IBIFN,IBCOB,IBQF) ; Function returns the current division's fac billing
135 ; prov id for the COB insurance sequence from file 355.92
136 ; IBIFN = ien file 399
137 ; IBCOB = # of COB ins seq or if "", current assumed
138 ; IBQF - 1 if qualifier is to be returned instead of ID
139 N Z,IBDIV,IBFT,X
140 S X=""
141 S IBDIV=+$P($G(^DGCR(399,IBIFN,0)),U,22)
142 S:'IBDIV IBDIV=$$MAIN()
143 S IBFT=$$FT^IBCEF(IBIFN),IBFT=$S(IBFT=3:1,1:2)
144 S:'$G(IBCOB) IBCOB=+$$COBN^IBCEF(IBIFN)
145 K ^TMP($J,"IBBF_ID")
146 D GETBPNUM(+$P($G(^DGCR(399,IBIFN,"M")),U,IBCOB))
147 I IBDIV=+$G(^TMP($J,"IBBF_ID")) S IBDIV=0
148 I '$G(IBQF) S X=$S($D(^TMP($J,"IBBF_ID",IBDIV,IBFT)):^(IBFT),1:$G(^TMP($J,"IBBF_ID",0,IBFT)))
149 I $G(IBQF) S X=$S($D(^TMP($J,"IBBF_ID",IBDIV,IBFT,"QUAL")):^("QUAL"),1:$G(^TMP($J,"IBBF_ID",0,IBFT,"QUAL")))
150 K ^TMP($J,"IBBF_ID")
151 Q X
152 ;
153SOP(IBIFN,IBZD) ; Returns X12 current source of pay code for bill ien IBIFN
154 ; IBZD = the current ins policy type, if known
155 N IBZ
156 S IBZ=""
157 I $G(IBZD)="" D F^IBCEF("N-CURRENT INS POLICY TYPE","IBZD",,IBIFN)
158 S IBZ=$S($G(IBZD)="":"G2","MAMB16"[IBZD:"1C",IBZD="TV"!(IBZD="MC"):"1D",IBZD="CH":"1H",IBZD="BL":$S($$FT^IBCEF(IBIFN)=2:"1B",1:"1A"),1:"G2")
159 Q IBZ
160 ;
Note: See TracBrowser for help on using the repository browser.