- MAGGTAU ;WOIFO/GEK/SG - RPC Calls to update the IMAGING WINDOWS WORKSTATION file ; 7/17/08 3:39pm
- ;;3.0;IMAGING;**7,16,8,59,93,138**;Mar 19, 2002;Build 5380;Sep 03, 2013
- ;; Per VHA Directive 2004-038, this routine should not be modified.
- ;; +---------------------------------------------------------------+
- ;; | 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
- ;
- ;***** UPDATES INFORMATIONS IN THE IMAGING WINDOWS WORKSTATION
- ; RPC: MAGG WRKS UPDATES
- ;
- ; .MAGRY Reference to a local variable where the results
- ; are returned to.
- ;
- ; DATA Data that should be stored in the IMAGING WINDOWS
- ; WORKSTATION file (#2006.81):
- ; ^01: Workstation name
- ; ^02: Date/Time of Capture application (external)
- ; ^03: Date/Time of Display application (external)
- ; ^04: Location of the workstation
- ; ^05: Date/Time of the MAGSETUP (external)
- ; ^06: Version of the Display application
- ; ^07: Version of the Capture application
- ; ^08: Startup mode: 1 = Normal startup,
- ; 2 = Started by CPRS, 3 = Import API
- ; ^09: OS Version
- ; ^10: VistaRad version
- ; ---- Patch MAG*3*59 ----
- ; ^11: RPCBroker server
- ; ^12: RPCBroker port
- ; ---- Patch MAG*3*93 ----
- ; ^13: Clinical Utilities version
- ; ^14: TeleReader version
- ; ^15: Date/Time of the Clinical Utilities (external)
- ; ^16: Date/Time of the TeleReader (external)
- ; ^17: Date/Time of the VistaRad (external)
- ;
- ; Return Values
- ; =============
- ;
- ; Zero value of the first '^'-piece of the MAGRY indicates that
- ; an error occurred during the execution of the procedure. In this
- ; case, the MAGRY is formatted as follows:
- ;
- ; MAGRY Result descriptor
- ; ^01: 0
- ; ^02: Error message (optional)
- ;
- ; Otherwise, first '^'-piece of the MAGRY contains the session
- ; number (IEN in the IMAGING WINDOWS SESSIONS file (#2006.82)):
- ;
- ; MAGRY Result descriptor
- ; ^01: Session IEN (file #2006.82)
- ; ^02: Message
- ;
- ; Notes
- ; =====
- ;
- ; This remote procedure is called after user login (local and remote
- ; image view).
- ;
- UPD(MAGRY,DATA) ;RPC [MAGG WRKS UPDATES]
- N MAG0,MAGI,MAGIEN,MAGLOC,MAGMODE,MAGNAME,MAGOSVER,MAGPL
- N MAGSRV,MAGSTART,MAGVERVR,MAGVERX,X,Y,Z
- K MAGGFDA,MAGXERR,MAGXIEN
- ;
- S MAGNAME=$P(DATA,U,1)
- S MAGLOC=$P(DATA,U,4)
- S:$P(DATA,U,6) MAGJOB("DISPLAY")=""
- S:$P(DATA,U,7) MAGJOB("CAPTURE")=""
- S MAGMODE=$P(DATA,U,8)
- S MAGOSVER=$P(DATA,U,9)
- S MAGVERVR=$P(DATA,U,10)
- S:$P(DATA,U,11)]"" MAGJOB("RPCSERVER")=$P(DATA,U,11)
- S:$P(DATA,U,12)]"" MAGJOB("RPCPORT")=$P(DATA,U,12)
- ;
- S MAGIEN=$S($L(MAGNAME):$O(^MAG(2006.81,"B",MAGNAME,"")),1:0)
- I 'MAGIEN D NEWWRKS(MAGNAME,MAGLOC,.MAGIEN)
- I MAGIEN<1 S MAGRY="0^Workstation Not on file" Q
- ;
- S MAG0=^MAG(2006.81,MAGIEN,0) ; '0' node for use later.
- L +^MAG(2006.81,"LOCK",MAGIEN):0
- S MAGIEN=+MAGIEN_","
- S MAGGFDA(2006.81,MAGIEN,.01)=MAGNAME ; Computer name
- S MAGGFDA(2006.81,MAGIEN,3)="@" ; Delete logoff time for this job
- S MAGGFDA(2006.81,MAGIEN,6)=MAGLOC ; Location free text from .INI
- S MAGGFDA(2006.81,MAGIEN,8)=1 ; Active or not
- S MAGGFDA(2006.81,MAGIEN,10)="@" ; Delete session pointer
- S MAGGFDA(2006.81,MAGIEN,11)="@" ; Reset the session error count
- S MAGGFDA(2006.81,MAGIEN,13)=MAGOSVER ; Operating system version
- ;
- ;=== Process the client date/time values (MAG*3*93)
- F MAGI="2^5.5","3^5","5^7","15^5.9","16^5.3","17^5.7" D
- . ;--- Convert date/time into internal format
- . S %DT="T",X=$P(DATA,U,+MAGI) D ^%DT
- . S $P(DATA,U,+MAGI)=Y
- . ;--- Prepare the date/time for storage
- . S:Y>-1 MAGGFDA(2006.81,MAGIEN,$P(MAGI,U,2))=Y
- . Q
- ;
- ;=== Process the client version numbers (MAG*3*93)
- S MAGVERX=""
- F MAGI="6^9","7^9.5","10^9.7","13^9.9","14^9.3" D
- . S X=$P(DATA,U,+MAGI) Q:X=""
- . ;--- Prepare the version number for storage
- . S MAGGFDA(2006.81,MAGIEN,$P(MAGI,U,2))=X
- . ;--- Whatever application calls, we'll use that version (MAG*3*8)
- . S:MAGVERX="" MAGVERX=X
- . Q
- ;
- S X=$P(MAG0,U,12)
- S MAGGFDA(2006.81,MAGIEN,12)=X+1 ; Sess count for wrks.
- ; Keep PLACE that this wrks logged in.
- S MAGPL=$S($G(DUZ(2)):+$$PLACE^MAGBAPI(DUZ(2)),1:0) ; DBI
- S:MAGPL MAGGFDA(2006.81,MAGIEN,.04)=MAGPL ; DBI
- ;
- S MAGSTART=$E($$NOW^XLFDT,1,12)
- I $G(DUZ) D
- . S MAGGFDA(2006.81,MAGIEN,1)=DUZ
- . S MAGGFDA(2006.81,MAGIEN,2)=MAGSTART
- . Q
- ;
- D UPDATE^DIE("S","MAGGFDA","MAGXIEN","MAGXERR")
- I $D(DIERR) D RTRNERR(.MAGRY) Q
- ; The MAGJOB( array is used by Imaging routines that are
- ; called from the Delphi App.
- ;
- S MAGJOB("WRKSIEN")=+MAGIEN
- S MAGJOB("VERSION")=MAGVERX
- S MAGRY="1^"
- ;
- ; SESSION : Create new session entry
- D GETS^DIQ(200,DUZ_",","29","I","Z","") ; service/section
- S MAGSRV=$G(Z(200,DUZ_",",29,"I"))
- ;
- K MAGGFDA,MAGXERR,MAGXIEN
- S MAGGFDA(2006.82,"+1,",.01)=$P(^VA(200,DUZ,0),U,1) ; User
- S MAGGFDA(2006.82,"+1,",1)=DUZ ; USER
- S MAGGFDA(2006.82,"+1,",2)=MAGSTART ; Sess Start Time
- S MAGGFDA(2006.82,"+1,",4)=+MAGIEN ; Wrks
- S MAGGFDA(2006.82,"+1,",7)=+MAGSRV ; User's Service/Section
- S MAGGFDA(2006.82,"+1,",13)=MAGMODE ; 1=normal 2= started by CPRS
- ; DBI - save the logon PLACE in the Session file.
- I MAGPL S MAGGFDA(2006.82,"+1,",.04)=MAGPL ; User's Institution (Imaging site param entry)
- ;
- ; 3.0.8 new fields 9 Client Ver, 9.2 Host Version, 9.4 OS Version
- S MAGGFDA(2006.82,"+1,",9)=MAGVERX ;
- S MAGGFDA(2006.82,"+1,",9.2)=$$VERSION^XPDUTL("IMAGING") ;
- S MAGGFDA(2006.82,"+1,",9.4)=MAGOSVER ;
- ;
- D UPDATE^DIE("","MAGGFDA","MAGXIEN","MAGXERR")
- I $D(DIERR) D RTRNERR(.MAGRY) Q
- S MAGRY="1^"
- I '+MAGXIEN(1) S MAGRY="0^" Q
- S MAGJOB("SESSION")=+MAGXIEN(1)
- S MAGRY=MAGJOB("SESSION")_"^Session # "_MAGJOB("SESSION")_" Started."
- S MAGGFDA(2006.81,+MAGIEN_",",10)=+MAGXIEN(1)
- D UPDATE^DIE("","MAGGFDA","MAGXIEN","MAGXERR")
- D ACTION("LOGON^")
- Q
- LOGACT(MAGRY,ACTION) ;RPC [MAG3 LOGACTION]
- ; Call to log actions for Imaging Session from
- ; Delphi interface
- D ACTION(ACTION)
- S MAGRY="1^Action Logged"
- Q
- ACTION(TXT,LOGTM,MAGSESS) ;Call to log actions for Imaging Workstation Session from other M routines
- ; ACTIONS LOGGED
- ; LOGON - Session StartTime LOGOFF - Session End Time
- ; IMG - Image accessed PAT - Patient Accessed
- ; CAP - Image Captured
- ; DEL - Image Deleted MOD - Image entry modified
- ; NOIMAGE- Image Entry moved to Audit file. No Image existed. ; p140
- ; IMPORT - Import API has been called
- ; Data - a node of data passed to Import API
- ; Result - a node of the Result Array from Import API Processing.
- ; Image - one of the Images (full path of import directory) that was imported.
- ; PPACT - A Post processing Action has been processed.
- ; VR-VW - VistaRad Exam displayed
- ; VR-INT - VistaRad Exam interpreted
- ; API - parameters sent to CP API, and the API Call i.e. ITIU-MDAPI
- ; DFTINDX- If the index fields have no values, call to Patch 17 code to
- ; generate the values for the fields.
- ; MOD - This was intended to log Modifications to Image Entries, it is
- ; (for now) only called when a group entry has an image added to its multiple.
- ;
- ; TXT is "^" delimited string
- ; $P(1) is code ( see above ) $P(2) is DFN
- ; $P(3) is Image IEN $P(4) reserved for procedure
- ; $P(5) reserved for time-stamp $P(6) is Vrad Image Count
- ; $P(7) is Vrad Patient Count
- ; $P(8) is Vrad User Type (1/0 = Rad/Non-Rad)
- ; $P(9) is Vrad REMOTE Read flag (1/0; 1=REMOTE)
- ; $P(TXT,"$$",2) is Tracking ID from an Imported Image. From this we compute Session #, to log actions.
- ; LOGTM - [1|0] Flag to indicate whether or not to log the time of the Action. Default = 0
- ; MAGSESS - Session IEN where the action should be logged. Default to MAGJOB("SESSION")
- ;
- N NODE,SESSIEN,MAGGFDA,MAGXERR,MAGXIEN,MAGPROC,LOGX,TRKID
- S LOGTM=$G(LOGTM)
- I TXT["$$" S TRKID=$P(TXT,"$$",2),TXT=$P(TXT,"$$",1)
- S SESSIEN=$S($G(MAGSESS):MAGSESS,$D(MAGJOB("SESSION")):MAGJOB("SESSION"),$G(TRKID)'="":$O(^MAG(2006.82,"E",TRKID,""),-1),1:0)
- I 'SESSIEN Q
- S NODE="+1,"_SESSIEN_","
- I $P(TXT,U,3) S MAGPROC=$P($G(^MAG(2005,$P(TXT,U,3),0)),U,8)
- ;
- I $P(TXT,U)="PAT" D
- . S Z=+$G(^MAG(2006.82,SESSIEN,1))+1
- . S MAGGFDA(2006.82,SESSIEN_",",10)=Z
- I $P(TXT,U)="IMG" D
- . S Z=+$P($G(^MAG(2006.82,SESSIEN,1)),U,2)+1
- . S MAGGFDA(2006.82,SESSIEN_",",11)=Z
- . D ENTRY^MAGLOG("IMGVW",DUZ,$P(TXT,"^",3),"Wrks",$P(TXT,"^",2),"1")
- . D ACCESS^MAGLOG($P(TXT,"^",3))
- I $E(TXT,1,3)="CAP" D
- . S Z=+$P($G(^MAG(2006.82,SESSIEN,1)),U,3)+1
- . S MAGGFDA(2006.82,SESSIEN_",",12)=Z
- . D ENTRY^MAGLOG("CAP",DUZ,$P(TXT,"^",3),"Wrks",$P(TXT,"^",2),"1")
- I $P(TXT,U,2) D
- . S MAGGFDA(2006.82,SESSIEN_",",5)=$P(TXT,U,2)
- I LOGTM D
- . S X=$$NOW^XLFDT
- . S $P(TXT,U,4)=$G(MAGPROC),$P(TXT,U,5)=$E(X,1,12)
- S MAGGFDA(2006.821,NODE,.01)=$P(TXT,"|",1)
- I $L(TXT,"|")>1 S MAGGFDA(2006.821,NODE,13)=$P(TXT,"|",2,99)
- D UPDATE^DIE("S","MAGGFDA","MAGXIEN","MAGXERR")
- Q
- NEWWRKS(MAGNAME,MAGLOC,MAGIEN) ;
- I $G(MAGNAME)="" Q
- N Y,MAGNFDA,MAGNIEN
- S MAGNFDA(2006.81,"+1,",.01)=MAGNAME
- S MAGNFDA(2006.81,"+1,",6)=$G(MAGLOC)
- D UPDATE^DIE("","MAGNFDA","MAGNIEN")
- S MAGIEN=MAGNIEN(1)
- Q
- LOGOFF(MAGRY) ;RPC [MAGG LOGOFF] Call when session is over.
- ; This updates session file with logoff time
- ; and marks the session closed.
- ;
- S MAGRY=1
- N MAGGFDA,MAGXERR,MAGXIEN,MAGIEN,MAGSESS,MAGEND,MAGCON
- ; The Imaging Workstation file keeps time of login
- ; We'll enter the logoff time ($$now^xlfdt) here.
- S X=$$NOW^XLFDT
- S MAGEND=$E(X,1,12)
- Q:'+$G(MAGJOB("WRKSIEN"))
- L -^MAG(2006.81,"LOCK",MAGJOB("WRKSIEN"))
- S MAGIEN=+MAGJOB("WRKSIEN")_","
- S MAGGFDA(2006.81,MAGIEN,3)=MAGEND ; logoff dttm
- S MAGGFDA(2006.81,MAGIEN,8)=0 ; Set job number to 0
- D UPDATE^DIE("S","MAGGFDA","MAGXIEN","MAGXERR")
- ;MAGJOB("WRKSIEN")
- Q:(+$G(MAGJOB("SESSION"))=0)
- S MAGSESS=+MAGJOB("SESSION")_","
- K MAGGFDA,MAGXERR,MAGXIEN
- S MAGGFDA(2006.82,MAGSESS,3)=MAGEND
- ; calculate the length of the session
- S MAGCON=""
- S MAGGFDA(2006.82,MAGSESS,14)=MAGCON
- D UPDATE^DIE("S","MAGGFDA","MAGXIEN","MAGXERR")
- D ACTION("LOGOFF^")
- ;
- Q
- RTRNERR(ETXT) ; There was error from UPDATE^DIE quit with error text
- S ETXT="0^ERROR "_MAGXERR("DIERR",1,"TEXT",1)
- Q
- --- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HMAGGTAU 11546 printed Jan 18, 2025@03:04:08 Page 2
- MAGGTAU ;WOIFO/GEK/SG - RPC Calls to update the IMAGING WINDOWS WORKSTATION file ; 7/17/08 3:39pm
- +1 ;;3.0;IMAGING;**7,16,8,59,93,138**;Mar 19, 2002;Build 5380;Sep 03, 2013
- +2 ;; Per VHA Directive 2004-038, this routine should not be modified.
- +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 ;; | 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
- +18 ;
- +19 ;***** UPDATES INFORMATIONS IN THE IMAGING WINDOWS WORKSTATION
- +20 ; RPC: MAGG WRKS UPDATES
- +21 ;
- +22 ; .MAGRY Reference to a local variable where the results
- +23 ; are returned to.
- +24 ;
- +25 ; DATA Data that should be stored in the IMAGING WINDOWS
- +26 ; WORKSTATION file (#2006.81):
- +27 ; ^01: Workstation name
- +28 ; ^02: Date/Time of Capture application (external)
- +29 ; ^03: Date/Time of Display application (external)
- +30 ; ^04: Location of the workstation
- +31 ; ^05: Date/Time of the MAGSETUP (external)
- +32 ; ^06: Version of the Display application
- +33 ; ^07: Version of the Capture application
- +34 ; ^08: Startup mode: 1 = Normal startup,
- +35 ; 2 = Started by CPRS, 3 = Import API
- +36 ; ^09: OS Version
- +37 ; ^10: VistaRad version
- +38 ; ---- Patch MAG*3*59 ----
- +39 ; ^11: RPCBroker server
- +40 ; ^12: RPCBroker port
- +41 ; ---- Patch MAG*3*93 ----
- +42 ; ^13: Clinical Utilities version
- +43 ; ^14: TeleReader version
- +44 ; ^15: Date/Time of the Clinical Utilities (external)
- +45 ; ^16: Date/Time of the TeleReader (external)
- +46 ; ^17: Date/Time of the VistaRad (external)
- +47 ;
- +48 ; Return Values
- +49 ; =============
- +50 ;
- +51 ; Zero value of the first '^'-piece of the MAGRY indicates that
- +52 ; an error occurred during the execution of the procedure. In this
- +53 ; case, the MAGRY is formatted as follows:
- +54 ;
- +55 ; MAGRY Result descriptor
- +56 ; ^01: 0
- +57 ; ^02: Error message (optional)
- +58 ;
- +59 ; Otherwise, first '^'-piece of the MAGRY contains the session
- +60 ; number (IEN in the IMAGING WINDOWS SESSIONS file (#2006.82)):
- +61 ;
- +62 ; MAGRY Result descriptor
- +63 ; ^01: Session IEN (file #2006.82)
- +64 ; ^02: Message
- +65 ;
- +66 ; Notes
- +67 ; =====
- +68 ;
- +69 ; This remote procedure is called after user login (local and remote
- +70 ; image view).
- +71 ;
- UPD(MAGRY,DATA) ;RPC [MAGG WRKS UPDATES]
- +1 NEW MAG0,MAGI,MAGIEN,MAGLOC,MAGMODE,MAGNAME,MAGOSVER,MAGPL
- +2 NEW MAGSRV,MAGSTART,MAGVERVR,MAGVERX,X,Y,Z
- +3 KILL MAGGFDA,MAGXERR,MAGXIEN
- +4 ;
- +5 SET MAGNAME=$PIECE(DATA,U,1)
- +6 SET MAGLOC=$PIECE(DATA,U,4)
- +7 if $PIECE(DATA,U,6)
- SET MAGJOB("DISPLAY")=""
- +8 if $PIECE(DATA,U,7)
- SET MAGJOB("CAPTURE")=""
- +9 SET MAGMODE=$PIECE(DATA,U,8)
- +10 SET MAGOSVER=$PIECE(DATA,U,9)
- +11 SET MAGVERVR=$PIECE(DATA,U,10)
- +12 if $PIECE(DATA,U,11)]""
- SET MAGJOB("RPCSERVER")=$PIECE(DATA,U,11)
- +13 if $PIECE(DATA,U,12)]""
- SET MAGJOB("RPCPORT")=$PIECE(DATA,U,12)
- +14 ;
- +15 SET MAGIEN=$SELECT($LENGTH(MAGNAME):$ORDER(^MAG(2006.81,"B",MAGNAME,"")),1:0)
- +16 IF 'MAGIEN
- DO NEWWRKS(MAGNAME,MAGLOC,.MAGIEN)
- +17 IF MAGIEN<1
- SET MAGRY="0^Workstation Not on file"
- QUIT
- +18 ;
- +19 ; '0' node for use later.
- SET MAG0=^MAG(2006.81,MAGIEN,0)
- +20 LOCK +^MAG(2006.81,"LOCK",MAGIEN):0
- +21 SET MAGIEN=+MAGIEN_","
- +22 ; Computer name
- SET MAGGFDA(2006.81,MAGIEN,.01)=MAGNAME
- +23 ; Delete logoff time for this job
- SET MAGGFDA(2006.81,MAGIEN,3)="@"
- +24 ; Location free text from .INI
- SET MAGGFDA(2006.81,MAGIEN,6)=MAGLOC
- +25 ; Active or not
- SET MAGGFDA(2006.81,MAGIEN,8)=1
- +26 ; Delete session pointer
- SET MAGGFDA(2006.81,MAGIEN,10)="@"
- +27 ; Reset the session error count
- SET MAGGFDA(2006.81,MAGIEN,11)="@"
- +28 ; Operating system version
- SET MAGGFDA(2006.81,MAGIEN,13)=MAGOSVER
- +29 ;
- +30 ;=== Process the client date/time values (MAG*3*93)
- +31 FOR MAGI="2^5.5","3^5","5^7","15^5.9","16^5.3","17^5.7"
- Begin DoDot:1
- +32 ;--- Convert date/time into internal format
- +33 SET %DT="T"
- SET X=$PIECE(DATA,U,+MAGI)
- DO ^%DT
- +34 SET $PIECE(DATA,U,+MAGI)=Y
- +35 ;--- Prepare the date/time for storage
- +36 if Y>-1
- SET MAGGFDA(2006.81,MAGIEN,$PIECE(MAGI,U,2))=Y
- +37 QUIT
- End DoDot:1
- +38 ;
- +39 ;=== Process the client version numbers (MAG*3*93)
- +40 SET MAGVERX=""
- +41 FOR MAGI="6^9","7^9.5","10^9.7","13^9.9","14^9.3"
- Begin DoDot:1
- +42 SET X=$PIECE(DATA,U,+MAGI)
- if X=""
- QUIT
- +43 ;--- Prepare the version number for storage
- +44 SET MAGGFDA(2006.81,MAGIEN,$PIECE(MAGI,U,2))=X
- +45 ;--- Whatever application calls, we'll use that version (MAG*3*8)
- +46 if MAGVERX=""
- SET MAGVERX=X
- +47 QUIT
- End DoDot:1
- +48 ;
- +49 SET X=$PIECE(MAG0,U,12)
- +50 ; Sess count for wrks.
- SET MAGGFDA(2006.81,MAGIEN,12)=X+1
- +51 ; Keep PLACE that this wrks logged in.
- +52 ; DBI
- SET MAGPL=$SELECT($GET(DUZ(2)):+$$PLACE^MAGBAPI(DUZ(2)),1:0)
- +53 ; DBI
- if MAGPL
- SET MAGGFDA(2006.81,MAGIEN,.04)=MAGPL
- +54 ;
- +55 SET MAGSTART=$EXTRACT($$NOW^XLFDT,1,12)
- +56 IF $GET(DUZ)
- Begin DoDot:1
- +57 SET MAGGFDA(2006.81,MAGIEN,1)=DUZ
- +58 SET MAGGFDA(2006.81,MAGIEN,2)=MAGSTART
- +59 QUIT
- End DoDot:1
- +60 ;
- +61 DO UPDATE^DIE("S","MAGGFDA","MAGXIEN","MAGXERR")
- +62 IF $DATA(DIERR)
- DO RTRNERR(.MAGRY)
- QUIT
- +63 ; The MAGJOB( array is used by Imaging routines that are
- +64 ; called from the Delphi App.
- +65 ;
- +66 SET MAGJOB("WRKSIEN")=+MAGIEN
- +67 SET MAGJOB("VERSION")=MAGVERX
- +68 SET MAGRY="1^"
- +69 ;
- +70 ; SESSION : Create new session entry
- +71 ; service/section
- DO GETS^DIQ(200,DUZ_",","29","I","Z","")
- +72 SET MAGSRV=$GET(Z(200,DUZ_",",29,"I"))
- +73 ;
- +74 KILL MAGGFDA,MAGXERR,MAGXIEN
- +75 ; User
- SET MAGGFDA(2006.82,"+1,",.01)=$PIECE(^VA(200,DUZ,0),U,1)
- +76 ; USER
- SET MAGGFDA(2006.82,"+1,",1)=DUZ
- +77 ; Sess Start Time
- SET MAGGFDA(2006.82,"+1,",2)=MAGSTART
- +78 ; Wrks
- SET MAGGFDA(2006.82,"+1,",4)=+MAGIEN
- +79 ; User's Service/Section
- SET MAGGFDA(2006.82,"+1,",7)=+MAGSRV
- +80 ; 1=normal 2= started by CPRS
- SET MAGGFDA(2006.82,"+1,",13)=MAGMODE
- +81 ; DBI - save the logon PLACE in the Session file.
- +82 ; User's Institution (Imaging site param entry)
- IF MAGPL
- SET MAGGFDA(2006.82,"+1,",.04)=MAGPL
- +83 ;
- +84 ; 3.0.8 new fields 9 Client Ver, 9.2 Host Version, 9.4 OS Version
- +85 ;
- SET MAGGFDA(2006.82,"+1,",9)=MAGVERX
- +86 ;
- SET MAGGFDA(2006.82,"+1,",9.2)=$$VERSION^XPDUTL("IMAGING")
- +87 ;
- SET MAGGFDA(2006.82,"+1,",9.4)=MAGOSVER
- +88 ;
- +89 DO UPDATE^DIE("","MAGGFDA","MAGXIEN","MAGXERR")
- +90 IF $DATA(DIERR)
- DO RTRNERR(.MAGRY)
- QUIT
- +91 SET MAGRY="1^"
- +92 IF '+MAGXIEN(1)
- SET MAGRY="0^"
- QUIT
- +93 SET MAGJOB("SESSION")=+MAGXIEN(1)
- +94 SET MAGRY=MAGJOB("SESSION")_"^Session # "_MAGJOB("SESSION")_" Started."
- +95 SET MAGGFDA(2006.81,+MAGIEN_",",10)=+MAGXIEN(1)
- +96 DO UPDATE^DIE("","MAGGFDA","MAGXIEN","MAGXERR")
- +97 DO ACTION("LOGON^")
- +98 QUIT
- LOGACT(MAGRY,ACTION) ;RPC [MAG3 LOGACTION]
- +1 ; Call to log actions for Imaging Session from
- +2 ; Delphi interface
- +3 DO ACTION(ACTION)
- +4 SET MAGRY="1^Action Logged"
- +5 QUIT
- ACTION(TXT,LOGTM,MAGSESS) ;Call to log actions for Imaging Workstation Session from other M routines
- +1 ; ACTIONS LOGGED
- +2 ; LOGON - Session StartTime LOGOFF - Session End Time
- +3 ; IMG - Image accessed PAT - Patient Accessed
- +4 ; CAP - Image Captured
- +5 ; DEL - Image Deleted MOD - Image entry modified
- +6 ; NOIMAGE- Image Entry moved to Audit file. No Image existed. ; p140
- +7 ; IMPORT - Import API has been called
- +8 ; Data - a node of data passed to Import API
- +9 ; Result - a node of the Result Array from Import API Processing.
- +10 ; Image - one of the Images (full path of import directory) that was imported.
- +11 ; PPACT - A Post processing Action has been processed.
- +12 ; VR-VW - VistaRad Exam displayed
- +13 ; VR-INT - VistaRad Exam interpreted
- +14 ; API - parameters sent to CP API, and the API Call i.e. ITIU-MDAPI
- +15 ; DFTINDX- If the index fields have no values, call to Patch 17 code to
- +16 ; generate the values for the fields.
- +17 ; MOD - This was intended to log Modifications to Image Entries, it is
- +18 ; (for now) only called when a group entry has an image added to its multiple.
- +19 ;
- +20 ; TXT is "^" delimited string
- +21 ; $P(1) is code ( see above ) $P(2) is DFN
- +22 ; $P(3) is Image IEN $P(4) reserved for procedure
- +23 ; $P(5) reserved for time-stamp $P(6) is Vrad Image Count
- +24 ; $P(7) is Vrad Patient Count
- +25 ; $P(8) is Vrad User Type (1/0 = Rad/Non-Rad)
- +26 ; $P(9) is Vrad REMOTE Read flag (1/0; 1=REMOTE)
- +27 ; $P(TXT,"$$",2) is Tracking ID from an Imported Image. From this we compute Session #, to log actions.
- +28 ; LOGTM - [1|0] Flag to indicate whether or not to log the time of the Action. Default = 0
- +29 ; MAGSESS - Session IEN where the action should be logged. Default to MAGJOB("SESSION")
- +30 ;
- +31 NEW NODE,SESSIEN,MAGGFDA,MAGXERR,MAGXIEN,MAGPROC,LOGX,TRKID
- +32 SET LOGTM=$GET(LOGTM)
- +33 IF TXT["$$"
- SET TRKID=$PIECE(TXT,"$$",2)
- SET TXT=$PIECE(TXT,"$$",1)
- +34 SET SESSIEN=$SELECT($GET(MAGSESS):MAGSESS,$DATA(MAGJOB("SESSION")):MAGJOB("SESSION"),$GET(TRKID)'="":$ORDER(^MAG(2006.82,"E",TRKID,""),-1),1:0)
- +35 IF 'SESSIEN
- QUIT
- +36 SET NODE="+1,"_SESSIEN_","
- +37 IF $PIECE(TXT,U,3)
- SET MAGPROC=$PIECE($GET(^MAG(2005,$PIECE(TXT,U,3),0)),U,8)
- +38 ;
- +39 IF $PIECE(TXT,U)="PAT"
- Begin DoDot:1
- +40 SET Z=+$GET(^MAG(2006.82,SESSIEN,1))+1
- +41 SET MAGGFDA(2006.82,SESSIEN_",",10)=Z
- End DoDot:1
- +42 IF $PIECE(TXT,U)="IMG"
- Begin DoDot:1
- +43 SET Z=+$PIECE($GET(^MAG(2006.82,SESSIEN,1)),U,2)+1
- +44 SET MAGGFDA(2006.82,SESSIEN_",",11)=Z
- +45 DO ENTRY^MAGLOG("IMGVW",DUZ,$PIECE(TXT,"^",3),"Wrks",$PIECE(TXT,"^",2),"1")
- +46 DO ACCESS^MAGLOG($PIECE(TXT,"^",3))
- End DoDot:1
- +47 IF $EXTRACT(TXT,1,3)="CAP"
- Begin DoDot:1
- +48 SET Z=+$PIECE($GET(^MAG(2006.82,SESSIEN,1)),U,3)+1
- +49 SET MAGGFDA(2006.82,SESSIEN_",",12)=Z
- +50 DO ENTRY^MAGLOG("CAP",DUZ,$PIECE(TXT,"^",3),"Wrks",$PIECE(TXT,"^",2),"1")
- End DoDot:1
- +51 IF $PIECE(TXT,U,2)
- Begin DoDot:1
- +52 SET MAGGFDA(2006.82,SESSIEN_",",5)=$PIECE(TXT,U,2)
- End DoDot:1
- +53 IF LOGTM
- Begin DoDot:1
- +54 SET X=$$NOW^XLFDT
- +55 SET $PIECE(TXT,U,4)=$GET(MAGPROC)
- SET $PIECE(TXT,U,5)=$EXTRACT(X,1,12)
- End DoDot:1
- +56 SET MAGGFDA(2006.821,NODE,.01)=$PIECE(TXT,"|",1)
- +57 IF $LENGTH(TXT,"|")>1
- SET MAGGFDA(2006.821,NODE,13)=$PIECE(TXT,"|",2,99)
- +58 DO UPDATE^DIE("S","MAGGFDA","MAGXIEN","MAGXERR")
- +59 QUIT
- NEWWRKS(MAGNAME,MAGLOC,MAGIEN) ;
- +1 IF $GET(MAGNAME)=""
- QUIT
- +2 NEW Y,MAGNFDA,MAGNIEN
- +3 SET MAGNFDA(2006.81,"+1,",.01)=MAGNAME
- +4 SET MAGNFDA(2006.81,"+1,",6)=$GET(MAGLOC)
- +5 DO UPDATE^DIE("","MAGNFDA","MAGNIEN")
- +6 SET MAGIEN=MAGNIEN(1)
- +7 QUIT
- LOGOFF(MAGRY) ;RPC [MAGG LOGOFF] Call when session is over.
- +1 ; This updates session file with logoff time
- +2 ; and marks the session closed.
- +3 ;
- +4 SET MAGRY=1
- +5 NEW MAGGFDA,MAGXERR,MAGXIEN,MAGIEN,MAGSESS,MAGEND,MAGCON
- +6 ; The Imaging Workstation file keeps time of login
- +7 ; We'll enter the logoff time ($$now^xlfdt) here.
- +8 SET X=$$NOW^XLFDT
- +9 SET MAGEND=$EXTRACT(X,1,12)
- +10 if '+$GET(MAGJOB("WRKSIEN"))
- QUIT
- +11 LOCK -^MAG(2006.81,"LOCK",MAGJOB("WRKSIEN"))
- +12 SET MAGIEN=+MAGJOB("WRKSIEN")_","
- +13 ; logoff dttm
- SET MAGGFDA(2006.81,MAGIEN,3)=MAGEND
- +14 ; Set job number to 0
- SET MAGGFDA(2006.81,MAGIEN,8)=0
- +15 DO UPDATE^DIE("S","MAGGFDA","MAGXIEN","MAGXERR")
- +16 ;MAGJOB("WRKSIEN")
- +17 if (+$GET(MAGJOB("SESSION"))=0)
- QUIT
- +18 SET MAGSESS=+MAGJOB("SESSION")_","
- +19 KILL MAGGFDA,MAGXERR,MAGXIEN
- +20 SET MAGGFDA(2006.82,MAGSESS,3)=MAGEND
- +21 ; calculate the length of the session
- +22 SET MAGCON=""
- +23 SET MAGGFDA(2006.82,MAGSESS,14)=MAGCON
- +24 DO UPDATE^DIE("S","MAGGFDA","MAGXIEN","MAGXERR")
- +25 DO ACTION("LOGOFF^")
- +26 ;
- +27 QUIT
- RTRNERR(ETXT) ; There was error from UPDATE^DIE quit with error text
- +1 SET ETXT="0^ERROR "_MAGXERR("DIERR",1,"TEXT",1)
- +2 QUIT