source: FOIAVistA/trunk/r/IMAGING-MAG-ZMAG/MAGDTR04.m@ 1123

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

initial load of FOIAVistA 6/30/08 version

File size: 4.2 KB
Line 
1MAGDTR04 ;WOIFO/PMK - Read a DICOM image file ; 13 Feb 2007 11:36 AM
2 ;;3.0;IMAGING;**46**;16-February-2007;;Build 1023
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 ;; | 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 ;;
18LOCK(RETURN,UNREAD,LOCKFLAG,FULLNAME,INITIALS,DUZACQ,DUZREAD,DUZREAD2) ; RPC = MAG DICOM CON UNREADLIST LOCK
19 N ACQSITE,LISTDATA,IPROCIDX,ISPECIDX,STATUS,X
20 S DUZACQ=DUZ ; DUZ at the acquisition site is the DUZ for the RPC
21 S STATUS=""
22 ;
23 I '$G(UNREAD) D
24 . S RETURN="-1|No UNREAD parameter set"
25 . Q
26 ;
27 E I '$D(^MAG(2006.5849,UNREAD,0)) D
28 . S RETURN="-2|UNREAD parameter wrong -- ^MAG(2006.5849,"_UNREAD_",0) is undefined"
29 . Q
30 ;
31 E D ; try to lock or unlock the study
32 . S LISTDATA=^MAG(2006.5849,UNREAD,0)
33 . S ACQSITE=$P(LISTDATA,"^",2),ISPECIDX=$P(LISTDATA,"^",3)
34 . S IPROCIDX=$P(LISTDATA,"^",4),STATUS=$P(LISTDATA,"^",11)
35 . I $G(LOCKFLAG) D ; try to lock the study
36 . . I STATUS="U" D
37 . . . S (STATUS,$P(^MAG(2006.5849,UNREAD,0),"^",11))="L"
38 . . . K ^MAG(2006.5849,"D",ACQSITE,ISPECIDX,IPROCIDX,"U",UNREAD)
39 . . . S ^MAG(2006.5849,"D",ACQSITE,ISPECIDX,IPROCIDX,"L",UNREAD)=""
40 . . . S X=FULLNAME_"^"_INITIALS_"^"_DUZACQ_"^"_DUZREAD_"^"_DUZREAD2
41 . . . S $P(^MAG(2006.5849,UNREAD,0),"^",12,16)=X ; reader identification
42 . . . S X=$$TIMESTMP^MAGDTR02(UNREAD) ; update time stamp piece of last activity
43 . . . S $P(^MAG(2006.5849,UNREAD,0),"^",17,18)=X_"^" ; start reading timestamp
44 . . . S RETURN="0|Successful Lock"
45 . . . Q
46 . . E I STATUS="L" D
47 . . . I $P(^MAG(2006.5849,UNREAD,0),"^",12)=FULLNAME D
48 . . . . S RETURN="1|Already locked by same user"
49 . . . . Q
50 . . . E D
51 . . . . S RETURN="-3|Already locked by a different user"
52 . . . . Q
53 . . . Q
54 . . E I STATUS?1"R".E D
55 . . . S RETURN="-4|Already resulted and can't be locked"
56 . . . Q
57 . . E I STATUS?1"C".E D
58 . . . S RETURN="-5|Already cancelled and can't be locked"
59 . . . Q
60 . . E I STATUS?1"W".E D
61 . . . S RETURN="-6|Waiting and can't be locked"
62 . . . Q
63 . . E D
64 . . . S RETURN="-7|Can't be locked because of Unknown Status"
65 . . . Q
66 . . Q
67 . ;
68 . E D ; try to unlock the study
69 . . I STATUS="L" D
70 . . . I $P(^MAG(2006.5849,UNREAD,0),"^",12)=FULLNAME D
71 . . . . D UNLOCK(UNREAD,.STATUS)
72 . . . . S RETURN="0|Successful Unlock"
73 . . . . Q
74 . . . E D
75 . . . . S RETURN="-8|Locked by different user, can't be unlocked"
76 . . . . Q
77 . . . Q
78 . . E I STATUS="U" D
79 . . . S RETURN="2|Already unlocked"
80 . . . Q
81 . . E I STATUS?1"R".E D
82 . . . S RETURN="-9|Already resulted and can't be unlocked"
83 . . . Q
84 . . E I STATUS?1"C".E D
85 . . . S RETURN="-10|Already cancelled and can't be unlocked"
86 . . . Q
87 . . E I STATUS?1"W".E D
88 . . . S RETURN="-11|Waiting and can't be unlocked"
89 . . . Q
90 . . E D
91 . . . S RETURN="-12|Can't be unlocked because of Unknown Status"
92 . . . Q
93 . . Q
94 . Q
95 S RETURN=RETURN_"|"_STATUS
96 Q
97 ;
98UNLOCK(UNREAD,STATUS) ; unlock the study - called by ^MAGDTR06
99 N ACQSITE,LISTDATA,IPROCIDX,ISPECIDX,X
100 S LISTDATA=^MAG(2006.5849,UNREAD,0)
101 S ACQSITE=$P(LISTDATA,"^",2),ISPECIDX=$P(LISTDATA,"^",3)
102 S IPROCIDX=$P(LISTDATA,"^",4)
103 S (STATUS,$P(^MAG(2006.5849,UNREAD,0),"^",11))="U"
104 K ^MAG(2006.5849,"D",ACQSITE,ISPECIDX,IPROCIDX,"L",UNREAD)
105 S ^MAG(2006.5849,"D",ACQSITE,ISPECIDX,IPROCIDX,"U",UNREAD)=""
106 S X=$$TIMESTMP^MAGDTR02(UNREAD) ; update time stamp piece of last activity
107 S $P(^MAG(2006.5849,UNREAD,0),"^",12,18)="^^^^^^"
108 Q
Note: See TracBrowser for help on using the repository browser.