| 1 | MAGGTU7 ;WOIFO/GEK - Silent calls for Queing functions from GUI ; [ 06/20/2001 08:57 ] | 
|---|
| 2 | ;;3.0;IMAGING;**8,20**;Apr 12, 2006 | 
|---|
| 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 | ONJBOX(MAGIEN,CODE) ; | 
|---|
| 20 | ;Check to see if the image ( Abs, Full, or Big ) is on the worm | 
|---|
| 21 | ;  before queuing it to be copied to HardDrive. | 
|---|
| 22 | ; We're testing to see if a pointer to the magnetic exists. | 
|---|
| 23 | ;  If not then we assume the Image is on JukeBox | 
|---|
| 24 | N ZNODE | 
|---|
| 25 | S ZNODE=$G(^MAG(2005,+MAGIEN,0)) | 
|---|
| 26 | IF '$L(ZNODE) Q 0 | 
|---|
| 27 | IF $$IMOFFLN^MAGFILEB($P(ZNODE,"^",2)) Q 0 | 
|---|
| 28 | Q:((+$P(ZNODE,U,11))!(+$P(ZNODE,U,12))) 0 | 
|---|
| 29 | IF CODE="A" Q '$P(ZNODE,U,4) | 
|---|
| 30 | IF CODE="F" Q '$P(ZNODE,U,3) | 
|---|
| 31 | IF CODE="B" Q $S('$P(^MAG(2005,+MAGIEN,"FBIG"),U,2):0,1:'$P(^MAG(2005,+MAGIEN,"FBIG"),U,1)) | 
|---|
| 32 | ; | 
|---|
| 33 | Q | 
|---|
| 34 | QUEIMAGE(MAGRY,CODE,MAGIEN) ;RPC [MAGG QUE IMAGE] | 
|---|
| 35 | ; Call to Queue an image for copy from Jukebox | 
|---|
| 36 | ;  NOTE : This is also called from other M routines. | 
|---|
| 37 | ; | 
|---|
| 38 | ; CODE is a string code for which images to Queue | 
|---|
| 39 | ;     ["A" Abatract | 
|---|
| 40 | ;     ["F" Full Resolution | 
|---|
| 41 | ;     ["B" Big File | 
|---|
| 42 | ; | 
|---|
| 43 | N Y,QUE | 
|---|
| 44 | S QUE="" | 
|---|
| 45 | S MAGRY="0^Error setting Que from JukeBox" | 
|---|
| 46 | ;S MAGRY="1^Image was Queued to copy from JukeBox" | 
|---|
| 47 | ;  GEK 6/27/03  added code (ABS4IMAG) that returns 1|0  1 if this image should have an Abstract | 
|---|
| 48 | ;     This will stop the Queing of Canned Bitmaps for Images of type DOC, PDF, WAV, AVI  etc. | 
|---|
| 49 | I (CODE["A"),$$ONJBOX(MAGIEN,"A"),$$ABS4IMAG^MAGGSFT(MAGIEN) S Y=$$JBTOHD^MAGBAPI(+MAGIEN_"^ABSTRACT",$$DA2PLC^MAGBAPIP(MAGIEN,"A")) S QUE="A" ; DBI - SEB 9/20/2002 | 
|---|
| 50 | I (CODE["F"),$$ONJBOX(MAGIEN,"F") S Y=$$JBTOHD^MAGBAPI(+MAGIEN_"^FULL",$$DA2PLC^MAGBAPIP(MAGIEN,"F")) S QUE=QUE_"F" ; DBI - SEB 9/20/2002 | 
|---|
| 51 | I (CODE["B"),$$ONJBOX(MAGIEN,"B") S Y=$$JBTOHD^MAGBAPI(+MAGIEN_"^BIG",$$DA2PLC^MAGBAPIP(MAGIEN,"B")) S QUE=QUE_"B" ; DBI - SEB 9/20/2002 | 
|---|
| 52 | I QUE="" S MAGRY="1^Copy from JukeBox not needed, Image was NOT Queued." | 
|---|
| 53 | E  S MAGRY="1^Image was Queued to copy from JukeBox ("_QUE_")" | 
|---|
| 54 | Q | 
|---|
| 55 | QPREFET(MAGRY,CODE,MAGIEN) ; | 
|---|
| 56 | ; CODE is a string code for which images to Queue | 
|---|
| 57 | ;     ["A" Abatract | 
|---|
| 58 | ;     ["F" Full Resolution | 
|---|
| 59 | ;     ["B" Big File | 
|---|
| 60 | ; | 
|---|
| 61 | N Y,QUE | 
|---|
| 62 | S QUE="" | 
|---|
| 63 | S MAGRY="0^Error setting Prefetch Que from JukeBox" | 
|---|
| 64 | ;S MAGRY="1^Image was Queued to copy from JukeBox" | 
|---|
| 65 | I (CODE["A"),$$ONJBOX(MAGIEN,"A"),$$ABS4IMAG^MAGGSFT(MAGIEN) S Y=$$PREFET^MAGBAPI(+MAGIEN_"^ABSTRACT",$$DA2PLC^MAGBAPIP(MAGIEN,"A")) S QUE="A" ; DBI - SEB 9/20/2002 | 
|---|
| 66 | I (CODE["F"),$$ONJBOX(MAGIEN,"F") S Y=$$PREFET^MAGBAPI(+MAGIEN_"^FULL",$$DA2PLC^MAGBAPIP(MAGIEN,"F")) S QUE=QUE_"F" ; DBI - SEB 9/20/2002 | 
|---|
| 67 | I (CODE["B"),$$ONJBOX(MAGIEN,"B") S Y=$$PREFET^MAGBAPI(+MAGIEN_"^BIG",$$DA2PLC^MAGBAPIP(MAGIEN,"B")) S QUE=QUE_"B" ; DBI - SEB 9/20/2002 | 
|---|
| 68 | I QUE="" S MAGRY="1^Copy from JukeBox not needed, Image was NOT Queued." | 
|---|
| 69 | E  S MAGRY="1^Image was Queued to copy from JukeBox" | 
|---|
| 70 | Q | 
|---|
| 71 | QUELIST(MAGRY,CODE,LIST) ;RPC [MAGG QUE LIST] | 
|---|
| 72 | ; Call to queue all images in the input list for a copy from jukebox | 
|---|
| 73 | ; | 
|---|
| 74 | ; CODE is a string code for which images to Queue | 
|---|
| 75 | ;     ["A" Abatract | 
|---|
| 76 | ;     ["F" Full Resolution | 
|---|
| 77 | ;     ["B" Big File | 
|---|
| 78 | ; LIST is an array of Image IEN's,  we queue images contained in CODE | 
|---|
| 79 | ; | 
|---|
| 80 | N Y,CT | 
|---|
| 81 | S CT=0 | 
|---|
| 82 | S X="" F  S X=$O(LIST(X)) Q:X=""  D QUEIMAGE(.XX,CODE,X) S CT=CT+1 | 
|---|
| 83 | S MAGRY=CT_"^"_CT_" Image"_$S(CT=1:"",1:"'s")_" Queued to copy from JukeBox" | 
|---|
| 84 | Q | 
|---|
| 85 | QUEGROUP(MAGRY,CODE,MAGIEN,QCODE) ;RPC [MAGG QUE IMAGE GROUP] | 
|---|
| 86 | ; Call to queue all images of an Image group for a copy from JukeBox. | 
|---|
| 87 | ;  This can also be a PREFETCH, in which case the Images being | 
|---|
| 88 | ;  Queued have a lower priority than other copies from JukeBox | 
|---|
| 89 | ; | 
|---|
| 90 | ; CODE is a string code for which images to Queue | 
|---|
| 91 | ;     ["A" Abatract | 
|---|
| 92 | ;     ["F" Full Resolution | 
|---|
| 93 | ;     ["B" Big File | 
|---|
| 94 | ; MAGIEN is assumed to be a group image. | 
|---|
| 95 | ; QCODE is a QUEUE code.  If = 1 then this is a prefetch | 
|---|
| 96 | ;   here we are queing the images contained in CODE | 
|---|
| 97 | ;   for all images in the group. | 
|---|
| 98 | N X,Y,Z,CT | 
|---|
| 99 | S QCODE=$G(QCODE) | 
|---|
| 100 | I '$D(^MAG(2005,+MAGIEN,0)) S MAGRY="0^Invalid Image IEN. Queuing Canceled." Q | 
|---|
| 101 | S CT=0,X=0 | 
|---|
| 102 | F  S X=$O(^MAG(2005,+MAGIEN,1,X)) Q:'X  S Z=+^(X,0) D | 
|---|
| 103 | . I QCODE D QPREFET(.XX,CODE,Z) S CT=CT+1 | 
|---|
| 104 | . I 'QCODE D QUEIMAGE(.XX,CODE,Z) S CT=CT+1 | 
|---|
| 105 | S MAGRY=CT_"^"_CT_" Group Image"_$S(CT=1:"",1:"'s")_" Queued to copy from JukeBox" | 
|---|
| 106 | Q | 
|---|
| 107 | QUEPAT(MAGRY,CODE,MAGDFN) ;RPC [MAGG QUE PATIENT] | 
|---|
| 108 | ; Call to  Prefetch all images for a patient. | 
|---|
| 109 | ;  CODE is a string code for which images to Queue | 
|---|
| 110 | ;     ["A" Abatract | 
|---|
| 111 | ;     ["F" Full Resolution | 
|---|
| 112 | ;     ["B" Big File | 
|---|
| 113 | ;  this will queue a JBTOHD copy for all images for the patient. | 
|---|
| 114 | ;  images queued depend on what is contained in CODE | 
|---|
| 115 | ; | 
|---|
| 116 | N Y,I | 
|---|
| 117 | I '$D(^MAG(2005,"AC",+MAGDFN)) S MAGRY="0^No Images on file for "_$P($G(^DPT(+MAGDFN,0)),U,1) Q | 
|---|
| 118 | S I="" F  S I=$O(^MAG(2005,"AC",+MAGDFN,I),-1) Q:'I  D | 
|---|
| 119 | . I $P(^MAG(2005,I,0),U,10) Q | 
|---|
| 120 | . I $P(^MAG(2005,I,0),U,6)="11" D QUEGROUP(.XX,CODE,I,1) Q | 
|---|
| 121 | . D QPREFET(.XX,CODE,I) | 
|---|
| 122 | S MAGRY="1^"_$P(^DPT(+MAGDFN,0),U)_"'s Images will be copied from the JukeBox." | 
|---|
| 123 | Q | 
|---|