source: FOIAVistA/trunk/r/IMAGING-MAG-ZMAG/MAGGTSR.m@ 731

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

initial load of FOIAVistA 6/30/08 version

File size: 4.5 KB
Line 
1MAGGTSR ;WOIFO/GEK - SURGERY CASE LIST ; [ 06/20/2001 08:57 ]
2 ;;3.0;IMAGING;**8,59**;Nov 27, 2007;Build 20
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 ;; | |
12 ;; | The Food and Drug Administration classifies this software as |
13 ;; | a medical device. As such, it may not be changed in any way. |
14 ;; | Modifications to this software may result in an adulterated |
15 ;; | medical device under 21CFR820, the use of which is considered |
16 ;; | to be a violation of US Federal Statutes. |
17 ;; +---------------------------------------------------------------+
18 ;;
19 Q
20GET(MAGRY,MAGDFN,DATA) ;RPC [MAGGSUR GET]
21 ; Call to get list of Patient Surgery procedures
22 ; MAGDFN = Patient DFN
23 ; DATA = For Future Use.
24 N $ETRAP,$ESTACK S $ETRAP="D ERRA^MAGGTERR"
25 N Y,NAME,AI,CASES,SDAT,DTX,SRFDA
26 K ^TMP($J,"MAGGTSR")
27 S NAME=$P($G(^DPT(MAGDFN,0)),U) I NAME="" S MAGRY(0)="0^INVALID Patient ID" Q
28 ; This is the Old Call we have always made. Doesn't have Non-OR
29 D GET^SROGTSR(.MAGRY,MAGDFN)
30 I 'MAGRY(0) S MAGRY(0)=MAGRY(0)_" for "_NAME G C1
31 ; Image count is for future use by Display
32 S MAGRY(1)="#^Date^Case description^Case #^Images"
33 S I=1 F S I=$O(MAGRY(I)) Q:'I D
34 . S DTX=$$FMTE^XLFDT($P(MAGRY(I),U,5),"5MZ")
35 . S ^TMP($J,"MAGGTSR",$P(MAGRY(I),U,5),$P(MAGRY(I),U,4))=DTX_"^"_$P(MAGRY(I),U,3)_"^"_$P(MAGRY(I),"^",4)_"^"_$P(MAGRY(I),U,6)_U_"|"_$P(MAGRY(I),U,4,5)_U
36 ;
37 ;This is the New Call, which has Non-OR, but doesn't have (Scheduled) so we merge the two calls.
38C1 D LIST^SROESTV(.CASES,MAGDFN)
39 I '$D(@CASES) G E1
40 S MAGRY(0)="1^"
41 S MAGRY(1)="#^Date^Case description^Case #^Images"
42 S I=0 F S I=$O(@CASES@(I)) Q:'I D
43 . S SDAT=@CASES@(I)
44 . ; SDAT = SURIEN ^ SURDESC ^ SURDT ^ DFN;NAME ^
45 . I $D(^TMP($J,"MAGGTSR",$P(SDAT,U,3),$P(SDAT,U,1))) Q
46 . S ^TMP($J,"MAGGTSR",$P(SDAT,U,3),$P(SDAT,U,1))=$$FMTE^XLFDT($P(SDAT,U,3),"5MZ")_U_$P(SDAT,U,2)_U_$P(SDAT,U,1)_U_$$IMGCT($P(SDAT,U,1))_U_"|"_$P(SDAT,U,1)_U_$P(SDAT,U,3)_U
47 . Q
48 ;
49 ; Now Returned the Merged List of the results of Old Call, with Results of New Call.
50E1 ;
51 I '$D(^TMP($J,"MAGGTSR")) S MAGRY(0)="0^No Cases for "_$G(NAME) Q
52 S I=1,DTX=0,SRFDA=0
53 F S DTX=$O(^TMP($J,"MAGGTSR",DTX)) Q:'DTX D
54 . S SRFDA="" F S SRFDA=$O(^TMP($J,"MAGGTSR",DTX,SRFDA),-1) Q:'SRFDA D
55 . . S I=I+1,MAGRY(I)=I-1_"^"_^TMP($J,"MAGGTSR",DTX,SRFDA)
56 . . Q
57 . Q
58 S $P(MAGRY(0),"^",1)=I-1
59 Q
60IMGCT(SRFIEN) ;
61 ; Count of images for this Surgery Case
62 ; If more than one group (or image)
63 ; then return "Group count : total images" i.e. "3:134"
64 ; else return count of Images i.e. "4"
65 ;
66 N CT,GCT,ICT,J
67 S J=0,CT=0,GCT=0
68 F S J=$O(^SRF(SRFIEN,2005,"B",J)) Q:'J D
69 . S ICT=+$P($G(^MAG(2005,J,1,0)),U,4)
70 . S ICT=$S(ICT:ICT,1:1) ;If no group images, set count =1 (single image)
71 . S GCT=GCT+1
72 . S CT=CT+ICT
73 I (GCT>1) Q GCT_":"_CT
74 Q CT
75 ;
76IMAGE(MAGRY,DATA) ;
77 ; Called with the IEN of the Surgery package ^SRF(170,x
78 ; We'll return a list of images.
79 N SRFIEN,MAGIEN
80 S SRFIEN=+DATA
81 I '$D(^SRF(SRFIEN)) S MAGRY(0)="0^INVALID Surgery File entry" Q
82 I '$O(^SRF(SRFIEN,2005,0)) S MAGRY(0)="0^No Images for this Operation." Q
83 D GETLIST
84 Q
85GETLIST ; called from other points in this routine, when SRFIEN is defined
86 ; and returns a list in MAGRY(1..n)
87 ; We'll make a tmp list of just the image IEN's
88 ; splitting groups into individual image entries.
89 K ^TMP($J,"MAGGX")
90 S I=0,CT=1 F S I=$O(^SRF(SRFIEN,2005,I)) Q:'I D
91 . S MAGIEN=$P(^SRF(SRFIEN,2005,I,0),U,1)
92 . Q:'$D(^MAG(2005,MAGIEN,0))
93 . I '$O(^MAG(2005,MAGIEN,1,0)) S ^TMP($J,"MAGGX",MAGIEN)=""
94 . E S Z=0 F S Z=$O(^MAG(2005,MAGIEN,1,Z)) Q:Z="" S ^TMP($J,"MAGGX",$P(^MAG(2005,MAGIEN,1,Z,0),U,1))=""
95 I '$D(^TMP($J,"MAGGX")) S MAGRY(0)="0^Surgery File Entry "_SRFIEN_": has INVALID Image Pointers" Q
96 S Z="",CT=0
97 S MAGQUIET=1
98 F S Z=$O(^TMP($J,"MAGGX",Z)) Q:Z="" D
99 . S CT=CT+1,MAGXX=Z D INFO^MAGGTII
100 . S MAGRY(CT)="B2^"_MAGFILE
101 K MAGQUIET
102 S MAGRY(0)=CT_"^Images for the selected Surgery File entry"
103 K ^TMP("MAGGX")
104 Q
Note: See TracBrowser for help on using the repository browser.