source: FOIAVistA/tag/r/IMAGING-MAG-ZMAG/MAGGSTI.m@ 1154

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

initial load of FOIAVistA 6/30/08 version

File size: 4.9 KB
Line 
1MAGGSTI ;WOIFO/GEK - Imaging interface to TIU RPC Calls etc. ; 01 Nov 2001 12:32 PM
2 ;;3.0;IMAGING;**7**;Jul 12, 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
19LISTC(ATMP,PROC,MAGDFN,BDT,EDT,NUM,DETAILS) ;Get Short list of TIU notes
20 ; given a CLASS in PROC parameter
21 ; The compressed listing, 4 columns "Date^Spec^Desc^Img Count^procedure info"
22 N MAGX,I,ACT,NODE,TMP
23 D CONTEXT^TIUSRVLO(.MAGX,PROC,1,MAGDFN)
24 I '$D(@MAGX) Q
25 S ACT=+$O(@ATMP@(""),-1)
26 S I="" F S I=$O(@MAGX@(I)) Q:I="" D
27 . ;
28 . S X=$S(DETAILS:$$DETINF(@MAGX@(I)),1:$$CMPINF(@MAGX@(I)))
29 . S ACT=ACT+1
30 . S @ATMP@(ACT)=X
31 I DETAILS S @ATMP@(1)="Date^Title^Images^Author^Status^Visit" ;^|TIUDA^
32 Q
33CMPINF(NODE) ;
34 N RY
35 S RY=$$EXTDT^MAGGSU1($P(NODE,U,3))_U_"TIU"_U_$P(NODE,U,2)_U
36 S RY=RY_$$IMGCT($P(NODE,U))_U_$P($P(NODE,U,5),";",2)_U
37 S RY=RY_"|TIU^"_$P(NODE,U)
38 Q RY
39 ;
40DETINF(NODE) ;
41 ; The node info from TIUSRVLO is
42 ; TIUDA Desc date patient duz;author status
43 ; x)=2452^General Note^2910528.1533^HOOD, ROBIN (H2591)^10;MELANIE BUECHLER
44 ; service status visit info ? ? ?
45 ; ^CARDIOLOGY^completed^Visit: 05/28/91^ ^^0^
46 N RY
47 ; DATE^DESC^IMGCT^AUTHOR^STATUS^VISIT^|"TIU^"TIUDA^
48 S RY=$$EXTDT^MAGGSU1($P(NODE,U,3))_U_$P(NODE,U,2)_U_$$IMGCT($P(NODE,U))_U
49 S RY=RY_$P($P(NODE,U,5),";",2)_U_$P(NODE,U,7)_U_$P(NODE,U,8)
50 S RY=RY_U_"|TIU"_U_$P(NODE,U)_U
51 Q RY
52IMGCT(TIUDA) ; Get count of images for this TIU Document
53 ; If more than one group (or image) is pointing to this Document
54 ; then return "Group count : total images" i.e. "3:134"
55 ;
56 N MAGARR,MAGIEN,CT,GCT,ICT,I
57 S I="",CT=0,GCT=0
58 D GETILST^TIUSRVPL(.MAGARR,TIUDA)
59 F S I=$O(MAGARR(I)) Q:'I D
60 . S ICT=+$P($G(^MAG(2005,MAGARR(I),1,0)),U,4)
61 . S ICT=$S(ICT:ICT,1:1) ;If no group images, set count =1 (single image)
62 . S GCT=GCT+1
63 . S CT=CT+ICT
64 I (GCT>1) Q GCT_":"_CT
65 Q CT
66FILE(MAGRY,MAGDA,TIUDA) ; RPC Call to file TIU and Imaging Pointers
67 ; TIU API to add image to TIU
68 ; TODO; have to validate that the Imaging patient matches the TIU patient.
69 D PUTIMAGE^TIUSRVPL(.MAGRY,TIUDA,MAGDA) ;
70 I 'MAGRY Q
71 ; Now SET the Parent fields in the Image File
72 S $P(^MAG(2005,MAGDA,2),U,6,8)=8925_U_TIUDA_U_+MAGRY
73 ; DONE.
74 S MAGRY="1^Image pointer filed successfully"
75 Q
76DATA(MAGRY,TIUDA) ;RPC Call to get TIU data from the TIUDA
77 ; Return = TIUDA^Document Type ^Document Date^DFN
78 ; returning DFN is new, We'll need IA for it ;TODO
79 ;
80 S MAGRY=TIUDA_U_$$GET1^DIQ(8925,TIUDA,".01","E")_U_$$GET1^DIQ(8925,TIUDA,"1201","I")_U_$$GET1^DIQ(8925,TIUDA,".02","I")
81 ;
82 Q
83IMAGES(MAGRY,TIUDA) ;RPC Call to get all images for a given TIU DA
84 ; We first get all Image IEN's breaking groups into seperate images
85 ; Then get Image Info for each one.
86 ; MAGRY - Return array of Image Data entries
87 ; MAGRY(0) is 1 ^ message if successful
88 ; 0 ^ Error message if error;
89 ; TIUDA is IEN in ^TIU(8925
90 ;
91 ; Call TIU API to get list of Image IEN's
92 N MAGARR,CT K ^TMP("MAGGX",$J)
93 N MAGZZ
94 D GETILST^TIUSRVPL(.MAGARR,TIUDA)
95 S CT=0
96 K ^TMP("MAGGX",$J)
97 ; Now get all images for all groups and single images.
98 S I="" F S I=$O(MAGARR(I)) Q:'I S DA=MAGARR(I) D
99 . I $O(^MAG(2005,DA,1,0)) D Q
100 . . S J=0 F S J=$O(^MAG(2005,DA,1,J)) Q:'J S CT=CT+1,^TMP("MAGGX",$J,CT)=^(J,0)
101 . S CT=CT+1
102 . S ^TMP("MAGGX",$J,CT)=DA
103 ; Now get image info for each image
104 ;
105 S CT=0,Z=""
106 S MAGQUIET=1
107 F S Z=$O(^TMP("MAGGX",$J,Z)) Q:Z="" D
108 . S CT=CT+1,MAGXX=^TMP("MAGGX",$J,Z)
109 . ;GEK 8/24/00 Stoping the Invalid Image IEN's and Deleted Images
110 . I '$D(^MAG(2005,MAGXX)) D Q
111 . . D INVALID^MAGGTIG(MAGXX,.MSGX) S MAGRY(CT)=MSGX
112 . D BOTH^MAGFILEB
113 . S MAGRY(CT)="B2^"_MAGFILE
114 K MAGQUIET
115 S MAGRY(0)=CT_"^"_CT_" Images for the selected TIU NOTE"
116 ; PUT THE Image IEN of the last image into the group ien field.
117 Q:'CT
118 S $P(MAGRY(0),U,3)=TIUDA
119 D DATA(.MAGZZ,TIUDA)
120 S $P(MAGRY(0),U,4)=$$GET1^DIQ(8925,TIUDA,".02","E")_" "_$P(MAGZZ,U,2)_" "_$$FMTE^XLFDT($P(MAGZZ,U,3),"8")
121 ;
122 S $P(MAGRY(0),U,5)=$S($P($G(MAGFILE),U):$P(MAGFILE,U),1:MAGXX)
123 Q
124 ;
Note: See TracBrowser for help on using the repository browser.