source: FOIAVistA/trunk/r/IMAGING-MAG-ZMAG/MAGJUTL3.m@ 1328

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

initial load of FOIAVistA 6/30/08 version

File size: 9.5 KB
Line 
1MAGJUTL3 ;WIRMFO/JHC VistARad subrtns & RPCs ; 29 Jul 2003 10:03 AM
2 ;;3.0;IMAGING;**16,9,22,18,65,76**;Jun 22, 2007;Build 19
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 in any way. |
14 ;; | Modifications to this software may result in an adulterated |
15 ;; | medical device under 21CFR820, the use of which is considered |
16 ;; | to be a violation of US Federal Statutes. |
17 ;; +---------------------------------------------------------------+
18 ;;
19 Q
20 ;RPC Entry points:
21 ; LISTINF--Custom list info
22 ; LOGOFF--update session file
23 ; CACHEQ--init session data
24 ; PINF1--Patient info
25 ; USERINF2--P18 inits for the session
26 ;Subrtn EPs:
27 ; LOG--Upd image access log
28 ; MAGJOBNC--inits for non-client sessions
29 ; USERKEYS--user key info
30 ; USERINF--user info
31 ;
32LISTINF(MAGGRY) ; RPC: MAGJ CUSTOM LISTS
33 ; get Exam List data
34 ; Return in ^TMP($J,"MAGJLSTINF",0:N)
35 ; 0)= # Entries below (0:n)
36 ; 1:n)= Button Label^List #^Button Hints^List Type
37 ;
38 ; MAGGRY holds $NA ref to ^TMP for return message
39 ; all refs to MAGGRY use SS indirection
40 ;
41 ; GLB has $NA ref to ^MAG(2006.631), Custom Lists
42 ; refs to GLB use SS indirection to get data from this file
43 ;
44 S X="ERR1^MAGJUTL3",@^%ZOSF("TRAP")
45 N D0,GLB,INF,MAGLST,NAM,T
46 S MAGLST="MAGJLSTINF"
47 K MAGGRY S MAGGRY=$NA(^TMP($J,MAGLST)) K @MAGGRY S @MAGGRY@(0)=0
48 S GLB=$NA(^MAG(2006.631)),NAM=""
49 F S NAM=$O(@GLB@("B",NAM)) Q:NAM="" S D0="" D
50 . S D0=$O(@GLB@("B",NAM,D0)) Q:'D0 D
51 . . S X=$G(@GLB@(D0,0)) Q:($P(X,U,2)>9000)!'$P(X,U,6) ; List Active & User-defined
52 . . S INF="" F I=1:1 S T=$P("7^2^1^3",U,I) Q:T="" S Y=$P(X,U,T) Q:Y="" S $P(INF,U,I)=Y
53 . . Q:T'="" ; req'd fields not all there
54 . . S T=@MAGGRY@(0)+1,^(0)=T,^(T)=INF ; add entry to reply
55 Q
56 ;
57LOG(ACTION,LOGDATA) ; Log exam access
58 N PTCT,TXT,RADFN,MAGIEN,NIMGS,REMOTE
59 S RADFN=$P(LOGDATA,U),MAGIEN=$P(LOGDATA,U,2),NIMGS=$P(LOGDATA,U,3),REMOTE=$P(LOGDATA,U,4)
60 I ACTION="" S ACTION="UNKNOWN" ; Should never happen
61 S PTCT=RADFN'=$G(MAGJOB("LASTPT",ACTION))
62 I PTCT S MAGJOB("LASTPT",ACTION)=RADFN
63 S TXT=ACTION_U_RADFN_U_MAGIEN_U_U_U_NIMGS
64 S TXT=TXT_U_PTCT_U_$S(+MAGJOB("USER",1):1,1:0)_U_REMOTE
65 ; Session Log
66 D ACTION^MAGGTAU(TXT,1)
67 ; Mag Log
68 I REMOTE S ACTION=ACTION_"/REM"
69 D ENTRY^MAGLOG(ACTION,+DUZ,MAGIEN,"VRAD:"_MAGJOB("VRVERSION"),RADFN,NIMGS)
70 Q
71 ;
72LOGOFF(MAGGRY,DATA) ; RPC: MAGJ LOGOFF
73 ; update session file: logoff time & session entry closed
74 D LOGOFF^MAGGTAU(.MAGGRY)
75 Q
76 ;
77CACHEQ(MAGGRY,DATA) ; RPC: MAGJ CACHELOCATION
78 ; some logon inits & get alternate paths for Remote Reading
79 ; input in DATA:
80 ; - WSLOC = WS Loc'n
81 ; - VRADVER = Client Vs -- p32 ONLY
82 ; - OSVER = Client OS Vs -- p32 ONLY
83 ; Return in ^TMP($J,"MAGJCACHE",0:N) (@MAGGRY)
84 ; 0)= # Entries below (0:n)
85 ; 1:n)= PhysName^Subdirectory^HashFlag^Username^Password^AltPath_IEN
86 ;
87 ; MAGGRY holds $NA reference to ^TMP for return message
88 ; refs to MAGGRY use SS indirection
89 ;
90 ; Also builds local array: p32/p18 compatibility: Some of this is moved to userinf2 below
91 ; MAGJOB("LOC",NetworkLocnIEN)=Site Abbrev
92 ; ("REMOTE")=1/0 (T/F for "User is Remote")
93 ; ("REMOTESCREEN")=0/1 (init User-switchable Remote Screening--P18 use only)
94 ; ("WSLOC")=WS Loc'n String
95 ; ("WSLOCTYP")=WS Loc'n Type
96 ; ("WSNAME")=WS ID
97 ; ("VRVERSION")=VRAD Vs
98 ; ("OSVER")=O/S Vs
99 ; ("ALTPATH")=1/0 ^ 1/0 (T/F Alt Paths are defined
100 ; ^ Alt Paths Enabled/Disabled for most recent exam)
101 ;
102 S X="ERR1^MAGJUTL3",@^%ZOSF("TRAP")
103 ;
104 N I,MAGLST,REPLY,TMP,WSLOC,XX,VRADVER,OSVER,DIQUIET,ALTIEN
105 S DIQUIET=1 D DT^DICRW
106 S REPLY=0,MAGLST="MAGJCACHE"
107 K MAGGRY S MAGGRY=$NA(^TMP($J,MAGLST)) K @MAGGRY
108 S WSLOC=$P(DATA,U),VRADVER=$P(DATA,U,2),OSVER=$P(DATA,U,3)
109 I '$D(MAGJOB("OSVER")) D ; ID p32 initialization
110 . S MAGJOB("OSVER")=$S(OSVER]"":OSVER,1:"UNK")
111 . S MAGJOB("VRVERSION")=$S(VRADVER]"":VRADVER,1:"UNK")
112 . D MAGJOB ; p32 init of VRAD
113 ; get alt paths location info
114 S MAGJOB("WSLOC")=WSLOC,MAGJOB("REMOTE")=0
115 S MAGJOB("REMOTESCREEN")=+$P($G(^MAG(2006.69,1,0)),U,10)
116 I WSLOC]"" D
117 . S X=$P($G(^MAG(2006.1,+MAGJOB("SITEP"),0)),U,9)
118 . I X]"",(X'=WSLOC) S MAGJOB("REMOTE")=1
119 . E Q
120 . D LIST^MAGBRTLD(WSLOC,.TMP)
121 . I TMP S REPLY=TMP,MAGJOB("ALTPATH")=$G(MAGJOB("ALTPATH"),"1^1") F I=1:1:TMP D
122 . . S ALTIEN=$P(TMP(I),U,7)
123 . . S XX=$P(TMP(I),U,1,5),X=$P(XX,U,3),$P(XX,U,3)=$S(X="Y":1,1:0)
124 . . S X=$P(XX,U,4),$P(XX,U,4)=$P(XX,U,5),$P(XX,U,5)=X,$P(XX,U,6)=ALTIEN
125 . . S @MAGGRY@(I)=XX,MAGJOB("LOC",ALTIEN)=$P(TMP(I),U,6)
126 I '$D(MAGJOB("ALTPATH")) S MAGJOB("ALTPATH")="0^0"
127 S @MAGGRY@(0)=REPLY
128CACHEQZ Q
129 ;
130MAGJOBNC ; EP for Prefetch/Bkgnd calls (NOT a Vrad Client)
131 N NOTCLIEN S NOTCLIEN=1
132 D MAGJOB
133 Q
134 ;
135MAGJOB ; Init magjob array
136 N T,RIST
137 I $G(MAGJOB("VRVERSION")) S X=MAGJOB("VRVERSION")
138 E S X="" ; non-client processes assume post-P32 logic
139 S MAGJOB("P32")=(X="3.0.41.17") ; P32 Client?
140 I MAGJOB("P32") D P32STOP^MAGJUTL5(.X) S MAGJOB("P32STOP")=X ; STOP support when P76 releases
141 D USERKEYS
142 S MAGJOB("CONSOLIDATED")=($G(^MAG(2006.1,"CONSOLIDATED"))="YES")
143 S MAGJOB("SITEP")=$$IMGSIT^MAGJUTL1(DUZ(2),1) ; Site Param ien
144 S RIST="" F X="S","R" I $D(^VA(200,"ARC",X,DUZ)) S RIST=X Q
145 S RIST=$S(RIST="S":15,RIST="R":12,1:0) ; Staff/Resident/Non rist
146 S MAGJOB("USER",1)=RIST_U_$$USERINF(+DUZ,".01;1") ; RIST_Type^NAME^INI
147 S X=$P($G(IO("CLNM")),"."),MAGJOB("WSNAME")=$S(X]"":X,1:"VistaradWS")
148 K MAGJOB("DIVSCRN") I MAGJOB("CONSOLIDATED") D
149 . ; include logon DIV, other DIVs to screen Unread Lists & Locking
150 . I $G(DUZ(2))]"" S MAGJOB("DIVSCRN",DUZ(2))=""
151 . S DIV=""
152 . I DUZ(2)'=$P(MAGJOB("SITEP"),U,3) D ; Assoc DIV
153 . . S IEN=$O(^MAG(2006.1,+MAGJOB("SITEP"),"INSTS","B",DUZ(2),0))
154 . . I IEN F S DIV=$O(^MAG(2006.1,+MAGJOB("SITEP"),"INSTS",IEN,201,"B",DIV)) Q:'DIV S MAGJOB("DIVSCRN",DIV)=""
155 . E D ; Parent DIV
156 . . F S DIV=$O(^MAG(2006.1,+MAGJOB("SITEP"),201,"B",DIV)) Q:'DIV S MAGJOB("DIVSCRN",DIV)=""
157 S MAGJOB("WSLOCTYP")=$S(+MAGJOB("USER",1):"RAD",1:"Non-Rad") ; USer is Rist/Not
158 I '$D(MAGJOB("WRKSIEN")) D
159 . Q:+$G(NOTCLIEN) ; proceed only if Vrad Client is attached
160 . S X=MAGJOB("WSNAME")_"^^^"_MAGJOB("WSLOCTYP")_U_U_U_U_1_U_MAGJOB("OSVER")_U_MAGJOB("VRVERSION")
161 . D UPD^MAGGTAU(.Y,X)
162 . D REMLOCK^MAGJEX1B ; put here to only run 1x/ login
163 Q
164 ;
165USERINF(DUZ,FLDS) ; get data from user file
166 I FLDS=""!'DUZ Q ""
167 N I,RSL,T S RSL=""
168 D GETS^DIQ(200,+DUZ,FLDS,"E","T")
169 S T=+DUZ_","
170 F I=1:1:$L(FLDS,";") S RSL=RSL_$S(RSL="":"",1:U)_T(200,T,$P(FLDS,";",I),"E")
171 Q RSL
172 ;
173USERKEYS ; Store Security Keys in MagJob
174 N I,X,Y
175 N MAGKS ; keys to send to XUS KEY CHECK
176 N MAGKG ; returned
177 K MAGJOB("KEYS")
178 S X="MAGJ",I=0
179 F S X=$O(^XUSEC(X)) Q:$E(X,1,4)'="MAGJ" D
180 . S I=I+1,MAGKS(I)=X
181 I '$D(MAGKS) Q
182 D OWNSKEY^XUSRB(.MAGKG,.MAGKS)
183 S I=0 F S I=$O(MAGKG(I)) Q:'I I MAGKG(I) S MAGJOB("KEYS",MAGKS(I))=""
184 Q
185 ;
186PINF1(MAGGRY,MAGDFN) ;RPC Call MAGJ PT INFO -- Get pt info
187 S X="ERR3^MAGJUTL3",@^%ZOSF("TRAP")
188 D INFO^MAGGTPT1(.MAGGRY,MAGDFN_"^1") ; 1=Don't log to session file
189 Q
190 ;
191USERINF2(MAGGRY,DATA) ; rpc: MAGJ USER2--get user info
192 ; Input= unused ^ Client Vs ^ Client O/S Vs
193 ; Reply=
194 ; 0) = 1/0^code~Msg | DUZ ^ NAME ^ INITIALS ^ REQFLAG
195 ; 1)= Net UserName ^ PSW ^ UserType ^ SYSADMIN
196 ; 1/0=Success/Fail flag for vs chk
197 ; code=4 if fail
198 ; Msg=Disp msg if fail
199 ; REQFLAG = 1/0 (Ena/Disa Requisition for non-rad staff)
200 ; UserType = 3: Staff R'ist; 2: Resident R'ist; 1: Rad Tech; 0: Non-Rad
201 ; SYSADMIN = 1/0 1=user has System User privileges
202 ; 2:N)=Sec Keys
203 ;
204 S X="ERR2^MAGJUTL3",@^%ZOSF("TRAP")
205 K MAGGRY S MAGGRY(0)="",MAGGRY(1)=""
206 I +$G(DUZ)=0 S MAGGRY(0)="0^4~DUZ Undefined, Null or Zero|" Q
207 N I,J,K,Y,REQ,VRADVER,OSVER,RADTECH,PLACE,REPLY
208 S VRADVER=$P(DATA,U,2),OSVER=$P(DATA,U,3)
209 D CHKVER^MAGJUTL5(.REPLY,VRADVER,.PLACE,.SVERSION)
210 I 'REPLY S MAGGRY(0)=REPLY_"|^^^^",MAGGRY(1)="^^^" G USERIN2Z ; Version check or PLACE failed
211 S RADTECH=""
212 S MAGJOB("OSVER")=$S(OSVER]"":OSVER,1:"UNK") ; IDs P18 initialization; cf cacheq ep above
213 S MAGJOB("VRVERSION")=$S(VRADVER]"":VRADVER,1:"UNK")
214 S MAGJOB("VSVERSION")=SVERSION
215 D MAGJOB
216 ; Enable/Disable Requisition if not a radiology user
217 S REQ=1
218 I 'MAGJOB("USER",1) D ; not a rist
219 . I $D(^VA(200,"ARC","T",+DUZ)) S RADTECH=1 Q ; Rad Tech OK
220 . S X=+$P($G(^MAG(2006.69,1,0)),U,16)
221 . I X S REQ=0 ; Disable Req
222 S MAGGRY(0)=REPLY_"|"_DUZ_U_$$GET1^DIQ(200,DUZ_",",.01)_U_$$GET1^DIQ(200,DUZ_",",1)_U_REQ_U_SVERSION
223 ; Network UserName and PSW
224 S MAGGRY(1)=$P($G(^MAG(2006.1,PLACE,"NET")),U,1,2)
225 S X=+MAGJOB("USER",1),X=$S(X=15:3,X=12:2,+RADTECH:1,1:0)
226 S MAGGRY(1)=MAGGRY(1)_U_X_U_$D(MAGJOB("KEYS","MAGJ SYSTEM USER"))
227 S MAGGRY(2)="*KEYS",X="" F I=3:1 S X=$O(MAGJOB("KEYS",X)) Q:X="" S MAGGRY(I)=X
228 S MAGGRY(I)="*END"
229USERIN2Z Q
230 ;
231ERR1 N ERR S ERR=$$EC^%ZOSV S @MAGGRY@(0)="0^4~"_ERR G ERR
232ERR2 N ERR S ERR=$$EC^%ZOSV S MAGGRY(0)="0^4~"_ERR G ERR
233ERR3 N ERR S ERR=$$EC^%ZOSV S MAGGRY="0^4~"_ERR
234ERR D @^%ZOSF("ERRTN")
235 Q:$Q 1 Q
236 ;
237END Q ;
Note: See TracBrowser for help on using the repository browser.