source: FOIAVistA/trunk/r/IMAGING-MAG-ZMAG/MAGGTAU.m@ 785

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

initial load of FOIAVistA 6/30/08 version

File size: 9.5 KB
Line 
1MAGGTAU ;WOIFO/GEK - RPC Calls to Update the Imaging Windows Workstation file ; [ 03/25/2001 11:20 ]
2 ;;3.0;IMAGING;**7,16,8,59**;Nov 27, 2007;Build 20
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 ;; | |
12 ;; | The Food and Drug Administration classifies this software as |
13 ;; | a medical device. As such, it may not be changed |
14 ;; | in any way. Modifications to this software may result in an |
15 ;; | adulterated medical device under 21CFR820, the use of which |
16 ;; | is considered to be a violation of US Federal Statutes. |
17 ;; +---------------------------------------------------------------+
18 ;;
19 Q
20UPD(MAGRY,DATA) ;RPC [MAGG WRKS UPDATES]
21 ; Called after User login. Local and RIV.
22 ; Updates information in the IMAGING WINDOWS WORKSTATION
23 ;
24 ; DATA is '^' delimited piece
25 ; 1 Workstation name 2 Date/Time of capture app.
26 ; 3 Date/Time of Display App.
27 ; 4 Location of workstation 5 Date/Time of MAGSETUP
28 ; 6 Version of Display 7 Version of Capture
29 ; 8 1=Normal startup 2=Started by CPRS 3=Import API
30 ; 9 OS Version 10 VistaRad Version
31 ; 11 RPCBroker Server 12 RPCBroker Port
32 N X,Y,Z
33 N MAGNAME,MAGCDT,MAGDDT,MAG0,MAGLOC,MAGIEN,MAGSETUP,MAGSTART,MAGSRV
34 N MAGVERSD,MAGVERSC,MAGMODE,MAGOSVER,MAGVERVR,MAGPL,MAGVERX
35 K MAGGFDA,MAGXERR,MAGXIEN
36 S MAGNAME=$P(DATA,U,1)
37 S MAGCDT=$P(DATA,U,2)
38 S MAGDDT=$P(DATA,U,3)
39 S MAGLOC=$P(DATA,U,4)
40 S MAGSETUP=$P(DATA,U,5)
41 S MAGVERSD=$P(DATA,U,6)
42 I MAGVERSD S MAGJOB("DISPLAY")=""
43 S MAGVERSC=$P(DATA,U,7)
44 I MAGVERSC S MAGJOB("CAPTURE")=""
45 S MAGMODE=$P(DATA,U,8)
46 S MAGOSVER=$P(DATA,U,9)
47 S MAGVERVR=$P(DATA,U,10)
48 I $P(DATA,U,11)]"" S MAGJOB("RPCSERVER")=$P(DATA,U,11)
49 I $P(DATA,U,12)]"" S MAGJOB("RPCPORT")=$P(DATA,U,12)
50 S MAGIEN=0
51 I $L(MAGNAME) S MAGIEN=$O(^MAG(2006.81,"B",MAGNAME,""))
52 I 'MAGIEN D NEWWRKS(MAGNAME,MAGLOC,.MAGIEN)
53 I MAGIEN<1 S MAGRY="0^Workstation Not on file" Q
54 ;
55 S %DT="T",X=MAGCDT D ^%DT S MAGCDT=Y
56 S %DT="T",X=MAGDDT D ^%DT S MAGDDT=Y
57 S %DT="T",X=MAGSETUP D ^%DT S MAGSETUP=Y
58 S MAG0=^MAG(2006.81,MAGIEN,0) ; '0' node for use later.
59 L +^MAG(2006.81,"LOCK",MAGIEN):0
60 S MAGIEN=+MAGIEN_","
61 S MAGGFDA(2006.81,MAGIEN,.01)=MAGNAME ; Computer Name
62 I MAGCDT>-1 S MAGGFDA(2006.81,MAGIEN,4)=MAGCDT ;TELE19N.EXE dttm
63 I MAGDDT>-1 S MAGGFDA(2006.81,MAGIEN,5)=MAGDDT ;IMGVWP10.EXE dttm
64 I MAGSETUP>-1 S MAGGFDA(2006.81,MAGIEN,7)=MAGSETUP ; MAGSETUP.EXE dttm
65 S MAGGFDA(2006.81,MAGIEN,8)=1 ; Active or not.
66 S MAGGFDA(2006.81,MAGIEN,6)=MAGLOC ; location free text from .INI
67 S MAGGFDA(2006.81,MAGIEN,3)="@" ; delete logoff time for this job.
68 S MAGGFDA(2006.81,MAGIEN,10)="@" ; delete session pointer
69 S MAGGFDA(2006.81,MAGIEN,11)="@" ; reset the session error count.
70 S MAGGFDA(2006.81,MAGIEN,9)=MAGVERSD ; IMGVWP10.EXE Version Info
71 S MAGGFDA(2006.81,MAGIEN,9.5)=MAGVERSC ; TELE19N.EXE Version Info
72 S MAGGFDA(2006.81,MAGIEN,9.7)=MAGVERVR ; VistARad.EXE Version Info
73 S MAGGFDA(2006.81,MAGIEN,13)=MAGOSVER ; Operating System Version.
74 ;
75 S X=$P(MAG0,U,12)
76 S MAGGFDA(2006.81,MAGIEN,12)=X+1 ; Sess count for wrks.
77 ; Keep PLACE that this wrks logged in.
78 S MAGPL=0 I $D(DUZ(2)) S MAGPL=+$$PLACE^MAGBAPI(DUZ(2)) ; DBI
79 I MAGPL S MAGGFDA(2006.81,MAGIEN,.04)=MAGPL ; DBI
80 ;
81 S X=$$NOW^XLFDT
82 S MAGSTART=$E(X,1,12)
83 I $G(DUZ) D
84 . S MAGGFDA(2006.81,MAGIEN,1)=DUZ
85 . S MAGGFDA(2006.81,MAGIEN,2)=MAGSTART
86 ;
87 D UPDATE^DIE("S","MAGGFDA","MAGXIEN","MAGXERR")
88 I $D(DIERR) D RTRNERR(.MAGRY) Q
89 ; The MAGJOB( array is used by Imaging routines that are
90 ; called from the Delphi App.
91 ;
92 ; 3.0.8 Whatever App calls this, we'll use that Version number.
93 S MAGVERX=$S(MAGVERSD]"":MAGVERSD,MAGVERSC]"":MAGVERSC,MAGVERVR]"":MAGVERVR,1:0)
94 S MAGJOB("WRKSIEN")=+MAGIEN
95 S MAGJOB("VERSION")=MAGVERX
96 S MAGRY="1^"
97 ;
98 ; SESSION : Create new session entry
99 D GETS^DIQ(200,DUZ_",","29","I","Z","") ; service/section
100 S MAGSRV=$G(Z(200,DUZ_",",29,"I"))
101 ;
102 K MAGGFDA,MAGXERR,MAGXIEN
103 S MAGGFDA(2006.82,"+1,",.01)=$P(^VA(200,DUZ,0),U,1) ; User
104 S MAGGFDA(2006.82,"+1,",1)=DUZ ; USER
105 S MAGGFDA(2006.82,"+1,",2)=MAGSTART ; Sess Start Time
106 S MAGGFDA(2006.82,"+1,",4)=+MAGIEN ; Wrks
107 S MAGGFDA(2006.82,"+1,",7)=+MAGSRV ; User's Service/Section
108 S MAGGFDA(2006.82,"+1,",13)=MAGMODE ; 1=normal 2= started by CPRS
109 ; DBI - save the logon PLACE in the Session file.
110 I MAGPL S MAGGFDA(2006.82,"+1,",.04)=MAGPL ; User's Institution (Imaging site param entry)
111 ;
112 ;3.0.8 new fields 9 Client Ver, 9.2 Host Version, 9.4 OS Version
113 S MAGGFDA(2006.82,"+1,",9)=MAGVERX ;
114 S MAGGFDA(2006.82,"+1,",9.2)=$$VERSION^XPDUTL("IMAGING") ;
115 S MAGGFDA(2006.82,"+1,",9.4)=MAGOSVER ;
116 ;
117 D UPDATE^DIE("","MAGGFDA","MAGXIEN","MAGXERR")
118 I $D(DIERR) D RTRNERR(.MAGRY) Q
119 S MAGRY="1^"
120 I '+MAGXIEN(1) S MAGRY="0^" Q
121 S MAGJOB("SESSION")=+MAGXIEN(1)
122 S MAGRY=MAGJOB("SESSION")_"^Session # "_MAGJOB("SESSION")_" Started."
123 S MAGGFDA(2006.81,+MAGIEN_",",10)=+MAGXIEN(1)
124 D UPDATE^DIE("","MAGGFDA","MAGXIEN","MAGXERR")
125 D ACTION("LOGON^")
126 Q
127LOGACT(MAGRY,ACTION) ;RPC [MAG3 LOGACTION]
128 ; Call to log actions for Imaging Session from
129 ; Delphi interface
130 D ACTION(ACTION)
131 S MAGRY="1^Action Logged"
132 Q
133ACTION(TXT,LOGTM,MAGSESS) ;Call to log actions for Imaging Workstation Session from other M routines
134 ; ACTIONS LOGGED
135 ; LOGON - Session StartTime LOGOFF - Session End Time
136 ; IMG - Image accessed PAT - Patient Accessed
137 ; CAP - Image Captured
138 ; DEL - Image Deleted MOD - Image entry modified
139 ; IMPORT - Import API has been called
140 ; Data - a node of data passed to Import API
141 ; Result - a node of the Result Array from Import API Processing.
142 ; Image - one of the Images (full path of import directory) that was imported.
143 ; PPACT - A Post processing Action has been processed.
144 ; VR-VW - VistaRad Exam displayed
145 ; VR-INT - VistaRad Exam interpreted
146 ; API - parameters sent to CP API, and the API Call i.e. ITIU-MDAPI
147 ; DFTINDX- If the index fields have no values, call to Patch 17 code to
148 ; generate the values for the fields.
149 ; MOD - This was intended to log Modifications to Image Entries, it is
150 ; (for now) only called when a group entry has an image added to its multiple.
151 ;
152 ; TXT is "^" delimited string
153 ; $P(1) is code ( see above ) $P(2) is DFN
154 ; $P(3) is Image IEN $P(4) reserved for procedure
155 ; $P(5) reserved for time-stamp $P(6) is Vrad Image Count
156 ; $P(7) is Vrad Patient Count
157 ; $P(8) is Vrad User Type (1/0 = Rad/Non-Rad)
158 ; $P(9) is Vrad REMOTE Read flag (1/0; 1=REMOTE)
159 ; $P(TXT,"$$",2) is Tracking ID from an Imported Image. From this we compute Session #, to log actions.
160 ; LOGTM - [1|0] Flag to indicate whether or not to log the time of the Action. Default = 0
161 ; MAGSESS - Session IEN where the action should be logged. Default to MAGJOB("SESSION")
162 ;
163 N NODE,SESSIEN,MAGGFDA,MAGXERR,MAGXIEN,MAGPROC,LOGX,TRKID
164 S LOGTM=$G(LOGTM)
165 I TXT["$$" S TRKID=$P(TXT,"$$",2),TXT=$P(TXT,"$$",1)
166 S SESSIEN=$S($G(MAGSESS):MAGSESS,$D(MAGJOB("SESSION")):MAGJOB("SESSION"),$G(TRKID)'="":$O(^MAG(2006.82,"E",TRKID,""),-1),1:0)
167 I 'SESSIEN Q
168 S NODE="+1,"_SESSIEN_","
169 I $P(TXT,U,3) S MAGPROC=$P($G(^MAG(2005,$P(TXT,U,3),0)),U,8)
170 ;
171 I $P(TXT,U)="PAT" D
172 . S Z=+$G(^MAG(2006.82,SESSIEN,1))+1
173 . S MAGGFDA(2006.82,SESSIEN_",",10)=Z
174 I $P(TXT,U)="IMG" D
175 . S Z=+$P($G(^MAG(2006.82,SESSIEN,1)),U,2)+1
176 . S MAGGFDA(2006.82,SESSIEN_",",11)=Z
177 . D ENTRY^MAGLOG("IMGVW",DUZ,$P(TXT,"^",3),"Wrks",$P(TXT,"^",2),"1")
178 . D ACCESS^MAGLOG($P(TXT,"^",3))
179 I $E(TXT,1,3)="CAP" D
180 . S Z=+$P($G(^MAG(2006.82,SESSIEN,1)),U,3)+1
181 . S MAGGFDA(2006.82,SESSIEN_",",12)=Z
182 . D ENTRY^MAGLOG("CAP",DUZ,$P(TXT,"^",3),"Wrks",$P(TXT,"^",2),"1")
183 I $P(TXT,U,2) D
184 . S MAGGFDA(2006.82,SESSIEN_",",5)=$P(TXT,U,2)
185 I LOGTM D
186 . S X=$$NOW^XLFDT
187 . S $P(TXT,U,4)=$G(MAGPROC),$P(TXT,U,5)=$E(X,1,12)
188 S MAGGFDA(2006.821,NODE,.01)=$P(TXT,"|",1)
189 I $L(TXT,"|")>1 S MAGGFDA(2006.821,NODE,13)=$P(TXT,"|",2,99)
190 D UPDATE^DIE("S","MAGGFDA","MAGXIEN","MAGXERR")
191 Q
192NEWWRKS(MAGNAME,MAGLOC,MAGIEN) ;
193 I $G(MAGNAME)="" Q
194 N Y,MAGNFDA,MAGNIEN
195 S MAGNFDA(2006.81,"+1,",.01)=MAGNAME
196 S MAGNFDA(2006.81,"+1,",6)=$G(MAGLOC)
197 D UPDATE^DIE("","MAGNFDA","MAGNIEN")
198 S MAGIEN=MAGNIEN(1)
199 Q
200LOGOFF(MAGRY) ;RPC [MAGG LOGOFF] Call when session is over.
201 ; This updates session file with logoff time
202 ; and marks the session closed.
203 ;
204 S MAGRY=1
205 N MAGGFDA,MAGXERR,MAGXIEN,MAGIEN,MAGSESS,MAGEND,MAGCON
206 ; The Imaging Workstation file keeps time of login
207 ; We'll enter the logoff time ($$now^xlfdt) here.
208 S X=$$NOW^XLFDT
209 S MAGEND=$E(X,1,12)
210 Q:'+$G(MAGJOB("WRKSIEN"))
211 L -^MAG(2006.81,"LOCK",MAGJOB("WRKSIEN"))
212 S MAGIEN=+MAGJOB("WRKSIEN")_","
213 S MAGGFDA(2006.81,MAGIEN,3)=MAGEND ; logoff dttm
214 S MAGGFDA(2006.81,MAGIEN,8)=0 ; Set job number to 0
215 D UPDATE^DIE("S","MAGGFDA","MAGXIEN","MAGXERR")
216 ;MAGJOB("WRKSIEN")
217 Q:(+$G(MAGJOB("SESSION"))=0)
218 S MAGSESS=+MAGJOB("SESSION")_","
219 K MAGGFDA,MAGXERR,MAGXIEN
220 S MAGGFDA(2006.82,MAGSESS,3)=MAGEND
221 ; calculate the length of the session
222 S MAGCON=""
223 S MAGGFDA(2006.82,MAGSESS,14)=MAGCON
224 D UPDATE^DIE("S","MAGGFDA","MAGXIEN","MAGXERR")
225 D ACTION("LOGOFF^")
226 ;
227 Q
228RTRNERR(ETXT) ; There was error from UPDATE^DIE quit with error text
229 S ETXT="0^ERROR "_MAGXERR("DIERR",1,"TEXT",1)
230 Q
Note: See TracBrowser for help on using the repository browser.