source: WorldVistAEHR/trunk/r/OUTPATIENT_PHARMACY-PSO-APSP-HUIP/PSOAFPTL.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: 6.4 KB
Line 
1PSOAFPTL ;VFA/HMS autofinish print for laser printer ; 3/6/07 9:25pm
2 ;;7.0;OUTPATIENT PHARMACY;**208**;DEC 1997;Build 39
3 ; Copyright (C) 2007 WorldVistA
4 ;
5 ; This program is free software; you can redistribute it and/or modify
6 ; it under the terms of the GNU General Public License as published by
7 ; the Free Software Foundation; either version 2 of the License, or
8 ; (at your option) any later version.
9 ;
10 ; This program is distributed in the hope that it will be useful,
11 ; but WITHOUT ANY WARRANTY; without even the implied warranty of
12 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 ; GNU General Public License for more details.
14 ;
15 ; You should have received a copy of the GNU General Public License
16 ; along with this program; if not, write to the Free Software
17 ; Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18BEGLP ;
19 U IO ;hms fax stuff
20 ;
21 F DR=1:1 Q:$G(SGY(DR))="" S SN=19+DR D
22 .S AFSIG(SN)=$G(SGY(DR))
23 S SIGL=DR-1
24 ;
25 ;CHECK FOR ES
26 S AFESFLAG=$P($G(^PS(59,PSOSITE,"RXFIN")),"^",3)
27 S AFORD=$P(^PSRX(RX,"OR1"),"^",2)
28 I $G(AFESFLAG)="Y" D
29 .S AFES=$P($G(^OR(100,AFORD,8,1,0)),"^",4)
30 .I $G(AFES)=1 S AFESYN="Y"
31 .I $G(AFESYN)="Y" S AFESIGN=$P($G(^OR(100,AFORD,8,1,0)),"^",5)
32 ;
33 ;CHECK FOR SCHEDULE II WET SIGNATUIRE
34 S AFWET2=$P($G(^PS(59,PSOSITE,"RXFIN")),"^",6)
35 S AFDEA=$P(^PSDRUG($P($G(^PSRX(RX,0)),"^",6),0),"^",3)
36 ;
37 I $G(AFWET2)="Y"&($G(AFDEA)["2") S AFESFLAG="" ;Turns off ES for Sch IIs if wet sig for IIs set in File#59
38 I $G(AFWET2)="Y"&($G(AFDEA)["2") S AFESYN=""
39 ;
40 ;Get Synonym
41 S AFS=0,DONE="N",AFSYN="" F L=1:1 S AFS=$O(^PSDRUG($P($G(^PSRX(RX,0)),"^",6),1,AFS)) Q:AFS=""!(DONE="Y") D
42 .I $P(^PSDRUG($P($G(^PSRX(RX,0)),"^",6),1,AFS,0),"^",3)="0" D
43 ..S AFSYN=$P($G(^PSDRUG($P($G(^PSRX(RX,0)),"^",6),1,AFS,0)),"^",1),DONE="Y"
44 K DONE
45 ;
46FAX ;
47 K AFFAX
48 S FAXNUM=$G(PSOAFFXP) ;PSOAFFXP from PSOLBLN
49 S FAXLCNUM=$G(PSOAFFXL)_"@"_FAXNUM
50 S FAXSER=$P($G(^PS(59,PSOSITE,"RXFIN")),"^",10)
51 I $G(FAXNUM)'=""&(FAXSER'="") D
52 . S AFFAX="Y"
53 I IO["AFFAX"!($G(AFFAX)="Y") D
54 .D NOW^%DTC
55 .S FAXDATE=$P(%,".",1)_"Z"_$P(%,".",2)
56 .S FAXJOB=RX_"Z"_DFN_"Z"_FAXDATE
57 .D OPEN^%ZISH("HFSFAX",FAXSER,FAXJOB_"+"_FAXLCNUM_".TXT","A")
58 .S AFFAX="Y"
59 .U IO
60 ;
61 ;Checks to see if 1st 3 lines should print
62 S PSOAFPFT=$P($G(^PS(59,PSOSITE,"RXFIN")),"^",9)
63 ;
64EN1 S OFF=$P(PS,"^",1)
65 W $S(PSOAFPFT="N":"",1:OFF)
66 ;
67 S OFFAD=$P(PS,"^",7)_","_STATE_" "_$G(PSOHZIP)
68 W !
69 W $S(PSOAFPFT="N":"",1:OFFAD)
70 ;
71 S OFFTEL=$P(PS,"^",3)_"-"_$P(PS,"^",4)
72 W !
73 W $S(PSOAFPFT="N":"",1:OFFTEL)
74 ;
75 S OFFFREE=$P($G(^PS(59,PSOSITE,"RXFIN")),"^",4)
76 W !,OFFFREE
77 ;
78 W !,"---------------------------------------------------------------",!
79 ;
80 W !,"Rx for: "
81 ;
82 D 6^VADPT,PID^VADPT
83 S PSOAFPTI=$S(DUZ("AG")="V":$E($G(VA("PID")),5,12),1:$G(VA("PID")))
84 S AFPNAM=PNM_" "_$G(PSOAFPTI)
85 W AFPNAM
86 ;
87 S AFPADD1=$G(VAPA(1))
88 W !," ",AFPADD1
89 ;
90 S AFPADD2=$G(ADDR(2))
91 W !," ",AFPADD2
92 ;
93 S AFPADD3=$G(ADDR(3))
94 W !," ",AFPADD3
95 ;
96 S AFPADD4=$G(ADDR(4))
97 W !," ",AFPADD4
98 ;
99 W !,"---------------------------------------------------------------",!
100 S AFDRUG=DRUG
101 W !,AFDRUG
102 ;
103 S SYNFLAG=$P($G(^PS(59,PSOSITE,"RXFIN")),"^",5)
104 I SYNFLAG="Y"&(AFSYN'="") D
105 .W !,"Also known as: "
106 .W AFSYN
107 ;
108 I $P($G(^PSRX(RX,"RXFIN")),"^",1)="Y" S VFASDD="Y"
109 I $G(VFASDD)="Y" D
110 .W !,"Pharmacy may choose strength(s) of drug to meet requirements of directions"
111 ;
112 ;
113SIG S SN=19
114 W !
115 F L=1:1:SIGL S SN=SN+1 W !,AFSIG(SN)
116 W !
117 ;
118 W !," Dispense: "
119 S AFDISP=$G(QTY)_" "_$G(PSDU)
120 W AFDISP
121 ;
122 I $G(VFASDD)="Y" W " Pharmacy to adjust qty for # of days"
123 ;
124 W !,"Days Supply: "
125 S VFADAYS=$G(DAYS)
126 W VFADAYS
127 ;
128 W !," Refill(s): "
129 S AFRF=$P(RXY,"^",9)
130 W AFRF
131 ;
132 W !," Issue Date: "
133 W DATE
134 ;
135 ;Print Diagnosis
136 I $P($G(^PS(59,PSOSITE,"RXFIN")),"^",8)="Y" D
137DIAG .W !," Diagnosis:"
138 .S AFICD9="None",AFICD="Not Available"
139 .I $D(^OR(100,AFORD,5.1,0)) D
140 ..S AFORL=0
141 ..F L=1:1 S AFORL=$O(^OR(100,AFORD,5.1,AFORL)) Q:AFORL="B"!(AFORL=0)!(AFORL="") D
142 ...S AFORIN=$P($G(^OR(100,AFORD,5.1,AFORL,0)),"^",1)
143 ...I AFORIN>"" D
144 ....S AFICD9=$P($G(^ICD9(AFORIN,0)),"^",1)
145 ....S AFICD=$P($G(^ICD9(AFORIN,0)),"^",3)
146 ....W ?13,AFICD9,?23,AFICD
147 .I AFICD9="None" W ?13,AFICD9,?23,AFICD
148 ;
149 ;Prints DOB
150 I $P($G(^PS(59,PSOSITE,"RXFIN")),"^",7)="Y" D
151 .S PSOAFDOB=$P($G(VADM(3)),"^",2)
152 .W !," DOB: "_PSOAFDOB,!
153 ;
154 ;Prints Provider Comments
155 ;W "MD Comments:"
156 K ^UTILITY($J,"W") S PSNACNT=1,DIWL=0,DIWR=48,DIWF="",(PSSIXFL,PSSEVFL)=0 F ZZ=0:0 S ZZ=$O(^PSRX(RX,"PRC",ZZ)) Q:'ZZ I $D(^(ZZ,0)) S X=^(0) D ^DIWP
157 ;D ^DIWW
158 I $D(^UTILITY($J,"W")) D
159 .W "MD Comments:"
160 .F ZZ=0:0 S ZZ=$O(^UTILITY($J,"W",DIWL,ZZ)) Q:'ZZ I $D(^(ZZ,0)) W ?13,^(0),!
161 K ^UTILITY($J,"W")
162 ;
163SIGN ;Prints DEA if it exists-if no DEA# prints VA# if it exists
164 I $G(AFESFLAG)="Y" D
165 .I $G(AFESYN)="Y" D
166 ..S AFDEA=$$GET1^DIQ(200,AFESIGN,53.2,"I")
167 ..I AFDEA="" D
168 ...S AFDEA=$$GET1^DIQ(200,AFESIGN,53.3,"I")
169 ..S AFESIGNN=$$GET1^DIQ(200,AFESIGN,.01,"I")
170 ..S AFSIGN=$G(AFESIGNN)_" "_AFDEA
171 ;
172SIGN1 I $G(AFESFLAG)'="Y" D
173 .W !!!,"Signature:_________________________________________________"
174 .;vfah prints DEA if it exists-if no DEA# prints VA# if it exists
175 .S AFDEA=$$GET1^DIQ(200,PSOAFPRV,53.2,"I")
176 .I AFDEA="" D
177 ..S AFDEA=$$GET1^DIQ(200,PSOAFPRV,53.3,"I")
178 .S AFSIGN=" "_$G(PHYS)_" "_AFDEA
179 ;
180SIGNP I $G(AFESYN)="Y" S AFSIGN="Signed: /ES/"_AFSIGN
181 W !,AFSIGN
182 ;
183 K AFESYN,AFESIGN,AFESIGNN
184 ;
185 W !!,"Must write BRAND NECESSARY to dispense brand drug"
186 ;
187 S AFPTIM=$S($D(REPRINT):"Re-Printed on: ",1:"Printed on: ")
188 W !!,AFPTIM
189 ;
190 D NOW^%DTC S Y=% X ^DD("DD")
191 S AFPRNDT=Y_" ("_RX_")"
192 W AFPRNDT
193 ;
194 I IO["AFFAX"!($G(AFFAX)="Y") D
195 .S FAXFROM=$P($G(^PS(59,PSOSITE,"RXFIN")),"^",11)
196 .W !!,"Faxed from: ",FAXFROM," ON ",Y
197 ;
198 I $D(REPRINT)&($G(PSOCKHN)'=",") W @IOF
199 ;
200 K VFASDD
201 ;
202 I IO["AFFAX"!($G(AFFAX)="Y") D CLOSE^%ZISH("HFSFAX") ;HMS CLOSE HFS FILE
203 ;
204 I $G(REPRINT)'=1 D
205 .I IO["AFFAX"!($G(AFFAX)="Y") D
206 ..S PSOLAP=$G(^SC(+ORL,"AFRXCLINPRNT"))
207 ..S PSOLAP=$P(^%ZIS(1,PSOLAP,0),"^",1)
208 ..S IOP=PSOLAP D ^%ZIS
209 ..U IO
210 ;
211ACT ;Set activity log if faxed
212 I IO["AFFAX"!($G(AFFAX)="Y") D
213 .S (X,PCOM,PCOMX)="Faxed to: "_PSOAFFXP_" on "_Y
214 .I '$D(PSOCLC) S PSOCLC=DUZ
215ACT1 .S RXF=0 F J=0:0 S J=$O(^PSRX(RX,1,J)) Q:'J S RXF=J S:J>5 RXF=J+1
216 .S IR=0 F J=0:0 S J=$O(^PSRX(RX,"A",J)) Q:'J S IR=J
217 .S PSOAFPTZ=$S($D(REPRINT):"W",1:"AFFAX")
218 .S IR=IR+1,^PSRX(RX,"A",0)="^52.3DA^"_IR_"^"_IR
219 .D NOW^%DTC S ^PSRX(RX,"A",IR,0)=%_"^"_PSOAFPTZ_"^"_DUZ_"^"_RXF_"^"_PCOM K PC,IR,PS,PCOM,XX,%,%H,%I,RXF
220 ;
221 K PSOAFFXP,PSOAFFXL
222 ;
223 Q
Note: See TracBrowser for help on using the repository browser.