source: WorldVistAEHR/trunk/r/IMAGING-MAG-ZMAG/MAGGTU6.m@ 1800

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

revised back to 6/30/08 version

File size: 7.5 KB
Line 
1MAGGTU6 ;WOIFO/GEK - Silent Utilities ; 25 Jan 2006 12:14 PM
2 ;;3.0;IMAGING;**24,8,48,45,20,46**;16-February-2007;;Build 1023
3 ;; Per VHA Directive 2004-038, this routine should not be modified.
4 ;; +---------------------------------------------------------------+
5 ;; | Property of the US Government. |
6 ;; | No permission to copy or redistribute this software is given. |
7 ;; | Use of unreleased versions of this software requires the user |
8 ;; | to execute a written test agreement with the VistA Imaging |
9 ;; | Development Office of the Department of Veterans Affairs, |
10 ;; | telephone (301) 734-0100. |
11 ;; | The Food and Drug Administration classifies this software as |
12 ;; | a medical device. As such, it may not be changed in any way. |
13 ;; | Modifications to this software may result in an adulterated |
14 ;; | medical device under 21CFR820, the use of which is considered |
15 ;; | to be a violation of US Federal Statutes. |
16 ;; +---------------------------------------------------------------+
17 ;;
18 Q
19 ;
20LOGACT(MAGRY,ZY) ;RPC [MAGGACTION LOG]
21 ; Call to LogAction from Delphi Window
22 ;
23 ; ZY is input variable it is '^' delimited string
24 ; 'A|B|C|D|E' ^^ MAGIEN ^ 'Copy/Download' ^ DFN ^ '1';
25 ; DUZ is inserted as 2nd piece below.
26 ; I.E. zy = "C^^103660^Copy To Clipboard^1033^1"
27 N Y
28 S MAGRY="0^Logging access..."
29 ;
30 N $ETRAP,$ESTACK S $ETRAP="D ERR^MAGGTERR"
31 ; C DUZ MAGIEN ACTION DFN 1
32 D ENTRY^MAGLOG($P(ZY,U),+$G(DUZ),$P(ZY,U,3),$P(ZY,U,4),$P(ZY,U,5),$P(ZY,U,6))
33 S MAGRY="1^Action was Logged."
34 Q
35LINKDT(MAGRY,MAGDA,DTTM) ; This is called when an Image is successfully
36 ; linked (Associated) with a Report/Procedure/Note etc.
37 ; MAGDA = Image IEN
38 ; DTTM = "" No date sent, so use NOW
39 ; DTTM = 1 No Date Sent, but use Image capture Date.
40 ; DTTM = Valid FM Date/Time , Use it.
41 N MSG
42 S DTTM=$G(DTTM)
43 I 'DTTM S DTTM=$$NOW^XLFDT ; Using NOW
44 I '$D(^MAG(2005,MAGDA)) Q
45 I DTTM=1 S DTTM=$P(^MAG(2005,MAGDA,2),"^",1) ; Using Date Image Captured.
46 I '$$VALID^MAGGSIV1(2005,64,.DTTM,.MSG) S MAGRY="0^"_MSG Q
47 S $P(^MAG(2005,MAGDA,2),"^",11)=DTTM
48 S MAGRY="1^Okay"
49 Q
50TIMEOUT(MAGRY,APP) ;RPC [MAGG GET TIMEOUT]
51 ; Call Returns the timeout for the APP from IMAGING SITE PARAMETERS File
52 ; APP is either 'DISPLAY' 'CAPTURE' or 'VISTARAD'
53 N I,MAGTIMES,MAGPLC
54 S MAGRY=""
55 S MAGPLC=$$PLACE^MAGBAPI(DUZ(2)) I 'MAGPLC Q ; DBI - SEB 9/20/2002
56 S MAGTIMES=$G(^MAG(2006.1,MAGPLC,"KEYS"))
57 I APP="DISPLAY" S MAGRY=$P(MAGTIMES,U,2)
58 I APP="CAPTURE" S MAGRY=$P(MAGTIMES,U,3)
59 I APP="VISTARAD" S MAGRY=$P(MAGTIMES,U,4)
60 I APP="TELEREADER" S MAGRY=$P(MAGTIMES,U,6) ; MJK - 2006.01.25 - TeleReader
61 Q
62EXIST(EKGPLACE) ;Does an ekg server exist in 2005.2
63 I $$CONSOLID^MAGBAPI()=0 Q $O(^MAG(2005.2,"E","EKG","")) ; DBI - SEB 9/20/2002
64 Q $O(^MAG(2005.2,"F",EKGPLACE,"EKG",""))
65 ;
66ONLINE(MAGR) ;RPC [MAG EKG ONLINE] EKG network location status
67 ;returns the status of the first EKG network location type
68 ;O if offline or a network location doesn't exist
69 ;1 if online
70 ;
71 N EKG1,EKGPLACE
72 S EKGPLACE=$$PLACE^MAGBAPI(DUZ(2)) ; DBI - SEB 9/20/2002
73 I EKGPLACE=0 S EKGPLACE=$$PLACE^MAGBAPI(DUZ(2)) ;Convert to extrinsic /gek 8/2003
74 I $$EXIST(EKGPLACE) D
75 . I $$CONSOLID^MAGBAPI() S EKG1=$O(^MAG(2005.2,"F",EKGPLACE,"EKG","")) ; DBI - SEB 9/20/2002
76 . E S EKG1=$O(^MAG(2005.2,"E","EKG",""))
77 . S MAGR=$P(^MAG(2005.2,EKG1,0),U,6)
78 E S MAGR=0
79 Q
80SHARE(MAGRY,TYPE) ;RPC [MAG GET NETLOC]
81 ; Get list of image shares
82 ;TYPE = One of the STORAGE TYPE codes : MAG, EKG, WORM, URL or ALL
83 N TMP,I,DATA0,DATA2,DATA3,DATA6,INFO,VALUE,STYP,PHYREF
84 N $ETRAP,$ESTACK S $ETRAP="D ERRA^MAGGTERR"
85 S I=0
86 I TYPE="" S TYPE="ALL"
87 S MAGRY(0)="1^SUCCESS"
88 F S I=$O(^MAG(2005.2,I)) Q:'I D
89 . Q:$$LOCDRIVE(I)
90 . S DATA0=$G(^MAG(2005.2,I,0))
91 . S DATA2=$G(^MAG(2005.2,I,2))
92 . S DATA3=$G(^MAG(2005.2,I,3))
93 . S DATA6=$G(^MAG(2005.2,I,6))
94 . ;
95 . S PHYREF=$P(DATA0,"^",2) ; PHYSICAL REFERENCE
96 . S STYP=$P(DATA0,"^",7) ; STORAGE TYPE
97 . ;
98 . I TYPE'="ALL" Q:STYP'[TYPE
99 . Q:$P(DATA0,"^",6)=0 ;SHARE IS OFFLINE (don't return offline shares)
100 . I STYP'="URL" Q:(PHYREF[".") ; pre 45, quit if '.' in phyref
101 . I STYP'="URL" Q:($E(PHYREF,1,2)'="\\") ; pre 45 quit if doesn't start with '\\'
102 . ;
103 . S INFO=$S($E(PHYREF,$L(PHYREF))="\":$E(PHYREF,1,$L(PHYREF)-1),1:PHYREF)
104 . S $P(INFO,"^",2)=$P($G(DATA0),"^",7) ;Physical reference (path)
105 . S $P(INFO,"^",3)=$P($G(DATA0),"^",6) ;Operational Status 0=OFFLINE 1=ONLINE
106 . S $P(INFO,"^",4)=$P($G(DATA2),"^",1) ;Username
107 . S $P(INFO,"^",5)=$P($G(DATA2),"^",2) ;Password
108 . S $P(INFO,"^",6)=$P($G(DATA6),"^",1) ;MUSE Site #
109 . I $P($G(DATA6),"^",2)'="" S $P(INFO,"^",7)=^MAG(2006.17,$P(DATA6,"^",2),0) ;MUSE version #
110 . S $P(INFO,"^",8)=$P($G(DATA3),"^",5) ;Network location SITE
111 . Q:$D(TMP(INFO))
112 . S TMP(INFO)=I
113 S INFO=""
114 F S INFO=$O(TMP(INFO)) Q:INFO="" D
115 . S MAGRY($O(MAGRY(""),-1)+1)=TMP(INFO)_"^"_INFO
116 K TMP
117 Q
118LOCDRIVE(I) ; Returns 1 if this is a local drive, else 0
119 ; Local Drive is determined by the DIR not being Type : URL and having a ":"
120 I $P(^MAG(2005.2,I,0),"^",7)'="URL" I $P(^MAG(2005.2,I,0),"^",2)[":" Q 1
121 Q 0
122GETENV(MAGRY) ;RPC [MAG GET ENV]
123 ; Get some environment variables (used by annotation control)
124 S MAGRY=DUZ(2)_"^"_$$NOW^XLFDT
125 Q
126ANNCB(STATARR) ;Status Callback (called by the import API)
127 ;
128 N I,CDUZ,QINDEX,A,COUNT
129 N XMDUZ,XMSUB,XMTEXT,XMY
130 ; 0 = error, all others are success.
131 I $P(STATARR(0),"^",1)'=0 D
132 . ; Import was successful
133 E D
134 . ; Import failed - send mail to MAG SERVER group and person who queued the import
135 . S XMDUZ=DUZ
136 . S XMSUB="Import Error Report"
137 . ; get text of message from status array
138 . S XMTEXT="A("
139 . ; XMD needs array to start with 1, not 0
140 . S COUNT=1,I=""
141 . F S I=$O(STATARR(I)) Q:I="" D
142 . . S A(COUNT)=I_") "_STATARR(I)
143 . . S COUNT=COUNT+1
144 . . Q
145 . S A(COUNT+1)=" "
146 . S A(COUNT+2)=" "
147 . S A(COUNT+3)=" The errors listed above were generated by"
148 . S A(COUNT+4)=" the VistA Imaging Annotation Editor while"
149 . S A(COUNT+5)=" trying to import your diagram. Please"
150 . S A(COUNT+6)=" report these errors to your VistA Imaging"
151 . S A(COUNT+7)=" support personnel."
152 . ;Get person who did the import
153 . S QINDEX=STATARR(2)
154 . S I=-1 F S I=$O(^MAG(2006.034,QINDEX,1,I)) Q:I="" D
155 . . I $P($G(^MAG(2006.034,QINDEX,1,I,0)),"^",1)=8 S CDUZ=$P(^MAG(2006.034,QINDEX,1,I,0),"^",2)
156 . ;Set recipients of message
157 . S XMY("G.MAG SERVER")=""
158 . I $G(CDUZ) S XMY(CDUZ)=""
159 . D ^XMD
160 . Q
161 Q
162GETCTP(MAGRY) ;RPC [MAG4 CT PRESETS GET]
163 N MAGPLC
164 S MAGPLC=$$PLACE^MAGBAPI(DUZ(2))
165 I 'MAGPLC S MAGRY="0^Error resolving Users Division" Q
166 S MAGRY=$G(^MAG(2006.1,MAGPLC,"CT"))
167 I MAGRY="" S MAGRY="0^Site doesn't have CT Presets defined." Q
168 S MAGRY="1^"_MAGRY
169 Q
170SAVECTP(MAGRY,VALUE) ;RPC [MAG4 CT PRESETS SAVE]
171 N MAGPLC
172 S MAGPLC=$$PLACE^MAGBAPI(DUZ(2))
173 I 'MAGPLC S MAGRY="0^Error resolving Users Division" Q
174 S ^MAG(2006.1,MAGPLC,"CT")=VALUE
175 S MAGRY="1^CT Presets saved."
176 Q
177NETPLCS ; Create an array of Place, SiteCodes for all entries of
178 ; Network Location entries.
179 N I,PLC,PLCODE,CONS
180 S CONS=$$CONSOLID^MAGBAPI
181 I 'CONS S PLC=$O(^MAG(2006.1,0)),PLCODE=$P(^MAG(2006.1,PLC,0),"^",9)
182 ;
183 K MAGJOB("NETPLC")
184 S I=0 F S I=$O(^MAG(2005.2,I)) Q:'I D
185 . I 'CONS S MAGJOB("NETPLC",I)=PLC_"^"_PLCODE Q
186 . ; Here, for consolidated sites we get the real Site IEN, and Site Code.
187 . I CONS S PLC=$P($G(^MAG(2005.2,I,0)),"^",10),PLCODE=$S(PLC:$P($G(^MAG(2006.1,PLC,0)),"^",9),1:"n/a")
188 . S MAGJOB("NETPLC",I)=PLC_"^"_PLCODE
189 . Q
190 Q
Note: See TracBrowser for help on using the repository browser.