| 1 | MAGGTSY1 ;WOIFO/GEK - Imaging Session Utilities ; [ 06/20/2001 08:57 ]
 | 
|---|
| 2 |  ;;3.0;IMAGING;**7**;Jul 12, 2002
 | 
|---|
| 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 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 | SESSION(MAGRY,DATA) ;RPC Call for MAGSYS utility.
 | 
|---|
| 20 |  ; List of Sessions for a Workstation.
 | 
|---|
| 21 |  ; DATA is '^' delimited string
 | 
|---|
| 22 |  ; IEN Workstatin File ^  From Date ^ To Date
 | 
|---|
| 23 |  ;
 | 
|---|
| 24 |  N I,J,I1,CT,X,Y,Z,MAGX,MAGWIEN,MAGTIEN
 | 
|---|
| 25 |  N DTFR,DTTO
 | 
|---|
| 26 |  S ^TMP("MAGGTSY1","DATA")=DATA
 | 
|---|
| 27 |  S MAGWIEN=$P(DATA,U,1)
 | 
|---|
| 28 |  S MAGRY=$NA(^TMP($J,"MAGWSESS"))
 | 
|---|
| 29 |  K ^TMP($J,"MAGWSESS")
 | 
|---|
| 30 |  S CT=1
 | 
|---|
| 31 |  S DTFR=$P(DATA,U,2),DTTO=$P(DATA,U,3)
 | 
|---|
| 32 |  I DTFR>DTTO S X=DTFR,DTFR=DTTO,DTTO=X
 | 
|---|
| 33 |  I DTTO=0 S DTTO=9999999
 | 
|---|
| 34 |  S DTTO=DTTO_".9999"
 | 
|---|
| 35 |  S ACI="L"_DTTO
 | 
|---|
| 36 |  F  S ACI=$O(^MAG(2006.82,"ACWRK",MAGWIEN,ACI),-1) S I1=$E(ACI,2,99) Q:I1<DTFR  D
 | 
|---|
| 37 |  . S I="" F  S I=$O(^MAG(2006.82,"ACWRK",MAGWIEN,ACI,I),-1) Q:'I  D
 | 
|---|
| 38 |  . . ;S I=$O(^MAG(2006.82,"ACWRK",MAGWIEN,ACI,""))
 | 
|---|
| 39 |  . . D INFO(I,.Y) S CT=CT+1,@MAGRY@(CT)=Y
 | 
|---|
| 40 |  I CT=1 S @MAGRY@(0)="0^No Sessions in Date Range." Q
 | 
|---|
| 41 |  S @MAGRY@(0)=(CT-1)_"^"_$P(^MAG(2006.81,MAGWIEN,0),U,1)_"  Workstation sessions "
 | 
|---|
| 42 |  S @MAGRY@(1)="User^Service/Section^Last Logon^Logoff^Pat ct^Image ct^Cap ct^Actions^Error^TrkID"
 | 
|---|
| 43 |  ;S @MAGRY@(1)="User^Workstation^Service/Section^Last Logon^Logoff^Pat ct^Image ct^Cap ct^Actions^Error"
 | 
|---|
| 44 |  Q
 | 
|---|
| 45 | INFO(I,Y) ;
 | 
|---|
| 46 |  N N1,N0,MDUZ,Z
 | 
|---|
| 47 |  S N0=^MAG(2006.82,I,0) ; Imaging Windows Session file
 | 
|---|
| 48 |  ; THIS WON'T BE NEEDED,I '$P(M,U,8) D SERV(I)
 | 
|---|
| 49 |  S Y=$P(N0,U,1) ; User Name
 | 
|---|
| 50 |  ;S Y=Y_$P(^MAG(2006.81,$P(M,U,5),0),U,1) ; Workstation Name
 | 
|---|
| 51 |  S X=""
 | 
|---|
| 52 |  I $P(N0,U,8) D
 | 
|---|
| 53 |  . D GETS^DIQ(49,$P(N0,U,8)_",",".01","E","Z","")
 | 
|---|
| 54 |  . S X=Z(49,$P(N0,U,8)_",",".01","E")
 | 
