source: WorldVistAEHR/trunk/r/IMAGING-MAG-ZMAG/MAGGTAU.m@ 1769

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

revised back to 6/30/08 version

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