source: FOIAVistA/trunk/r/OUTPATIENT_PHARMACY-PSO-APSP-HUIP/PSOBBC.m@ 1015

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

initial load of FOIAVistA 6/30/08 version

File size: 9.4 KB
Line 
1PSOBBC ;IHS/DSD/JCM-BATCH BARCODE DRIVER ;3/30/06 10:10am
2 ;;7.0;OUTPATIENT PHARMACY;**11,22,27,34,46,130,146,185,242,264**;DEC 1997;Build 19
3 ;External reference to ^IBE(350.1,"ANEW" supported by DBIA 592
4 ;External references CHPUS^IBACUS and TRI^IBACUS supported by DBIA 2030
5 ;External reference PDA^PPPPDA1 supported by DBIA 1374
6 ;External references LK^ORX2 and ULK^ORX2 supported by DBIA 867
7 ;External references ^PS(55 supported by DBIA 2228
8 ;External references U, UL, PSOL, and PSOUL^PSSLOCK supported by DBIA 2789
9 ;PSO*242 change default to from Q to S
10 ;-------------------------------------------------------------------
11START ;
12 N PSODFN,PSOBBCNO
13 D INIT I '$D(PSOPAR) D ^PSOLSET G:'$D(PSOPAR) EOJ
14 I $G(PSOSITE) S PSOBARID=$G(^PS(59,PSOSITE,"IB")) I '$D(^IBE(350.1,"ANEW",+PSOBARID,1,1)) D S PSORX("QFLG")=1 K PSOBARID G END
15 .W $C(7),!!,"WARNING: Pharmacy Copay not working,",!,?10,"Check IB SERVICE/SECTION in Pharmacy Site File.",!!!,"You will not be able to enter any new prescriptions until this is corrected!"
16 S PSOBBC("QFLG")=0,PSORX("BAR CODE")=1
17 D FROM I PSOBBC("QFLG") S PSORX("QFLG")=1 G END
18 D ASK I PSOBBC("QFLG") S PSORX("QFLG")=1 G END
19 D PROCESS
20END D EOJ
21 Q
22 ;--------------------------------------------------------------------
23INIT ;
24 S PSOBBC("QFLG")=0,PSORX("BAR CODE")=1 K PPL
25 I '$G(PSOINST) D
26 .K DIC,DR,DIQ S DA=$P($$SITE^VASITE(),"^") I DA D
27 ..K PSOINST S DIC=4,DIQ(0)="I",DR=99,DIQ="PSOINST" D EN^DIQ1
28 ..S PSOINST=PSOINST(4,DA,99,"I") K DIC,DA,DIQ,PSOINST(4)
29 Q
30FROM ;
31 S DIR(0)="S^1:REFILLS;2:RENEWS;"
32 S DIR("A")="Batch Barcode for",DIR("B")="REFILLS"
33 D DIR G:'Y FROMX
34 S PSOBBC1("FROM")=$S(Y=1:"REFILL",1:"NEW")
35FROMX K X,Y,DIR
36 Q
37 ;
38ASK ;
39 K BINGCRT,BINGRTE,BBRX
40 W !,"Please answer the following for this session of prescriptions",!
41 D EN^PSOREF2(.PSOBBC) I PSOBBC("DFLG") S PSOBBC("QFLG")=1 G ASKX
42 D SUSP
43 D INPT,CNH
44 D:'$P($G(PSOPAR),"^",6) EARLY
45 D SET
46 D:PSOBBC1("FROM")="NEW" NOORE^PSONEW(.PSOBBC) S:$G(PSOBBC("NOO"))'="" PSOBBCNO=$G(PSOBBC("NOO")) S:$G(PSOBBC("DFLG")) PSOBBC("QFLG")=1
47ASKX Q
48 ;
49SUSP ;
50 S DIR(0)="SAB^Q:QUEUED;S:SUSPENDED"
51 S DIR("A")="Will these refills be Queued or Suspended ? "
52 S DIR("B")="S" ;PSO*242
53 D DIR G:PSOBBC("QFLG") SUSPX
54 S (PSOBBC1("QS"),PSOBBC("QS"))=Y S:PSOBBC1("QS")="S" BINGCRT=0
55SUSPX K X,Y,DIR
56 Q
57 ;
58INPT ;
59 S DIR(0)="YA"
60 S DIR("A")="Allow refills for inpatient ? "
61 S DIR("B")="N"
62 D DIR G:PSOBBC("QFLG") INPTX
63 S (PSOBBC1("INOK"),PSOBBC("INOK"))=Y
64INPTX K X,Y,DIR
65 Q
66CNH ;
67 S DIR(0)="YA"
68 S DIR("A")="Allow refills for CNH ? "
69 S DIR("B")="N"
70 D DIR G:PSOBBC("QFLG") CNHX
71 S (PSOBBC1("CNHOK"),PSOBBC("CNHOK"))=Y
72CNHX K X,Y,DIR
73 Q
74 ;
75EARLY ;
76 S DIR(0)="YA"
77 S DIR("A")="Allow early refills ? "
78 S DIR("B")="N"
79 D DIR G:PSOBBC("QFLG") EARLYX
80 S (PSOBBC1("EAOK"),PSOBBC("EAOK"))=Y
81EARLYX K X,Y,DIR
82 Q
83 ;
84SET ;
85 S PSOBBC1("MAIL/WINDOW")=PSOBBC("MAIL/WINDOW") S:PSOBBC1("MAIL/WINDOW")="W" BINGRTE="W"
86 S PSOBBC1("FILL DATE")=PSOBBC("FILL DATE")
87 S:$G(PSOBBC("CLERK CODE")) PSOBBC1("CLERK CODE")=PSOBBC("CLERK CODE")
88 S:$G(PSOBBC("EXPIRATION DATE")) PSOBBC1("EXPIRATION DATE")=PSOBBC("EXPIRATION DATE")
89 Q
90DIR ;
91 D ^DIR
92 S:$D(DIRUT) PSOBBC("QFLG")=1,PSORX("QFLG")=1
93 K DIRUT,DUOUT,DTOUT,DIROUT
94 Q
95 ;
96PROCESS ;
97 S PSOBBC("DFLG")=0 D NOW^%DTC S TM=$E(%,1,12),TM1=$P(TM,".",2)
98 S RXN=$O(^TMP("PSORXN",$J,0)) I RXN D
99 .S RXN1=^TMP("PSORXN",$J,RXN) D EN^PSOHLSN1(RXN,$P(RXN1,"^"),$P(RXN1,"^",2),"",$P(RXN1,"^",3))
100 .I $P(^PSRX(RXN,"STA"),"^")=5 D EN^PSOHLSN1(RXN,"SC","ZS","")
101 K RXN,RXN1,^TMP("PSORXN",$J) D CLEAN^PSOVER1 K ^TMP("PSORXDC",$J)
102 D GETRXM D:PSOBBC("QFLG") ULK,ULP,ULRX G:PSOBBC("QFLG") PROCESSX
103 I $G(PSODFN)'=$P(^PSRX(PSOBBC("IRXN"),0),"^",2) D G:PSOBBC("DFLG") PROCESS
104 .I $G(PSODFN) D ULK,ULP
105 .D PT Q:PSOBBC("DFLG")
106 .D PROFILE^PSORX1 S X="PPPPDA1" X ^%ZOSF("TEST") I S X=$$PDA^PPPPDA1(PSODFN) W !!
107 E D PTC G:PSOBBC("DFLG") PROCESS
108 D:'$G(PSOSD) ^PSOBUILD
109 S PSOBBC("DONE")=PSOBBC("IRXN")_","
110 D @PSOBBC1("FROM") S:$G(PPL)&$D(BINGRTE) BBRX(1)=$S($D(PSOBBC("DONE")):PSOBBC("DONE"),1:BBRX) D:$D(BINGCRT)&($D(BINGRTE)&($D(DISGROUP))) ^PSOBING1 K BBRX D ULRX G PROCESS
111PROCESSX I $G(PPL) D SETX,TRI,Q^PSORXL K PPL,RXFL
112 Q
113GETRXM ;
114 K DIR,PSOBBC("IRXN"),PSOREFXM
115 S DIR(0)="FO^5:245^K:X'?3N1""-""1.N X"
116 S DIR("A")="WAND BARCODE"
117 S DIR("?",1)="Wand the barcoded number of the prescription to be processed."
118 S DIR("?",2)="The number should be of the form NNN-NNNNNN"
119 S DIR("?",3)="where the number before the dash is your station number."
120 S DIR("?")="Enter ""^"", or a RETURN to quit."
121 D DIR G:PSOBBC("QFLG") GETRXMX
122 I $P(X,"-")'=PSOINST W !?7,$C(7),$C(7),$C(7),"Not From this Institution" G GETRXM
123 S (PSOBBC("IRXN"),PSOBBC("OIRXN"),BBRX)=$P(X,"-",2)
124 I $G(^PSRX(PSOBBC("IRXN"),0))']"" W !,$C(7),"Rx data is not on file !",! G GETRXM
125 S PSOXDFN=+$P($G(^PSRX(PSOBBC("IRXN"),0)),"^",2) I PSOXDFN S PSOLOUD=1 D:$P($G(^PS(55,PSOXDFN,0)),"^",6)'=2 EN^PSOHLUP(PSOXDFN) K PSOLOUD
126 K PSOXDFN I $P($G(^PSRX(PSOBBC("IRXN"),"STA")),"^")=13 W !,$C(7),"Rx has already been deleted." G GETRXM
127 I $G(PSOBBC("DONE"))[PSOBBC("IRXN")_"," W !,$C(7),"Rx has already been entered" G GETRXM
128 I $G(PSOBBC1("FROM"))="REFILL" S PSOREFXM=$G(PSOBBC("IRXN")) I PSOREFXM D PSOL^PSSLOCK(PSOREFXM) I '$G(PSOMSG) D K PSOMSG G GETRXM
129 .I $P($G(PSOMSG),"^",2)'="" W $C(7),!!?5,$P(PSOMSG,"^",2),! Q
130 .W $C(7),!!?5,"Another person is editing Rx "_$P($G(^PSRX(+$G(PSOBBC("IRXN")),0)),"^"),!
131 I '$D(PSODFNX(+$P(^PSRX(PSOBBC("IRXN"),0),"^",2))),$G(PSOBBC1("FROM"))="NEW" K PSONOERR D G:'$G(PSOPLCK)!($G(PSONOERR)) GETRXM
132 .S PSOPLCK=$$L^PSSLOCK(+$P(^PSRX(PSOBBC("IRXN"),0),"^",2),0) I '$G(PSOPLCK) D LOCK^PSOORCPY Q
133 .S X=+$P(^PSRX(PSOBBC("IRXN"),0),"^",2)_";DPT(" D LK^ORX2 I 'Y S PSONOERR=1 D UL^PSSLOCK(+$P(^PSRX(PSOBBC("IRXN"),0),"^",2)) Q
134 .S PSODFNX(+$P(^PSRX(PSOBBC("IRXN"),0),"^",2))=""
135GETRXMX K X,Y,DIR,PSOOPT
136 Q
137 ;
138PT ;
139 S PSOBBC("DFLG")=0
140 W !,$C(7),"New Patient, please pause"
141 I $G(PPL) D SETX,TRI,Q^PSORXL K PPL
142 K RXFL
143 S (DFN,PSODFN)=$P(^PSRX(PSOBBC("IRXN"),0),"^",2),PSORX("NAME")=$P(^DPT(PSODFN,0),"^")
144 D ICN^PSODPT(DFN)
145 ;CHECK FOR BAD ADDRESS/SAB
146 S PSOLOUD=1 D:$P($G(^PS(55,PSODFN,0)),"^",6)'=2 EN^PSOHLUP(PSODFN) K PSOLOUD
147 D ^PSOBUILD
148 S PSOX=$G(^PS(55,PSODFN,"PS")) I PSOX]"" S PSORX("PATIENT STATUS")=$P($G(^PS(53,PSOX,0)),"^")
149 K PSOX
150PTC S (DFN,PSODFN)=$P(^PSRX(PSOBBC("IRXN"),0),"^",2)
151 S PSOLOUD=1 D:$P($G(^PS(55,PSODFN,0)),"^",6)'=2 EN^PSOHLUP(PSODFN) K PSOLOUD
152 S PSOBBC("DFLG")=0 D GET^PSOPTPST
153 I $G(PSOPTPST(2,PSODFN,.351))]"" S PSOBBC("DFLG")=1 D DEAD^PSOPTPST G PTX
154 N PSOTPEXT I $G(PSOBBC1("FROM"))="NEW",$D(^PS(52.91,PSODFN,0)) I '$P(^PS(52.91,PSODFN,0),"^",3)!($P(^(0),"^",3)>DT) D PDIR^PSOTPCAN(PSODFN) I $G(PSOTPEXT) K PSOTPEXT S PSOBBC("DFLG")=1 G PTX
155 K PSOTPEXT
156 I $G(PSOPTPST(2,PSODFN,.1))]"" D:'PSOBBC("INOK") PID W !,$C(7),?10,"PATIENT IS AN INPATIENT ON WARD ",PSOPTPST(2,PSODFN,.1)," !!" I 'PSOBBC("INOK") S PSOBBC("DFLG")=1 G PTX
157 K PSORX("CNH")
158 I $G(PSOPTPST(2,PSODFN,148))="YES" D:'PSOBBC("CNHOK") PID W !,$C(7),?10,"PATIENT IS IN A CONTRACT NURSING HOME !!" S:PSOBBC("CNHOK") PSORX("CNH")=1 I 'PSOBBC("CNHOK") S PSOBBC("DFLG")=1 G PTX
159 D:PSOBBC1("FROM")="NEW" COPAY^PSOPTPST
160PTX K PSOPTPST W:PSOBBC("DFLG") !!,$C(7),"Rx not filled"
161 Q
162 ;
163REFILL ;
164 N PSOFROM S PSOFROM="REFILL",XFROM="BATCH"
165 D EN^PSOREF0(.PSOBBC)
166 Q
167REFILLX ;
168 Q
169 ;
170NEW ;
171 N PSOFROM S (PSOFROM,XFROM)="BATCH"
172 S PSOBBC("OIRXN")=PSOBBC("IRXN")
173 S PSORNW("FILL DATE")=PSOBBC1("FILL DATE"),PSOOPT=3
174 S PSORX("DFLG")=0,PSOBBC("NOO")=$G(PSOBBCNO) D EN^PSORENW0(.PSOBBC)
175 S PSOBBC("MAIL/WINDOW")=PSOBBC1("MAIL/WINDOW")
176 S PSOBBC("EAOK")=$G(PSOBBC1("EAOK"))
177 S PSOBBC("QS")=PSOBBC1("QS")
178 S PSOBBC("INOK")=PSOBBC1("INOK")
179 S PSOBBC("CNHOK")=PSOBBC1("CNHOK")
180 S:$G(PSOBBC1("CLERK CODE")) PSOBBC("CLERK CODE")=PSOBBC1("CLERK CODE")
181 S:$G(PSOBBC1("EXPIRATION DATE")) PSOBBC("EXPIRATION DATE")=PSOBBC1("EXPIRATION DATE")
182 K PSORNW,PSOOPT
183 Q
184 ;
185EOJ ;
186 K PSOMSG,PSOREFXM,PSONOERR,PSOPLCK,PSOSD,PSOBBC,PSOBBC1,PSOBARID,Y,X,XFROM,PSOCOUU,PSOCOU,ACNT,ADFN,CLS,CMOP,CNT,FDR,HDR,PSCAN,JJ,POERR,PSOBCK,PSONEW3,PSORENW3,RXFL,PSOOPT
187 K PSORX,RFDT,RX1,RXS,SDA,PSONOOR,VALMBCK,VALMSG,SIG,SIGOK,STA,TM,TM1,VA,VADM,VAEL,VAPA
188 D CLEAN^PSOVER1 K ^TMP("PSORXDC",$J)
189 Q
190TRI ;Check for Tricare Rx's
191 S X="IBACUS" X ^%ZOSF("TEST") I '$T Q
192 I '$$TRI^IBACUS Q
193 Q:'$G(PPL)
194 ;PREV LINE, IN V 7 D ZOSF FIRST
195 N DA,NEWPPL,WWFLAG,PSOWRX,PSOWW,WWNEXT,WXRX,WPAT,WSITE,WDUZ,WFILL,WLOOP,WBILL,WPPLFLG,WWW
196 D DEV^PSOCPTRI
197 S NEWPPL=PPL S PPL=""
198 S (WWFLAG,WPPLFLG)=0 F PSOWW=1:1 S PSOWRX=$P(NEWPPL,",",PSOWW) D Q:$G(WWFLAG)
199 .S WWNEXT=$P(NEWPPL,",",(PSOWW+1)) I WWNEXT=""!(WWNEXT=",") S WWFLAG=1
200 .I '$G(DT) S DT=$$DT^XLFDT
201 .S WPAT=$P($G(^PSRX(+PSOWRX,0)),"^",2),WSITE=+$G(PSOSITE),WDUZ=+$G(DUZ)
202 .S WFILL=0 F WLOOP=0:0 S WLOOP=$O(^PSRX(+PSOWRX,1,WLOOP)) Q:'WLOOP S WFILL=WLOOP
203 .S WBILL=$$CHPUS^IBACUS(WPAT,DT,PSOWRX,WFILL,PSOLAP,WSITE,WDUZ)
204 .I '$G(WBILL) S WXRX(PSOWW,PSOWRX)="" Q
205 .S WPPLFLG=1
206 .S FLD(99)="99",FLD(99.1)="Awaiting CHAMPUS billing approval"
207 .N RSDT,ACT,PSUS,RXF,I,PSDA,NOW,IR,FDA,RFN S DA=PSOWRX D H^PSOCPTRH Q
208 I '$G(WPPLFLG) S PPL=NEWPPL Q
209 S WWW="" F S WWW=$O(WXRX(WWW)) Q:WWW="" D
210 .I $G(PPL)="" S PPL=$O(WXRX(WWW,0))_"," Q
211 .S PPL=PPL_$O(WXRX(WWW,0))_","
212 Q
213ULK ;
214 Q:$G(PSOBBC1("FROM"))'="NEW"
215 I '$G(PSODFN) Q
216 S X=PSODFN_";DPT(" D ULK^ORX2 K PSODFNX(PSODFN) Q
217ULP Q:$G(PSOBBC1("FROM"))'="NEW"
218 Q:'$G(PSODFN)
219 D UL^PSSLOCK(PSODFN)
220 Q
221ULRX ;
222 Q:$G(PSOBBC1("FROM"))'="REFILL"
223 Q:'$G(PSOREFXM)
224 D PSOUL^PSSLOCK(PSOREFXM)
225 K PSOREFXM
226 Q
227 ;
228SETX ;
229 S:$G(PSOBBC1("FROM"))="REFILL" XFROM="BATCH"
230 S:$G(PSOBBC1("FROM"))="NEW" XFROM="BATCH"
231 Q
232PID ;
233 I '$G(DFN) S DFN=+$G(PSODFN)
234 Q:'$G(DFN)
235 K VAPTYP D PID^VADPT
236 W !!,?9,$G(PSORX("NAME"))_" ",$G(VA("BID"))
237 K VA("BID"),VA("PID")
238 Q
Note: See TracBrowser for help on using the repository browser.