MAGGI13 ;WOIFO/SG/BNT/NST/GEK/JSL - IMAGE FILE API (QUERY) ; 21 Jul 2010 11:05 AM
;;3.0;IMAGING;**93,117,122**;Mar 19, 2002;Build 92;Aug 02, 2012
;; Per VHA Directive 2004-038, this routine should not be modified.
;; +---------------------------------------------------------------+
;; | Property of the US Government. |
;; | No permission to copy or redistribute this software is given. |
;; | Use of unreleased versions of this software requires the user |
;; | to execute a written test agreement with the VistA Imaging |
;; | Development Office of the Department of Veterans Affairs, |
;; | telephone (301) 734-0100. |
;; | The Food and Drug Administration classifies this software as |
;; | a medical device. As such, it may not be changed in any way. |
;; | Modifications to this software may result in an adulterated |
;; | medical device under 21CFR820, the use of which is considered |
;; | to be a violation of US Federal Statutes. |
;; +---------------------------------------------------------------+
;;
;P122 : Stop Timeout error from QA Review window.
; Modified tag : QUERY, to now use ADTDUZ Cross reference
; when searching for images captured by a User.
; Remedy _<todo, get remedy ticket>
Q
;
;+++++ RETURNS INVERTED/REVERSED DATE/TIME (FILEMAN)
INVDT(DATETIME) ;
Q 9999999.9999-DATETIME
;
;##### $ORDER BOTH #2005 AND #2005.1 FILES AT THE SAME TIME
;
; NODE Name of a node in file #2005 or #2005.1 (it does
; not matter in which one if the BOTH parameter is
; not zero). The last subscript can be empty string.
;
; [DIR] Browsing direction:
; $G(DIR)'<0 forward
; DIR<0 backward
;
; [BOTH] If this parameter is defined and not zero, then
; the MAGORD browses subscripts of IMAGE (#2005) and
; IMAGE AUDIT (2005.1) files at the same time (as if
; the nodes were merged into a single array).
; Otherwise, it works as the $ORDER function.
;
; Return Values
; =============
; "" No more records
; Next/previous subscript (in #2005, #2005.1, or both)
;
; Notes
; =====
;
; This function relies on the fact that there are no records with
; the same IENs in the files #2005 and #2005.1.
;
MAGORD(NODE,DIR,BOTH) ;
Q:NODE'?1"^MAG(2005".1".1"1","1.E1")" ""
N FILE,LST,PI,SUBS,TRAIL
S DIR=$S($G(DIR)<0:-1,1:1)
Q:'$G(BOTH) $O(@NODE,DIR)
;--- Find subscripts in both files that follow the @NODE
S TRAIL=","_$P(NODE,",",2,999)
F FILE=2005,2005.1 D
. S PI="^MAG("_FILE_TRAIL,SUBS=$O(@PI,DIR)
. S:SUBS'="" LST(SUBS,FILE)=""
. Q
;--- Return one of the subscripts according to the direction
Q $O(LST(""),DIR)
;
;+++++ CHECKS THE PATIENT REFERENCE
;
; IMGIEN Internal entry number of the image entry
;
; DFN Patient IEN (DFN)
;
; Return Values
; =============
; 0 Skip the image entry (different patient or error)
; 1 Process the image entry
;
PTCHK(IMGIEN,DFN) ;
N NODE S NODE=$$NODE^MAGGI11(IMGIEN)
Q $S(NODE'="":$P($G(@NODE@(0)),U,7)=DFN,1:0)
;
;##### BROWSES IMAGES AND CALLS THE CALLBACK FUNCTION
;
; CALLBACK Full name of the callback function ($$TAG^ROUTINE)
; that is called for each preselected image.
;
; SINCE ENTRIES THAT ARE NOT MARKED AS DELETED CAN
; REFERENCE DELETED "CHILDREN", SUCH ENTRIES ARE PASSED
; TO THE CALLBACK FUNCTION EVEN IF ONLY DELETED IMAGES
; ARE REQUESTED! THEREFORE, THE FUNCTION MUST PERFORM
; ADDITIONAL SCREENING BY CHECKING THE "CHILD" ENTRIES.
;
; The function should accept 3 parameters:
;
; IMGIEN IEN of the image record
; (file #2005 or #2005.1)
;
; FLAGS Value of the FLAGS parameter of the
; $$QUERY function (see below).
;
; .DATA Reference to the local array passed via
; the MAG8DATA parameter of the $$QUERY
; function (see below).
;
; Non-zero result values of the callback function
; terminate the query:
;
; <0 Error descriptor (see the $$ERROR^MAGUERR)
; 0 Continue
; >0 Terminate the query (e.g. if maximum number of
; returned records has been reached)
;
; See the source code of the IMGQUERY^MAGGA03 and
; $$QRYCBK^MAGGA03 for an example.
;
; FLAGS Flags that control the execution (can be combined):
;
; C Capture date range. If this flag is provided,
; then the remote procedure uses values of the
; MAG8FROM and MAG8TO parameters to select images
; that were captured in this date range (see the
; DATE/TIME IMAGE SAVED field (7) and the "AD"
; cross-reference).
;
; Otherwise, values of those parameters are
; treated as the date range when procedures were
; performed (see the PROCEDURE/EXAM DATE/TIME
; field (15) and cross-references "APDTPX" and
; "APDT").
;
; G Include Group Images in the list of images returned.
; If any image in a group has an image that matches the
; status provided in the search criteria then
; the group will be returned.
;
; If the G flag is not set then only the status of the
; Group entry will be checked and the group will be
; returned if it passes.
;
; D Include only deleted images (file #2005.1)
;
; E Include only existing images (file #2005)
;
; If neither 'E' nor 'D' flag is provided, then an
; error code is returned.
;
; [.MAG8DATA] Reference to a local array that is passed to the
; callback function (by reference) "as is"
;
; [MAG8FROM] Date/time range for image selection. Parameter
; [MAG8TO] values should be valid date/times in internal or
; external FileMan format. If a parameter is not
; defined or empty, then the range remains open on
; the corresponding side.
;
; The beginning of the date/time range is included
; the search but the end is not! For example, if you
; need images for October 15, 2007, the internal
; parameter values should be 3071015 and 3071016.
;
; If the MAG8FROM is after the MAG8TO, then values
; of the parameters are swapped.
;
; [DFN] Patient IEN (DFN). If this parameter is defined and
; greater than 0, then only images associated with this
; patient are processed.
;
; Return Values
; =============
; <0 Error descriptor (see the $$ERROR^MAGUERR)
; 0 All appropriate image records have been processed
; >0 Value returned by the callback function when it
; terminated the query
;
; Notes
; =====
;
; Temporary global node ^TMP($J,"MAGGI13") is used by this function.
;
QUERY(CALLBACK,FLAGS,MAG8DATA,MAG8FROM,MAG8TO,DFN) ;
N MAG8BOTH,MAG8CALL,MAG8DT,MAG8IEN,MAG8RC,MAG8ROOT,MAG8XREF,TMP
;P122
N MAG8APP,MAG8DUZ,MAG8SITE,BOTHAPP
;
S FLAGS=$G(FLAGS)
;=== Validate parameters
Q:'(CALLBACK?2"$"1.8UN1"^MAG"1.5UN) $$IPVE^MAGUERR("CALLBACK")
;--- If a patient IEN is provided, it must be valid
I $G(DFN)>0,'$$VALDFN^MAGUTL05(DFN,.TMP) D STORE^MAGUERR(TMP) Q TMP
;--- Unknown/Unsupported flag(s)
Q:$TR(FLAGS,"CDEG")'="" $$IPVE^MAGUERR("FLAGS")
;--- Missing required flag
Q:$TR(FLAGS,"DE")=FLAGS $$ERROR^MAGUERR(-6,,"D,E")
;
;=== The expression in the following line does not look like
; (FLAGS["E")&(FLAGS["D") because a group header that is
;=== not marked as deleted can reference deleted "children".
S MAG8BOTH=(FLAGS["D")
S TMP=$S(FLAGS["E":2005,1:2005.1),MAG8ROOT=$NA(^MAG(TMP))
S TMP=$$DDQ^MAGUTL05(FLAGS)
S MAG8CALL="S MAG8RC="_CALLBACK_"(MAG8IEN,"_TMP_",.MAG8DATA)"
S MAG8RC=0
;P122 set a variable (MAG8DUZ) to $Order through the Cross Ref.
S MAG8DUZ=+$P($G(MAG8DATA("SAVEDBY")),"^",1)
;=== Return images in the capture date range captured by a User MAG8DUZ
; This call is made by the QA Review window. Looking for a list of images
; captured by a certain user in a certain date range.
I (FLAGS["C"),(MAG8DUZ) D Q MAG8RC
. ;--- Modify the callback to check for patient
. S:$G(DFN)>0 $E(MAG8CALL,1)="S:$$PTCHK(MAG8IEN,"_DFN_")"
. ;---
. ; ATDUZ may be used by more than QA Review, can't Force MAG8BOTH
. ; to '0', Deleted Images may be wanted by other functions.
. ;- S MAG8BOTH=0
. ; Loop through both Capture Application nodes of ADTDUZ
. F MAG8APP="C","I" D
. . S MAG8XREF=$NA(@MAG8ROOT@("ADTDUZ",MAG8APP))
. . S MAG8DT=MAG8TO
. . F S MAG8DT=$$MAGORD($NA(@MAG8XREF@(MAG8DT)),-1,MAG8BOTH) Q:(MAG8DT="")!(MAG8DT<MAG8FROM) D Q:MAG8RC
. . . S MAG8SITE=""
. . . F S MAG8SITE=$$MAGORD($NA(@MAG8XREF@(MAG8DT,MAG8DUZ,MAG8SITE)),-1,MAG8BOTH) Q:(MAG8SITE="") D
. . . . S MAG8IEN=""
. . . . F D Q:(MAG8IEN="")!MAG8RC X MAG8CALL Q:MAG8RC
. . . . . S MAG8IEN=$$MAGORD($NA(@MAG8XREF@(MAG8DT,MAG8DUZ,MAG8SITE,MAG8IEN)),-1,MAG8BOTH)
. . . . . I $D(ZTQUEUED),$$S^%ZTLOAD S MAG8RC="1^Task asked to stop",ZTSTOP=1
. . . . . Q
. . . . Q
. . Q
. Q
;=== Browse images in the capture date range
I FLAGS["C" D Q MAG8RC
. ;--- Modify the callback to check for patient
. S:$G(DFN)>0 $E(MAG8CALL,1)="S:$$PTCHK(MAG8IEN,"_DFN_")"
. ;---
. S MAG8XREF=$NA(@MAG8ROOT@("AD"))
. S MAG8DT=MAG8TO
. F S MAG8DT=$$MAGORD($NA(@MAG8XREF@(MAG8DT)),-1,MAG8BOTH) Q:(MAG8DT="")!(MAG8DT<MAG8FROM) D Q:MAG8RC
. . S MAG8IEN=""
. . F D Q:(MAG8IEN="")!MAG8RC X MAG8CALL Q:MAG8RC
. . . S MAG8IEN=$$MAGORD($NA(@MAG8XREF@(MAG8DT,MAG8IEN)),-1,MAG8BOTH)
. . . I $D(ZTQUEUED),$$S^%ZTLOAD S MAG8RC="1^Task asked to stop",ZTSTOP=1
. . . Q
. . Q
. Q
;
;=== Browse images in the procedure date range; single patient
I $G(DFN)>0 D Q MAG8RC
. N MAG8DT1,MAG8DT2,MAG8PRX,MAG8TMP
. S MAG8XREF=$NA(@MAG8ROOT@("APDTPX",+DFN))
. S MAG8TMP=$NA(^TMP("MAGGI13",$J))
. ;--- "Invert" the dates
. S MAG8DT1=$$INVDT(MAG8TO),MAG8DT2=$$INVDT(MAG8FROM)
. ;---
. S MAG8DT=MAG8DT1
. F S MAG8DT=$$MAGORD($NA(@MAG8XREF@(MAG8DT)),1,MAG8BOTH) Q:(MAG8DT="")!(MAG8DT>MAG8DT2) D Q:MAG8RC
. . K @MAG8TMP
. . I $D(ZTQUEUED),$$S^%ZTLOAD S MAG8RC="1^Task asked to stop",ZTSTOP=1 Q
. . ;--- Merge IEN lists from both files
. . S MAG8PRX=""
. . F S MAG8PRX=$$MAGORD($NA(@MAG8XREF@(MAG8DT,MAG8PRX)),1,MAG8BOTH) Q:MAG8PRX="" D
. . . S MAG8IEN=""
. . . F S MAG8IEN=$$MAGORD($NA(@MAG8XREF@(MAG8DT,MAG8PRX,MAG8IEN)),1,MAG8BOTH) Q:MAG8IEN="" D
. . . . S @MAG8TMP@(MAG8IEN)=""
. . . . Q
. . ;--- Browse the list and select the images
. . S MAG8IEN=""
. . F D Q:(MAG8IEN'>0)!MAG8RC X MAG8CALL Q:MAG8RC
. . . S MAG8IEN=$O(@MAG8TMP@(MAG8IEN),-1)
. . . I $D(ZTQUEUED),$$S^%ZTLOAD S MAG8RC="1^Task asked to stop",ZTSTOP=1
. . . Q
. . Q
. ;---
. K @MAG8TMP
. Q
;
;=== Browse images in the procedure date range; all patients
S MAG8XREF=$NA(@MAG8ROOT@("APDT"))
S MAG8DT=MAG8TO
F S MAG8DT=$$MAGORD($NA(@MAG8XREF@(MAG8DT)),-1,MAG8BOTH) Q:(MAG8DT="")!(MAG8DT<MAG8FROM) D Q:MAG8RC
. S MAG8IEN=""
. F D Q:(MAG8IEN="")!MAG8RC X MAG8CALL Q:MAG8RC
. . S MAG8IEN=$$MAGORD($NA(@MAG8XREF@(MAG8DT,MAG8IEN)),-1,MAG8BOTH)
. . I $D(ZTQUEUED),$$S^%ZTLOAD S MAG8RC="1^Task asked to stop",ZTSTOP=1
. . Q
. Q
;---
Q MAG8RC
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HMAGGI13 12302 printed Dec 13, 2024@02:02:29 Page 2
MAGGI13 ;WOIFO/SG/BNT/NST/GEK/JSL - IMAGE FILE API (QUERY) ; 21 Jul 2010 11:05 AM
+1 ;;3.0;IMAGING;**93,117,122**;Mar 19, 2002;Build 92;Aug 02, 2012
+2 ;; Per VHA Directive 2004-038, this routine should not be modified.
+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 ;; | The Food and Drug Administration classifies this software as |
+11 ;; | a medical device. As such, it may not be changed in any way. |
+12 ;; | Modifications to this software may result in an adulterated |
+13 ;; | medical device under 21CFR820, the use of which is considered |
+14 ;; | to be a violation of US Federal Statutes. |
+15 ;; +---------------------------------------------------------------+
+16 ;;
+17 ;P122 : Stop Timeout error from QA Review window.
+18 ; Modified tag : QUERY, to now use ADTDUZ Cross reference
+19 ; when searching for images captured by a User.
+20 ; Remedy _<todo, get remedy ticket>
+21 QUIT
+22 ;
+23 ;+++++ RETURNS INVERTED/REVERSED DATE/TIME (FILEMAN)
INVDT(DATETIME) ;
+1 QUIT 9999999.9999-DATETIME
+2 ;
+3 ;##### $ORDER BOTH #2005 AND #2005.1 FILES AT THE SAME TIME
+4 ;
+5 ; NODE Name of a node in file #2005 or #2005.1 (it does
+6 ; not matter in which one if the BOTH parameter is
+7 ; not zero). The last subscript can be empty string.
+8 ;
+9 ; [DIR] Browsing direction:
+10 ; $G(DIR)'<0 forward
+11 ; DIR<0 backward
+12 ;
+13 ; [BOTH] If this parameter is defined and not zero, then
+14 ; the MAGORD browses subscripts of IMAGE (#2005) and
+15 ; IMAGE AUDIT (2005.1) files at the same time (as if
+16 ; the nodes were merged into a single array).
+17 ; Otherwise, it works as the $ORDER function.
+18 ;
+19 ; Return Values
+20 ; =============
+21 ; "" No more records
+22 ; Next/previous subscript (in #2005, #2005.1, or both)
+23 ;
+24 ; Notes
+25 ; =====
+26 ;
+27 ; This function relies on the fact that there are no records with
+28 ; the same IENs in the files #2005 and #2005.1.
+29 ;
MAGORD(NODE,DIR,BOTH) ;
+1 if NODE'?1"^MAG(2005".1".1"1","1.E1")"
QUIT ""
+2 NEW FILE,LST,PI,SUBS,TRAIL
+3 SET DIR=$SELECT($GET(DIR)<0:-1,1:1)
+4 if '$GET(BOTH)
QUIT $ORDER(@NODE,DIR)
+5 ;--- Find subscripts in both files that follow the @NODE
+6 SET TRAIL=","_$PIECE(NODE,",",2,999)
+7 FOR FILE=2005,2005.1
Begin DoDot:1
+8 SET PI="^MAG("_FILE_TRAIL
SET SUBS=$ORDER(@PI,DIR)
+9 if SUBS'=""
SET LST(SUBS,FILE)=""
+10 QUIT
End DoDot:1
+11 ;--- Return one of the subscripts according to the direction
+12 QUIT $ORDER(LST(""),DIR)
+13 ;
+14 ;+++++ CHECKS THE PATIENT REFERENCE
+15 ;
+16 ; IMGIEN Internal entry number of the image entry
+17 ;
+18 ; DFN Patient IEN (DFN)
+19 ;
+20 ; Return Values
+21 ; =============
+22 ; 0 Skip the image entry (different patient or error)
+23 ; 1 Process the image entry
+24 ;
PTCHK(IMGIEN,DFN) ;
+1 NEW NODE
SET NODE=$$NODE^MAGGI11(IMGIEN)
+2 QUIT $SELECT(NODE'="":$PIECE($GET(@NODE@(0)),U,7)=DFN,1:0)
+3 ;
+4 ;##### BROWSES IMAGES AND CALLS THE CALLBACK FUNCTION
+5 ;
+6 ; CALLBACK Full name of the callback function ($$TAG^ROUTINE)
+7 ; that is called for each preselected image.
+8 ;
+9 ; SINCE ENTRIES THAT ARE NOT MARKED AS DELETED CAN
+10 ; REFERENCE DELETED "CHILDREN", SUCH ENTRIES ARE PASSED
+11 ; TO THE CALLBACK FUNCTION EVEN IF ONLY DELETED IMAGES
+12 ; ARE REQUESTED! THEREFORE, THE FUNCTION MUST PERFORM
+13 ; ADDITIONAL SCREENING BY CHECKING THE "CHILD" ENTRIES.
+14 ;
+15 ; The function should accept 3 parameters:
+16 ;
+17 ; IMGIEN IEN of the image record
+18 ; (file #2005 or #2005.1)
+19 ;
+20 ; FLAGS Value of the FLAGS parameter of the
+21 ; $$QUERY function (see below).
+22 ;
+23 ; .DATA Reference to the local array passed via
+24 ; the MAG8DATA parameter of the $$QUERY
+25 ; function (see below).
+26 ;
+27 ; Non-zero result values of the callback function
+28 ; terminate the query:
+29 ;
+30 ; <0 Error descriptor (see the $$ERROR^MAGUERR)
+31 ; 0 Continue
+32 ; >0 Terminate the query (e.g. if maximum number of
+33 ; returned records has been reached)
+34 ;
+35 ; See the source code of the IMGQUERY^MAGGA03 and
+36 ; $$QRYCBK^MAGGA03 for an example.
+37 ;
+38 ; FLAGS Flags that control the execution (can be combined):
+39 ;
+40 ; C Capture date range. If this flag is provided,
+41 ; then the remote procedure uses values of the
+42 ; MAG8FROM and MAG8TO parameters to select images
+43 ; that were captured in this date range (see the
+44 ; DATE/TIME IMAGE SAVED field (7) and the "AD"
+45 ; cross-reference).
+46 ;
+47 ; Otherwise, values of those parameters are
+48 ; treated as the date range when procedures were
+49 ; performed (see the PROCEDURE/EXAM DATE/TIME
+50 ; field (15) and cross-references "APDTPX" and
+51 ; "APDT").
+52 ;
+53 ; G Include Group Images in the list of images returned.
+54 ; If any image in a group has an image that matches the
+55 ; status provided in the search criteria then
+56 ; the group will be returned.
+57 ;
+58 ; If the G flag is not set then only the status of the
+59 ; Group entry will be checked and the group will be
+60 ; returned if it passes.
+61 ;
+62 ; D Include only deleted images (file #2005.1)
+63 ;
+64 ; E Include only existing images (file #2005)
+65 ;
+66 ; If neither 'E' nor 'D' flag is provided, then an
+67 ; error code is returned.
+68 ;
+69 ; [.MAG8DATA] Reference to a local array that is passed to the
+70 ; callback function (by reference) "as is"
+71 ;
+72 ; [MAG8FROM] Date/time range for image selection. Parameter
+73 ; [MAG8TO] values should be valid date/times in internal or
+74 ; external FileMan format. If a parameter is not
+75 ; defined or empty, then the range remains open on
+76 ; the corresponding side.
+77 ;
+78 ; The beginning of the date/time range is included
+79 ; the search but the end is not! For example, if you
+80 ; need images for October 15, 2007, the internal
+81 ; parameter values should be 3071015 and 3071016.
+82 ;
+83 ; If the MAG8FROM is after the MAG8TO, then values
+84 ; of the parameters are swapped.
+85 ;
+86 ; [DFN] Patient IEN (DFN). If this parameter is defined and
+87 ; greater than 0, then only images associated with this
+88 ; patient are processed.
+89 ;
+90 ; Return Values
+91 ; =============
+92 ; <0 Error descriptor (see the $$ERROR^MAGUERR)
+93 ; 0 All appropriate image records have been processed
+94 ; >0 Value returned by the callback function when it
+95 ; terminated the query
+96 ;
+97 ; Notes
+98 ; =====
+99 ;
+100 ; Temporary global node ^TMP($J,"MAGGI13") is used by this function.
+101 ;
QUERY(CALLBACK,FLAGS,MAG8DATA,MAG8FROM,MAG8TO,DFN) ;
+1 NEW MAG8BOTH,MAG8CALL,MAG8DT,MAG8IEN,MAG8RC,MAG8ROOT,MAG8XREF,TMP
+2 ;P122
+3 NEW MAG8APP,MAG8DUZ,MAG8SITE,BOTHAPP
+4 ;
+5 SET FLAGS=$GET(FLAGS)
+6 ;=== Validate parameters
+7 if '(CALLBACK?2"$"1.8UN1"^MAG"1.5UN)
QUIT $$IPVE^MAGUERR("CALLBACK")
+8 ;--- If a patient IEN is provided, it must be valid
+9 IF $GET(DFN)>0
IF '$$VALDFN^MAGUTL05(DFN,.TMP)
DO STORE^MAGUERR(TMP)
QUIT TMP
+10 ;--- Unknown/Unsupported flag(s)
+11 if $TRANSLATE(FLAGS,"CDEG")'=""
QUIT $$IPVE^MAGUERR("FLAGS")
+12 ;--- Missing required flag
+13 if $TRANSLATE(FLAGS,"DE")=FLAGS
QUIT $$ERROR^MAGUERR(-6,,"D,E")
+14 ;
+15 ;=== The expression in the following line does not look like
+16 ; (FLAGS["E")&(FLAGS["D") because a group header that is
+17 ;=== not marked as deleted can reference deleted "children".
+18 SET MAG8BOTH=(FLAGS["D")
+19 SET TMP=$SELECT(FLAGS["E":2005,1:2005.1)
SET MAG8ROOT=$NAME(^MAG(TMP))
+20 SET TMP=$$DDQ^MAGUTL05(FLAGS)
+21 SET MAG8CALL="S MAG8RC="_CALLBACK_"(MAG8IEN,"_TMP_",.MAG8DATA)"
+22 SET MAG8RC=0
+23 ;P122 set a variable (MAG8DUZ) to $Order through the Cross Ref.
+24 SET MAG8DUZ=+$PIECE($GET(MAG8DATA("SAVEDBY")),"^",1)
+25 ;=== Return images in the capture date range captured by a User MAG8DUZ
+26 ; This call is made by the QA Review window. Looking for a list of images
+27 ; captured by a certain user in a certain date range.
+28 IF (FLAGS["C")
IF (MAG8DUZ)
Begin DoDot:1
+29 ;--- Modify the callback to check for patient
+30 if $GET(DFN)>0
SET $EXTRACT(MAG8CALL,1)="S:$$PTCHK(MAG8IEN,"_DFN_")"
+31 ;---
+32 ; ATDUZ may be used by more than QA Review, can't Force MAG8BOTH
+33 ; to '0', Deleted Images may be wanted by other functions.
+34 ;- S MAG8BOTH=0
+35 ; Loop through both Capture Application nodes of ADTDUZ
+36 FOR MAG8APP="C","I"
Begin DoDot:2
+37 SET MAG8XREF=$NAME(@MAG8ROOT@("ADTDUZ",MAG8APP))
+38 SET MAG8DT=MAG8TO
+39 FOR
SET MAG8DT=$$MAGORD($NAME(@MAG8XREF@(MAG8DT)),-1,MAG8BOTH)
if (MAG8DT="")!(MAG8DT<MAG8FROM)
QUIT
Begin DoDot:3
+40 SET MAG8SITE=""
+41 FOR
SET MAG8SITE=$$MAGORD($NAME(@MAG8XREF@(MAG8DT,MAG8DUZ,MAG8SITE)),-1,MAG8BOTH)
if (MAG8SITE="")
QUIT
Begin DoDot:4
+42 SET MAG8IEN=""
+43 FOR
Begin DoDot:5
+44 SET MAG8IEN=$$MAGORD($NAME(@MAG8XREF@(MAG8DT,MAG8DUZ,MAG8SITE,MAG8IEN)),-1,MAG8BOTH)
+45 IF $DATA(ZTQUEUED)
IF $$S^%ZTLOAD
SET MAG8RC="1^Task asked to stop"
SET ZTSTOP=1
+46 QUIT
End DoDot:5
if (MAG8IEN="")!MAG8RC
QUIT
XECUTE MAG8CALL
if MAG8RC
QUIT
+47 QUIT
End DoDot:4
End DoDot:3
if MAG8RC
QUIT
+48 QUIT
End DoDot:2
+49 QUIT
End DoDot:1
QUIT MAG8RC
+50 ;=== Browse images in the capture date range
+51 IF FLAGS["C"
Begin DoDot:1
+52 ;--- Modify the callback to check for patient
+53 if $GET(DFN)>0
SET $EXTRACT(MAG8CALL,1)="S:$$PTCHK(MAG8IEN,"_DFN_")"
+54 ;---
+55 SET MAG8XREF=$NAME(@MAG8ROOT@("AD"))
+56 SET MAG8DT=MAG8TO
+57 FOR
SET MAG8DT=$$MAGORD($NAME(@MAG8XREF@(MAG8DT)),-1,MAG8BOTH)
if (MAG8DT="")!(MAG8DT<MAG8FROM)
QUIT
Begin DoDot:2
+58 SET MAG8IEN=""
+59 FOR
Begin DoDot:3
+60 SET MAG8IEN=$$MAGORD($NAME(@MAG8XREF@(MAG8DT,MAG8IEN)),-1,MAG8BOTH)
+61 IF $DATA(ZTQUEUED)
IF $$S^%ZTLOAD
SET MAG8RC="1^Task asked to stop"
SET ZTSTOP=1
+62 QUIT
End DoDot:3
if (MAG8IEN="")!MAG8RC
QUIT
XECUTE MAG8CALL
if MAG8RC
QUIT
+63 QUIT
End DoDot:2
if MAG8RC
QUIT
+64 QUIT
End DoDot:1
QUIT MAG8RC
+65 ;
+66 ;=== Browse images in the procedure date range; single patient
+67 IF $GET(DFN)>0
Begin DoDot:1
+68 NEW MAG8DT1,MAG8DT2,MAG8PRX,MAG8TMP
+69 SET MAG8XREF=$NAME(@MAG8ROOT@("APDTPX",+DFN))
+70 SET MAG8TMP=$NAME(^TMP("MAGGI13",$JOB))
+71 ;--- "Invert" the dates
+72 SET MAG8DT1=$$INVDT(MAG8TO)
SET MAG8DT2=$$INVDT(MAG8FROM)
+73 ;---
+74 SET MAG8DT=MAG8DT1
+75 FOR
SET MAG8DT=$$MAGORD($NAME(@MAG8XREF@(MAG8DT)),1,MAG8BOTH)
if (MAG8DT="")!(MAG8DT>MAG8DT2)
QUIT
Begin DoDot:2
+76 KILL @MAG8TMP
+77 IF $DATA(ZTQUEUED)
IF $$S^%ZTLOAD
SET MAG8RC="1^Task asked to stop"
SET ZTSTOP=1
QUIT
+78 ;--- Merge IEN lists from both files
+79 SET MAG8PRX=""
+80 FOR
SET MAG8PRX=$$MAGORD($NAME(@MAG8XREF@(MAG8DT,MAG8PRX)),1,MAG8BOTH)
if MAG8PRX=""
QUIT
Begin DoDot:3
+81 SET MAG8IEN=""
+82 FOR
SET MAG8IEN=$$MAGORD($NAME(@MAG8XREF@(MAG8DT,MAG8PRX,MAG8IEN)),1,MAG8BOTH)
if MAG8IEN=""
QUIT
Begin DoDot:4
+83 SET @MAG8TMP@(MAG8IEN)=""
+84 QUIT
End DoDot:4
End DoDot:3
+85 ;--- Browse the list and select the images
+86 SET MAG8IEN=""
+87 FOR
Begin DoDot:3
+88 SET MAG8IEN=$ORDER(@MAG8TMP@(MAG8IEN),-1)
+89 IF $DATA(ZTQUEUED)
IF $$S^%ZTLOAD
SET MAG8RC="1^Task asked to stop"
SET ZTSTOP=1
+90 QUIT
End DoDot:3
if (MAG8IEN'>0)!MAG8RC
QUIT
XECUTE MAG8CALL
if MAG8RC
QUIT
+91 QUIT
End DoDot:2
if MAG8RC
QUIT
+92 ;---
+93 KILL @MAG8TMP
+94 QUIT
End DoDot:1
QUIT MAG8RC
+95 ;
+96 ;=== Browse images in the procedure date range; all patients
+97 SET MAG8XREF=$NAME(@MAG8ROOT@("APDT"))
+98 SET MAG8DT=MAG8TO
+99 FOR
SET MAG8DT=$$MAGORD($NAME(@MAG8XREF@(MAG8DT)),-1,MAG8BOTH)
if (MAG8DT="")!(MAG8DT<MAG8FROM)
QUIT
Begin DoDot:1
+100 SET MAG8IEN=""
+101 FOR
Begin DoDot:2
+102 SET MAG8IEN=$$MAGORD($NAME(@MAG8XREF@(MAG8DT,MAG8IEN)),-1,MAG8BOTH)
+103 IF $DATA(ZTQUEUED)
IF $$S^%ZTLOAD
SET MAG8RC="1^Task asked to stop"
SET ZTSTOP=1
+104 QUIT
End DoDot:2
if (MAG8IEN="")!MAG8RC
QUIT
XECUTE MAG8CALL
if MAG8RC
QUIT
+105 QUIT
End DoDot:1
if MAG8RC
QUIT
+106 ;---
+107 QUIT MAG8RC