source: WorldVistAEHR/trunk/r/IMAGING-MAG-ZMAG/MAGGNTI.m@ 1073

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

revised back to 6/30/08 version

File size: 5.4 KB
Line 
1MAGGNTI ;WOIFO/GEK - Imaging interface to TIU RPC Calls etc. ; 04 Apr 2002 2:37 PM
2 ;;3.0;IMAGING;**10,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
19FILE(MAGRY,MAGDA,TIUDA) ;RPC [MAG3 TIU IMAGE]
20 ; Call to file TIU and Imaging Pointers
21 ; TIU API to add image to TIU
22 I $P(^TIU(8925,TIUDA,0),U,2)'=$P(^MAG(2005,MAGDA,0),U,7) S MAGRY="0^Patient Mismatch." Q
23 D PUTIMAGE^TIUSRVPL(.MAGRY,TIUDA,MAGDA) ;
24 I 'MAGRY Q
25 ; Now SET the Parent fields in the Image File
26 S $P(^MAG(2005,MAGDA,2),U,6,8)=8925_U_TIUDA_U_+MAGRY
27 ; DONE.
28 S MAGRY="1^Image pointer filed successfully"
29 Q
30DATA(MAGRY,TIUDA) ;RPC [MAG3 TIU DATA FROM DA]
31 ; Call to get TIU data from the TIUDA
32 ; Return = TIUDA^Document Type ^Document Date^DFN
33 ;
34 S MAGRY=TIUDA_U_$$GET1^DIQ(8925,TIUDA,".01","E")_U_$$GET1^DIQ(8925,TIUDA,"1201","I")_U_$$GET1^DIQ(8925,TIUDA,".02","I")
35 Q
36IMAGES(MAGRY,TIUDA) ;RPC [MAG3 CPRS TIU NOTE]
37 ; Call to get all images for a given TIU DA
38 ; We first get all Image IEN's breaking groups into seperate images
39 ; Then get Image Info for each one.
40 ; MAGRY - Return array of Image Data entries
41 ; MAGRY(0) is 1 ^ message if successful
42 ; 0 ^ Error message if error;
43 ; TIUDA is IEN in ^TIU(8925
44 ;
45 ; Call TIU API to get list of Image IEN's
46 N MAGARR,CT,TCT K ^TMP("MAGGX",$J)
47 N DA,MAGQI,MAGNCHK,MAGXX,MAGRSLT
48 N TIUDFN,MAGQUIT ; MAGQI 8/22/01
49 ; MAGFILE is returned from MAGGTII
50 ;
51 S MAGQUIT=0 ; MAGQI 8/22/01
52 S TIUDFN=$P($G(^TIU(8925,TIUDA,0)),U,2) ;MAGQI 8/22/01
53 I 'TIUDFN S MAGRY(0)="0^Invalid Patient DFN for Note ID: '"_TIUDA_"'"
54 D GETILST^TIUSRVPL(.MAGARR,TIUDA)
55 S CT=0,TCT=0
56 ; Now get all images for all groups and single images.
57 S I="" F S I=$O(MAGARR(I)) Q:'I S DA=MAGARR(I) D ;Q:MAGQUIT
58 . S Z=$$ISDELIMG(DA) I Z S TCT=TCT+1,MAGRY(TCT)="B2^"_Z Q
59 . ; Check that array of images from selected TIUDA have
60 . ; same patient's and valid backward pointers
61 . I $P($G(^MAG(2005,DA,0)),U,7)'=TIUDFN S MAGQUIT=1,MAGNCHK="Patient Mismatch. TIU: "_TIUDA
62 . I $P($G(^MAG(2005,DA,2)),U,7)'=TIUDA S MAGQUIT=1,MAGNCHK="Pointer Mismatch. TIU: "_TIUDA
63 . I MAGQUIT S MAGXX=DA D INFO^MAGGTII D Q
64 . . ; remove the Abstract and Image File Names ; 2/14/03 p8t14 remove c:\program files. with .\bmp\
65 . . S $P(MAGFILE,U,2,3)="-1~Questionable Data Integrity^.\bmp\imageQA.bmp"
66 . . ;this stops Delphi App from changing Abstract BMP to OFFLINE IMAGE
67 . . S $P(MAGFILE,U,6)=$S(($P(MAGFILE,U,6)'=11):"99",1:11)
68 . . S $P(MAGFILE,U,10)="M"
69 . . ;Send the error message
70 . . S $P(MAGFILE,U,17)=MAGNCHK
71 . . S TCT=TCT+1,MAGRY(TCT)="B2^"_MAGFILE
72 . ;
73 . I $O(^MAG(2005,DA,1,0)) D Q
74 . . ; Integrity check, if group is questionable, add it's ien to list, not it's
75 . . ; children. Later when list is looped through, it's INFO^MAGGTII will be in
76 . . ; list. Have to do this to allow other images in list from TIU to be processed.
77 . . D CHK^MAGGSQI(.MAGQI,DA) I 'MAGQI(0) S CT=CT+1,^TMP("MAGGX",$J,CT)=DA Q
78 . . S J=0 ; the following line needs to take only the first piece of the node - PMK 4/4/02
79 . . F S J=$O(^MAG(2005,DA,1,J)) Q:'J S CT=CT+1,^TMP("MAGGX",$J,CT)=$P(^(J,0),"^")
80 . S CT=CT+1
81 . S ^TMP("MAGGX",$J,CT)=DA
82 ; Now get image info for each image
83 ;
84 S Z=""
85 S MAGQUIET=1
86 F S Z=$O(^TMP("MAGGX",$J,Z)) Q:Z="" D
87 . S TCT=TCT+1,MAGXX=^TMP("MAGGX",$J,Z)
88 . ;GEK 8/24/00 Stoping the Invalid Image IEN's and Deleted Images
89 . I '$D(^MAG(2005,MAGXX)) D Q
90 . . D INVALID^MAGGTIG(MAGXX,.MAGRSLT) S MAGRY(CT)=MAGRSLT
91 . D INFO^MAGGTII
92 . S MAGRY(TCT)="B2^"_MAGFILE
93 K MAGQUIET
94 S MAGRY(0)=TCT_"^"_TCT_" Images for the selected TIU NOTE"
95 ; PUT THE Image IEN of the last image into the group ien field.
96 Q:'TCT
97 S $P(MAGRY(0),U,3)=TIUDA
98 K MAGRSLT
99 D DATA(.MAGRSLT,TIUDA)
100 S $P(MAGRY(0),U,4)=$$GET1^DIQ(8925,TIUDA,".02","E")_" "_$P(MAGRSLT,U,2)_" "_$$FMTE^XLFDT($P(MAGRSLT,U,3),"8")
101 ;
102 S $P(MAGRY(0),U,5)=$S($P($G(MAGFILE),U):$P(MAGFILE,U),1:MAGXX)
103 Q
104 ;. S Z=ISDELIMG(DA) I Z S TCT=TCT+1,MAGRY(TCT)="B2^"_$P(Z,U,2) Q
105ISDELIMG(MAGIEN) ; Is this a deleted Image.
106 N MAGDEL,MAGIMG,MAGR,Z,MAGT
107 S MAGDEL=$D(^MAG(2005.1,MAGIEN))
108 S MAGIMG=$D(^MAG(2005,MAGIEN))
109 I MAGIMG,'MAGDEL S MAGR="0^Valid Image"
110 I 'MAGIMG,MAGDEL S MAGR="1^Deleted Image",MAGT=66
111 I 'MAGIMG,'MAGDEL S MAGR="1^Invalid Image pointer",MAGT=67
112 I MAGIMG,MAGDEL S MAGR="0^Image IEN exists, and is Deleted !"
113 I 'MAGR Q MAGR
114 S MAGR=$P(MAGR,U,2)
115 S $P(Z,U,1,4)=MAGIEN_"^-1~"_MAGR_"^-1~"_MAGR_"^"_MAGR
116 S $P(Z,U,6)=MAGT
117 ;this stops Delphi App from changing Abstract BMP to OFFLINE IMAGE
118 S $P(Z,U,10)="M"
119 ;Send the error message
120 S $P(Z,U,17)=$P(MAGR,U,2)
121 Q Z
Note: See TracBrowser for help on using the repository browser.