Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: MAGDSTQ8

MAGDSTQ8.m

Go to the documentation of this file.
  1. MAGDSTQ8 ;WOIFO/PMK - Study Tracker - Patient Level Query/Retrieve Display; Apr 06, 2020@13:36:50
  1. ;;3.0;IMAGING;**231**;Mar 19, 2002;Build 9;Aug 30, 2013
  1. ;; Per VHA Directive 2004-038, this routine should not be modified.
  1. ;; +---------------------------------------------------------------+
  1. ;; | Property of the US Government. |
  1. ;; | No permission to copy or redistribute this software is given. |
  1. ;; | Use of unreleased versions of this software requires the user |
  1. ;; | to execute a written test agreement with the VistA Imaging |
  1. ;; | Development Office of the Department of Veterans Affairs, |
  1. ;; | telephone (301) 734-0100. |
  1. ;; | The Food and Drug Administration classifies this software as |
  1. ;; | a medical device. As such, it may not be changed in any way. |
  1. ;; | Modifications to this software may result in an adulterated |
  1. ;; | medical device under 21CFR820, the use of which is considered |
  1. ;; | to be a violation of US Federal Statutes. |
  1. ;; +---------------------------------------------------------------+
  1. ;;
  1. ;
  1. ; Notice: This routine is on both VistA and the DICOM Gateway
  1. ;
  1. ; Supported IA #10103 reference $$HTE^XLFDT function call
  1. ;
  1. ; Display Retrieve Status
  1. ;
  1. Q
  1. ;
  1. RETRIEVE ;
  1. N ACNUMB,BADTAGS,BADUIDS,COMMENT,COMPLETED,DONE,ERRORID,FAILED,I,MEANING,NORESULTS
  1. N REDISPLAY,REMAINING,STATUS,STATUSCODE,TIME,TIMEOUT,TIMESTAMP,X,WARNING
  1. ;
  1. S TIMEOUT=1
  1. ;
  1. S ACNUMB=$G(^TMP("MAG",$J,"Q/R QUERY",QRSTACK,"ACCESSION NUMBER"))
  1. I ACNUMB="",^TMP("MAG",$J,"Q/R QUERY",QRSTACK,"RETRIEVE LEVEL")="PATIENT" D
  1. . S ACNUMB=^TMP("MAG",$J,"Q/R QUERY",QRSTACK,"PATIENT ID")
  1. . Q
  1. ;
  1. K ^XTMP(MAGXTMP,HOSTNAME,$J,QRSTACK,"Q/R RETRIEVE STATUS",ACNUMB)
  1. ;
  1. D DISPLAY(.REDISPLAY)
  1. ;
  1. S (DONE,NORESULTS)=0
  1. F D Q:DONE
  1. . I REDISPLAY D DISPLAY(.REDIPLAY)
  1. . F Q:$X=0 W @IOBS," ",@IOBS ; erase the line
  1. . S X=$G(^XTMP(MAGXTMP,HOSTNAME,$J,QRSTACK,"Q/R RETRIEVE STATUS",ACNUMB))
  1. . I X="" D
  1. . . W "No retrieve results yet"
  1. . . S NORESULTS=NORESULTS+1
  1. . . F I=1:1:NORESULTS W "."
  1. . . I NORESULTS>45 S DONE=-1
  1. . . Q
  1. . E D
  1. . . S STATE=$P(X,"|",1)
  1. . . S TIMESTAMP=$P(X,"|",2)
  1. . . S STATUSCODE=$P(X,"|",3)
  1. . . I STATUSCODE="" W STATE Q ; informational message
  1. . . S REMAINING=+$P(X,"|",4) ; coerce null to 0
  1. . . S COMPLETED=+$P(X,"|",5) ; coerce null to 0
  1. . . S FAILED=$P(X,"|",6)
  1. . . S WARNING=$P(X,"|",7)
  1. . . S BADTAGS=$P(X,"|",8)
  1. . . S BADUIDS=$P(X,"|",9)
  1. . . S ERRORID=$P(X,"|",10)
  1. . . S COMMENT=$P(X,"|",11,999) ; may contain "|"
  1. . . S TIME=$P($$HTE^XLFDT(TIMESTAMP),"@",2)
  1. . . S STATUS=$$STATUS(STATUSCODE,.MEANING)
  1. . . I STATUS="Pending" D
  1. . . . I COMPLETED=0 W "No DICOM object retrieved yet"
  1. . . . E I COMPLETED=1 W "One DICOM object retrieved"
  1. . . . E W COMPLETED," DICOM objects retrieved"
  1. . . . W " -- "
  1. . . . I REMAINING=1 W "one DICOM object remaining"
  1. . . . E W REMAINING," DICOM objects remaining"
  1. . . . Q
  1. . . E I STATUS="Success" D
  1. . . . I COMPLETED=0 W "No DICOM objects were retrieved"
  1. . . . E I COMPLETED=1 W "One DICOM object retrieved from """,QRSCP,""""
  1. . . . E W "A total of ",COMPLETED," DICOM objects retrieved from """,QRSCP,""""
  1. . . . S DONE=1
  1. . . . Q
  1. . . E I STATUS="Cancel" D
  1. . . . W "Retrieve operation canceled"
  1. . . . S DONE=1
  1. . . . Q
  1. . . E I STATUS="Failure" D
  1. . . . W "Retrieve operation failed: ",MEANING
  1. . . . S DONE=1
  1. . . . Q
  1. . . I FAILED D
  1. . . . W !,"Number of failed operations: ",FAILED
  1. . . . S REDISPLAY=1
  1. . . . Q
  1. . . I WARNING D
  1. . . . W !,"Number of operations with warnings: ",WARNING
  1. . . . S REDISPLAY=1
  1. . . . Q
  1. . . I ERRORID'="" D
  1. . . . W !,"Error ID: ",ERRORID
  1. . . . S REDISPLAY=1
  1. . . . Q
  1. . . I COMMENT'="" D
  1. . . . W !,"Error Comment: ",COMMENT
  1. . . . S REDISPLAY=1
  1. . . . Q
  1. . . I BADTAGS'="" D
  1. . . . W !,"Offending Elements: ",BADTAGS
  1. . . . S REDISPLAY=1
  1. . . . Q
  1. . . I BADUIDS'="" D
  1. . . . W !,"Failed SOP Instance UIDs: ",BADUIDS
  1. . . . S REDISPLAY=1
  1. . . . Q
  1. . . Q
  1. . Q:DONE
  1. . W ?68,"More?"
  1. . R " y// ",X:TIMEOUT
  1. . I X="" S X="y" W X
  1. . I "Yy"'[$E(X) S DONE=1
  1. . Q
  1. I DONE<1 W !,"*** Possible problem with DICOM Gateway C-Move Request process ***"
  1. D CONTINUE^MAGDSTQ
  1. Q
  1. ;
  1. DISPLAY(REDISPLAY) ; refresh the top of the screen
  1. D DISPLAY^MAGDSTQ
  1. W !!!
  1. S REDISPLAY=0
  1. Q
  1. ;
  1. STATUS(CODE,MEANING) ; return status codes
  1. ; from Table C.4-2 C-MOVE Response Status Values PS3.4 2108b
  1. I CODE="FF00" D Q "Pending"
  1. . S MEANING="Sub-operations are continuing"
  1. . Q
  1. I CODE="FF01" D Q "Pending"
  1. . S MEANING="Sub-operations are continuing but one or more Optional Keys were not supported"
  1. . Q
  1. I (CODE="0000")!(CODE=0) D Q "Success"
  1. . S MEANING="Sub-operations Complete - No Failures"
  1. . Q
  1. I CODE="A700" D Q "Failure"
  1. . S MEANING="Refused: Out of Resources"
  1. . Q
  1. I CODE="A701" D Q "Failure"
  1. . S MEANING="Refused: Out of Resources - Unable to calculate number of matches"
  1. . Q
  1. I CODE="A702" D Q "Failure"
  1. . S MEANING="Refused: Out of Resources - Unable to perform sub-operations"
  1. . Q
  1. I CODE="A801" D Q "Failure"
  1. . S MEANING="Refused: Move Destination unknown"
  1. . Q
  1. I CODE="A900" D Q "Failure"
  1. . S MEANING="Error: Data Set does not match SOP Class"
  1. . Q
  1. I CODE?1"C"3E D Q "Failure"
  1. . S MEANING="Failed: Unable to Process"
  1. . Q
  1. I CODE="FE00" D Q "Cancel"
  1. . S MEANING="Sub-operations terminated due to Cancel Indication"
  1. . Q
  1. I CODE="B000" D Q "Warning"
  1. . S MEANING="Sub-operations Complete - One or more Failures"
  1. . Q
  1. S MEANING="Unknown Status Code: """_CODE_""""
  1. Q "???"