source: WorldVistAEHR/trunk/r/IMAGING-MAG-ZMAG/MAGGTRAI.m@ 1240

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

initial load of WorldVistAEHR

File size: 6.2 KB
RevLine 
[613]1MAGGTRAI ;WOIFO/GEK - list images for Radiology report ; [ 11/08/2001 17:18 ]
2 ;;3.0;IMAGING;**8**;Sep 15, 2004
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
19IMAGE(MAGZRY,DATA) ;RPC [MAGGRADIMAGE]
20 ; Call from selected entry in Rad Exam list.
21 ; INPUT is DATA, which is just what we sent in the list of Rad
22 ; Exams for the patient.
23 ;DATA is the Radiology values stored in ^TMP($J,"RAEX",x)
24 ; that the radiology procedure RAPTLU sets during the search
25 ; for patient exams. (see routine RAPTLU )
26 ; ^TMP($J,"RAEX",RACNT)=
27 ; RADFN_"^"_RADTI_"^"_RACNI_"^"_RANME_"^"_RASSN_"^"
28 ; _RADATE_"^"_RADTE_"^"_RACN_"^"_RAPRC_"^"_RARPT_"^"_RAST
29 ;
30 S MAGZRY=$NA(^TMP("MAGGTRAI",$J))
31 K @MAGZRY
32 IF $$NEWERR^%ZTER N $ETRAP,$ESTACK S $ETRAP="D ERRA^MAGGTERR"
33 E S X="ERRA^MAGGTERR",@^%ZOSF("TRAP")
34 N I,Y,CT,MAGIEN
35 ;
36 S DATA=$P(DATA,"^",7,99)
37 S CT=0
38 F I="RADFN","RADTI","RACNI","RANME","RASSN","RADATE","RADTE","RACN","RAPRC","RARPT","RAST" S CT=CT+1,@I=$P(DATA,"^",CT)
39 ; Patch 2.0.5 next few lines for Patient Safety
40 I RARPT["PMRAD" S @MAGZRY@(0)="-2^Patient Mismatch. Radiology Files" Q
41 I 'RARPT S @MAGZRY@(0)="0^No Report for selected exam." Q
42 I '$O(^RARPT(RARPT,2005,0)) S @MAGZRY@(0)="0^No Images for selected exam." Q
43 I $P($G(^RARPT(RARPT,0)),U,2)'=RADFN S @MAGZRY@(0)="-2^Patient Mismatch. Radiology Files" Q
44 D GETLIST
45 Q
46IMAGEC(MAGZRY,DATA) ;RPC [MAGG CPRS RAD EXAM]
47 ; Call to list Images for a Rad Exam that was selected from CPRS
48 ; and Imaging Window was notified via windows messaging
49 ; INPUT : DATA is in format of Windows message received from CPRS
50 ; example 'RPT^CPRS^29027^RA^i79029185.9998-1'
51 N DFN,RARPT,ENT,INVDTTM,INVDT,INVTM
52 S X=$$RTRNFMT^XWBLIB("GLOBAL ARRAY",1)
53 S MAGZRY=$NA(^TMP("MAGGTRAI",$J))
54 K @MAGZRY
55 S DFN=$P(DATA,U,3)
56 S ENT=$P($P(DATA,U,5),"-",2)
57 S INVDTTM=$P($P(DATA,U,5),"-",1)
58 S INVDT=$P(INVDTTM,".",1)
59 S INVTM=$P(INVDTTM,".",2)
60 F Q:($L(INVDT)<8) S INVDT=$E(INVDT,2,$L(INVDT))
61 S INVDTTM=INVDT_"."_INVTM
62 I '$D(^RADPT(DFN,"DT",INVDTTM,"P",ENT,0)) S @MAGZRY@(0)="0^INVALID Data : Attempt to access Exam failed." Q
63 ; Get out the Naked reference .
64 S RARPT=$P(^RADPT(DFN,"DT",INVDTTM,"P",ENT,0),U,17)
65 ;S RARPT=$P(^(0),U,17)
66 I 'RARPT S @MAGZRY@(0)="0^No Report for selected Exam" Q
67 ; MAGQI 8/22/01
68 I $P($G(^RARPT(RARPT,0)),U,2)'=DFN S @MAGZRY@(0)="-2^Patient Mismatch. Radiology File" Q
69 D GETLIST
70 N XINFO
71 S XINFO=$P(^RARPT(RARPT,0),U,1)
72 S X=$P(^RADPT(DFN,"DT",INVDTTM,"P",ENT,0),U,2)
73 S XINFO=XINFO_" "_$P(^RAMIS(71,X,0),U)
74 S X=$P(^RARPT(RARPT,0),U,3)
75 S XINFO=XINFO_" "_X
76 S $P(@MAGZRY@(0),U,3)=RARPT
77 S $P(@MAGZRY@(0),U,4)=XINFO
78 Q
79GETLIST ; Private call. From other points in this routine, when RARPT is defined
80 ; and returns a list in MAGZRY(1..n).
81 ; We'll make a tmp list of just the image IEN's
82 ; splitting groups into individual image entries.
83 ; If more than 1 Image group points to this report, we
84 ; will prefix the Image Description with (G1), (G2) etc
85 ; We call GROUP^MAGGTIG to get the images for the group, this call
86 ; sorts the images in Dicom Series, Dicom Image number order.
87 ;
88 K ^TMP("MAGGX",$J)
89 N OI,IGCT,MAGIEN1,ORDCT,GCT,MAGQI,MAGX
90 S (ORDCT,GCT,SINGCT)=0
91 S IGCT=+$P($G(^RARPT(RARPT,2005,0)),U,4)
92 ; Quit if no images for RARPT
93 I IGCT=0 S @MAGZRY@(0)="0^0 Images for Radiology Report." Q
94 ;
95 ; Check all Image entries in RARPT 2005 NODE. for Patient match Pointer match, from both
96 ; RARPT end, and Imaging end.
97 S MAGQI=1
98 S OI=0,CT=1 F S OI=$O(^RARPT(RARPT,2005,OI)) Q:'OI D Q:(MAGQI<1)
99 . S MAGIEN1=$P(^RARPT(RARPT,2005,OI,0),U)
100 . ; Assure magdfn = rarpt dfn
101 . I $P($G(^RARPT(RARPT,0)),U,2)'=$P($G(^MAG(2005,MAGIEN1,0)),U,7) S MAGQI="-2^Patient Mismatch. Radiology Report" Q
102 . ; Assure magien1 is pointing to this rarpt
103 . I $P($G(^MAG(2005,MAGIEN1,2)),U,7)'=RARPT S MAGQI="-2^Pointer Mismatch. Radiology Report" Q
104 . ; Now run the Imaging integrity check
105 . D CHK^MAGGSQI(.MAGX,MAGIEN1) I 'MAGX(0) S MAGQI="-2^"_$P(MAGX(0),U,2,99) Q
106 ;
107 I MAGQI<1 S @MAGZRY@(0)=MAGQI Q
108 S CT=0
109 ;
110 S OI=0,CT=1 F S OI=$O(^RARPT(RARPT,2005,OI)) Q:'OI D
111 . S MAGIEN1=$P(^RARPT(RARPT,2005,OI,0),U) D ONELIST
112 ;
113 ; Now get the list from the TMP LIST and return it.
114 I '$D(^TMP("MAGGX",$J)) S @MAGZRY@(0)="0^Report "_RARPT_": has INVALID Image Pointers" Q
115 S CT=0
116 S MAGQUIET=1
117 S I="",J="",K=""
118 F S I=$O(^TMP("MAGGX",$J,I)) Q:I="" D
119 . S J=""
120 . F S J=$O(^TMP("MAGGX",$J,I,J)) Q:J="" D
121 . . S K=""
122 . . F S K=$O(^TMP("MAGGX",$J,I,J,K)) Q:K="" D
123 . . . S CT=CT+1
124 . . . S X="["_J_"]"_$P(^TMP("MAGGX",$J,I,J,K),U,8)
125 . . . S $P(^TMP("MAGGX",$J,I,J,K),U,8)=X
126 . . . S @MAGZRY@(CT)=^TMP("MAGGX",$J,I,J,K)
127 K MAGQUIET
128 S @MAGZRY@(0)=CT_"^Images for the selected Radiology Exam"
129 ; Redesign needed for Multiple Image Groups pointing to an exam or note.
130 ; we now put all images from all groups in one list.
131 S $P(@MAGZRY@(0),U,5)=$G(MAGIEN1) ; this was last ien from multiple Image Groups.
132 ;
133 Q
134ONELIST ; Private Call from other parts of this routine.
135 N MAGTMP
136 Q:'$D(^MAG(2005,MAGIEN1,0))
137 ; if a single image just get record for that IEN
138 I '$O(^MAG(2005,MAGIEN1,1,0)) D Q
139 . S MAGXX=MAGIEN1 D INFO^MAGGTII
140 . S ORDCT=ORDCT+1,SINGCT=SINGCT+1
141 . S ^TMP("MAGGX",$J,ORDCT,"S",SINGCT)="B2^"_MAGFILE
142 D GROUP^MAGGTIG(.MAGTMP,MAGIEN1) I $P(@MAGTMP@(0),U,2)>0 D
143 . S ORDCT=ORDCT+1,GCT=GCT+1,X="G"_GCT
144 . K @MAGTMP@(0)
145 . M ^TMP("MAGGX",$J,ORDCT,X)=@MAGTMP
146 Q
Note: See TracBrowser for help on using the repository browser.