source: cprs/branches/tmg-cprs/m_files/TMGNDF4F.m@ 1620

Last change on this file since 1620 was 796, checked in by Kevin Toppenberg, 14 years ago

Initial upload

File size: 25.4 KB
Line 
1TMGNDF4F ;TMG/kst/FDA Import -- Explore drugs linked to OQV ;03/25/06
2 ;;1.0;TMG-LIB;**1**;01/10/07
3
4 ;" FDA - NATIONAL DRUG FILES COMPILING FUNCTIONS
5 ;" Exploration of drugs linked to a selected ORDER QUICK VIEW
6 ;"Kevin Toppenberg MD
7 ;"GNU General Public License (GPL) applies
8 ;"1-10-2007
9
10 ;"=======================================================================
11 ;" API -- Public Functions.
12 ;"=======================================================================
13 ;"Menu
14 ;"MenuOI(IEN101d43) -- Menu to explore ORDERABLE ITEM
15 ;"MenuPOI(OIArray) -- Menu to explore PHARMACY ORDERABLE ITEM
16 ;"MenuDrug(IEN50) -- Menu to explore DRUG item.
17 ;"MenuFDA(FDA) -- Menu to explore TMG FDA IMPORT COMPILED
18
19 ;"=======================================================================
20 ;" Private Functions.
21 ;"=======================================================================
22 ;"GetAvail(IEN,Array,sigArray) -- explore the available doses for a given orderable item
23 ;"MenuPickRx(IEN50Array,IEN50) -- allow user to pick which linked DRUG entry to explore
24 ;"Show1Chain(IENOQV) -- show entire chain, as far back as possible
25 ;"ShowAvail(IEN101d43) -- Show available drugs for a given ORDERABLE ITEM (101.43)
26 ;"GetAvail(IEN101d43,Array,sigArray) -- explore the available doses for a given ORDERABLE ITEM (101.43)
27 ;"$$AskOQV(NameOut) -- ask the user for a ORDER QUICK VIEW drug to view.
28 ;"ShowComp(array) -- display all the drugs and sigs for a set of IEN's in 101.43
29 ;"DispOI(IEN101d43) -- display the relevent parts of the 101.43 (ORDERABLE ITEM)
30 ;"DispPOI(IEN50d7) -- display the relevent parts of the 50.7 (PHARMACY ORDERABLE ITEM)
31 ;"DispOQV(IENS) -- display the relevent parts of the 101.44 (ORDER QUICK VIEW)
32 ;"DispRx(IEN50) -- display the relevent parts of the 50 (DRUG)
33 ;"DispFDA(IEN) -- display the relevent parts of TMG FDA IMPORT COMPILED (22706.9)
34 ;"ShowPIa(IEN101d43,RxSet) -- show all links from 101.44 --> 101.43
35 ;"PickOI(IENOQV) -- start from a ORDER QUICK VIEW record, and track backwards
36 ;"DispDoses(IEN101d43) -- Display possible dosed for a ORDER QUICK VIEW record
37
38
39
40 ;"=======================================================================
41Menu
42 ;"Purpose: Menu for exploring 101.44
43
44 new RxSet
45 set RxSet=$$GetOQVSet^TMGNDFUT() if RxSet'>0 goto MenuDone
46
47 new IENS,IEN101d43,IENOQV,OQVName
48 new Menu,UsrSlct,MenuNum
49
50M0 kill Menu
51 set Menu(0)="Pick Option to explore ORDER QUICK VIEW (4F)"
52 if $get(OQVName)'="" set Menu(0)=Menu(0)_": "_OQVName
53 set MenuNum=1
54 if $data(IENOQV)=0 do
55 . set Menu(MenuNum)="Pick ORDER QUICK VIEW"_$char(9)_"PickOQV",MenuNum=MenuNum+1
56 else do
57 . set Menu(MenuNum)="Pick *NEW* ORDER QUICK VIEW"_$char(9)_"PickOQV",MenuNum=MenuNum+1
58 . set Menu(MenuNum)="Show current ORDER QUICK VIEW"_$char(9)_"ShowOQV",MenuNum=MenuNum+1
59 . set Menu(MenuNum)="Show OQV's linked to ORDERABLE ITEM: "_IENOQV("Linked 101.43","Name")_$char(9)_"ShowLinks",MenuNum=MenuNum+1
60 . set Menu(MenuNum)="Explore linked ORDERABLE ITEM"_$char(9)_"ExploreOI",MenuNum=MenuNum+1
61 . set Menu(MenuNum)="Show Dump of Doses for Current."_$char(9)_"DispOQV",MenuNum=MenuNum+1
62 . set Menu(MenuNum)="Show Chain of Linked Files & Entries."_$char(9)_"ShowChain",MenuNum=MenuNum+1
63 . set Menu(MenuNum)="Fix current ORDER QUICK VIEW"_$char(9)_"FixCurOQV",MenuNum=MenuNum+1
64 set Menu(MenuNum)="Fix Missing ORDER QUICK VIEW."_$char(9)_"FixMissing",MenuNum=MenuNum+1
65 set Menu("M")="Show data map"_$char(9)_"Map"
66 set Menu("P")="Prev Stage"_$char(9)_"Prev"
67 ;"set Menu("N")="Next Stage"_$char(9)_"Next"
68
69 write #
70 set UsrSlct=$$Menu^TMGUSRIF(.Menu,"^")
71
72 if UsrSlct="PickOQV" do goto M0
73 . kill OQVIEN
74 . do PickOI(.IENOQV)
75 . if $data(IENOQV)=0 quit
76 . set OQVName=$$GET1^DIQ(101.442,IENOQV("IENS"),2)
77
78 if UsrSlct="ShowOI" do DispOI(IENOQV("Linked 101.43")) goto M0
79 if UsrSlct="ShowOQV" do DispOQV(IENOQV("IENS")) goto M0
80 if UsrSlct="ShowLinks" do ShowPIa(IENOQV("Linked 101.43"),IENOQV(0)) goto M0
81 if UsrSlct="ExploreOI" do MenuOI(IENOQV("Linked 101.43")) goto M0
82 if UsrSlct="DispOQV" do DispDoses(IENOQV("Linked 101.43")) goto M0
83 if UsrSlct="ShowChain" do Show1Chain(.IENOQV) goto M0
84 if UsrSlct="FixMissing" do FixOQVMissing^TMGNDF4G goto M0
85 if UsrSlct="FixCurOQV" do FixCurOQV(.IENOQV) goto M0
86 if UsrSlct="Map" do goto M0
87 . write "ORDER QUICK VIEW (101.44) --> ORDERABLE ITEM (101.43)",!
88 . do PressToCont^TMGUSRIF
89 if UsrSlct="Prev" goto Menu^TMGNDF4E ;"quit can occur from there...
90 ;"if UsrSlct="Next" goto Menu^TMGNDF2H ;"quit can occur from there...
91
92 if UsrSlct="^" goto MenuDone
93 goto M0
94
95MenuDone
96 quit
97
98MenuOI(IEN101d43)
99 ;"Purpose: Menu to explore ORDERABLE ITEM
100
101 new OIArray do GetOIInfo^TMGNDFUT(IEN101d43,.OIArray)
102 new OIName set OIName=$get(OIArray("IEN 101.43","NAME"))
103 if OIName="" goto MBDone
104
105 new IEN50d7 set IEN50d7=$get(OIArray("IEN 50.7 from 101.43"))
106 new POIName set POIName=$get(OIArray("IEN 50.7 from 101.43","NAME"))
107
108 new Menu,UsrSlct
109 set Menu(0)="Pick Option to explore ORDERABLE ITEM: "_OIName
110 set Menu(1)="Show current ORDERABLE ITEM: "_OIName_$char(9)_"ShowOI"
111 set Menu(2)="Explore linked PHARMACY ORDERABLE ITEM: "_POIName_$char(9)_"Explore"
112 set Menu(3)="Show CPRS function of all avail doses"_$char(9)_"ShowAvail"
113 set Menu(5)="Show Dump of Doses for Current."_$char(9)_"DispOI"
114 set Menu("M")="Show data map"_$char(9)_"Map"
115
116MB1 write #
117 set UsrSlct=$$Menu^TMGUSRIF(.Menu,"^")
118
119 if UsrSlct="ShowOI" do DispOI(IEN101d43) goto MB1
120 if UsrSlct="Explore" do MenuPOI(.OIArray) goto MB1
121 if UsrSlct="ShowAvail" do ShowAvail(IEN101d43) goto MPOI1
122 if UsrSlct="DispOI" do DispDoses(IEN101d43) goto MPOI1
123
124 if UsrSlct="Map" do goto MB1
125 . write "OQV (101.44) --> ORDERABLE ITEM (101.43) --> PHARMACY ORDERABLE ITEM (50.7)",!
126 . do PressToCont^TMGUSRIF
127 if UsrSlct="^" goto MBDone
128 goto MB1
129
130MBDone
131 quit
132
133
134MenuPOI(Array)
135 ;"Purpose: Menu to explore PHARMACY ORDERABLE ITEM
136 ;"INPUT: Array -- PASS BY REFERENCE. Format: (as created by GetOIInfo^TMGNDFUT)
137 ;" Array("IEN 50.7 from 101.43")=IEN50d7
138 ;" Array("IEN 50.7 from 101.43","NAME")=Name of 50.7, or "<LINK IS NOT TO A DRUG>" if problem
139
140 new IEN50d7 set IEN50d7=$get(Array("IEN 50.7 from 101.43"))
141 new POIName set POIName=$get(Array("IEN 50.7 from 101.43","NAME"))
142 if POIName="" set POIName=$$GET1^DIQ(50.7,IEN50d7_",",.01)
143
144 new IEN50Array
145 do GetDRUGs^TMGNDFUT(IEN50d7,.IEN50Array)
146 new Menu,UsrSlct
147 set Menu(0)="Pick Option to explore PHARMACY ORDERABLE ITEM: "_POIName
148 set Menu(1)="Show current PHARMACY ORDERABLE ITEM: "_POIName_$char(9)_"ShowPOI"
149 set Menu(2)="Explore a linked DRUG item"_$char(9)_"Explore"
150 set Menu("M")="Show data map"_$char(9)_"Map"
151
152MPOI1 write #
153 set UsrSlct=$$Menu^TMGUSRIF(.Menu,"^")
154
155 if UsrSlct="ShowPOI" do DispPOI(IEN50d7) goto MPOI1
156 if UsrSlct="Explore" do goto MB1
157 . new IEN50
158 . do MenuPickRx(.IEN50Array,.IEN50)
159 . if $data(IEN50)=0 quit
160 . do MenuDrug(.IEN50)
161 if UsrSlct="Map" do goto MB1
162 . write "ORDERABLE ITEM (101.43) --> PHARMACY ORDERABLE ITEM (50.7) --> DRUG (50)",!
163 . do PressToCont^TMGUSRIF
164
165 if UsrSlct="^" goto MPOIDone
166 goto MB1
167
168MPOIDone
169 quit
170
171
172MenuPickRx(IEN50Array,IEN50)
173 ;"Purpose: To allow user to pick which linked DRUG entry to explore
174 ;"Input: IEN50Array -- PASS BY REFERENCE, Format:
175 ;" IEN50Array(IEN50)=Name (.01 field) of record
176 ;" IEN50Array(IEN50)=Name (.01 field) of record
177
178 ;" IEN50 -- PASS BY REFERENCE. An OUT PARAMETER. Format:
179 ;" IEN50=IEN in 50
180 ;" IEN50("NAME")=Name of 50 -- OPTIONAL
181 ;"Results: None
182
183 new Menu,UsrSlct
184 kill IEN50
185 set Menu(0)="Pick DRUG"
186 new count set count=1
187 new name set name=""
188 for set name=$order(IEN50Array(name)) quit:(name="") do
189 . new IEN set IEN=""
190 . for set IEN=$order(IEN50Array(name,IEN)) quit:(IEN="") do
191 . . set Menu(count)=$get(name)_" #"_IEN_$char(9)_IEN
192 . . set count=count+1
193
194MPR1 set UsrSlct=$$Menu^TMGUSRIF(.Menu,"^")
195
196 if +UsrSlct=UsrSlct do goto MPRDone
197 . set IEN50=+UsrSlct
198 . set IEN50("NAME")=$get(IEN50Array(IEN50))
199
200 if UsrSlct="^" goto MPRDone
201 goto MPR1
202
203MPRDone
204 quit
205
206
207MenuDrug(IEN50)
208 ;"Purpose: Menu to explore DRUG item.
209 ;"INPUT: IEN50 -- PASS BY REFERENCE. Format:
210 ;" IEN50=IEN in 50
211 ;" IEN50("NAME")=Name of 50 -- OPTIONAL
212
213 set IEN50("NAME")=$get(IEN50("NAME"))
214 if IEN50("NAME")="" set IEN50("NAME")=$$GET1^DIQ(50,IEN50_",",.01)
215
216 new FDA do GetFDA^TMGNDFUT(IEN50,.FDA)
217
218 new Menu,UsrSlct
219 set Menu(0)="Pick Option to explore DRUG: "_IEN50("NAME")
220 set Menu(1)="Show current DRUG item: "_IEN50("NAME")_$char(9)_"ShowDRUG"
221 set Menu(2)="Edit current DRUG item: "_IEN50("NAME")_$char(9)_"EditDRUG"
222 set Menu(3)="Browse current DRUG item: "_IEN50("NAME")_$char(9)_"Browse"
223 set Menu(4)="Explore linked FDA IMPORT: "_FDA("NAME")_$char(9)_"Explore1"
224 set Menu("M")="Show data map"_$char(9)_"Map"
225 ;"set Menu(2)="Explore linked PHARMACY ORDERABLE ITEM: "_POI("NAME")_$char(9)_"Explore"
226
227MRx1 write #
228 set UsrSlct=$$Menu^TMGUSRIF(.Menu,"^")
229
230 if UsrSlct="ShowDRUG" do DispRx(IEN50) goto MRx1
231 if UsrSlct="EditDRUG" do Edit50^TMGNDFUT(IEN50) goto MRx1
232 if UsrSlct="Explore1" do MenuFDA(.FDA) goto MRx1
233 if UsrSlct="Browse" do Browse^TMGBROWS(50,IEN50,0) goto MRx1
234 if UsrSlct="Map" do goto MRx1
235 . write "POI (50.7) --> DRUG (50) --> VA PRODUCT (50.68)",!
236 . write " --> TMG FDA IMPORT COMPILED (22706.9)",!
237 . write " --> NATIONAL DRUG FILE ENTRY (50.6)",!
238 . write " --> TMG FDA IMPORT COMPILED (22706.9)",!
239 . do PressToCont^TMGUSRIF
240 if UsrSlct="^" goto MRxDone
241 goto MB1
242
243MRxDone
244 quit
245
246
247MenuFDA(FDA)
248 ;"Purpose: Menu to explore TMG FDA IMPORT COMPILED
249 ;"INPUT: FDA -- PASS BY REFERENCE. Format:
250 ;" FDA=IEN in 22706.9
251 ;" FDA("NAME")=Name of 22706.9
252
253 new Menu,UsrSlct
254 set Menu(0)="Pick Option to explore TMG FDA IMPORT COMPILED item."
255 set Menu(1)="Show current FDA IMPORT item: "_FDA("NAME")_$char(9)_"ShowFDA"
256 set Menu(2)="Browse current FDA IMPORT item: "_FDA("NAME")_$char(9)_"Browse"
257 set Menu(3)="Explore a linked DRUG item"_$char(9)_"Explore"
258 set Menu("M")="Show data map"_$char(9)_"Map"
259
260MF1 write #
261 set UsrSlct=$$Menu^TMGUSRIF(.Menu,"^")
262
263 if UsrSlct="ShowFDA" do DispFDA(FDA) goto MF1
264 if UsrSlct="Browse" do Browse^TMGBROWS(22706.9,FDA,0) goto MF1
265 if UsrSlct="Map" do goto MF1
266 . write "DRUG (50) --> TMG FDA IMPORT COMPILED (22706.9)",!
267 . do PressToCont^TMGUSRIF
268
269 if UsrSlct="^" goto MFDone
270 goto MB1
271
272MFDone
273 quit
274
275Show1Chain(IENOQV)
276 ;"Purpose: To show entire chain, as far back as possible
277 ;"Input: IENOQV -- PASS BY REFERENCE
278 ;" IENOQV(0)=RxSet, i.e. the IEN in 101.44 containing ORWDSET O RX
279 ;" IENOQV=IEN IN 101.442
280 ;" IENOQV("IENS")=IENS
281 ;" IENOQV("Name")=Name of ORDER QUICK VIEW
282 ;" IENOQV("Linked 101.43")=IEN of linked 101.43
283 ;" IENOQV("Linked 101.43","Name")=name
284
285 ;"results: none.
286
287 new IEN50Array,IEN101d43,indent,OIArray,POIName
288 set indent=2
289 write "ORDER QUICK VIEW(101.44): ",IENOQV("Name")," #",IENOQV("IENS"),!
290 set IEN101d43=IENOQV("Linked 101.43")
291 write ?indent,"ORDERABLE ITEM(101.43): ",IENOQV("Linked 101.43","Name")," #",IEN101d43,!
292 set indent=indent+5
293 do GetOIInfo^TMGNDFUT(IEN101d43,.OIArray)
294 set IEN50d7=$get(OIArray("IEN 50.7 from 101.43"))
295 set POIName=$get(OIArray("IEN 50.7 from 101.43","NAME"))
296 write ?indent,"PHARMACY ORDERABLE ITEM(50.7): ",POIName," #",IEN50d7,!
297 set indent=indent+5
298 do GetDRUGs^TMGNDFUT(IEN50d7,.IEN50Array)
299 new IEN50,Name50 set IEN50="",Name50=""
300 for set Name50=$order(IEN50Array(Name50)) quit:(Name50="") do
301 . set IEN50=$order(IEN50Array(Name50,""))
302 . write ?indent,"DRUG(50): ",Name50," #",IEN50,!
303 . new TMGIEN set TMGIEN=""
304 . for set TMGIEN=$order(^TMG(22706.9,"DRUG",IEN50,TMGIEN)) quit:(TMGIEN="") do
305 . . new TMGname set TMGname=$$GET1^DIQ(22706.9,TMGIEN_",",.04)
306 . . if TMGname'="" write ?(indent+5),"TMG(22706.9): ",TMGname," #",TMGIEN,!
307 . set TMGIEN=""
308 . for set TMGIEN=$order(^TMG(22706.9,"DRUGT",IEN50,TMGIEN)) quit:(TMGIEN="") do
309 . . new TMGname set TMGname=$$GET1^DIQ(22706.9,TMGIEN_",",.04)
310 . . if TMGname'="" write ?(indent+5),"TMG(212706.9): ",TMGname," #",TMGIEN,!
311
312 do PressToCont^TMGUSRIF
313
314 quit
315
316
317FixCurOQV(IENOQV)
318 ;"Purpose: To Fix the current OQV
319 ;"Input: IENOQV -- PASS BY REFERENCE
320 ;" IENOQV(0)=RxSet, i.e. the IEN in 101.44 containing ORWDSET O RX
321 ;" IENOQV=IEN IN 101.442
322 ;" IENOQV("IENS")=IENS
323 ;" IENOQV("Name")=Name of ORDER QUICK VIEW
324 ;" IENOQV("Linked 101.43")=IEN of linked 101.43
325 ;" IENOQV("Linked 101.43","Name")=name
326
327 ;"results: none.
328
329 new IEN50d7,IEN50Array,IEN101d43,chainA
330 set IEN101d43=IENOQV("Linked 101.43")
331 ;"set IEN50d7=$$GetPOI^TMGNDFUT(IEN101d43) <-- not working for some reason
332 new OIArray
333 do GetOIInfo^TMGNDFUT(IEN101d43,.OIArray)
334 set IEN50d7=$get(OIArray("IEN 50.7 from 101.43"))
335 new POIName set POIName=$get(OIArray("IEN 50.7 from 101.43","NAME"))
336 do GetDRUGs^TMGNDFUT(IEN50d7,.IEN50Array)
337 new IEN50,Name50 set IEN50="",Name50=""
338 for set Name50=$order(IEN50Array(Name50)) quit:(Name50="") do
339 . set IEN50=$order(IEN50Array(Name50,""))
340 . new TMGIEN set TMGIEN=""
341 . for set TMGIEN=$order(^TMG(22706.9,"DRUG",IEN50,TMGIEN)) quit:(TMGIEN="") do
342 . . new TMGname set TMGname=$$GET1^DIQ(22706.9,TMGIEN_",",.04)
343 . . set chainA(TMGname,TMGIEN_"^22706.9")=""
344 . set TMGIEN=""
345 . for set TMGIEN=$order(^TMG(22706.9,"DRUGT",IEN50,TMGIEN)) quit:(TMGIEN="") do
346 . . new TMGname set TMGname=$$GET1^DIQ(22706.9,TMGIEN_",",.04)
347 . . set chainA(TMGname,TMGIEN_"^22706.9")=""
348
349 if $data(chainA) do
350 . do HandleChain^TMGNDF4G(.chainA)
351 else do
352 . write "Sorry, unable to locate sources in file 22706.9",!
353 . do PressToCont^TMGUSRIF
354
355 quit
356
357ShowAvail(IEN101d43)
358 ;"Purpose: to Show available drugs for a given ORDERABLE ITEM (101.43),
359 ;" As determined by RPC code used by CPRS
360 ;"Input: IEN101d43 -- IEN in 101.43
361 ;"results: none.
362
363 new i,DrugIEN
364 new IEN,Y,DIC,drugsArray,sigArray
365
366 kill drugsArray,sigArray
367 do GetAvail(IEN101d43,.drugsArray,.sigArray)
368 if $data(drugsArray)=0 do goto SAvDone
369 . write "No Drugs to show!",!
370 . do PressToCont^TMGUSRIF
371
372 ;"write "Here are entries in DRUG file:",!
373 ;"write "-------------------------------",!
374 ;"new IEN set IEN=""
375 ;"for set IEN=$order(drugsArray(IEN)) quit:(IEN="") do
376 ;". write " #",IEN," in File #50: ",drugsArray(IEN),!
377 ;"do PressToCont^TMGUSRIF
378
379 write "Here are the different sigs:",!
380 write "-------------------------------",!
381 new netDose set netDose=""
382 for set netDose=$order(sigArray(netDose)) quit:(netDose="") do
383 . ;"write "Net Dose: ",netDose,!
384 . new IEN set IEN=""
385 . for set IEN=$order(sigArray(netDose,IEN)) quit:(IEN="") do
386 . . new name set name=""
387 . . for set name=$order(sigArray(netDose,IEN,name)) quit:(name="") do
388 . . . ;"write " #",IEN,": ",name,!
389 . . . new sig set sig=""
390 . . . for set sig=$order(sigArray(netDose,IEN,name,sig)) quit:(sig="") do
391 . . . . new mult set mult=$get(sigArray(netDose,IEN,name,sig))
392 . . . . write " ",sig,?30,"#",IEN,": ",name," --",mult,!
393 do PressToCont^TMGUSRIF
394SAvDone
395 quit
396
397
398GetAvail(IEN101d43,Array,sigArray)
399 ;"Purpose: To explore the available doses for a given ORDERABLE ITEM (101.43)
400 ;"Input: IEN -- the record number for ORDERABLE ITEM (101.43)
401 ;" Array -- pass by REFERENCE, an OUT PARAMETER
402 ;" sigArray -- pass by REFERENCE, an OUT PARAMETER
403 ;"Output: Array format:
404 ;" Array(IEN in 50)=DrugName
405 ;" Array(IEN in 50)=DrugName
406 ;" sigArray format:
407 ;" sigArray(NetDose,IEN in 50,DrugName,sig)=multiplier
408 ;"Result: None
409
410 new temp,IENs,IENs2
411 do OISLCT^ORWDPS2(.temp,IEN101d43,0,1,"Y","Y")
412 new i set i=""
413 for set i=$order(temp(i)) quit:(i="")!($get(temp(i))="~Dispense")
414 if i'="" for set i=$order(temp(i)) quit:(i="")!($extract($get(temp(i)),1)="~") do
415 . new s set s=$piece($get(temp(i)),"^",1)
416 . new IEN set IEN=+$extract(s,2,999)
417 . set Array(IEN)=$piece($get(temp(i)),"^",4)
418
419 set i=""
420 for set i=$order(temp(i)) quit:(i="")!($get(temp(i))="~Dosage")
421 if i'="" for set i=$order(temp(i)) quit:(i="")!($extract($get(temp(i)),1)="~") do
422 . new s set s=$piece($get(temp(i)),"^",4)
423 . new IEN set IEN=+$piece(s,"&",6)
424 . new netDose set netDose=+$piece(s,"&",5)
425 . new drug set drug=$extract($piece($get(temp(i)),"^",1),2,999)
426 . new sig set sig=$piece($get(temp(i)),"^",5)
427 . new mult set mult=$piece(s,"&",3)
428 . set sigArray(netDose,IEN,drug,sig)=mult
429
430 quit
431
432
433AskOQV(NameOut)
434 ;"Purpose: To ask the user for a ORDER QUICK VIEW drug to view.
435 ;" Note: this is actually a query in the subfile #101.442
436 ;"Input: NameOut -- PASS BY REFERENCE, an OUT PARAMETER
437 ;" returns the name of the ORDER QUICK VIEW selected
438 ;"Result: an IENS that can be used to get record, or "" if unsuccessful
439 ;" e.g. set Value=$$GET1^DIQ(101.442,IENS,.01)
440
441 new DIC,X,Y,RxSet,DA
442 new result set result=""
443 set NameOut=""
444
445 set RxSet=$$GetOQVSet^TMGNDFUT() if RxSet'>0 goto AOQVDone
446
447 if $data(^ORD(101.44,RxSet,20,"B"))=0 do
448 . ;"Put code here to reindex "B" index (.01 field of field 20)
449
450 new RxName,TMGDATA,TMGERR
451 read "DRUG NAME (May be partial name): ",RxName:$get(DTIME,3600),!
452
453 do FIND^DIC(101.442,","_RxSet_",","","M",RxName,"*","B","","","TMGDATA","TMGERR")
454 if +$get(TMGDATA("DILIST",0))>0 do
455AOQV1 . new found,j,IEN,IEN101d43,Menu,Num,Link,UsrSlct
456 . set Menu(0)="Pick Drug",Num=1
457 . set j=0 for set j=+$order(TMGDATA("DILIST",2,j)) quit:(j=0) do
458 . . set IEN=$get(TMGDATA("DILIST",2,j))
459 . . set IEN101d43=$get(TMGDATA("DILIST",1,j))
460 . . if $data(found(IEN101d43))>0 quit
461 . . set found(IEN101d43)=1
462 . . set Menu(Num)=$$GET1^DIQ(101.442,IEN_","_RxSet_",",".01")_" --> "_$$GET1^DIQ(101.43,IEN101d43_",",".01")_" #"_IEN101d43
463 . . set Link(Num)=IEN
464 . . set Num=Num+1
465 . if Num>2 do
466 . . set Menu(Num)="Compare Drugs and Sigs above."_$char(9)_"COMPARE"
467 . write #
468 . set UsrSlct=$$Menu^TMGUSRIF(.Menu,"^")
469 . if UsrSlct="COMPARE" do goto AOQV1
470 . . do ShowComp(.found)
471 . set result=$get(Link(UsrSlct),-1)
472 . if result>0 set result=result_","_RxSet_","
473 else do goto:(Y'>-1) AOQVDone
474 . set DA(1)=RxSet
475 . set DIC(0)="MAEQ"
476 . set DIC("A")="Please enter drug name again: ^//"
477 . set DIC="^ORD(101.44,"_DA(1)_",20,"
478 . do ^DIC write !
479 . if Y'>-1 quit
480 . set result=+Y_","_DA(1)_","
481
482AOQVDone
483 if result'="" set NameOut=$$GET1^DIQ(101.442,result,.01)
484 quit result
485
486ShowComp(array)
487 ;"Purpose: to display all the drugs and sigs for a set of IEN's in 101.43
488 ;"Input: array: PASS BY REFERENCE. Format:
489 ;" array(IEN)=""
490 ;" array(IEN)=""
491 ;" array(IEN)=""
492 ;"Output: Will dump out data for all IEN's in list
493
494 new IEN101d43
495 set IEN101d43="" for set IEN101d43=$order(array(IEN101d43)) quit:(IEN101d43="") do
496 . do ShowAvail(IEN101d43)
497 quit
498
499
500DispOI(IEN101d43)
501 ;"Purpose: To display the relevent parts of the 101.43 (ORDERABLE ITEM)
502 ;" to allow debug tracing.
503 ;"Input: IEN101d43 -- the IEN in file 101.43
504 ;"Results: none
505
506 new Fields
507 set Fields(.01)="" ;".01 NAME
508 set Fields(.1)="" ;"1 INACTIVATED
509 set Fields(1)="" ;"1 SYNONYMS
510 set Fields(1.1)="" ;"1.1 PACKAGE NAME
511 set Fields(2)="" ;"2 ID
512
513 write "File: ORDERABLE ITEM (101.43) "
514 do DumpRec2^TMGDEBUG(101.43,IEN101d43,1,.Fields)
515 do PressToCont^TMGUSRIF
516
517 quit
518
519
520DispPOI(IEN50d7)
521 ;"Purpose: To display the relevent parts of the 50.7 (PHARMACY ORDERABLE ITEM)
522 ;" to allow debug tracing.
523 ;"Input: IEN50d7 -- the IEN in file 50d7
524 ;"Results: none
525
526 write "File: PHARMACY ORDERABLE ITEM (50.7) "
527 do DumpRec2^TMGDEBUG(50.7,IEN50d7,1)
528 do PressToCont^TMGUSRIF
529
530 quit
531
532
533DispOQV(IENS)
534 ;"Purpose: To display the relevent parts of the 101.44 (ORDER QUICK VIEW)
535 ;" to allow debug tracing.
536 ;"Input: IENS -- the IENS to display 101.442, e.g. "1000,23"
537 ;"Results: none
538
539 write "File: in ORDER QUICK VIEW (101.442) "
540 do DumpRec2^TMGDEBUG(101.442,IENS,1,)
541 do PressToCont^TMGUSRIF
542
543 quit
544
545DispRx(IEN50)
546 ;"Purpose: To display the relevent parts of the 50 (DRUG)
547 ;" to allow debug tracing.
548 ;"Input: IEN50 -- the IEN to display in 50
549 ;"Results: none
550
551 write "File: in DRUG (50) "
552 do DumpRec2^TMGDEBUG(50,IEN50_",",0)
553 do PressToCont^TMGUSRIF
554
555 quit
556
557
558DispFDA(IEN)
559 ;"Purpose: To display the relevent parts of TMG FDA IMPORT COMPILED (22706.9)
560 ;" to allow debug tracing.
561 ;"Input: IEN -- the IEN to display in 22706.9
562 ;"Results: none
563
564 write "File: in TMG FDA IMPORT COMPILED (22706.9) "
565 do DumpRec2^TMGDEBUG(22706.9,IEN_",",0)
566 do PressToCont^TMGUSRIF
567
568 quit
569
570
571ShowPIa(IEN101d43,RxSet)
572 ;"Purpose: To show all links from 101.44 --> 101.43
573 ;"Input: IEN101d43 -- the IEN from 101d43
574 ;" RxSet -the IEN in 101.44 containing ORWDSET O RX
575 ;"Results: none
576
577 new OQVIndex
578 do Index101d44^TMGNDFUT(RxSet,"OQVIndex")
579
580 new IENOQV set IENOQV=""
581 new someShown set someShown=0
582 new pauseCount set pauseCount=0
583 write "Here are all the entries in ORDER QUICK VIEW that point to",!
584 write "ORDERABLE ITEM: ",$$GET1^DIQ(101.43,IEN101d43_",",.01),!
585 write " <--- (IEN in ORDER QUICK VIEW) NAME",!
586 for set IENOQV=$order(OQVIndex(IEN101d43,IENOQV)) quit:(IENOQV'>0) do
587 . write " <--- (#",IENOQV,") "
588 . write $$GET1^DIQ(101.442,IENOQV_","_RxSet_",",2),!
589 . set someShown=1
590 . set pauseCount=pauseCount+1
591 . if pauseCount<10 quit
592 . do PressToCont^TMGUSRIF
593 . set pauseCount=0
594 if someShown=0 write " (None)",!
595 do PressToCont^TMGUSRIF
596
597 quit
598
599
600PickOI(IENOQV)
601 ;"Purpose: To start from a ORDER QUICK VIEW record, and track backwards
602 ;"Input: IENOQV -- PASS BY REFERENCE. An OUT PARAMETER. Format:
603 ;" IENOQV(0)=RxSet, i.e. the IEN in 101.44 containing ORWDSET O RX
604 ;" IENOQV=IEN IN 101.442
605 ;" IENOQV("IENS")=IENS
606 ;" IENOQV("Name")=Name of ORDER QUICK VIEW
607 ;" IENOQV("Linked 101.43")=IEN of linked 101.43
608 ;" IENOQV("Linked 101.43","Name")=name
609 ;"Result: none.
610
611 new IENS,IEN101d43,OQVName
612 set IENS=$$AskOQV(.OQVName) if IENS="" goto POIDone
613 ;"write "ORDER QUICK VIEW (",IENS,") --> ORDERABLE ITEM ",!
614 set IEN101d43=$$GET1^DIQ(101.442,IENS,.01,"I")
615 set IENOQV=$piece(IENS,",",1)
616 set IENOQV(0)=$piece(IENS,",",2)
617 set IENOQV("IENS")=IENS
618 set IENOQV("Name")=OQVName
619 set IENOQV("Linked 101.43")=IEN101d43
620 set IENOQV("Linked 101.43","Name")=$$GET1^DIQ(101.43,IEN101d43_",",.01)
621
622POIDone
623 quit
624
625DispDoses(IEN101d43)
626 ;"Purpose: To Display possible dosed for a ORDER QUICK VIEW record
627 ;"Input: IEN101d43 -- IEN in 101.43
628 ;"Output: displays possible doses
629 ;"Result: none.
630
631 new array
632 do OISLCT^ORWDPS2(.array,IEN101d43,"O",0,"Y","N")
633 do ArrayDump^TMGDEBUG("array")
634 do PressToCont^TMGUSRIF
635
636 quit
637
638
Note: See TracBrowser for help on using the repository browser.