source: FOIAVistA/trunk/r/IMAGING-MAG-ZMAG/MAGGTRA1.m@ 1590

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

initial load of FOIAVistA 6/30/08 version

File size: 3.6 KB
Line 
1MAGGTRA1 ;WOIFO/GEK - RPC Call to list Patient's Rad/Nuc Exams, Reports ; [ 11/08/2001 17:18 ]
2 ;;3.0;IMAGING;;Mar 01, 2002
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
19LIST(MAGRY,DATA) ; RPC Call MAGGRADLIST
20 ;MAGRY - the return array of patient's exams.
21 ;DATA - DFN ^ begining date ^ end date ^ number to return
22 ; (only DFN is being sent for now. later we'll enable date
23 ; ranges and/or counts )
24 ;
25 IF $$NEWERR^%ZTER N $ETRAP,$ESTACK S $ETRAP="D ERRA^MAGGTERR"
26 E S X="ERRA^MAGGTERR",@^%ZOSF("TRAP")
27 ;
28 N X,Y,Z,I,J,K,MAGNAME,MAGDFN,MAGCNT,MAGBDT,MAGEDT,MAGEXN
29 S MAGDFN=+DATA
30 S MAGNAME=$P($G(^DPT(MAGDFN,0)),U)
31 I MAGNAME="" S MAGRY(0)="0^INVALID Patient ID" Q
32 ; We have to account for old Wrkstation code that was returning a
33 ; 1 as second piece.
34 I $P(DATA,U,2)=1 S $P(DATA,U,2)=""
35 ; Set default Begin,End dates and number to return
36 S MAGBDT=$S($P(DATA,U,2):$P(DATA,U,2),1:"1070101")
37 S MAGEDT=$S($P(DATA,U,3):$P(DATA,U,3),1:$$DT^XLFDT)
38 S MAGEXN=$S($P(DATA,U,4):$P(DATA,U,4),1:200)
39 S MAGRY(0)="0^Compiling list of Radiology Exams..."
40 ;
41 D EN1^RAO7PC1(MAGDFN,MAGBDT,MAGEDT,MAGEXN)
42 I '$D(^TMP($J,"RAE1")) S MAGRY(0)="0^No Radiology Exams for "_MAGNAME Q
43 ;
44 ; we'll return MAGRY(0) = return count^message
45 ; MAGRY(1)=column heading^column heading^column h.....
46 ; MAGRY(2..n)=info from exam.
47 D CONVERT
48 S MAGRY(0)=MAGCNT-1_"^Radiology Exams: "_MAGNAME
49 S MAGRY(1)="#^Day-Case^Procedure^Exam Date^Exam status / Report status^Imaging Loc"
50 Q
51CONVERT ; Convert the ^TMP($J,"RAE1",MAGDFN to our output array.
52 N XRPT
53 S MAGCNT=1
54 S I=0 F S I=$O(^TMP($J,"RAE1",MAGDFN,I)) Q:'I D
55 . S MAGCNT=MAGCNT+1
56 . S J=^TMP($J,"RAE1",MAGDFN,I) ; Changed to full reference /gek
57 . S X=9999999.9999-$P(I,"-"),X=$E(X,4,7)_$E(X,2,3)
58 . ; Y2K not needed on day-case - Rad uses as string variable.
59 . ; 1 # 2 day-case 3 desc
60 . S Z=MAGCNT-1_U_X_"-"_$P(J,"^",2)_U_$P(J,U)_U
61 . S X=9999999.9999-$P(I,"-")
62 . ; 4 date
63 . S Z=Z_$E(X,4,5)_"/"_$E(X,6,7)_"/"_(1700+$E(X,1,3))_U
64 . ; 5 EXAM status / Report status
65 . S Z=Z_$P($P(J,U,6),"~",2)_" / "_$P(J,U,3)_U
66 . S K=$$FMTE^XLFDT(X,"1P")
67 . ; 6 image loc 7 dfn 8 invrs dt 9 case # 10 11 12 output date
68 . S Z=Z_$P(J,U,7)_U_MAGDFN_U_$P(I,"-")_U_$P(I,"-",2)_U_U_U_K_U
69 . ; 13 intdt 14 RACN 16 rarpt
70 . S Z=Z_X_U_$P(J,U,2)_U_U_$P(J,U,5)_U_U
71 . S XRPT=$P(J,U,5) I XRPT I $P($G(^RARPT(XRPT,0)),U,2)'=MAGDFN D
72 . . S $P(Z,U,16)=XRPT_"PMRAD"
73 . . S $P(Z,U,5)="Patient Mismatch. Radiology Files"
74 . ; If this report has images, we'll display "(I)"
75 . I $O(^RARPT(+$P(J,U,5),2005,0)) S $P(Z,U,5)=$P(Z,U,5)_" (I)"
76 . ;
77 . S MAGRY(MAGCNT)=Z
78 Q
Note: See TracBrowser for help on using the repository browser.