| 1 | MAGGTSR ;WOIFO/GEK - SURGERY CASE LIST ; [ 06/20/2001 08:57 ]
 | 
|---|
| 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
 | 
|---|
| 19 | GET(MAGRY,MAGDFN) ;RPC [MAGGSUR GET]
 | 
|---|
| 20 |  ; Call to get list of Patient Surgery procedures
 | 
|---|
| 21 |  ; MAGDFN is Patient DFN
 | 
|---|
| 22 |  ;
 | 
|---|
| 23 |  IF $$NEWERR^%ZTER N $ETRAP,$ESTACK S $ETRAP="D ERRA^MAGGTERR"
 | 
|---|
| 24 |  E  S X="ERRA^MAGGTERR",@^%ZOSF("TRAP")
 | 
|---|
| 25 |  N Y,DFN,MAGNAME
 | 
|---|
| 26 |  S MAGNAME=$P($G(^DPT(MAGDFN,0)),U)
 | 
|---|
| 27 |  I MAGNAME="" S MAGGRY(0)="0^INVALID Patient ID" Q
 | 
|---|
| 28 |  D GET^SROGTSR(.MAGRY,MAGDFN)
 | 
|---|
| 29 |  I 'MAGRY(0) S MAGRY(0)=MAGRY(0)_" for "_MAGNAME Q
 | 
|---|
| 30 |  ; Here we are changing the data returned in the array, from SROGTSR
 | 
|---|
| 31 |  ; , it will now also return the count of images associated with the 
 | 
|---|
| 32 |  ; surgery report.  This is in advance of the change for Display, to 
 | 
|---|
| 33 |  ; list the patient's surgery reports, like we list radiology reports.
 | 
|---|
| 34 |  ;
 | 
|---|
| 35 |  I (+$G(MAGJOB("VERSION"))<2.5) Q
 | 
|---|
| 36 |  S MAGRY(1)=$P(MAGRY(1),U,1,3)_"^Images"
 | 
|---|
| 37 |  S I=1 F  S I=$O(MAGRY(I)) Q:'I  D
 | 
|---|
| 38 |  . S MAGRY(I)=$P(MAGRY(I),U,1,3)_U_$P(MAGRY(I),U,6)_U_$C(124)_$P(MAGRY(I),U,4,5)_U
 | 
|---|
| 39 |  Q
 | 
|---|
| 40 | IMAGE(MAGRY,DATA) ;
 | 
|---|
| 41 |  ;  Called with the IEN of the Surgery package ^SRF(170,x
 | 
|---|
| 42 |  ;  We'll return a list of images.
 | 
|---|
| 43 |  N SRFIEN,MAGIEN
 | 
|---|
| 44 |  S SRFIEN=+DATA
 | 
|---|
| 45 |  I '$D(^SRF(SRFIEN)) S MAGRY(0)="0^INVALID Surgery File entry" Q
 | 
|---|
| 46 |  I '$O(^SRF(SRFIEN,2005,0)) S MAGRY(0)="0^No Images for this Operation." Q
 | 
|---|
| 47 |  D GETLIST
 | 
|---|
| 48 |  Q
 | 
|---|
| 49 | GETLIST ; called from other points in this routine, when SRFIEN is defined
 | 
|---|
| 50 |  ; and returns a list in MAGRY(1..n)
 | 
|---|
| 51 |  ; We'll make a tmp list of just the image IEN's
 | 
|---|
| 52 |  ;  splitting groups into individual image entries.
 | 
|---|
| 53 |  K ^TMP("MAGGX",$J)
 | 
|---|
| 54 |  S I=0,CT=1 F  S I=$O(^SRF(SRFIEN,2005,I)) Q:'I  D
 | 
|---|
| 55 |  . S MAGIEN=$P(^SRF(SRFIEN,2005,I,0),U,1)
 | 
|---|
| 56 |  . Q:'$D(^MAG(2005,MAGIEN,0))
 | 
|---|
| 57 |  . I '$O(^MAG(2005,MAGIEN,1,0)) S ^TMP("MAGGX",$J,MAGIEN)=""
 | 
|---|
| 58 |  . E  S Z=0 F  S Z=$O(^MAG(2005,MAGIEN,1,Z)) Q:Z=""  S ^TMP("MAGGX",$J,$P(^MAG(2005,MAGIEN,1,Z,0),U,1))=""
 | 
|---|
| 59 |  I '$D(^TMP("MAGGX",$J)) S MAGRY(0)="0^Surgery File Entry "_SRFIEN_": has INVALID Image Pointers" Q
 | 
|---|
| 60 |  S Z="",CT=0
 | 
|---|
| 61 |  S MAGQUIET=1
 | 
|---|
| 62 |  F  S Z=$O(^TMP("MAGGX",$J,Z)) Q:Z=""  D
 | 
|---|
| 63 |  . S CT=CT+1,MAGXX=Z D INFO^MAGGTII
 | 
|---|
| 64 |  . S MAGRY(CT)="B2^"_MAGFILE
 | 
|---|
| 65 |  K MAGQUIET
 | 
|---|
| 66 |  S MAGRY(0)=CT_"^Images for the selected Surgery File entry"
 | 
|---|
| 67 |  K ^TMP("MAGGX")
 | 
|---|
| 68 |  Q
 | 
|---|