MAGDTR04 ;WOIFO/PMK/NST - Read a DICOM image file ; 13 Feb 2007 11:36 AM
;;3.0;IMAGING;**46,127**;Mar 19, 2002;Build 4231;Apr 01, 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. |
;; +---------------------------------------------------------------+
;;
LOCK(RETURN,UNREAD,LOCKFLAG,FULLNAME,INITIALS,DUZACQ,DUZREAD,DUZREAD2,DUZRDSTN) ; RPC = MAG DICOM CON UNREADLIST LOCK
;
; DUZREAD -- User's DUZ at the Reading Site
; DUZREAD2 -- DIC(4) pointer to Reading Site
; DUZRDSTN -- Station Number to Reading Site
;
; DUZRDSTN (Station Number, e.g. 660AA) and DUZREAD2 (IEN in INSTITUTION file (#4), e.g. 6001) describe same site
;
; Cannot switch to Station Number only. Old GUI clients, before P127, send only Site IEN
S DUZREAD2=$$SITEIEN^MAGDTR05($G(DUZREAD2),$G(DUZRDSTN)) ; Use Station number to get IEN of the site
N ACQSITE,LISTDATA,IPROCIDX,ISPECIDX,STATUS,X
S DUZACQ=DUZ ; DUZ at the acquisition site is the DUZ for the RPC
S STATUS=""
;
I '$G(UNREAD) D
. S RETURN="-1|No UNREAD parameter set"
. Q
;
E I '$D(^MAG(2006.5849,UNREAD,0)) D
. S RETURN="-2|UNREAD parameter wrong -- ^MAG(2006.5849,"_UNREAD_",0) is undefined"
. Q
;
E D ; try to lock or unlock the study
. S LISTDATA=^MAG(2006.5849,UNREAD,0)
. S ACQSITE=$P(LISTDATA,"^",2),ISPECIDX=$P(LISTDATA,"^",3)
. S IPROCIDX=$P(LISTDATA,"^",4),STATUS=$P(LISTDATA,"^",11)
. I $G(LOCKFLAG) D ; try to lock the study
. . I STATUS="U" D
. . . S (STATUS,$P(^MAG(2006.5849,UNREAD,0),"^",11))="L"
. . . K ^MAG(2006.5849,"D",ACQSITE,ISPECIDX,IPROCIDX,"U",UNREAD)
. . . S ^MAG(2006.5849,"D",ACQSITE,ISPECIDX,IPROCIDX,"L",UNREAD)=""
. . . S X=FULLNAME_"^"_INITIALS_"^"_DUZACQ_"^"_DUZREAD_"^"_DUZREAD2
. . . S $P(^MAG(2006.5849,UNREAD,0),"^",12,16)=X ; reader identification
. . . S X=$$TIMESTMP^MAGDTR02(UNREAD) ; update time stamp piece of last activity
. . . S $P(^MAG(2006.5849,UNREAD,0),"^",17,18)=X_"^" ; start reading timestamp
. . . S RETURN="0|Successful Lock"
. . . Q
. . E I STATUS="L" D
. . . I $P(^MAG(2006.5849,UNREAD,0),"^",12)=FULLNAME D
. . . . S RETURN="1|Already locked by same user"
. . . . Q
. . . E D
. . . . S RETURN="-3|Already locked by a different user"
. . . . Q
. . . Q
. . E I STATUS?1"R".E D
. . . S RETURN="-4|Already resulted and can't be locked"
. . . Q
. . E I STATUS?1"C".E D
. . . S RETURN="-5|Already cancelled and can't be locked"
. . . Q
. . E I STATUS?1"W".E D
. . . S RETURN="-6|Waiting and can't be locked"
. . . Q
. . E D
. . . S RETURN="-7|Can't be locked because of Unknown Status"
. . . Q
. . Q
. ;
. E D ; try to unlock the study
. . I STATUS="L" D
. . . I $P(^MAG(2006.5849,UNREAD,0),"^",12)=FULLNAME D
. . . . D UNLOCK(UNREAD,.STATUS)
. . . . S RETURN="0|Successful Unlock"
. . . . Q
. . . E D
. . . . S RETURN="-8|Locked by different user, can't be unlocked"
. . . . Q
. . . Q
. . E I STATUS="U" D
. . . S RETURN="2|Already unlocked"
. . . Q
. . E I STATUS?1"R".E D
. . . S RETURN="-9|Already resulted and can't be unlocked"
. . . Q
. . E I STATUS?1"C".E D
. . . S RETURN="-10|Already cancelled and can't be unlocked"
. . . Q
. . E I STATUS?1"W".E D
. . . S RETURN="-11|Waiting and can't be unlocked"
. . . Q
. . E D
. . . S RETURN="-12|Can't be unlocked because of Unknown Status"
. . . Q
. . Q
. Q
S RETURN=RETURN_"|"_STATUS
Q
;
UNLOCK(UNREAD,STATUS) ; unlock the study - called by ^MAGDTR06
N ACQSITE,LISTDATA,IPROCIDX,ISPECIDX,X
S LISTDATA=^MAG(2006.5849,UNREAD,0)
S ACQSITE=$P(LISTDATA,"^",2),ISPECIDX=$P(LISTDATA,"^",3)
S IPROCIDX=$P(LISTDATA,"^",4)
S (STATUS,$P(^MAG(2006.5849,UNREAD,0),"^",11))="U"
K ^MAG(2006.5849,"D",ACQSITE,ISPECIDX,IPROCIDX,"L",UNREAD)
S ^MAG(2006.5849,"D",ACQSITE,ISPECIDX,IPROCIDX,"U",UNREAD)=""
S X=$$TIMESTMP^MAGDTR02(UNREAD) ; update time stamp piece of last activity
S $P(^MAG(2006.5849,UNREAD,0),"^",12,18)="^^^^^^"
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HMAGDTR04 4849 printed Nov 22, 2024@17:12:17 Page 2
MAGDTR04 ;WOIFO/PMK/NST - Read a DICOM image file ; 13 Feb 2007 11:36 AM
+1 ;;3.0;IMAGING;**46,127**;Mar 19, 2002;Build 4231;Apr 01, 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 ;;
LOCK(RETURN,UNREAD,LOCKFLAG,FULLNAME,INITIALS,DUZACQ,DUZREAD,DUZREAD2,DUZRDSTN) ; RPC = MAG DICOM CON UNREADLIST LOCK
+1 ;
+2 ; DUZREAD -- User's DUZ at the Reading Site
+3 ; DUZREAD2 -- DIC(4) pointer to Reading Site
+4 ; DUZRDSTN -- Station Number to Reading Site
+5 ;
+6 ; DUZRDSTN (Station Number, e.g. 660AA) and DUZREAD2 (IEN in INSTITUTION file (#4), e.g. 6001) describe same site
+7 ;
+8 ; Cannot switch to Station Number only. Old GUI clients, before P127, send only Site IEN
+9 ; Use Station number to get IEN of the site
SET DUZREAD2=$$SITEIEN^MAGDTR05($GET(DUZREAD2),$GET(DUZRDSTN))
+10 NEW ACQSITE,LISTDATA,IPROCIDX,ISPECIDX,STATUS,X
+11 ; DUZ at the acquisition site is the DUZ for the RPC
SET DUZACQ=DUZ
+12 SET STATUS=""
+13 ;
+14 IF '$GET(UNREAD)
Begin DoDot:1
+15 SET RETURN="-1|No UNREAD parameter set"
+16 QUIT
End DoDot:1
+17 ;
+18 IF '$TEST
IF '$DATA(^MAG(2006.5849,UNREAD,0))
Begin DoDot:1
+19 SET RETURN="-2|UNREAD parameter wrong -- ^MAG(2006.5849,"_UNREAD_",0) is undefined"
+20 QUIT
End DoDot:1
+21 ;
+22 ; try to lock or unlock the study
IF '$TEST
Begin DoDot:1
+23 SET LISTDATA=^MAG(2006.5849,UNREAD,0)
+24 SET ACQSITE=$PIECE(LISTDATA,"^",2)
SET ISPECIDX=$PIECE(LISTDATA,"^",3)
+25 SET IPROCIDX=$PIECE(LISTDATA,"^",4)
SET STATUS=$PIECE(LISTDATA,"^",11)
+26 ; try to lock the study
IF $GET(LOCKFLAG)
Begin DoDot:2
+27 IF STATUS="U"
Begin DoDot:3
+28 SET (STATUS,$PIECE(^MAG(2006.5849,UNREAD,0),"^",11))="L"
+29 KILL ^MAG(2006.5849,"D",ACQSITE,ISPECIDX,IPROCIDX,"U",UNREAD)
+30 SET ^MAG(2006.5849,"D",ACQSITE,ISPECIDX,IPROCIDX,"L",UNREAD)=""
+31 SET X=FULLNAME_"^"_INITIALS_"^"_DUZACQ_"^"_DUZREAD_"^"_DUZREAD2
+32 ; reader identification
SET $PIECE(^MAG(2006.5849,UNREAD,0),"^",12,16)=X
+33 ; update time stamp piece of last activity
SET X=$$TIMESTMP^MAGDTR02(UNREAD)
+34 ; start reading timestamp
SET $PIECE(^MAG(2006.5849,UNREAD,0),"^",17,18)=X_"^"
+35 SET RETURN="0|Successful Lock"
+36 QUIT
End DoDot:3
+37 IF '$TEST
IF STATUS="L"
Begin DoDot:3
+38 IF $PIECE(^MAG(2006.5849,UNREAD,0),"^",12)=FULLNAME
Begin DoDot:4
+39 SET RETURN="1|Already locked by same user"
+40 QUIT
End DoDot:4
+41 IF '$TEST
Begin DoDot:4
+42 SET RETURN="-3|Already locked by a different user"
+43 QUIT
End DoDot:4
+44 QUIT
End DoDot:3
+45 IF '$TEST
IF STATUS?1"R".E
Begin DoDot:3
+46 SET RETURN="-4|Already resulted and can't be locked"
+47 QUIT
End DoDot:3
+48 IF '$TEST
IF STATUS?1"C".E
Begin DoDot:3
+49 SET RETURN="-5|Already cancelled and can't be locked"
+50 QUIT
End DoDot:3
+51 IF '$TEST
IF STATUS?1"W".E
Begin DoDot:3
+52 SET RETURN="-6|Waiting and can't be locked"
+53 QUIT
End DoDot:3
+54 IF '$TEST
Begin DoDot:3
+55 SET RETURN="-7|Can't be locked because of Unknown Status"
+56 QUIT
End DoDot:3
+57 QUIT
End DoDot:2
+58 ;
+59 ; try to unlock the study
IF '$TEST
Begin DoDot:2
+60 IF STATUS="L"
Begin DoDot:3
+61 IF $PIECE(^MAG(2006.5849,UNREAD,0),"^",12)=FULLNAME
Begin DoDot:4
+62 DO UNLOCK(UNREAD,.STATUS)
+63 SET RETURN="0|Successful Unlock"
+64 QUIT
End DoDot:4
+65 IF '$TEST
Begin DoDot:4
+66 SET RETURN="-8|Locked by different user, can't be unlocked"
+67 QUIT
End DoDot:4
+68 QUIT
End DoDot:3
+69 IF '$TEST
IF STATUS="U"
Begin DoDot:3
+70 SET RETURN="2|Already unlocked"
+71 QUIT
End DoDot:3
+72 IF '$TEST
IF STATUS?1"R".E
Begin DoDot:3
+73 SET RETURN="-9|Already resulted and can't be unlocked"
+74 QUIT
End DoDot:3
+75 IF '$TEST
IF STATUS?1"C".E
Begin DoDot:3
+76 SET RETURN="-10|Already cancelled and can't be unlocked"
+77 QUIT
End DoDot:3
+78 IF '$TEST
IF STATUS?1"W".E
Begin DoDot:3
+79 SET RETURN="-11|Waiting and can't be unlocked"
+80 QUIT
End DoDot:3
+81 IF '$TEST
Begin DoDot:3
+82 SET RETURN="-12|Can't be unlocked because of Unknown Status"
+83 QUIT
End DoDot:3
+84 QUIT
End DoDot:2
+85 QUIT
End DoDot:1
+86 SET RETURN=RETURN_"|"_STATUS
+87 QUIT
+88 ;
UNLOCK(UNREAD,STATUS) ; unlock the study - called by ^MAGDTR06
+1 NEW ACQSITE,LISTDATA,IPROCIDX,ISPECIDX,X
+2 SET LISTDATA=^MAG(2006.5849,UNREAD,0)
+3 SET ACQSITE=$PIECE(LISTDATA,"^",2)
SET ISPECIDX=$PIECE(LISTDATA,"^",3)
+4 SET IPROCIDX=$PIECE(LISTDATA,"^",4)
+5 SET (STATUS,$PIECE(^MAG(2006.5849,UNREAD,0),"^",11))="U"
+6 KILL ^MAG(2006.5849,"D",ACQSITE,ISPECIDX,IPROCIDX,"L",UNREAD)
+7 SET ^MAG(2006.5849,"D",ACQSITE,ISPECIDX,IPROCIDX,"U",UNREAD)=""
+8 ; update time stamp piece of last activity
SET X=$$TIMESTMP^MAGDTR02(UNREAD)
+9 SET $PIECE(^MAG(2006.5849,UNREAD,0),"^",12,18)="^^^^^^"
+10 QUIT