1 | TMGRPC1 ;TMG/kst-RPC Functions ;03/25/06
|
---|
2 | ;;1.0;TMG-LIB;**1**;08/18/09
|
---|
3 |
|
---|
4 | ;"TMG RPC FUNCTIONS
|
---|
5 |
|
---|
6 | ;"Kevin Toppenberg MD
|
---|
7 | ;"GNU General Public License (GPL) applies
|
---|
8 | ;"3/24/07
|
---|
9 |
|
---|
10 | ;"=======================================================================
|
---|
11 | ;" RPC -- Public Functions.
|
---|
12 | ;"=======================================================================
|
---|
13 | ;"DOWNLOAD(GREF,FPATH,FNAME,LOCIEN)
|
---|
14 | ;"UPLOAD(RESULT,FPATH,FNAME,LOCIEN,ARRAY)
|
---|
15 | ;"DOWNDROP(RESULT,FPATH,FNAME,LOCIEN) -- Download drop box file
|
---|
16 | ;"UPLDDROP(RESULT,FPATH,FNAME,LOCIEN) -- Upload Dropbox File
|
---|
17 | ;"GETLONG(GREF,IMAGEIEN)
|
---|
18 | ;"GETDFN(RESULT,RECNUM,RECFIELD,LNAME,FNAME,MNAME,DOB,SEX,SSNUM)
|
---|
19 | ;"BLANKTIU(RESULT,DFN,PERSON,LOC,DOS,TITLE)
|
---|
20 | ;"AUTOSIGN(RESULT,DOCIEN)
|
---|
21 | ;"FNINFO(RESULT,DFN) -- GET PATIENT DEMOGRAPHICS
|
---|
22 | ;"PTADD(RESULT,INFO) -- ADD PATIENT
|
---|
23 | ;"STPTINFO(RESULT,DFN,INFO) -- SET PATIENT DEMOGRAPHICS
|
---|
24 | ;"GETURLS(RESULT) -- TMG CPRS GET URL LIST
|
---|
25 |
|
---|
26 | ;"=======================================================================
|
---|
27 | ;"PRIVATE API FUNCTIONS
|
---|
28 | ;"=======================================================================
|
---|
29 | ;"ENCODE(GRef,incSubscr,encodeFn)
|
---|
30 | ;"DECODE(GRef,incSubscr,decodeFn)
|
---|
31 | ;"$$HEXCODER(INPUT) ;"encode the input string. Currently using simple hex encoding/
|
---|
32 | ;"$$B64CODER(INPUT) ;"encode the input string via UUENCODE (actually Base64)
|
---|
33 | ;"$$B64DECODER(INPUT) ;"encode the input string via UUDECODE (actually Base64)
|
---|
34 |
|
---|
35 | ;"=======================================================================
|
---|
36 | ;"=======================================================================
|
---|
37 | ;"Dependencies:
|
---|
38 | ;"TMGBINF
|
---|
39 | ;"TMGSTUTL
|
---|
40 | ;"RGUTUU
|
---|
41 | ;"=======================================================================
|
---|
42 | ;"=======================================================================
|
---|
43 |
|
---|
44 | DOWNLOAD(GREF,FPATH,FNAME,LOCIEN)
|
---|
45 | ;"SCOPE: Public
|
---|
46 | ;"Purpose: To provide an entry point for a RPC call from a client. The client
|
---|
47 | ;" will ask for a given file, and it will be passed back in the form
|
---|
48 | ;" of an array (in BASE64 ascii encoding)
|
---|
49 | ;"Input: GREF -- OUT PARAM -- the array to pass the result back in (PASSED BY REFERENCE)
|
---|
50 | ;" FPATH -- the file path up to, but not including, the filename
|
---|
51 | ;" Use '/' to NOT specify any subdirectory
|
---|
52 | ;" FNAME -- the name of the file to pass back
|
---|
53 | ;" LOCIEN-- [optional] -- the IEN from file 2005.2 (network location) to download from
|
---|
54 | ;" default value is 1
|
---|
55 | ;" Note: For security reasons, all path requests will be considered relative to a root path.
|
---|
56 | ;" e.g. if user asks for /download/SomeFile.jpg, this function will retrieve:
|
---|
57 | ;" /var/local/Dir1/Dir2/download/SomeFile.jpg
|
---|
58 | ;" This root path is found in custom field 22701 in file 2005.2
|
---|
59 | ;"Output: results are passed out in @GREF
|
---|
60 | ;" @GREF@(0)=success; 1=success, 0=failure
|
---|
61 | ;" @GREF@(1..xxx) = actual data
|
---|
62 |
|
---|
63 | set FPATH=$get(FPATH)
|
---|
64 | set FNAME=$get(FNAME)
|
---|
65 | set LOCIEN=$GET(LOCIEN,1)
|
---|
66 |
|
---|
67 | new PathRoot
|
---|
68 | set PathRoot=$piece($get(^MAG(2005.2,LOCIEN,22700)),"^",1) ;"NOTE: CUSTOM FIELD
|
---|
69 |
|
---|
70 | new NodeDiv
|
---|
71 | set NodeDiv=$piece($get(^MAG(2005.2,LOCIEN,22701),"/"),"^",1) ;"default is "/" NOTE: CUSTOM FIELD
|
---|
72 |
|
---|
73 | new EndRoot set EndRoot=$extract(PathRoot,$length(PathRoot))
|
---|
74 | new StartPath set StartPath=$extract(FPATH,1)
|
---|
75 |
|
---|
76 | if (EndRoot=NodeDiv)&(StartPath=NodeDiv) do
|
---|
77 | . set FPATH=$extract(FPATH,2,1024)
|
---|
78 | else if (EndRoot'=NodeDiv)&(StartPath'=NodeDiv) do
|
---|
79 | . set PathRoot=PathRoot_NodeDiv
|
---|
80 |
|
---|
81 | set FPATH=PathRoot_FPATH
|
---|
82 |
|
---|
83 | set GREF="^TMP(""DOWNLOAD^TMGRPC1"","_$J_")"
|
---|
84 |
|
---|
85 | kill @GREF
|
---|
86 | set @GREF@(0)=$$BFTG^TMGBINF(.FPATH,.FNAME,$name(@GREF@(1)),3)
|
---|
87 |
|
---|
88 | do ENCODE($name(@GREF@(1)),3)
|
---|
89 |
|
---|
90 | quit
|
---|
91 |
|
---|
92 |
|
---|
93 | UPLOAD(RESULT,FPATH,FNAME,LOCIEN,ARRAY)
|
---|
94 | ;"SCOPE: Public
|
---|
95 | ;"RPC That calls this: TMG UPLOAD FILE
|
---|
96 | ;"Purpose: To provide an entry point for a RPC call from a client. The client
|
---|
97 | ;" will provide a file for upload (in BASE64 ascii encoding)
|
---|
98 | ;"Input: GREF -- OUT PARAM -- the array to pass the result back in (PASSED BY REFERENCE)
|
---|
99 | ;" FPATH -- the file path up to, but not including, the filename
|
---|
100 | ;" Use '/' to NOT specify any subdirectory
|
---|
101 | ;" FNAME -- the name of the file to pass back
|
---|
102 | ;" LOCIEN-- [optional] -- the IEN from file 2005.2 (network location) to upload to
|
---|
103 | ;" default value is 1
|
---|
104 | ;" Note: For security reasons, all path requests will be considered relative to a root path.
|
---|
105 | ;" e.g. if user asks for /download/SomeFile.jpg, this function will retrieve:
|
---|
106 | ;" /var/local/Dir1/Dir2/download/SomeFile.jpg
|
---|
107 | ;" This root path is found in custom field 22701 in file 2005.2
|
---|
108 | ;" ARRAY -- the array that will hold the file, in BASE64 ascii encoding
|
---|
109 | ;"Output: results are passed out in RESULT: 1^SuccessMessage or 0^FailureMessage
|
---|
110 |
|
---|
111 | new result
|
---|
112 | new resultMsg set resultMsg="1^Successful Upload"
|
---|
113 |
|
---|
114 | set ^TMP("UPLOAD^TMGRPC1",$J,"FPATH")=$GET(FPATH)
|
---|
115 | set ^TMP("UPLOAD^TMGRPC1",$J,"FNAME")=$GET(FNAME)
|
---|
116 | set ^TMP("UPLOAD^TMGRPC1",$J,"LOCIEN")=$GET(LOCIEN)
|
---|
117 |
|
---|
118 | if $data(ARRAY)=0 set resultMsg="0^No data received to upload" goto UpDone
|
---|
119 | set FPATH=$get(FPATH)
|
---|
120 | if FPATH="" set resultMsg="0^No file path received" goto UpDone
|
---|
121 | set FNAME=$get(FNAME)
|
---|
122 | if FNAME="" set resultMsg="0^No file name received" goto UpDone
|
---|
123 | set LOCIEN=$GET(LOCIEN,1);
|
---|
124 | new GREF
|
---|
125 |
|
---|
126 | new PathRoot
|
---|
127 | set PathRoot=$piece($get(^MAG(2005.2,LOCIEN,22700)),"^",1)
|
---|
128 |
|
---|
129 | new NodeDiv
|
---|
130 | set NodeDiv=$piece($get(^MAG(2005.2,LOCIEN,22701),"/"),"^",1) ;"default is "/"
|
---|
131 |
|
---|
132 | new EndRoot set EndRoot=$extract(PathRoot,$length(PathRoot))
|
---|
133 | new StartPath set StartPath=$extract(FPATH,1)
|
---|
134 | if (EndRoot=NodeDiv)&(StartPath=NodeDiv) do
|
---|
135 | . set FPATH=$extract(FPATH,2,1024)
|
---|
136 | else if (EndRoot'=NodeDiv)&(StartPath'=NodeDiv) do
|
---|
137 | . set PathRoot=PathRoot_NodeDiv
|
---|
138 |
|
---|
139 | set FPATH=PathRoot_FPATH
|
---|
140 |
|
---|
141 | merge ^TMP("UPLOAD^TMGRPC1",$J,"ENCODED")=ARRAY ;"//TEMP
|
---|
142 | do DECODE("ARRAY(0)",1)
|
---|
143 | merge ^TMP("UPLOAD^TMGRPC1",$J,"DECODED")=ARRAY ;"//TEMP
|
---|
144 |
|
---|
145 | if $$GTBF^TMGBINF("ARRAY(0)",1,FPATH,FNAME)=0 do
|
---|
146 | . set resultMsg="0^Error while saving file"
|
---|
147 |
|
---|
148 | UpDone
|
---|
149 | set RESULT=resultMsg
|
---|
150 | quit
|
---|
151 |
|
---|
152 |
|
---|
153 | DOWNDROP(RESULT,FPATH,FNAME,LOCIEN) ;"i.e. Download drop box file
|
---|
154 | ;"SCOPE: Public
|
---|
155 | ;"RPC That calls this: TMG DOWNLOAD FILE DROPBOX
|
---|
156 | ;"Purpose: To provide an entry point for a RPC call from a client. The client
|
---|
157 | ;" will request for the file to be placed into in a 'dropbox' file
|
---|
158 | ;" location that both the client and server can access. File may be
|
---|
159 | ;" moved from there to its final destination by the client.
|
---|
160 | ;" This method alloows file-hiding ability on the server side.
|
---|
161 | ;"Input: RESULT -- OUT PARAM -- the array to pass the result back in (PASSED BY REFERENCE)
|
---|
162 | ;" FPATH -- the file path up to, but not including, the filename. This
|
---|
163 | ;" is the path that the file is stored at (relative to a root path,
|
---|
164 | ;" see comments below). It is NOT the path of the dropbox.
|
---|
165 | ;" Use '/' to NOT specify any subdirectory
|
---|
166 | ;" FNAME -- the name of the file to be uploaded. Note: This is also the
|
---|
167 | ;" name of the file to be put into the dropbox. It is the
|
---|
168 | ;" responsibility of the client to ensure that there is not already
|
---|
169 | ;" a similarly named file in the dropbox before requesting a file
|
---|
170 | ;" be put there. It is the responsibility of the client to delete
|
---|
171 | ;" the file from the drop box.
|
---|
172 | ;" LOCIEN-- [optional] -- the IEN from file 2005.2 (network location) to download from
|
---|
173 | ;" default value is 1
|
---|
174 | ;" Note: For security reasons, all path requests will be considered relative to a root path.
|
---|
175 | ;" e.g. if user asks for /download/SomeFile.jpg, this function will retrieve:
|
---|
176 | ;" /var/local/Dir1/Dir2/download/SomeFile.jpg
|
---|
177 | ;" This root path is found in custom field 22701 in file 2005.2
|
---|
178 | ;" Also: dropbox location is obtained from custom field 22702 in file 2005.2
|
---|
179 | ;"NOTE RE DROPBOX:
|
---|
180 | ;" This system is designed for a system where by the server and the client have a
|
---|
181 | ;" shared filesystem, but the directory paths will be different. For example:
|
---|
182 | ;" Linux server has dropbox at: /mnt/WinServer/dropbox/
|
---|
183 | ;" Windows Client has access to dropbox at: V:\Dropbox\
|
---|
184 |
|
---|
185 | ;"Output: results are 1^Success^FileSize (in bytes), or 0^Error Message
|
---|
186 |
|
---|
187 | new resultMsg set resultMsg="1^Successful Download"
|
---|
188 |
|
---|
189 | set FPATH=$get(FPATH)
|
---|
190 | if FPATH="" set resultMsg="0^No file path received" goto DnDBxDone
|
---|
191 | set FNAME=$get(FNAME)
|
---|
192 | if FNAME="" set resultMsg="0^No file name received" goto DnDBxDone
|
---|
193 | set LOCIEN=$GET(LOCIEN,1);
|
---|
194 | new GREF
|
---|
195 |
|
---|
196 | new PathRoot
|
---|
197 | set PathRoot=$piece($get(^MAG(2005.2,LOCIEN,22700)),"^",1)
|
---|
198 |
|
---|
199 | new NodeDiv
|
---|
200 | set NodeDiv=$piece($get(^MAG(2005.2,LOCIEN,22701),"/"),"^",1) ;"default is "/"
|
---|
201 |
|
---|
202 | new DropBox
|
---|
203 | set DropBox=$piece($get(^MAG(2005.2,LOCIEN,22702)),"^",1)
|
---|
204 | if DropBox="" do goto UpDBxDone
|
---|
205 | . set resultMsg="0^Dropbox location not configured in file 2005.2, IEN "_LOCIEN_", field 22702"
|
---|
206 | ;"Ensure DropBox ends in a node divider
|
---|
207 | if $extract(DropBox,$length(DropBox))'=NodeDiv do
|
---|
208 | . set DropBox=DropBox_NodeDiv
|
---|
209 |
|
---|
210 | ;"Ensure PathRoot ends in a node divider
|
---|
211 | if $extract(PathRoot,$length(PathRoot))'=NodeDiv do
|
---|
212 | . set PathRoot=PathRoot_NodeDiv
|
---|
213 |
|
---|
214 | ;"Ensure Fpath does NOT start in a node divider
|
---|
215 | if $extract(FPATH,1)=NodeDiv do
|
---|
216 | . set FPATH=$extract(FPATH,2,1024)
|
---|
217 |
|
---|
218 | set FPATH=PathRoot_FPATH
|
---|
219 |
|
---|
220 | new SrcNamePath set SrcNamePath=FPATH_FNAME
|
---|
221 | ;"new DestNamePath set DestNamePath=DropBox_FNAME
|
---|
222 |
|
---|
223 | new moveResult
|
---|
224 | set moveResult=$$Copy^TMGKERNL(SrcNamePath,DropBox)
|
---|
225 | if moveResult>0 do
|
---|
226 | . set resultMsg="0^Move failed, returning OS error code: "_moveResult
|
---|
227 | else do
|
---|
228 | . set resultMsg=resultMsg_"^"_$$FileSize^TMGKERNL(SrcNamePath)
|
---|
229 |
|
---|
230 | DnDBxDone
|
---|
231 | set RESULT=resultMsg
|
---|
232 | quit
|
---|
233 |
|
---|
234 |
|
---|
235 | UPLDDROP(RESULT,FPATH,FNAME,LOCIEN) ;"i.e. Upload Dropbox File
|
---|
236 | ;"SCOPE: Public
|
---|
237 | ;"RPC That calls this: TMG UPLOAD FILE DROPBOX
|
---|
238 | ;"Purpose: To provide an entry point for a RPC call from a client. The client
|
---|
239 | ;" will put the file in a 'dropbox' file location that both the client
|
---|
240 | ;" and server can access. File will be moved from there to its final
|
---|
241 | ;" destination. This will provide file-hiding ability on the server side.
|
---|
242 | ;"Input: RESULT -- OUT PARAM -- the array to pass the result back in (PASSED BY REFERENCE)
|
---|
243 | ;" FPATH -- the file path up to, but not including, the filename. This
|
---|
244 | ;" is the path to store the file at. (relative to a root path,
|
---|
245 | ;" see comments below). It is NOT the path of the dropbox.
|
---|
246 | ;" Use '/' to NOT specify any subdirectory
|
---|
247 | ;" FNAME -- the name of the file to be uploaded. Note: This is also the
|
---|
248 | ;" name of the file to be pulled from the dropbox. It is the
|
---|
249 | ;" responsibility of the client to ensure that there is not already
|
---|
250 | ;" a similarly named file in the dropbox before depositing a file there.
|
---|
251 | ;" The server will remove the file from the dropbox, unless there is
|
---|
252 | ;" an error with the host OS (which will be returned as an error message)
|
---|
253 | ;" LOCIEN-- [optional] -- the IEN from file 2005.2 (network location) to upload to
|
---|
254 | ;" default value is 1
|
---|
255 | ;" Note: For security reasons, all path requests will be considered relative to a root path.
|
---|
256 | ;" e.g. if user asks for /download/SomeFile.jpg, this function will retrieve:
|
---|
257 | ;" /var/local/Dir1/Dir2/download/SomeFile.jpg
|
---|
258 | ;" This root path is found in custom field 22700 in file 2005.2
|
---|
259 | ;" Also: dropbox location is obtained from custom field 22702 in file 2005.2
|
---|
260 | ;"NOTE RE DROPBOX:
|
---|
261 | ;" This system is designed for a system where by the server and the client have a
|
---|
262 | ;" shared filesystem, but the directory paths will be different. For example:
|
---|
263 | ;" Linux server has dropbox at: /mnt/WinServer/dropbox/
|
---|
264 | ;" Windows Client has access to dropbox at: V:\Dropbox\
|
---|
265 |
|
---|
266 | ;"Output: results are passed out in RESULT:
|
---|
267 | ;" 1^SuccessMessage or 0^FailureMessage
|
---|
268 |
|
---|
269 | new result
|
---|
270 | new resultMsg set resultMsg="1^Successful Upload"
|
---|
271 |
|
---|
272 | set FPATH=$get(FPATH)
|
---|
273 | if FPATH="" set resultMsg="0^No file path received" goto UpDBxDone
|
---|
274 | set FNAME=$get(FNAME)
|
---|
275 | if FNAME="" set resultMsg="0^No file name received" goto UpDBxDone
|
---|
276 | set LOCIEN=$GET(LOCIEN,1);
|
---|
277 | new GREF
|
---|
278 |
|
---|
279 | new PathRoot
|
---|
280 | set PathRoot=$piece($get(^MAG(2005.2,LOCIEN,22700)),"^",1)
|
---|
281 |
|
---|
282 | new NodeDiv
|
---|
283 | set NodeDiv=$piece($get(^MAG(2005.2,LOCIEN,22701),"/"),"^",1) ;"default is "/"
|
---|
284 |
|
---|
285 | new DropBox
|
---|
286 | set DropBox=$piece($get(^MAG(2005.2,LOCIEN,22702)),"^",1)
|
---|
287 | if DropBox="" do goto UpDBxDone
|
---|
288 | . set resultMsg="0^Dropbox location not configured in file 2005.2, IEN "_LOCIEN_", field 22702"
|
---|
289 | ;"Ensure DropBox ends in a node divider
|
---|
290 | if $extract(DropBox,$length(DropBox))'=NodeDiv do
|
---|
291 | . set DropBox=DropBox_NodeDiv
|
---|
292 |
|
---|
293 | ;"Ensure PathRoot ends in a node divider
|
---|
294 | if $extract(PathRoot,$length(PathRoot))'=NodeDiv do
|
---|
295 | . set PathRoot=PathRoot_NodeDiv
|
---|
296 |
|
---|
297 | ;"Ensure Fpath does NOT start in a node divider
|
---|
298 | if $extract(FPATH,1)=NodeDiv do
|
---|
299 | . set FPATH=$extract(FPATH,2,1024)
|
---|
300 |
|
---|
301 | set FPATH=PathRoot_FPATH
|
---|
302 |
|
---|
303 | new SrcNamePath,DestNamePath
|
---|
304 | set SrcNamePath=DropBox_FNAME
|
---|
305 | set DestNamePath=FPATH_FNAME
|
---|
306 |
|
---|
307 | new moveResult
|
---|
308 | set moveResult=$$Move^TMGKERNL(SrcNamePath,DestNamePath)
|
---|
309 | if moveResult>0 do
|
---|
310 | . set resultMsg="0^Move failed, returning OS error code: "_moveResult
|
---|
311 |
|
---|
312 | UpDBxDone
|
---|
313 | set RESULT=resultMsg
|
---|
314 | quit
|
---|
315 |
|
---|
316 |
|
---|
317 | ENCODE(GRef,incSubscr,encodeFn)
|
---|
318 | ;"Purpose: ENCODE a BINARY GLOBAL.
|
---|
319 | ;"Input:
|
---|
320 | ;" GRef-- Global reference of the SOURCE binary global array, in fully resolved
|
---|
321 | ;" (closed root) format.
|
---|
322 | ;" Note:
|
---|
323 | ;" At least one subscript must be numeric. This will be the incrementing
|
---|
324 | ;" subscript (i.e. the subscript that $$BIN2WP^TMGBINWP will increment
|
---|
325 | ;" to store each new global node). This subscript need not be the final
|
---|
326 | ;" subscript. For example, to load into a WORD PROCESSING field, the
|
---|
327 | ;" incrementing node is the second-to-last subscript; the final subscript
|
---|
328 | ;" is always zero.
|
---|
329 | ;" REQUIRED
|
---|
330 | ;" incSubscr-- (required) Identifies the incrementing subscript level, for the source global
|
---|
331 | ;" For example, if you pass ^TMP(115,1,1,0) as the global_ref parameter and
|
---|
332 | ;" pass 3 as the inc_subscr parameter, $$BIN2GBL will increment the third
|
---|
333 | ;" subscript, such as ^TMP(115,1,x), but will WRITE notes at the full global
|
---|
334 | ;" reference, such as ^TMP(115,1,x,0).
|
---|
335 | ;" REQUIRED
|
---|
336 | ;" encodeFn- (OPTIONAL) the name of a function that will encode a line of data.
|
---|
337 | ;" e.g. "CODER^ZZZCODER" or "LOCALCODER". The function should
|
---|
338 | ;" take one input variable (the line of raw binary data), and return a converted
|
---|
339 | ;" line. e.g.
|
---|
340 | ;" CODER(INPUT)
|
---|
341 | ;" ... ;"convert INPUT to RESULT
|
---|
342 | ;" QUIT RESULT
|
---|
343 | ;" default value is B64CODER^TMGRPC1
|
---|
344 | ;"
|
---|
345 | ;"Output: @GRef is converted to encoded data
|
---|
346 | ;"Result: None
|
---|
347 |
|
---|
348 | if $get(GRef)="" goto EncodeDone
|
---|
349 | if $get(incSubscr)="" goto EncodeDone
|
---|
350 |
|
---|
351 | set encodeFn=$get(encodeFn,"B64CODER")
|
---|
352 |
|
---|
353 | new encoder
|
---|
354 | set encoder="set temp=$$"_encodeFn_"(.temp)"
|
---|
355 |
|
---|
356 | for do quit:(GRef="")
|
---|
357 | . new temp
|
---|
358 | . set temp=$get(@GRef)
|
---|
359 | . if temp="" set GRef="" quit
|
---|
360 | . xecute encoder ;"i.e. set temp=$$encoderFn(.temp)
|
---|
361 | . set @GRef=temp
|
---|
362 | . set GRef=$$NEXTNODE^TMGBINF(GRef,incSubscr,1,1)
|
---|
363 |
|
---|
364 | EncodeDone
|
---|
365 | quit
|
---|
366 |
|
---|
367 |
|
---|
368 | HEXCODER(INPUT)
|
---|
369 | ;"Purpose: to encode the input string. Currently using simple hex encoding/
|
---|
370 | quit $$STRB2H^TMGSTUTL(.INPUT,0,1)
|
---|
371 |
|
---|
372 |
|
---|
373 | B64CODER(INPUT)
|
---|
374 | ;"Purpose: to encode the input string via UUENCODE (actually Base64)
|
---|
375 | quit $$ENCODE^RGUTUU(.INPUT)
|
---|
376 |
|
---|
377 | B64DECODER(INPUT)
|
---|
378 | ;"Purpose: to encode the input string via UUENCODE (actually Base64)
|
---|
379 | quit $$DECODE^RGUTUU(.INPUT)
|
---|
380 |
|
---|
381 |
|
---|
382 | DECODE(GRef,incSubscr,decodeFn)
|
---|
383 | ;"Purpose: ENCODE a BINARY GLOBAL.
|
---|
384 | ;"Input:
|
---|
385 | ;" GRef-- Global reference of the SOURCE binary global array, in fully resolved
|
---|
386 | ;" (closed root) format.
|
---|
387 | ;" Note:
|
---|
388 | ;" At least one subscript must be numeric. This will be the incrementing
|
---|
389 | ;" subscript (i.e. the subscript that $$BIN2WP^TMGBINWP will increment
|
---|
390 | ;" to store each new global node). This subscript need not be the final
|
---|
391 | ;" subscript. For example, to load into a WORD PROCESSING field, the
|
---|
392 | ;" incrementing node is the second-to-last subscript; the final subscript
|
---|
393 | ;" is always zero.
|
---|
394 | ;" REQUIRED
|
---|
395 | ;" incSubscr-- (required) Identifies the incrementing subscript level, for the source global
|
---|
396 | ;" For example, if you pass ^TMP(115,1,1,0) as the global_ref parameter and
|
---|
397 | ;" pass 3 as the inc_subscr parameter, $$BIN2GBL will increment the third
|
---|
398 | ;" subscript, such as ^TMP(115,1,x), but will WRITE notes at the full global
|
---|
399 | ;" reference, such as ^TMP(115,1,x,0).
|
---|
400 | ;" REQUIRED
|
---|
401 | ;" decodeFn- (OPTIONAL) the name of a function that will decode a line of data.
|
---|
402 | ;" e.g. "DECODER^ZZZCODER" or "DECODER". The function should take
|
---|
403 | ;" one input variable (the line of encoded data), and return a decoded line. e.g.
|
---|
404 | ;" DECODER(INPUT)
|
---|
405 | ;" ... ;"convert INPUT to RESULT
|
---|
406 | ;" QUIT RESULT
|
---|
407 | ;" default value is B64DECODER^TMGRPC1
|
---|
408 | ;"
|
---|
409 | ;"Output: @GRef is converted to decoded data
|
---|
410 | ;"Result: None
|
---|
411 |
|
---|
412 | if $get(GRef)="" goto DecodeDone
|
---|
413 | if $get(incSubscr)="" goto DecodeDone
|
---|
414 | set decodeFn=$get(decodeFn,"B64DECODER")
|
---|
415 |
|
---|
416 | new decoder
|
---|
417 | set decoder="set temp=$$"_decodeFn_"(.temp)"
|
---|
418 |
|
---|
419 | for do quit:(GRef="")
|
---|
420 | . new temp
|
---|
421 | . set temp=$get(@GRef)
|
---|
422 | . if temp="" set GRef="" quit
|
---|
423 | . xecute decoder ;"i.e. set temp=$$decoderFn(.temp)
|
---|
424 | . set @GRef=temp
|
---|
425 | . set GRef=$$NEXTNODE^TMGBINF(GRef,incSubscr,1,1)
|
---|
426 |
|
---|
427 | DecodeDone
|
---|
428 | quit
|
---|
429 |
|
---|
430 |
|
---|
431 | GETLONG(GREF,IMAGEIEN)
|
---|
432 | ;"SCOPE: Public
|
---|
433 | ;"Purpose: To provide an entry point for a RPC call from a client.
|
---|
434 | ;" Will return results of field 11 (LONG DESCRIPTION) from file IMAGE(2005)
|
---|
435 | ;"Input: GREF -- OUT PARAM -- the array to pass the result back in (PASSED BY REFERENCE)
|
---|
436 | ;" IMAGEIEN-- The IEN (record number) from file 2005 (IMAGE)
|
---|
437 | ;"Output: results are passed out in @GREF
|
---|
438 | ;" @GREF@(0) = WP header line: format is: ^^MaxLine^MaxLine^TimeStamp(FM Date/Time Format)
|
---|
439 | ;" @GREF@(1) = WP line 1
|
---|
440 | ;" @GREF@(2) = WP line 2
|
---|
441 | ;" @GREF@(3) = WP line 3
|
---|
442 | ;" @GREF@(4) = WP line 4 ... etc.
|
---|
443 |
|
---|
444 | set GREF="^TMP(""GETLONG^TMGRPC1"","_$J_")"
|
---|
445 |
|
---|
446 | kill @GREF
|
---|
447 |
|
---|
448 | new i,s,MaxLines,header
|
---|
449 | set header=""
|
---|
450 | if +$get(IMAGEIEN)>0 do
|
---|
451 | . set header=$get(^MAG(2005,IMAGEIEN,3,0)) ;"NOTE: Field 11 held in node 3;0
|
---|
452 | set @GREF@(0)=header
|
---|
453 | set MaxLines=+$piece(header,"^",3)
|
---|
454 | for i=1:1:MaxLines do
|
---|
455 | . set @GREF@(i)=$get(^MAG(2005,IMAGEIEN,3,i,0))
|
---|
456 |
|
---|
457 | quit
|
---|
458 |
|
---|
459 |
|
---|
460 |
|
---|
461 | GETDFN(RESULT,RECNUM,PMS,FNAME,LNAME,MNAME,DOB,SEX,SSNUM,AUTOADD)
|
---|
462 | ;"Purpose: This is a RPC entry point for looking up a patient.
|
---|
463 | ;"Input:
|
---|
464 | ;" RESULT -- an OUT PARAMETER
|
---|
465 | ;" RECNUM -- Record number from a PMS
|
---|
466 | ;" PMS -- Which PMS RECNUM refers to (1=Medic,2=Sequel,3=Paradigm)
|
---|
467 | ;" FNAME -- First Name
|
---|
468 | ;" LNAME -- Last name
|
---|
469 | ;" MNAME -- Middle Name or initial
|
---|
470 | ;" DOB -- Date of birth in EXTERNAL format
|
---|
471 | ;" SEX -- Patient sex: M or F
|
---|
472 | ;" SSNUM -- Social security number (digits only)
|
---|
473 | ;" AUTOADD -- Automatically register patient if needed (if value=1)
|
---|
474 | ;"Output: Patient may be added to database if AUTOADD=1
|
---|
475 | ;"Results: Returns DFN (i.e. IEN in PATIENT file) or -1 if not found or error
|
---|
476 |
|
---|
477 | new Patient,TMGFREG
|
---|
478 | set RESULT=-1 ;"default to not found
|
---|
479 |
|
---|
480 | if $get(LNAME)'="" do
|
---|
481 | . set Patient("NAME")=$get(LNAME)
|
---|
482 | . if $get(FNAME)'="" set Patient("NAME")=Patient("NAME")_","_FNAME
|
---|
483 | . if $get(MNAME)'="" set Patient("NAME")=Patient("NAME")_" "_MNAME
|
---|
484 | set Patient("DOB")=$get(DOB)
|
---|
485 | set Patient("SEX")=$get(SEX)
|
---|
486 | set Patient("SSNUM")=$get(SSNUM)
|
---|
487 | test if $get(AUTOADD)=1 set TMGFREG=1
|
---|
488 |
|
---|
489 | if $get(PMS)=1 set Patient("PATIENTNUM")=$get(RECNUM) ;" <-- Medic account number
|
---|
490 | if $get(PMS)=2 set Patient("SEQUELNUM")=$get(RECNUM) ;" <-- Sequel or other account number
|
---|
491 | if $get(PMS)=3 set Patient("PARADIGMNUM")=$get(RECNUM) ;" <-- Paradigm or other account number
|
---|
492 |
|
---|
493 | ;"temp
|
---|
494 | ;"merge ^TMG("TMP","GETDFN","KILLLATER")=Patient
|
---|
495 | ;"set ^TMG("TMP","GETDFN","KILLLATER","FNAME")=FNAME
|
---|
496 | ;"set ^TMG("TMP","GETDFN","KILLLATER","LNAME")=LNAME
|
---|
497 | ;"set ^TMG("TMP","GETDFN","KILLLATER","MNAME")=MNAME
|
---|
498 |
|
---|
499 | set RESULT=$$GetDFN^TMGGDFN(.Patient)
|
---|
500 |
|
---|
501 | quit
|
---|
502 |
|
---|
503 |
|
---|
504 | BLANKTIU(RESULT,DFN,PERSON,LOC,DOS,TITLE)
|
---|
505 | ;"Purpose: To create a new, blank TIU note and return it's IEN
|
---|
506 | ;"Input: DFN -- IEN in PATIENT file of patient
|
---|
507 | ;" PERSON -- Provider NAME
|
---|
508 | ;" LOC -- Location for new document
|
---|
509 | ;" DOS -- Date of Service
|
---|
510 | ;" TITLE -- Title of new document
|
---|
511 | ;"Results: IEN in file 8925 is returned in RESULT,
|
---|
512 | ;" or -1^ErrMsg1;ErrMsg2... if failure
|
---|
513 | ;"Note: This functionality probably duplicates that of RPC call:
|
---|
514 | ;" TIU CREATE NOTE -- found after writing this...
|
---|
515 |
|
---|
516 | new Document,Flag
|
---|
517 |
|
---|
518 | set ^TMG("TMP","BLANKTIU","DFN")=$G(DFN)
|
---|
519 | set ^TMG("TMP","BLANKTIU","PERSON")=$G(PERSON)
|
---|
520 | set ^TMG("TMP","BLANKTIU","LOC")=$G(LOC)
|
---|
521 | set ^TMG("TMP","BLANKTIU","DOS")=$G(DOS)
|
---|
522 | set ^TMG("TMP","BLANKTIU","TITLE")=$G(TITLE)
|
---|
523 |
|
---|
524 | set Document("DFN")=DFN
|
---|
525 | set Document("PROVIDER IEN")=$$GetProvIEN^TMGPUTN0(PERSON)
|
---|
526 | if +LOC=LOC s LOC="`"_LOC
|
---|
527 | set Document("LOCATION")=$get(LOC)
|
---|
528 | set Document("DATE")=$get(DOS)
|
---|
529 | set Document("TITLE")=$get(TITLE)
|
---|
530 | set Document("TRANSCRIPTIONIST")=""
|
---|
531 | set Document("CHARACTER COUNT - TRANSCRIPTIONIST'S")=0
|
---|
532 |
|
---|
533 | set RESULT=$$PrepDoc^TMGPUTN0(.Document)
|
---|
534 | if +RESULT>0 do ;"change capture method from Upload (default) to RPC
|
---|
535 | . new TMGFDA,TMGMSG
|
---|
536 | . set TMGFDA(8925,RESULT_",",1303)="R" ;"1303 = capture method. "R" = RPC
|
---|
537 | . merge ^TMG("TMP","BLANKTIU","TMGFDA")=TMGFDA
|
---|
538 | . do FILE^DIE("E","TMGFDA","TMGMSG") ;"ignore any errors.
|
---|
539 | else do
|
---|
540 | . new i,ErrMsg set ErrMsg=""
|
---|
541 | . for i=1:1:+$get(Document("ERROR","NUM")) do
|
---|
542 | . . set ErrMsg=ErrMsg_$get(Document("ERROR",i))_" ||"
|
---|
543 | . if $data(Document("ERROR","FM INFO"))>0 do
|
---|
544 | . . new ref set ref="Document(""ERROR"",""FM INFO"")"
|
---|
545 | . . set ErrMsg=ErrMsg_"FILEMAN SAYS:"
|
---|
546 | . . for set ref=$query(@ref) quit:(ref="")!(ref'["FM INFO") do
|
---|
547 | . . . if ErrMsg'="" set ErrMsg=ErrMsg_" ||"
|
---|
548 | . . . set ErrMsg=ErrMsg_$piece(ref,"DIERR",2)_"="_$get(@ref)
|
---|
549 | . if ErrMsg="" set ErrMsg="Unknown error"
|
---|
550 | . set ErrMsg=$translate(ErrMsg,"^","@")
|
---|
551 | . set $piece(RESULT,"^",2)=ErrMsg
|
---|
552 |
|
---|
553 | ;"temp
|
---|
554 | merge ^TMG("TMP","BLANKTIU","RESULT")=RESULT
|
---|
555 | merge ^TMG("TMP","BLANKTIU","Document")=Document
|
---|
556 |
|
---|
557 |
|
---|
558 | quit
|
---|
559 |
|
---|
560 |
|
---|
561 | AUTOSIGN(RESULT,DOCIEN)
|
---|
562 | ;"Purpose: To automatically sign TIU note (8925).
|
---|
563 | ;"Input: DOCIEN -- the IEN in 8925 of the file to be automatically signed.
|
---|
564 | ;"Note: This function will not succeed unless field 1303 holds "R"
|
---|
565 | ;" and an Author found for note
|
---|
566 | ;"Results: Results passed back in RESULT(0) ARRAY
|
---|
567 | ;" -1 = failure. 1= success
|
---|
568 | ;" Any error message is passed back in RESULT("DIERR")
|
---|
569 | ;"Note: This differs from RPC CALL: TIU SIGN RECORD in that a signiture
|
---|
570 | ;" code is NOT required
|
---|
571 |
|
---|
572 | new TMGFDA,TMGMSG
|
---|
573 | new AuthorIEN,AuthorName
|
---|
574 | new CaptureMethod
|
---|
575 |
|
---|
576 | set DOCIEN=+$get(DOCIEN)
|
---|
577 | set RESULT=-1 ;"default to failure
|
---|
578 |
|
---|
579 | set CaptureMethod=$piece($get(^TIU(8925,DOCIEN,13)),"^",3)
|
---|
580 | if CaptureMethod'="R" do goto ASDone
|
---|
581 | . set RESULT("DIERR")="Unable to auto-sign. Upload-Method was not 'R'."
|
---|
582 | set AuthorIEN=$piece($get(^TIU(8925,DOCIEN,12)),"^",2)
|
---|
583 | if AuthorIEN'>0 do goto ASDone
|
---|
584 | . set RESULT("DIERR")="Unable to find author of document."
|
---|
585 | set AuthorName=$piece($get(^VA(200,AuthorIEN,0)),"^",1)
|
---|
586 |
|
---|
587 | set TMGFDA(8925,DOCIEN_",",.05)="COMPLETED" ;"field .05 = STATUS
|
---|
588 | set TMGFDA(8925,DOCIEN_",",1501)="NOW" ;"field 1501 = Signed date
|
---|
589 | set TMGFDA(8925,DOCIEN_",",1502)="`"_AuthorIEN ;"field 1502 = signed by
|
---|
590 | set TMGFDA(8925,DOCIEN_",",1503)=AuthorName ;"field 1503 = Signature block name
|
---|
591 | set TMGFDA(8925,DOCIEN_",",1504)="[Scanned image auto-signed]" ;"field 1504 = Signature block title
|
---|
592 | set TMGFDA(8925,DOCIEN_",",1505)="C" ;C=Chart ;"field 1505 = Signature mode
|
---|
593 | do FILE^DIE("E","TMGFDA","TMGMSG")
|
---|
594 | if $data(TMGMSG("DIERR")) do goto ASDone
|
---|
595 | . merge RESULT("DIERR")=TMGMSG("DIERR")
|
---|
596 |
|
---|
597 | set RESULT(0)=1 ;"set success if we got this far.
|
---|
598 | ASDone
|
---|
599 | quit
|
---|
600 |
|
---|
601 |
|
---|
602 | DFNINFO(RESULT,DFN)
|
---|
603 | ;"Purpose: To return array with demographcs details about patient
|
---|
604 | ;"Input: RESULT (this is the output array)
|
---|
605 | ;" DFN : The record number in file #2 of the patient to inquire about.
|
---|
606 | ;"Results: Results passed back in RESULT array. Format as follows:
|
---|
607 | ;" The results are in format: KeyName=Value,
|
---|
608 | ;" There is no set order these will appear.
|
---|
609 | ;" Here are the KeyName names that will be provided.
|
---|
610 | ;" If the record has no value, then value will be empty
|
---|
611 | ;" IEN=record#
|
---|
612 | ;" COMBINED_NAME=
|
---|
613 | ;" LNAME=
|
---|
614 | ;" FNAME=
|
---|
615 | ;" MNAME=
|
---|
616 | ;" PREFIX=
|
---|
617 | ;" SUFFIX=
|
---|
618 | ;" DEGREE
|
---|
619 | ;" DOB=
|
---|
620 | ;" SEX=
|
---|
621 | ;" SS_NUM=
|
---|
622 | ;" ADDRESS_LINE_1=
|
---|
623 | ;" ADDRESS_LINE_2=
|
---|
624 | ;" ADDRESS_LINE_3=
|
---|
625 | ;" CITY=
|
---|
626 | ;" STATE=
|
---|
627 | ;" ZIP4=
|
---|
628 | ;" BAD_ADDRESS=
|
---|
629 | ;" TEMP_ADDRESS_LINE_1=
|
---|
630 | ;" TEMP_ADDRESS_LINE_2=
|
---|
631 | ;" TEMP_ADDRESS_LINE_3=
|
---|
632 | ;" TEMP_CITY=
|
---|
633 | ;" TEMP_STATE=
|
---|
634 | ;" TEMP_ZIP4=
|
---|
635 | ;" TEMP_STARTING_DATE=
|
---|
636 | ;" TEMP_ENDING_DATE=
|
---|
637 | ;" TEMP_ADDRESS_ACTIVE=
|
---|
638 | ;" CONF_ADDRESS_LINE_1=
|
---|
639 | ;" CONF_ADDRESS_LINE_2=
|
---|
640 | ;" CONF_ADDRESS_LINE_3=
|
---|
641 | ;" CONF_CITY=
|
---|
642 | ;" CONF_STATE=
|
---|
643 | ;" CONF_ZIP4=
|
---|
644 | ;" CONF_STARTING_DATE=
|
---|
645 | ;" CONF_ENDING_DATE=
|
---|
646 | ;" CONF_ADDRESS_ACTIVE=
|
---|
647 | ;" PHONE_RESIDENCE=
|
---|
648 | ;" PHONE_WORK=
|
---|
649 | ;" PHONE_CELL=
|
---|
650 | ;" PHONE_TEMP=
|
---|
651 |
|
---|
652 | ;"Note, for the following, there may be multiple entries. # is record number
|
---|
653 | ;" ALIAS # NAME
|
---|
654 | ;" ALIAS # SSN
|
---|
655 |
|
---|
656 | new TMGFDA,TMGMSG,IENS
|
---|
657 | set IENS=""
|
---|
658 | new ptrParts set ptrParts=0
|
---|
659 | set DFN=+$get(DFN)
|
---|
660 | if DFN>0 do
|
---|
661 | . set ptrParts=+$piece($get(^DPT(DFN,"NAME")),"^",1) ;"ptr to file #20, NAME COMPONENTS
|
---|
662 | . set IENS=DFN_","
|
---|
663 | . do GETS^DIQ(2,IENS,"**","N","TMGFDA","TMGMSG")
|
---|
664 |
|
---|
665 | new line set line=0
|
---|
666 | set RESULT(line)="IEN="_DFN set line=line+1
|
---|
667 | set RESULT(line)="COMBINED_NAME="_$get(TMGFDA(2,IENS,.01)) set line=line+1
|
---|
668 | new s set s=""
|
---|
669 | if ptrParts>0 set s=$get(^VA(20,ptrParts,1))
|
---|
670 | set RESULT(line)="LNAME="_$piece(s,"^",1) set line=line+1
|
---|
671 | set RESULT(line)="FNAME="_$piece(s,"^",2) set line=line+1
|
---|
672 | set RESULT(line)="MNAME="_$piece(s,"^",3) set line=line+1
|
---|
673 | set RESULT(line)="PREFIX="_$piece(s,"^",4) set line=line+1
|
---|
674 | set RESULT(line)="SUFFIX="_$piece(s,"^",5) set line=line+1
|
---|
675 | set RESULT(line)="DEGREE="_$piece(s,"^",5) set line=line+1
|
---|
676 | set RESULT(line)="DOB="_$get(TMGFDA(2,IENS,.03)) set line=line+1
|
---|
677 | set RESULT(line)="SEX="_$get(TMGFDA(2,IENS,.02)) set line=line+1
|
---|
678 | set RESULT(line)="SS_NUM="_$get(TMGFDA(2,IENS,.09)) set line=line+1
|
---|
679 | set RESULT(line)="EMAIL="_$get(TMGFDA(2,IENS,.133)) set line=line+1
|
---|
680 | set RESULT(line)="ADDRESS_LINE_1="_$get(TMGFDA(2,IENS,.111)) set line=line+1
|
---|
681 | set RESULT(line)="ADDRESS_LINE_2="_$get(TMGFDA(2,IENS,.112)) set line=line+1
|
---|
682 | set RESULT(line)="ADDRESS_LINE_3="_$get(TMGFDA(2,IENS,.113)) set line=line+1
|
---|
683 | set RESULT(line)="CITY="_$get(TMGFDA(2,IENS,.114)) set line=line+1
|
---|
684 | set RESULT(line)="STATE="_$get(TMGFDA(2,IENS,.115)) set line=line+1
|
---|
685 | if $get(TMGFDA(2,IENS,.1122))'="" do
|
---|
686 | . set RESULT(line)="ZIP4="_$get(TMGFDA(2,IENS,.1122)) set line=line+1
|
---|
687 | else if $get(TMGFDA(2,IENS,.1116))'="" do
|
---|
688 | . set RESULT(line)="ZIP4="_$get(TMGFDA(2,IENS,.1116)) set line=line+1
|
---|
689 | set RESULT(line)="BAD_ADDRESS="_$get(TMGFDA(2,IENS,.121)) set line=line+1
|
---|
690 | set RESULT(line)="TEMP_ADDRESS_LINE_1="_$get(TMGFDA(2,IENS,.1211)) set line=line+1
|
---|
691 | set RESULT(line)="TEMP_ADDRESS_LINE_2="_$get(TMGFDA(2,IENS,.1212)) set line=line+1
|
---|
692 | set RESULT(line)="TEMP_ADDRESS_LINE_3="_$get(TMGFDA(2,IENS,.1213)) set line=line+1
|
---|
693 | set RESULT(line)="TEMP_CITY="_$get(TMGFDA(2,IENS,.1214)) set line=line+1
|
---|
694 | set RESULT(line)="TEMP_STATE="_$get(TMGFDA(2,IENS,.1215)) set line=line+1
|
---|
695 | set RESULT(line)="TEMP_ZIP4="_$get(TMGFDA(2,IENS,.1216)) set line=line+1
|
---|
696 | set RESULT(line)="TEMP_STARTING_DATE="_$get(TMGFDA(2,IENS,.1217)) set line=line+1
|
---|
697 | set RESULT(line)="TEMP_ENDING_DATE="_$get(TMGFDA(2,IENS,.1218)) set line=line+1
|
---|
698 | set RESULT(line)="TEMP_ADDRESS_ACTIVE="_$get(TMGFDA(2,IENS,.12105)) set line=line+1
|
---|
699 | set RESULT(line)="CONF_ADDRESS_LINE_1="_$get(TMGFDA(2,IENS,.1411)) set line=line+1
|
---|
700 | set RESULT(line)="CONF_ADDRESS_LINE_1="_$get(TMGFDA(2,IENS,.1412)) set line=line+1
|
---|
701 | set RESULT(line)="CONF_ADDRESS_LINE_1="_$get(TMGFDA(2,IENS,.1413)) set line=line+1
|
---|
702 | set RESULT(line)="CONF_CITY="_$get(TMGFDA(2,IENS,.1414)) set line=line+1
|
---|
703 | set RESULT(line)="CONF_STATE="_$get(TMGFDA(2,IENS,.1415)) set line=line+1
|
---|
704 | set RESULT(line)="CONF_ZIP4="_$get(TMGFDA(2,IENS,.1416)) set line=line+1
|
---|
705 | set RESULT(line)="CONF_STARTING_DATE="_$get(TMGFDA(2,IENS,.1417)) set line=line+1
|
---|
706 | set RESULT(line)="CONF_ENDING_DATE="_$get(TMGFDA(2,IENS,.1418)) set line=line+1
|
---|
707 | set RESULT(line)="CONF_ADDRESS_ACTIVE="_$get(TMGFDA(2,IENS,.14105)) set line=line+1
|
---|
708 | set RESULT(line)="PHONE_RESIDENCE="_$get(TMGFDA(2,IENS,.131)) set line=line+1
|
---|
709 | set RESULT(line)="PHONE_WORK="_$get(TMGFDA(2,IENS,.132)) set line=line+1
|
---|
710 | set RESULT(line)="PHONE_CELL="_$get(TMGFDA(2,IENS,.134)) set line=line+1
|
---|
711 | set RESULT(line)="PHONE_TEMP="_$get(TMGFDA(2,IENS,.1219)) set line=line+1
|
---|
712 |
|
---|
713 | ;"the GETS doesn't return ALIAS entries, so will do manually:
|
---|
714 | new Itr,IEN
|
---|
715 | set IEN=$$ItrInit^TMGITR(2.01,.Itr,DFN_",")
|
---|
716 | if IEN'="" for do quit:(+$$ItrNext^TMGITR(.Itr,.IEN)'>0)
|
---|
717 | . new s set s=$get(^DPT(DFN,.01,IEN,0))
|
---|
718 | . if s="" quit
|
---|
719 | . set RESULT(line)="ALIAS "_IEN_" NAME="_$piece(s,"^",1) set line=line+1
|
---|
720 | . set RESULT(line)="ALIAS "_IEN_" SSN="_$piece(s,"^",2) set line=line+1
|
---|
721 | . ;"maybe later do something with NAME COMPONENTS in Alias.
|
---|
722 |
|
---|
723 | quit
|
---|
724 |
|
---|
725 |
|
---|
726 | STPTINFO(RESULT,DFN,INFO) ;" SET PATIENT INFO
|
---|
727 | ;"Purpose: To set demographcs details about patient
|
---|
728 | ;"Input: RESULT (this is the output array)
|
---|
729 | ;" DFN : The record number in file #2 of the patient to inquire about.
|
---|
730 | ;" INFO: Format as follows:
|
---|
731 | ;" The results are in format: INFO("KeyName")=Value,
|
---|
732 | ;" There is no set order these will appear.
|
---|
733 | ;" Here are the KeyName names that will be provided.
|
---|
734 | ;" If the record has no value, then value will be empty
|
---|
735 | ;" If a record should be deleted, its value will be @
|
---|
736 | ;" INFO("COMBINED_NAME")=
|
---|
737 | ;" INFO("PREFIX")=
|
---|
738 | ;" INFO("SUFFIX")=
|
---|
739 | ;" INFO("DEGREE")=
|
---|
740 | ;" INFO("DOB")=
|
---|
741 | ;" INFO("SEX")=
|
---|
742 | ;" INFO("SS_NUM")=
|
---|
743 | ;" INFO("ADDRESS_LINE_1")=
|
---|
744 | ;" INFO("ADDRESS_LINE_2")=
|
---|
745 | ;" INFO("ADDRESS_LINE_3")=
|
---|
746 | ;" INFO("CITY")=
|
---|
747 | ;" INFO("STATE")=
|
---|
748 | ;" INFO("ZIP4")=
|
---|
749 | ;" INFO("BAD_ADDRESS")=
|
---|
750 | ;" INFO("TEMP_ADDRESS_LINE_1")=
|
---|
751 | ;" INFO("TEMP_ADDRESS_LINE_2")=
|
---|
752 | ;" INFO("TEMP_ADDRESS_LINE_3")=
|
---|
753 | ;" INFO("TEMP_CITY")=
|
---|
754 | ;" INFO("TEMP_STATE")=
|
---|
755 | ;" INFO("TEMP_ZIP4")=
|
---|
756 | ;" INFO("TEMP_STARTING_DATE")=
|
---|
757 | ;" INFO("TEMP_ENDING_DATE")=
|
---|
758 | ;" INFO("TEMP_ADDRESS_ACTIVE")=
|
---|
759 | ;" INFO("CONF_ADDRESS_LINE_1")=
|
---|
760 | ;" INFO("CONF_ADDRESS_LINE_2")=
|
---|
761 | ;" INFO("CONF_ADDRESS_LINE_3")=
|
---|
762 | ;" INFO("CONF_CITY")=
|
---|
763 | ;" INFO("CONF_STATE")=
|
---|
764 | ;" INFO("CONF_ZIP4")=
|
---|
765 | ;" INFO("CONF_STARTING_DATE")=
|
---|
766 | ;" INFO("CONF_ENDING_DATE")=
|
---|
767 | ;" INFO("CONF_ADDRESS_ACTIVE")=
|
---|
768 | ;" INFO("PHONE_RESIDENCE")=
|
---|
769 | ;" INFO("PHONE_WORK")=
|
---|
770 | ;" INFO("PHONE_CELL")=
|
---|
771 | ;" INFO("PHONE_TEMP")=
|
---|
772 | ;"Note, for the following, there may be multiple entries. # is record number
|
---|
773 | ;" If a record should be added, it will be marked +1, +2 etc.
|
---|
774 | ;" INFO("ALIAS # NAME")=
|
---|
775 | ;" INFO("ALIAS # SSN")=
|
---|
776 | ;"
|
---|
777 | ;"Results: Results passed back in RESULT string:
|
---|
778 | ;" 1 = success
|
---|
779 | ;" -1^Message = failure
|
---|
780 |
|
---|
781 | set RESULT=1 ;"default to success
|
---|
782 |
|
---|
783 | ;"kill ^TMG("TMP","RPC")
|
---|
784 | ;"merge ^TMG("TMP","RPC")=INFO ;"temp... remove later
|
---|
785 |
|
---|
786 | new TMGFDA,TMGMSG,IENS
|
---|
787 | set IENS=DFN_","
|
---|
788 | new key set key=""
|
---|
789 | for set key=$order(INFO(key)) quit:(key="") do
|
---|
790 | . if key="COMBINED_NAME" set TMGFDA(2,IENS,.01)=INFO("COMBINED_NAME")
|
---|
791 | . else if +key=key set TMGFDA(2,IENS,key)=INFO(key)
|
---|
792 | . else if key="DOB" set TMGFDA(2,IENS,.03)=INFO("DOB")
|
---|
793 | . else if key="SEX" set TMGFDA(2,IENS,.02)=INFO("SEX")
|
---|
794 | . else if key="SS_NUM" set TMGFDA(2,IENS,.09)=INFO("SS_NUM")
|
---|
795 | . else if key="ADDRESS_LINE_1" set TMGFDA(2,IENS,.111)=INFO("ADDRESS_LINE_1")
|
---|
796 | . else if key="ADDRESS_LINE_2" set TMGFDA(2,IENS,.112)=INFO("ADDRESS_LINE_2")
|
---|
797 | . else if key="ADDRESS_LINE_3" set TMGFDA(2,IENS,.113)=INFO("ADDRESS_LINE_3")
|
---|
798 | . else if key="CITY" set TMGFDA(2,IENS,.114)=INFO("CITY")
|
---|
799 | . else if key="STATE" set TMGFDA(2,IENS,.115)=INFO("STATE")
|
---|
800 | . else if key="ZIP4" set TMGFDA(2,IENS,.1112)=INFO("ZIP4")
|
---|
801 | . else if key="BAD_ADDRESS" set TMGFDA(2,IENS,.121)=INFO("BAD_ADDRESS")
|
---|
802 | . else if key="TEMP_ADDRESS_LINE_1" set TMGFDA(2,IENS,.1211)=INFO("TEMP_ADDRESS_LINE_1")
|
---|
803 | . else if key="TEMP_ADDRESS_LINE_2" set TMGFDA(2,IENS,.1212)=INFO("TEMP_ADDRESS_LINE_2")
|
---|
804 | . else if key="TEMP_ADDRESS_LINE_3" set TMGFDA(2,IENS,.1213)=INFO("TEMP_ADDRESS_LINE_3")
|
---|
805 | . else if key="TEMP_CITY" set TMGFDA(2,IENS,.1214)=INFO("TEMP_CITY")
|
---|
806 | . else if key="TEMP_STATE" set TMGFDA(2,IENS,.1215)=INFO("TEMP_STATE")
|
---|
807 | . else if key="TEMP_ZIP4" set TMGFDA(2,IENS,.12112)=INFO("TEMP_ZIP4")
|
---|
808 | . else if key="TEMP_STARTING_DATE" set TMGFDA(2,IENS,.1217)=INFO("TEMP_STARTING_DATE")
|
---|
809 | . else if key="TEMP_ENDING_DATE" set TMGFDA(2,IENS,.1218)=INFO("TEMP_ENDING_DATE")
|
---|
810 | . else if key="TEMP_ADDRESS_ACTIVE" set TMGFDA(2,IENS,.12105)=INFO("TEMP_ADDRESS_ACTIVE")
|
---|
811 | . else if key="CONF_ADDRESS_LINE_1" set TMGFDA(2,IENS,.1411)=INFO("CONF_ADDRESS_LINE_1")
|
---|
812 | . else if key="CONF_ADDRESS_LINE_2" set TMGFDA(2,IENS,.1412)=INFO("CONF_ADDRESS_LINE_2")
|
---|
813 | . else if key="CONF_ADDRESS_LINE_3" set TMGFDA(2,IENS,.1413)=INFO("CONF_ADDRESS_LINE_3")
|
---|
814 | . else if key="CONF_CITY" set TMGFDA(2,IENS,.1414)=INFO("CONF_CITY")
|
---|
815 | . else if key="CONF_STATE" set TMGFDA(2,IENS,.1415)=INFO("CONF_STATE")
|
---|
816 | . else if key="CONF_ZIP" set TMGFDA(2,IENS,.1416)=INFO("CONF_ZIP")
|
---|
817 | . else if key="CONF_STARTING_DATE" set TMGFDA(2,IENS,.1417)=INFO("CONF_STARTING_DATE")
|
---|
818 | . else if key="CONF_ENDING_DATE" set TMGFDA(2,IENS,.1418)=INFO("CONF_ENDING_DATE")
|
---|
819 | . else if key="CONF_ADDRESS_ACTIVE" set TMGFDA(2,IENS,.14105)=INFO("CONF_ADDRESS_ACTIVE")
|
---|
820 | . else if key="PHONE_RESIDENCE" set TMGFDA(2,IENS,.131)=INFO("PHONE_RESIDENCE")
|
---|
821 | . else if key="PHONE_WORK" set TMGFDA(2,IENS,.132)=INFO("PHONE_WORK")
|
---|
822 | . else if key="PHONE_CELL" set TMGFDA(2,IENS,.134)=INFO("PHONE_CELL")
|
---|
823 | . else if key="PHONE_TEMP" set TMGFDA(2,IENS,.1219)=INFO("PHONE_TEMP")
|
---|
824 | . else if key="EMAIL" set TMGFDA(2,IENS,.133)=INFO("EMAIL")
|
---|
825 |
|
---|
826 | if $data(TMGFDA) do
|
---|
827 | . do FILE^DIE("EKST","TMGFDA","TMGMSG")
|
---|
828 | . if $data(TMGMSG("DIERR")) do
|
---|
829 | . . set RESULT="-1^Filing Error Occured: "_$get(TMGMSG("DIERR",1,"TEXT",1))
|
---|
830 | . . ;"merge ^TMG("TMP","RPC","DIERR")=TMGMSG("DIERR")
|
---|
831 | . . ;"merge ^TMG("TMP","RPC","FDA")=TMGFDA
|
---|
832 |
|
---|
833 | ;"now file Alias info separately
|
---|
834 | if RESULT=1 do
|
---|
835 | . new tempArray,index,key2
|
---|
836 | . new key set key=""
|
---|
837 | . for set key=$order(INFO(key)) quit:(key="") do
|
---|
838 | . . if key["ALIAS" do
|
---|
839 | . . . set index=$piece(key," ",2) quit:(index="")
|
---|
840 | . . . set key2=$piece(key," ",3)
|
---|
841 | . . . set tempArray(index,key2)=INFO(key)
|
---|
842 | . set index=0 for set index=$order(tempArray(index)) quit:(index="")!(RESULT'=1) do
|
---|
843 | . . new TMGFDA,TMGMSG,TMGIEN,newRec
|
---|
844 | . . set newRec=0
|
---|
845 | . . set key="" for set key=$order(tempArray(index,key)) quit:(key="")!(RESULT'=1) do
|
---|
846 | . . . if key="NAME" set TMGFDA(2.01,index_","_DFN_",",.01)=$get(tempArray(index,"NAME"))
|
---|
847 | . . . if key="SSN" set TMGFDA(2.01,index_","_DFN_",",1)=$get(tempArray(index,"SSN"))
|
---|
848 | . . . if index["+" set newRec=1
|
---|
849 | . . if $data(TMGFDA) do
|
---|
850 | . . . if newRec=0 do FILE^DIE("EKST","TMGFDA","TMGMSG")
|
---|
851 | . . . else do UPDATE^DIE("ES","TMGFDA","TMGIEN","TMGMSG")
|
---|
852 | . . if $data(TMGMSG("DIERR")) do
|
---|
853 | . . . set RESULT="-1^Filing Error Occured: "_$get(TMGMSG("DIERR",1,"TEXT",1))
|
---|
854 | . . . ;"merge ^TMG("TMP","RPC","DIERR")=TMGMSG("DIERR")
|
---|
855 | . . . ;"merge ^TMG("TMP","RPC","FDA")=TMGFDA
|
---|
856 |
|
---|
857 | quit
|
---|
858 |
|
---|
859 | PTADD(RESULT,INFO) ;" ADD PATIENT
|
---|
860 | ;"Purpose: To add a patient
|
---|
861 | ;"Input: RESULT (this is the output array)
|
---|
862 | ;"
|
---|
863 | ;" INFO: Format as follows:
|
---|
864 | ;" The results are in format: INFO("KeyName")=Value,
|
---|
865 | ;" There is no set order these will appear.
|
---|
866 | ;" Here are the KeyName names that will be provided.
|
---|
867 | ;" If the record has no value, then value will be empty
|
---|
868 | ;" If a record should be deleted, its value will be @
|
---|
869 | ;" INFO("COMBINED_NAME")=
|
---|
870 | ;" INFO("DOB")=
|
---|
871 | ;" INFO("SEX")=
|
---|
872 | ;" INFO("SS_NUM")=
|
---|
873 | ;" INFO("Veteran")=
|
---|
874 | ;" INFO("PtType")=
|
---|
875 | ;"Results: Results passed back in RESULT string:
|
---|
876 | ;" DFN = success
|
---|
877 | ;" -1^Message = failure
|
---|
878 | ;" 0^DFN = already exists
|
---|
879 |
|
---|
880 | set RESULT=1 ;"default to success
|
---|
881 |
|
---|
882 | kill ^TMG("TMP","RPC")
|
---|
883 | merge ^TMG("TMP","RPC")=INFO ;"temp... remove later
|
---|
884 |
|
---|
885 | new TMGFDA,TMGMSG,IENS,PATIENT,DFN,TMGFREG
|
---|
886 | ;" set IENS=DFN_","
|
---|
887 | new key set key=""
|
---|
888 | for set key=$order(INFO(key)) quit:(key="") do
|
---|
889 | . if key="COMBINED_NAME" set PATIENT("NAME")=INFO("COMBINED_NAME")
|
---|
890 | . else if key="DOB" set PATIENT("DOB")=INFO("DOB")
|
---|
891 | . else if key="SEX" set PATIENT("SEX")=INFO("SEX")
|
---|
892 | . else if key="SS_NUM" set PATIENT("SSNUM")=INFO("SS_NUM")
|
---|
893 | . else if key="Veteran" set PATIENT("VETERAN")=INFO("Veteran")
|
---|
894 | . else if key="PtType" set PATIENT("PT_TYPE")=INFO("PtType")
|
---|
895 | set DFN=$$GetDFN^TMGGDFN(.PATIENT)
|
---|
896 | if DFN=-1 do
|
---|
897 | . new Entry,result,ErrMsg
|
---|
898 | . do Pat2Entry^TMGGDFN(.PATIENT,.Entry)
|
---|
899 | . set DFN=$$AddNewPt^TMGGDFN(.Entry,.ErrMsg)
|
---|
900 | . ;"set DFN=$$GetDFN^TMGGDFN(.PATIENT)
|
---|
901 | . if DFN'>0 do
|
---|
902 | . . set RESULT="-1^ERROR ADDING" ;"should use ErrMsg from above. Fix later
|
---|
903 | . . set RESULT=RESULT_". "_$$GetErrStr^TMGDEBUG(.ErrMsg)
|
---|
904 | . else do
|
---|
905 | .. set RESULT=DFN
|
---|
906 | else do
|
---|
907 | . set RESULT="0^"_DFN
|
---|
908 |
|
---|
909 | quit
|
---|
910 |
|
---|
911 |
|
---|
912 | GETBARCD(GREF,MESSAGE,OPTION)
|
---|
913 | ;"SCOPE: Public
|
---|
914 | ;"RPC that calls this: TMG BARCODE ENCODE
|
---|
915 | ;"Purpose: To provide an entry point for a RPC call from a client.
|
---|
916 | ;" A 2D DataMatrix Bar Code will be create and passed to client.
|
---|
917 | ;" It will not be stored on server
|
---|
918 | ;"Input: GREF -- OUT PARAM -- the array to pass the result back in (PASSED BY REFERENCE)
|
---|
919 | ;" MESSAGE-- The text to use to create the barcode
|
---|
920 | ;" OPTION -- Array that may hold optional settings, as follows:
|
---|
921 | ;" OPTION("IMAGE TYPE")="jpg" <-- if not specified, then default is "png"
|
---|
922 | ;"Output: results are passed out in @GREF
|
---|
923 | ;" @GREF@(0)=success; 1=success, 0=failure
|
---|
924 | ;" @GREF@(1..xxx) = actual data
|
---|
925 |
|
---|
926 | ;"NOTE: dmtxread must be installed on linux host.
|
---|
927 | ;" I found source code here:
|
---|
928 | ;" http://sourceforge.net/projects/libdmtx/
|
---|
929 | ;" After installing (./configure --> make --> make install), I
|
---|
930 | ;" copied dmtxread and dmtxwrite, which were found in the
|
---|
931 | ;" (installdir)/util/dmtxread/.libs and (installdir)/util/dmtxwrite/.libs
|
---|
932 | ;" folders, into a folder on the system path. I chose /usr/bin/
|
---|
933 | ;" Also, to achieve compile of above, I had to install required libs.
|
---|
934 | ;" See notes included with dmtx source code.
|
---|
935 |
|
---|
936 | new FileSpec
|
---|
937 | new file
|
---|
938 | new FName,FPath
|
---|
939 |
|
---|
940 | set GREF="^TMP(""GETBARCD^TMGRPC1"","_$J_")"
|
---|
941 | kill @GREF
|
---|
942 | set @GREF@(0)="" ;"default to failure
|
---|
943 | set MESSAGE=$get(MESSAGE)
|
---|
944 | if MESSAGE="" goto GBCDone
|
---|
945 |
|
---|
946 | ;"Create the barcode and get file name and path
|
---|
947 | set file=$$MAKEBC^TMGBARC(MESSAGE,.OPTION)
|
---|
948 | do SplitFNamePath^TMGIOUTL(file,.FPath,.FName,"/")
|
---|
949 |
|
---|
950 | ;"Load binary image into global array
|
---|
951 | set @GREF@(0)=$$BFTG^TMGBINF(.FPath,.FName,$name(@GREF@(1)),3)
|
---|
952 |
|
---|
953 | ;"convert binary data to ascii encoded data
|
---|
954 | do ENCODE($name(@GREF@(1)),3)
|
---|
955 |
|
---|
956 | ;"delete temp image file
|
---|
957 | do SplitFNamePath^TMGIOUTL(file,.FPath,.FName,"/")
|
---|
958 | set FileSpec(FName)=""
|
---|
959 | new temp set temp=$$DEL^%ZISH(FPath,"FileSpec")
|
---|
960 |
|
---|
961 | GBCDone
|
---|
962 | quit
|
---|
963 |
|
---|
964 |
|
---|
965 | DECODEBC(RESULT,ARRAY,IMGTYPE)
|
---|
966 | ;"SCOPE: Public
|
---|
967 | ;"RPC that calls this: TMG BARCODE DECODE
|
---|
968 | ;"Purpose: To provide an entry point for a RPC call from a client. The client
|
---|
969 | ;" will upload an image file (.png format only) of a barcode (Datamatrix
|
---|
970 | ;" format) for decoding. Decoded message is passed back.
|
---|
971 | ;"Input: RESULT -- an OUT PARAMETER. See output below.
|
---|
972 | ;" ARRAY -- the array that will hold the image file, in BASE64 ascii encoding
|
---|
973 | ;" IMGTYPE -- Image type, e.g. "jpg" (Note: don't include any '.')
|
---|
974 | ;"Output: results are passed out in RESULT: 1^Decoded Message or 0^FailureMessage
|
---|
975 |
|
---|
976 | ;"NOTE: dmtxread must be installed on linux host.
|
---|
977 | ;" I found source code here:
|
---|
978 | ;" http://sourceforge.net/projects/libdmtx/
|
---|
979 | ;" After installing (./configure --> make --> make install), I
|
---|
980 | ;" copied dmtxread and dmtxwrite, which were found in the
|
---|
981 | ;" (installdir)/util/dmtxread/.libs and (installdir)/util/dmtxwrite/.libs
|
---|
982 | ;" folders, into a folder on the system path. I chose /usr/bin/
|
---|
983 | ;" Also, to achieve compile of above, I had to install required libs.
|
---|
984 | ;" See notes included with dmtx source code.
|
---|
985 | ;"NOTE: if image types other than .png will be uploaded, then the linux host
|
---|
986 | ;" must have ImageMagick utility 'convert' installed for conversion
|
---|
987 | ;" between image types.
|
---|
988 |
|
---|
989 | kill ^TMG("TMP","BARCODE")
|
---|
990 | ;"set ^TMG("TMP","BARCODE","LOG")=1 ;"temp
|
---|
991 |
|
---|
992 | ;"new Stack do GetStackInfo^TMGIDE2(.Stack)
|
---|
993 | ;"merge ^TMG("TMP","BARCODE","STACK")=Stack
|
---|
994 |
|
---|
995 | new resultMsg
|
---|
996 | if $data(ARRAY)=0 set resultMsg="0^No image data received to decode" goto DBCDone
|
---|
997 |
|
---|
998 | new imageType set imageType=$$LOW^XLFSTR($get(IMGTYPE))
|
---|
999 | if imageType="" set resultMsg="0^Image type not specified" goto DBCDone
|
---|
1000 |
|
---|
1001 | new imageFName set imageFName="/tmp/barcode."_imageType
|
---|
1002 | set imageFName=$$UNIQUE^%ZISUTL(imageFName)
|
---|
1003 | new FName,FPath,FileSpec
|
---|
1004 | do SplitFNamePath^TMGIOUTL(imageFName,.FPath,.FName,"/")
|
---|
1005 | set FileSpec(FName)=""
|
---|
1006 |
|
---|
1007 | ;"temp...
|
---|
1008 | ;"merge ^TMG("TMP","BARCODE","DATA")=ARRAY
|
---|
1009 | ;"merge ^TMG("TMP","BARCODE","IMGTYPE")=IMGTYPE
|
---|
1010 |
|
---|
1011 | ;"set ^TMG("TMP","BARCODE","LOG")=2 ;"temp
|
---|
1012 | ;"Remove BASE64 ascii encoding
|
---|
1013 | do DECODE("ARRAY(0)",1)
|
---|
1014 |
|
---|
1015 | ;"set ^TMG("TMP","BARCODE","LOG")=3 ;"temp
|
---|
1016 | ;"set ^TMG("TMP","BARCODE","LOG","Orig file: "_FPath_FName)=""
|
---|
1017 |
|
---|
1018 | ;"Save to host file system
|
---|
1019 | if $$GTBF^TMGBINF("ARRAY(0)",1,FPath,FName)=0 do goto DBCDone
|
---|
1020 | . set resultMsg="0^Error while saving file to HFS"
|
---|
1021 |
|
---|
1022 | ;"set ^TMG("TMP","BARCODE","LOG")=4 ;"temp
|
---|
1023 |
|
---|
1024 | ;"convert image file to .png format, if needed
|
---|
1025 | if imageType'="png" do
|
---|
1026 | . set imageFName=$$Convert^TMGKERNL(imageFName,"png")
|
---|
1027 | . if imageFName="" do quit
|
---|
1028 | . . set resultMsg="0^Error while converting image from ."_imageType_" to .png format."
|
---|
1029 | . do SplitFNamePath^TMGIOUTL(imageFName,.FPath,.FName,"/")
|
---|
1030 | . set FileSpec(FName)=""
|
---|
1031 | if imageFName="" goto DBCDone
|
---|
1032 |
|
---|
1033 | ;"set ^TMG("TMP","BARCODE","LOG")=5 ;"temp
|
---|
1034 |
|
---|
1035 | ;"Decode the barcode.png image
|
---|
1036 | new result set result=$$READBC^TMGBARC(imageFName)
|
---|
1037 | if result'="" set resultMsg="1^"_result
|
---|
1038 | else set resultMsg="0^Unable to Decode Image"
|
---|
1039 |
|
---|
1040 | ;"delete temp image file
|
---|
1041 | ;"temp REMOVE COMMENTS LATER TO DELETE FILE. !!!!!
|
---|
1042 | ;"set result=$$DEL^%ZISH(FPath,"FileSpec")
|
---|
1043 |
|
---|
1044 | DBCDone
|
---|
1045 | ;"set ^TMG("TMP","BARCODE","LOG")=6 ;"temp
|
---|
1046 |
|
---|
1047 | set RESULT=resultMsg
|
---|
1048 | quit
|
---|
1049 |
|
---|
1050 | ;"--------------------
|
---|
1051 | GETURLS(RESULT)
|
---|
1052 | ;"SCOPE: Public
|
---|
1053 | ;"RPC that calls this: TMG CPRS GET URL LIST
|
---|
1054 | ;"Purpose: To provide an entry point for a RPC call from a client. The client
|
---|
1055 | ;" will request URLs to display in custom tabs inside CPRS, in an
|
---|
1056 | ;" imbedded web browser
|
---|
1057 | ;"Input: RESULT -- an OUT PARAMETER. See output below.
|
---|
1058 | ;"Output: results are passed out in RESULT:
|
---|
1059 | ;" RESULT(0)="1^Success" or "0^SomeFailureMessage"
|
---|
1060 | ;" RESULT(1)="Name1^URL#1" ; shows URL#1 in tab #1, named 'Name1'
|
---|
1061 | ;" RESULT(2)="Name2^URL#2" ; etc.
|
---|
1062 | ;" RESULT(3)="Name3^URL#3"
|
---|
1063 | ;"
|
---|
1064 | ;" E.g. RESULT(1)="cnn^www.cnn.com"
|
---|
1065 | ;" RESULT(2)="INFO^192.168.0.1/home.html"
|
---|
1066 | ;"
|
---|
1067 | ;" The number of allowed tabs is determined by code in CPRS
|
---|
1068 | ;" Reference to tab numbers > specified in CPRS will be ignored by CPRS
|
---|
1069 | ;" If a web tab is NOT specified, then the page previously
|
---|
1070 | ;" displayed will be left in place. It will not be cleared.
|
---|
1071 | ;" To clear a given page, a url of "about:blank" will cause a
|
---|
1072 | ;" blank page to be displayed. e.g.
|
---|
1073 | ;" RESULT(3)="^about:blank"
|
---|
1074 | ;" To HIDE a tab on CPRS use this:
|
---|
1075 | ;" RESULT(3)="^<!HIDE!>" ;triggers tab #3 to be hidden
|
---|
1076 | ;" To have the browser remain UNCHANGED use this:
|
---|
1077 | ;" RESULT(3)="^<!NOCHANGE!>" ;triggers tab #3 to remain unchanged.
|
---|
1078 | ;" Note: the rationale for this is that the web tab may have info
|
---|
1079 | ;" that should not be refreshed when the patient info is refreshed
|
---|
1080 | ;" i.e. the user may have navigated somewhere, and doesn't want
|
---|
1081 | ;" to loose their location.
|
---|
1082 | ;" --to be implemented.
|
---|
1083 | ;" Note: The other way to do this, as above, is to simply have NO
|
---|
1084 | ;" entry for a given tab. I.e. don't have any value for RESULT(3)
|
---|
1085 | ;" --already implemented.
|
---|
1086 | ;"Notice to others: Below is where code should be added to return
|
---|
1087 | ;" proper URL's to CPRS. This will be called whenever a new patient
|
---|
1088 | ;" is opened, or a Refresh Information is requested.
|
---|
1089 | ;" FYI, 'DFN' should be defined as a globally-scoped variable that can be used
|
---|
1090 | ;" to pass back URLS specific for a given patient.
|
---|
1091 |
|
---|
1092 | set RESULT(0)="1^Success"
|
---|
1093 | ;"set RESULT(1)="Yahoo^www.yahoo.com"
|
---|
1094 | ;"set RESULT(2)="(x)^about:blank"
|
---|
1095 | ;"set RESULT(3)="^<!HIDE!>"
|
---|
1096 |
|
---|
1097 | ;"kill RESULT
|
---|
1098 | ;"merge RESULT=^TMG("TMP","URLS") ;"TEMP!!!
|
---|
1099 |
|
---|
1100 | quit
|
---|
1101 |
|
---|
1102 | ;
|
---|