MAGGTSY1 ;WOIFO/GEK - Imaging Session Utilities ; [ 06/20/2001 08:57 ]
;;3.0;IMAGING;**7**;Jul 12, 2002
;; +---------------------------------------------------------------+
;; | Property of the US Government. |
;; | No permission to copy or redistribute this software is given. |
;; | Use of unreleased versions of this software requires the user |
;; | to execute a written test agreement with the VistA Imaging |
;; | Development Office of the Department of Veterans Affairs, |
;; | telephone (301) 734-0100. |
;; | |
;; | The Food and Drug Administration classifies this software as |
;; | a medical device. As such, it may not be changed in any way. |
;; | Modifications to this software may result in an adulterated |
;; | medical device under 21CFR820, the use of which is considered |
;; | to be a violation of US Federal Statutes. |
;; +---------------------------------------------------------------+
;;
Q
SESSION(MAGRY,DATA) ;RPC Call for MAGSYS utility.
; List of Sessions for a Workstation.
; DATA is '^' delimited string
; IEN Workstatin File ^ From Date ^ To Date
;
N I,J,I1,CT,X,Y,Z,MAGX,MAGWIEN,MAGTIEN
N DTFR,DTTO
S ^TMP("MAGGTSY1","DATA")=DATA
S MAGWIEN=$P(DATA,U,1)
S MAGRY=$NA(^TMP($J,"MAGWSESS"))
K ^TMP($J,"MAGWSESS")
S CT=1
S DTFR=$P(DATA,U,2),DTTO=$P(DATA,U,3)
I DTFR>DTTO S X=DTFR,DTFR=DTTO,DTTO=X
I DTTO=0 S DTTO=9999999
S DTTO=DTTO_".9999"
S ACI="L"_DTTO
F S ACI=$O(^MAG(2006.82,"ACWRK",MAGWIEN,ACI),-1) S I1=$E(ACI,2,99) Q:I1<DTFR D
. S I="" F S I=$O(^MAG(2006.82,"ACWRK",MAGWIEN,ACI,I),-1) Q:'I D
. . ;S I=$O(^MAG(2006.82,"ACWRK",MAGWIEN,ACI,""))
. . D INFO(I,.Y) S CT=CT+1,@MAGRY@(CT)=Y
I CT=1 S @MAGRY@(0)="0^No Sessions in Date Range." Q
S @MAGRY@(0)=(CT-1)_"^"_$P(^MAG(2006.81,MAGWIEN,0),U,1)_" Workstation sessions "
S @MAGRY@(1)="User^Service/Section^Last Logon^Logoff^Pat ct^Image ct^Cap ct^Actions^Error^TrkID"
;S @MAGRY@(1)="User^Workstation^Service/Section^Last Logon^Logoff^Pat ct^Image ct^Cap ct^Actions^Error"
Q
INFO(I,Y) ;
N N1,N0,MDUZ,Z
S N0=^MAG(2006.82,I,0) ; Imaging Windows Session file
; THIS WON'T BE NEEDED,I '$P(M,U,8) D SERV(I)
S Y=$P(N0,U,1) ; User Name
;S Y=Y_$P(^MAG(2006.81,$P(M,U,5),0),U,1) ; Workstation Name
S X=""
I $P(N0,U,8) D
. D GETS^DIQ(49,$P(N0,U,8)_",",".01","E","Z","")
. S X=Z(49,$P(N0,U,8)_",",".01","E")
S Y=Y_U_X
S Y=Y_U_$$OUTDT^MAGGTSY($P(N0,U,3)) ;Date of Last Logon, by a user.
S Y=Y_U_$$OUTDT^MAGGTSY($P(N0,U,4)) ;Date/Time of Last Logoff.
;
S N1=$G(^MAG(2006.82,I,1))
;
S Y=Y_U_$P(N1,U,1) ; patients viewed this session
S Y=Y_U_$P(N1,U,2) ; images viewed this session.
S Y=Y_U_$P(N1,U,3) ; Images captured this session
S Y=Y_U_$P($G(^MAG(2006.82,I,"ACT",0)),U,3) ; action count
S Y=Y_U_$P($G(^MAG(2006.82,I,"ERR",0)),U,3) ; error count
S Y=Y_U_$P(N0,U,9)
S Y=Y_U_I ; session ien
Q
DISPLAY(MAGRY,MAGSIEN) ; RPC Call for MAGSYS utility.
; Returns a display of this sessions info.
;
N CT,I,ECT,ACT
S MAGRY=$NA(^TMP($J,"MAGSDISP"))
K ^TMP($J,"MAGSDISP")
S CT=0,I=0,ACT=0
F S I=$O(^MAG(2006.82,MAGSIEN,"ACT",I)) Q:'I D
. S CT=CT+1,ACT=ACT+1
. S @MAGRY@(CT)=^MAG(2006.82,MAGSIEN,"ACT",I,0)
S I=0,ECT=0
I $D(^MAG(2006.82,MAGSIEN,"ERR")) D
. S CT=CT+1
. S @MAGRY@(CT)="[ERRORS]"
. F S I=$O(^MAG(2006.82,MAGSIEN,"ERR",I)) Q:'I D
. . S CT=CT+1,ECT=ECT+1
. . S @MAGRY@(CT)=^MAG(2006.82,MAGSIEN,"ERR",I,0)
S @MAGRY@(0)=(CT)_"^"_ACT_" Actions. "_ECT_" Errors."
Q
SERV(I) ;
; FILE THE SERVICE/SECTION INTO THE SESSION FILE
N N,MAGGFDA,MDUZ
S N=^MAG(2006.82,I,0)
S MDUZ=$P(N,U,2)_","
D GETS^DIQ(200,MDUZ,"29","I","Z","") ; service/section
S MAGGFDA(2006.82,I_",",7)=Z(200,MDUZ,29,"I")
D UPDATE^DIE("","MAGGFDA","","")
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HMAGGTSY1 3942 printed Dec 13, 2024@02:03:16 Page 2
MAGGTSY1 ;WOIFO/GEK - Imaging Session Utilities ; [ 06/20/2001 08:57 ]
+1 ;;3.0;IMAGING;**7**;Jul 12, 2002
+2 ;; +---------------------------------------------------------------+
+3 ;; | Property of the US Government. |
+4 ;; | No permission to copy or redistribute this software is given. |
+5 ;; | Use of unreleased versions of this software requires the user |
+6 ;; | to execute a written test agreement with the VistA Imaging |
+7 ;; | Development Office of the Department of Veterans Affairs, |
+8 ;; | telephone (301) 734-0100. |
+9 ;; | |
+10 ;; | The Food and Drug Administration classifies this software as |
+11 ;; | a medical device. As such, it may not be changed in any way. |
+12 ;; | Modifications to this software may result in an adulterated |
+13 ;; | medical device under 21CFR820, the use of which is considered |
+14 ;; | to be a violation of US Federal Statutes. |
+15 ;; +---------------------------------------------------------------+
+16 ;;
+17 QUIT
SESSION(MAGRY,DATA) ;RPC Call for MAGSYS utility.
+1 ; List of Sessions for a Workstation.
+2 ; DATA is '^' delimited string
+3 ; IEN Workstatin File ^ From Date ^ To Date
+4 ;
+5 NEW I,J,I1,CT,X,Y,Z,MAGX,MAGWIEN,MAGTIEN
+6 NEW DTFR,DTTO
+7 SET ^TMP("MAGGTSY1","DATA")=DATA
+8 SET MAGWIEN=$PIECE(DATA,U,1)
+9 SET MAGRY=$NAME(^TMP($JOB,"MAGWSESS"))
+10 KILL ^TMP($JOB,"MAGWSESS")
+11 SET CT=1
+12 SET DTFR=$PIECE(DATA,U,2)
SET DTTO=$PIECE(DATA,U,3)
+13 IF DTFR>DTTO
SET X=DTFR
SET DTFR=DTTO
SET DTTO=X
+14 IF DTTO=0
SET DTTO=9999999
+15 SET DTTO=DTTO_".9999"
+16 SET ACI="L"_DTTO
+17 FOR
SET ACI=$ORDER(^MAG(2006.82,"ACWRK",MAGWIEN,ACI),-1)
SET I1=$EXTRACT(ACI,2,99)
if I1<DTFR
QUIT
Begin DoDot:1
+18 SET I=""
FOR
SET I=$ORDER(^MAG(2006.82,"ACWRK",MAGWIEN,ACI,I),-1)
if 'I
QUIT
Begin DoDot:2
+19 ;S I=$O(^MAG(2006.82,"ACWRK",MAGWIEN,ACI,""))
+20 DO INFO(I,.Y)
SET CT=CT+1
SET @MAGRY@(CT)=Y
End DoDot:2
End DoDot:1
+21 IF CT=1
SET @MAGRY@(0)="0^No Sessions in Date Range."
QUIT
+22 SET @MAGRY@(0)=(CT-1)_"^"_$PIECE(^MAG(2006.81,MAGWIEN,0),U,1)_" Workstation sessions "
+23 SET @MAGRY@(1)="User^Service/Section^Last Logon^Logoff^Pat ct^Image ct^Cap ct^Actions^Error^TrkID"
+24 ;S @MAGRY@(1)="User^Workstation^Service/Section^Last Logon^Logoff^Pat ct^Image ct^Cap ct^Actions^Error"
+25 QUIT
INFO(I,Y) ;
+1 NEW N1,N0,MDUZ,Z
+2 ; Imaging Windows Session file
SET N0=^MAG(2006.82,I,0)
+3 ; THIS WON'T BE NEEDED,I '$P(M,U,8) D SERV(I)
+4 ; User Name
SET Y=$PIECE(N0,U,1)
+5 ;S Y=Y_$P(^MAG(2006.81,$P(M,U,5),0),U,1) ; Workstation Name
+6 SET X=""
+7 IF $PIECE(N0,U,8)
Begin DoDot:1
+8 DO GETS^DIQ(49,$PIECE(N0,U,8)_",",".01","E","Z","")
+9 SET X=Z(49,$PIECE(N0,U,8)_",",".01","E")
End DoDot:1
+10 SET Y=Y_U_X
+11 ;Date of Last Logon, by a user.
SET Y=Y_U_$$OUTDT^MAGGTSY($PIECE(N0,U,3))
+12 ;Date/Time of Last Logoff.
SET Y=Y_U_$$OUTDT^MAGGTSY($PIECE(N0,U,4))
+13 ;
+14 SET N1=$GET(^MAG(2006.82,I,1))
+15 ;
+16 ; patients viewed this session
SET Y=Y_U_$PIECE(N1,U,1)
+17 ; images viewed this session.
SET Y=Y_U_$PIECE(N1,U,2)
+18 ; Images captured this session
SET Y=Y_U_$PIECE(N1,U,3)
+19 ; action count
SET Y=Y_U_$PIECE($GET(^MAG(2006.82,I,"ACT",0)),U,3)
+20 ; error count
SET Y=Y_U_$PIECE($GET(^MAG(2006.82,I,"ERR",0)),U,3)
+21 SET Y=Y_U_$PIECE(N0,U,9)
+22 ; session ien
SET Y=Y_U_I
+23 QUIT
DISPLAY(MAGRY,MAGSIEN) ; RPC Call for MAGSYS utility.
+1 ; Returns a display of this sessions info.
+2 ;
+3 NEW CT,I,ECT,ACT
+4 SET MAGRY=$NAME(^TMP($JOB,"MAGSDISP"))
+5 KILL ^TMP($JOB,"MAGSDISP")
+6 SET CT=0
SET I=0
SET ACT=0
+7 FOR
SET I=$ORDER(^MAG(2006.82,MAGSIEN,"ACT",I))
if 'I
QUIT
Begin DoDot:1
+8 SET CT=CT+1
SET ACT=ACT+1
+9 SET @MAGRY@(CT)=^MAG(2006.82,MAGSIEN,"ACT",I,0)
End DoDot:1
+10 SET I=0
SET ECT=0
+11 IF $DATA(^MAG(2006.82,MAGSIEN,"ERR"))
Begin DoDot:1
+12 SET CT=CT+1
+13 SET @MAGRY@(CT)="[ERRORS]"
+14 FOR
SET I=$ORDER(^MAG(2006.82,MAGSIEN,"ERR",I))
if 'I
QUIT
Begin DoDot:2
+15 SET CT=CT+1
SET ECT=ECT+1
+16 SET @MAGRY@(CT)=^MAG(2006.82,MAGSIEN,"ERR",I,0)
End DoDot:2
End DoDot:1
+17 SET @MAGRY@(0)=(CT)_"^"_ACT_" Actions. "_ECT_" Errors."
+18 QUIT
SERV(I) ;
+1 ; FILE THE SERVICE/SECTION INTO THE SESSION FILE
+2 NEW N,MAGGFDA,MDUZ
+3 SET N=^MAG(2006.82,I,0)
+4 SET MDUZ=$PIECE(N,U,2)_","
+5 ; service/section
DO GETS^DIQ(200,MDUZ,"29","I","Z","")
+6 SET MAGGFDA(2006.82,I_",",7)=Z(200,MDUZ,29,"I")
+7 DO UPDATE^DIE("","MAGGFDA","","")
+8 QUIT