|---|
| 55 |  S Y=Y_U_X
 | 
|---|
| 56 |  S Y=Y_U_$$OUTDT^MAGGTSY($P(N0,U,3)) ;Date of Last Logon, by a user.
 | 
|---|
| 57 |  S Y=Y_U_$$OUTDT^MAGGTSY($P(N0,U,4)) ;Date/Time of Last Logoff.
 | 
|---|
| 58 |  ;
 | 
|---|
| 59 |  S N1=$G(^MAG(2006.82,I,1))
 | 
|---|
| 60 |  ;
 | 
|---|
| 61 |  S Y=Y_U_$P(N1,U,1) ; patients viewed this session
 | 
|---|
| 62 |  S Y=Y_U_$P(N1,U,2) ; images viewed this session.
 | 
|---|
| 63 |  S Y=Y_U_$P(N1,U,3) ; Images captured this session
 | 
|---|
| 64 |  S Y=Y_U_$P($G(^MAG(2006.82,I,"ACT",0)),U,3) ; action count
 | 
|---|
| 65 |  S Y=Y_U_$P($G(^MAG(2006.82,I,"ERR",0)),U,3) ; error count
 | 
|---|
| 66 |  S Y=Y_U_$P(N0,U,9)
 | 
|---|
| 67 |  S Y=Y_U_I ; session ien
 | 
|---|
| 68 |  Q
 | 
|---|
| 69 | DISPLAY(MAGRY,MAGSIEN) ; RPC Call for MAGSYS utility. 
 | 
|---|
| 70 |  ; Returns a display of this sessions info.
 | 
|---|
| 71 |  ;
 | 
|---|
| 72 |  N CT,I,ECT,ACT
 | 
|---|
| 73 |  S MAGRY=$NA(^TMP($J,"MAGSDISP"))
 | 
|---|
| 74 |  K ^TMP($J,"MAGSDISP")
 | 
|---|
| 75 |  S CT=0,I=0,ACT=0
 | 
|---|
| 76 |  F  S I=$O(^MAG(2006.82,MAGSIEN,"ACT",I)) Q:'I  D
 | 
|---|
| 77 |  . S CT=CT+1,ACT=ACT+1
 | 
|---|
| 78 |  . S @MAGRY@(CT)=^MAG(2006.82,MAGSIEN,"ACT",I,0)
 | 
|---|
| 79 |  S I=0,ECT=0
 | 
|---|
| 80 |  I $D(^MAG(2006.82,MAGSIEN,"ERR")) D
 | 
|---|
| 81 |  . S CT=CT+1
 | 
|---|
| 82 |  . S @MAGRY@(CT)="[ERRORS]"
 | 
|---|
| 83 |  . F  S I=$O(^MAG(2006.82,MAGSIEN,"ERR",I)) Q:'I  D
 | 
|---|
| 84 |  . . S CT=CT+1,ECT=ECT+1
 | 
|---|
| 85 |  . . S @MAGRY@(CT)=^MAG(2006.82,MAGSIEN,"ERR",I,0)
 | 
|---|
| 86 |  S @MAGRY@(0)=(CT)_"^"_ACT_" Actions.  "_ECT_" Errors."
 | 
|---|
| 87 |  Q
 | 
|---|
| 88 | SERV(I) ;
 | 
|---|
| 89 |  ; FILE THE SERVICE/SECTION INTO THE SESSION FILE
 | 
|---|
| 90 |  N N,MAGGFDA,MDUZ
 | 
|---|
| 91 |  S N=^MAG(2006.82,I,0)
 | 
|---|
| 92 |  S MDUZ=$P(N,U,2)_","
 | 
|---|
| 93 |  D GETS^DIQ(200,MDUZ,"29","I","Z","") ; service/section
 | 
|---|
| 94 |  S MAGGFDA(2006.82,I_",",7)=Z(200,MDUZ,29,"I")
 | 
|---|
| 95 |  D UPDATE^DIE("","MAGGFDA","","")
 | 
|---|
| 96 |  Q
 | 
|---|