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

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

initial load of FOIAVistA 6/30/08 version

File size: 8.9 KB
Line 
1IBCEF5 ;ALB/TMP - MRA/EDI ACTIVATED UTILITIES ;06-FEB-96
2 ;;2.0;INTEGRATED BILLING;**137**;21-MAR-94
3 ;
4ADDRULE() ; Add a new rule to the EDI transmission rules file
5 ; Function returns the entry number of the new rule or
6 ; 0 if no rule added
7 ;
8 N DIR,X,Y,IBD,IBS,IBOK,IBDA1,IBC,DIC,DA,DR,DIE,IB,DO,DD,DLAYGO
9 ;
10 D FULL^VALM1
11 S IBOK=1
12 ;
13 L +^IBE(364.4,0):10
14 I '$T S IBOK=0 W !,"FILE LOCKED ... TRY AGAIN LATER" S IBOK=0 G ADDQ
15 S X=$O(^IBE(364.4,"A"),-1)
16 F S X=X+1 I '$D(^IBE(364.4,X,0)) S DIC="^IBE(364.4,",DIC(0)="L",DLAYGO=364.4,DIC("DR")="10.01////"_DUZ_";10.02///"_$$NOW^XLFDT D FILE^DICN S IBDA1=+Y K DLAYGO,DIC Q
17 L -^IBE(364.4,0)
18 I IBDA1'>0 S IBOK=0 G ADDQ
19 K DIR
20 S DIR(0)="364.4,.11A",DIR("A")="New Rule's TYPE OF RULE: "
21 D ^DIR K DIR
22 I $D(DIRUT) S IBOK=0 G ADDQ ;Required
23 S IB(.11)=+Y
24 I +Y=0 W !,"YOU ARE ADDING A RULE THAT WILL ONLY ALLOW THE TRANSMISSION OF BILLS WHOSE",!," FORM TYPE IS INCLUDED IN THIS RULE."
25 ;
26 S IB(.03)=2 ;MRA ONLY
27 I IB(.11)'=2 D G:'IBOK ADDQ
28 . S DIR(0)="364.4,.03A^^I X=2 K X",DIR("A")="New Rule's TRANSMISSION TYPE: "
29 . D ^DIR K DIR,DA
30 . I Y'>0 S IBOK=0 K IB(.03) ;Required
31 . S IB(.03)=+Y
32 ;
33 S DIR("A")=$S(IB(.11)'=0:"APPLY RULE ONLY TO BILLS THAT ARE (I)NSTITUTIONAL, (P)ROFESSIONAL, OR (B)OTH: ",1:"ONLY TRANSMIT (I)NSTITUTIONAL, (P)ROFESSIONAL, OR (B)OTH: ")
34 S DIR(0)="SAM^I:INSTITUTIONAL ONLY;P:PROFESSIONAL ONLY;B:BOTH TYPES"
35 D ^DIR K DIR,DA
36 I "IPB"'[Y S IBOK=0 G ADDQ
37 S IB(.05)=$S(Y="I":1,Y="P":2,1:3)
38 ;
39 ;S DIR("A")="APPLY RULE ONLY TO BILLS THAT ARE (I)NPATIENT, (O)UTPATIENT, OR (B)OTH: "
40 ;S DIR(0)="SAM^I:INPATIENT;OUTPATIENT;B:BOTH"
41 ;D ^DIR K DIR,DA
42 ;I "IPB"'[Y S IBOK=0 G ADDQ
43 ;S IB(.04)=$S(Y="I":1,Y="P":2,1:3)
44 S IB(.04)=3
45 ;
46 W !
47 ;
48 S IBS="",$P(IBS,"*",36)=""
49 S DIR("A",1)=IBS
50 S DIR("A",2)="THIS RULE WILL ONLY APPLY TO BILLS THAT MATCH ALL OF THE FOLLOWING CONDITIONS:"
51 S IBD=2
52 I IB(.11)'=2 D
53 . S IBD=IBD+1
54 . S DIR("A",IBD)=$J("",5)_"BILL IS "_$S(IB(.03)<3:"AN "_$P("EDI^MRA",U,+IB(.03)),1:"EITHER AN EDI OR MRA")_" BILL AND IS ALSO "
55 . S Z=$S(IB(.11)=0:IB(.05)#2+1,1:+IB(.05))
56 . S DIR("A",IBD)=DIR("A",IBD)_$S(IB(.05)<3:$P("AN INSTITUTIONAL^A PROFESSIONAL",U,Z),1:"EITHER A PROFESSIONAL OR INSTITUTIONAL")_" BILL"
57 .;S IBD=IBD+1,DIR("A",IBD)=$J("",5)_"AND "_$S(IB(.04)<3:"IS ALSO AN "_$P("INPATIENT^OUTPATIENT",U,+IB(.04)),1:"IS EITHER AN INPATIENT OR OUTPATIENT")_" BILL."
58 . S IBD=IBD+1,DIR("A",IBD)=""
59 . S IBD=IBD+1,DIR("A",IBD)="NOTE: RULE WILL BE IGNORED FOR ANY BILLS THAT DO NOT MATCH ALL THE CONDITIONS"
60 . ;
61 . I IB(.11)=0 D INSINC(.IBD)
62 . ;
63 . I IB(.11)=1 D
64 .. D INSINC(.IBD),RTINC(.IBD)
65 . ;
66 . I IB(.11)=9 D
67 .. S IBD=IBD+1,DIR("A",IBD)=""
68 .. D INSINC(.IBD)
69 ;
70 I IB(.11)=2 D
71 . S IBD=IBD+1,DIR("A",IBD)=$J("",5)_"BILL IS AN MRA BILL"
72 . S IBD=IBD+1,DIR("A",IBD)=$J("",5)_"AND IS ALSO "_$S(IB(.05)<3:$P("AN INSTITUTIONAL^A PROFESSIONAL",U,+IB(.05)),1:"EITHER A PROFESSIONAL OR INSTITUTIONAL")_" BILL"
73 .;S IBD=IBD+1,DIR("A",IBD)=$J("",7)_"AND "_$S(IB(.04)<3:"IS ALSO AN "_$P("INPATIENT^OUTPATIENT",U,+IB(.04)),1:"IS EITHER AN INPATIENT OR OUTPATIENT")_" BILL"
74 . S IBD=IBD+1,DIR("A",IBD)=$J("",5)_"AND ALSO HAS A NEXT INSURANCE THAT HAS BEEN INCLUDED IN THE"
75 . S IBD=IBD+1,DIR("A",IBD)=$J("",8)_"'INSURANCE COMPANIES INCLUDED' LIST FOR THIS RULE."
76 . S IBD=IBD+1,DIR("A",IBD)=""
77 . S IBD=IBD+1,DIR("A",IBD)="NOTE: THIS RULE WILL BE IGNORED FOR ANY BILL THAT DOES NOT MATCH"
78 . S IBD=IBD+1,DIR("A",IBD)=" ALL OF THESE CONDITIONS."
79 . S IBD=IBD+1,DIR("A",IBD)=""
80 . S IBD=IBD+1,DIR("A",IBD)="THE EFFECT OF THIS RULE WILL BE: IF A BILL MATCHES ALL OF THE ABOVE CONDITIONS,"
81 . S IBD=IBD+1,DIR("A",IBD)="THE REQUEST AND RECEIPT OF AN MRA WILL NOT BE ALLOWED."
82 S IBD=IBD+1,DIR("A",IBD)=IBS
83 ;
84 S DIR("A")="IS THIS CORRECT? "
85 S DIR(0)="YA",DIR("B")="YES"
86 D ^DIR K DIR
87 I 'Y S IBOK=0 G ADDQ
88 ;
89 W !
90 ;
91 ; Combine inpatient/outpatient and inst/prof checks
92 S IB(.05,"IN")=$S(IB(.04)=1:0,1:$S(IB(.05)=1:2,IB(.05)=2:1,1:3))
93 S IB(.05,"OUT")=$S(IB(.04)=2:0,1:$S(IB(.05)=1:2,IB(.05)=2:1,1:3))
94 S IB(1)=$S(IB(.11)=0:"I $$MULTYP^IBCEF5(.IB,"_IB(.05,"IN")_","_IB(.05,"OUT")_")",IB(.11)=1:"I $$BILLTYP^IBCEF5(IBIFN,$G(IBDA))",IB(.11)=2:"I $$REQMRA^IBEFUNC(IBIFN)",1:"")
95 S DR=".03////"_IB(.03)_";.05////"_IB(.05)_";.02;.06;.08;4;.07"_$S(IB(.11)'=2:"",1:"////1")_";.11////"_IB(.11)
96 S DR=DR_";1"_$S(IB(.11)<9:"////"_IB(1),1:"")
97 S DIE="^IBE(364.4,",DA=IBDA1
98 D ^DIE
99 I $D(Y) S IBOK=0 G ADDQ
100 ;
101 W !
102 S IB(.07)=$P($G(^IBE(364.4,IBDA1,0)),U,7)
103 ;
104 D:IB(.07)'=3 INSCO^IBCEF51(.IB,.IBOK,IBDA1)
105 I 'IBOK K IB G ADDQ
106 I IB(.11)=1 D BTYP^IBCEF51(.IB,.IBOK) ;Enter applicable bill types
107 I 'IBOK K IB G ADDQ
108 ;
109 I IBOK D ADDBTYP^IBCEF61(.IB,IBDA1),INSADD^IBCEF61(.IB,IBDA1)
110 ;
111ADDQ I $G(IBDA1),'IBOK S DA=IBDA1,DIK="^IBE(364.4," D ^DIK
112 I IBOK D REBLD^IBCEF6($G(IBACTIVE))
113 Q $S(IBOK:IBDA1,1:0)
114 ;
115BILLTYP(IBIFN,IBDA) ; Check bill type for valid to transmit
116 N IB,IB0,IB00,IB399,IBOK,IBALL,IBB,IBEXC,IBQUIT,IBINC,Z,Z1
117 S Z=$$FT^IBCEF(IBIFN)
118 S IB399=$G(^DGCR(399,IBIFN,0))
119 S IB0=$P(IB399,U,24,26)
120 S IB0=$P(IB0,U)_$P($G(^DGCR(399.1,+$P(IB0,U,2),0)),U,2)_$P(IB0,U,3)
121 ;
122 S (IB,IBINC,IBOK,IBALL)=0
123 ;
124 ; Check for all bill types allowed, dates allowed
125 F S IB=$O(^IBE(364.4,IBDA,"BTYP","B","XXX",IB)) Q:'IB D Q:IBALL
126 . S IB00=$G(^IBE(364.4,IBDA,"BTYP",IB,0))
127 . I $S($P(IB00,U,2):$P(IB00,U,2)'>DT,1:1),$S($P(IB00,U,3):$P(IB00,U,3)>DT,1:1) S IBALL=1 Q
128 ;
129 ; If not all bill types are included, find out if any are included
130 I 'IBALL S IB="",IBINC=0 F S IB=$O(^IBE(364.4,IBDA,"BTYP","B",IB),-1) Q:IB=""!($E(IB)="-") D Q:IBINC
131 . S IBB=+$O(^IBE(364.4,IBDA,"BTYP","B",IB,0)),IB00=$G(^IBE(364.4,IBDA,"BTYP",IBB,0))
132 . I $S($P(IB00,U,2):$P(IB00,U,2)'>DT,1:1),$S($P(IB00,U,3):$P(IB00,U,3)>DT,1:1) S IBINC=1 Q
133 ;
134 I IB0'="" D ;Check bill's type of bill in included list, or is excluded
135 . S (IBQUIT,IBEXC)=0
136 . F Z1=1,2 Q:Z1=2&'IBOK S:'IBINC Z1=2,IBOK=1 F IB=$E(IB0)_"XX",$E(IB0,1,2)_"X",IB0 S IBQUIT=0 D Q:IBQUIT
137 .. I Z1=2 S IB="-"_IB ;Checking for exclusions on this pass
138 .. S Z=0
139 .. F S Z=$O(^IBE(364.4,+$G(IBDA),"BTYP","B",IB,Z)) Q:'Z S IB00=$G(^IBE(364.4,IBDA,"BTYP",Z,0)),IBQUIT=0 D Q:IBQUIT
140 ... I $P(IB00,U,2)>DT Q ;Not effective yet
141 ... I $P(IB00,U,3),$P(IB00,U,3)'>DT Q ;Expired
142 ... I $E(IB00)'="-" S (IBQUIT,IBOK)=1 Q ; Bill type included
143 ... I $E(IB00)="-" S IBOK=0,(IBEXC,IBQUIT)=1 Q ; Bill type is excluded
144 . I 'IBALL,'IBINC,'IBEXC S IBOK=1 ;No active restrictions found
145 ;
146BTYPQ Q IBOK
147 ;
148QUIT ; DIR call to continue processing after error message display
149 S DIR("A")="Press RETURN to continue: "
150 S DIR(0)="EA" D ^DIR K DIR
151 ;
152 Q
153 ;
154MULTYP(IB,IN,OUT) ; Code to execute to determine multiple types
155 ; of I/O and prof/inst bills combinations OK to transmit
156 ; IB = ien of bill in file 399
157 ; IB(x) = array containing necessary data for xref search from bill
158 ; subscripted by x=field # in file 364.4
159 ; IN =0 or null for no inpt at all
160 ; =1 for inpt,prof only; =2 for inpt,inst only; =3 for inpt,both
161 ; OUT =0 or null for no outpt at all
162 ; =1 for outpt,prof only; =2 for outpt,inst only; =3 for outpt,both
163 ;
164 ; Function returns 1 if edit passes, 0 if edit fails
165 ;
166 ; Functionality has been removed, but code remains in case they decide
167 ; they need it later (INPT/OUTPT part)
168 ;
169 N IBOK
170 S IBOK=1
171 ; IB(.04) = the value of the bill's type of care (1=outpt, 2=inpt)
172 ; IB(.05) = the value of the bill's form type (1=inst, 2=prof)
173 ; outpatient bill
174 I $G(IB(.04))=1,$G(OUT)'=3 D G:'IBOK MULTQ
175 . I +$G(OUT)=0 S IBOK=0 Q
176 . I $G(OUT)=1,$G(IB(.05))'=2 S IBOK=0 Q
177 . I $G(OUT)=2,$G(IB(.05))'=1 S IBOK=0 Q
178 ; inpatient bill
179 I $G(IB(.04))=2,$G(IN)'=3 D G:'IBOK MULTQ
180 . I +$G(IN)=0 S IBOK=0 Q
181 . I $G(IN)=1,$G(IB(.05))'=2 S IBOK=0 Q
182 . I $G(IN)=2,$G(IB(.05))'=1 S IBOK=0 Q
183MULTQ Q IBOK
184 ;
185INSINC(IBD) ; Insurance include/exclude condition explanation
186 ; IBD = line counter - pass by reference
187 S IBD=IBD+1,DIR("A",IBD)=""
188 S IBD=IBD+1,DIR("A",IBD)="THE EFFECT OF THIS RULE WILL BE: IF A BILL MATCHES BOTH OF THE ABOVE CONDITIONS,"
189 S IBD=IBD+1,DIR("A",IBD)="THE RULE WILL BE APPLIED AND THE BILL WILL NOT BE TRANSMITTED IF:"
190 S IBD=IBD+1,DIR("A",IBD)=" - THE RULE APPLIES TO ALL INSURANCE COMPANIES"
191 S IBD=IBD+1,DIR("A",IBD)=$J("",17)_"OR"
192 S IBD=IBD+1,DIR("A",IBD)=" - THE RULE 'APPLIES TO' ONLY SPECIFIC INSURANCE COMPANIES AND THE BILL'S"
193 S IBD=IBD+1,DIR("A",IBD)=" INSURANCE COMPANY APPEARS ON THE RULE'S 'INCLUDE LIST'"
194 S IBD=IBD+1,DIR("A",IBD)=$J("",17)_"OR"
195 S IBD=IBD+1,DIR("A",IBD)=" - THE RULE 'EXCLUDES' SPECIFIC INSURANCE COMPANIES AND THE BILL'S"
196 S IBD=IBD+1,DIR("A",IBD)=" INSURANCE COMPANY DOES NOT APPEAR ON THE RULE'S 'EXCLUDE LIST'"
197 Q
198 ;
199RTINC(IBD) ; Bill type include/exclude condition explanation
200 ; IBD = line counter - pass by reference
201 ;
202 S IBD=IBD+1,DIR("A",IBD)="*** AND ***"
203 S IBD=IBD+1,DIR("A",IBD)=" - THE RULE HAS NO BILL TYPE RESTRICTIONS OR APPLIES TO ALL BILL TYPES"
204 S IBD=IBD+1,DIR("A",IBD)=$J("",17)_"OR"
205 S IBD=IBD+1,DIR("A",IBD)=" - THE RULE IS RESTRICTED TO CERTAIN BILL TYPES AND THE BILL'S BILL TYPE IS"
206 S IBD=IBD+1,DIR("A",IBD)=" INCLUDED FOR THE RULE OR IS NOT EXCLUDED FOR THE RULE"
207 Q
208 ;
Note: See TracBrowser for help on using the repository browser.