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

MAGGTRAI.m

Go to the documentation of this file.
  1. MAGGTRAI ;WOIFO/GEK - list images for Radiology report ; [ 11/08/2001 17:18 ]
  1. ;;3.0;IMAGING;**8,93**;Dec 02, 2009;Build 163
  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. ;; | |
  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. Q
  1. IMAGE(MAGZRY,DATA) ;RPC [MAGGRADIMAGE]
  1. ; Call from selected entry in Rad Exam list.
  1. ; INPUT is DATA, which is just what we sent in the list of Rad
  1. ; Exams for the patient.
  1. ;DATA is the Radiology values stored in ^TMP($J,"RAEX",x)
  1. ; that the radiology procedure RAPTLU sets during the search
  1. ; for patient exams. (see routine RAPTLU )
  1. ; ^TMP($J,"RAEX",RACNT)=
  1. ; RADFN_"^"_RADTI_"^"_RACNI_"^"_RANME_"^"_RASSN_"^"
  1. ; _RADATE_"^"_RADTE_"^"_RACN_"^"_RAPRC_"^"_RARPT_"^"_RAST
  1. ;
  1. S MAGZRY=$NA(^TMP("MAGGTRAI",$J))
  1. K @MAGZRY
  1. IF $$NEWERR^%ZTER N $ETRAP,$ESTACK S $ETRAP="D ERRA^MAGGTERR"
  1. E S X="ERRA^MAGGTERR",@^%ZOSF("TRAP")
  1. N I,Y,CT,MAGIEN
  1. ;
  1. S DATA=$P(DATA,"^",7,99)
  1. S CT=0
  1. F I="RADFN","RADTI","RACNI","RANME","RASSN","RADATE","RADTE","RACN","RAPRC","RARPT","RAST" S CT=CT+1,@I=$P(DATA,"^",CT)
  1. ; Patch 2.0.5 next few lines for Patient Safety
  1. I RARPT["PMRAD" S @MAGZRY@(0)="-2^Patient Mismatch. Radiology Files" Q
  1. I 'RARPT S @MAGZRY@(0)="0^No Report for selected exam." Q
  1. I '$O(^RARPT(RARPT,2005,0)) S @MAGZRY@(0)="0^No Images for selected exam." Q
  1. I $P($G(^RARPT(RARPT,0)),U,2)'=RADFN S @MAGZRY@(0)="-2^Patient Mismatch. Radiology Files" Q
  1. D GETLIST
  1. Q
  1. IMAGEC(MAGZRY,DATA) ;RPC [MAGG CPRS RAD EXAM]
  1. ; Call to list Images for a Rad Exam that was selected from CPRS
  1. ; and Imaging Window was notified via windows messaging
  1. ; INPUT : DATA is in format of Windows message received from CPRS
  1. ; example 'RPT^CPRS^29027^RA^i79029185.9998-1'
  1. N DFN,RARPT,ENT,INVDTTM,INVDT,INVTM
  1. S X=$$RTRNFMT^XWBLIB("GLOBAL ARRAY",1)
  1. S MAGZRY=$NA(^TMP("MAGGTRAI",$J))
  1. K @MAGZRY
  1. S DFN=$P(DATA,U,3)
  1. S ENT=$P($P(DATA,U,5),"-",2)
  1. S INVDTTM=$P($P(DATA,U,5),"-",1)
  1. S INVDT=$P(INVDTTM,".",1)
  1. S INVTM=$P(INVDTTM,".",2)
  1. F Q:($L(INVDT)<8) S INVDT=$E(INVDT,2,$L(INVDT))
  1. S INVDTTM=INVDT_"."_INVTM
  1. I '$D(^RADPT(DFN,"DT",INVDTTM,"P",ENT,0)) S @MAGZRY@(0)="0^INVALID Data : Attempt to access Exam failed." Q
  1. ; Get out the Naked reference .
  1. S RARPT=$P(^RADPT(DFN,"DT",INVDTTM,"P",ENT,0),U,17)
  1. ;S RARPT=$P(^(0),U,17)
  1. I 'RARPT S @MAGZRY@(0)="0^No Report for selected Exam" Q
  1. ; MAGQI 8/22/01
  1. I $P($G(^RARPT(RARPT,0)),U,2)'=DFN S @MAGZRY@(0)="-2^Patient Mismatch. Radiology File" Q
  1. D GETLIST
  1. N XINFO
  1. S XINFO=$P(^RARPT(RARPT,0),U,1)
  1. S X=$P(^RADPT(DFN,"DT",INVDTTM,"P",ENT,0),U,2)
  1. S XINFO=XINFO_" "_$P(^RAMIS(71,X,0),U)
  1. S X=$P(^RARPT(RARPT,0),U,3)
  1. S XINFO=XINFO_" "_X
  1. S $P(@MAGZRY@(0),U,3)=RARPT
  1. S $P(@MAGZRY@(0),U,4)=XINFO
  1. Q
  1. GETLIST ; Private call. From other points in this routine, when RARPT is defined
  1. ; and returns a list in MAGZRY(1..n).
  1. ; We'll make a tmp list of just the image IEN's
  1. ; splitting groups into individual image entries.
  1. ; If more than 1 Image group points to this report, we
  1. ; will prefix the Image Description with (G1), (G2) etc
  1. ; We call GROUP^MAGGTIG to get the images for the group, this call
  1. ; sorts the images in Dicom Series, Dicom Image number order.
  1. ;
  1. K ^TMP("MAGGX",$J)
  1. N OI,IGCT,MAGIEN1,ORDCT,GCT,MAGQI,MAGX,SINGCT
  1. S (ORDCT,GCT,SINGCT)=0
  1. S IGCT=+$P($G(^RARPT(RARPT,2005,0)),U,4)
  1. ; Quit if no images for RARPT
  1. I IGCT=0 S @MAGZRY@(0)="0^0 Images for Radiology Report." Q
  1. ;
  1. ; Check all Image entries in RARPT 2005 NODE. for Patient match Pointer match, from both
  1. ; RARPT end, and Imaging end.
  1. S MAGQI=1
  1. S OI=0,CT=1 F S OI=$O(^RARPT(RARPT,2005,OI)) Q:'OI D Q:(MAGQI<1)
  1. . S MAGIEN1=$P(^RARPT(RARPT,2005,OI,0),U)
  1. . ; Assure magdfn = rarpt dfn
  1. . I $P($G(^RARPT(RARPT,0)),U,2)'=$P($G(^MAG(2005,MAGIEN1,0)),U,7) S MAGQI="-2^Patient Mismatch. Radiology Report" Q
  1. . ; Assure magien1 is pointing to this rarpt
  1. . I $P($G(^MAG(2005,MAGIEN1,2)),U,7)'=RARPT S MAGQI="-2^Pointer Mismatch. Radiology Report" Q
  1. . ; Now run the Imaging integrity check
  1. . D CHK^MAGGSQI(.MAGX,MAGIEN1) I 'MAGX(0) S MAGQI="-2^"_$P(MAGX(0),U,2,99) Q
  1. ;
  1. I MAGQI<1 S @MAGZRY@(0)=MAGQI Q
  1. S CT=0
  1. ;
  1. S OI=0,CT=1 F S OI=$O(^RARPT(RARPT,2005,OI)) Q:'OI D
  1. . S MAGIEN1=$P(^RARPT(RARPT,2005,OI,0),U) D ONELIST
  1. ;
  1. ; Now get the list from the TMP LIST and return it.
  1. I '$D(^TMP("MAGGX",$J)) S @MAGZRY@(0)="0^Report "_RARPT_": has INVALID Image Pointers" Q
  1. S CT=0
  1. S MAGQUIET=1
  1. S I="",J="",K=""
  1. F S I=$O(^TMP("MAGGX",$J,I)) Q:I="" D
  1. . S J=""
  1. . F S J=$O(^TMP("MAGGX",$J,I,J)) Q:J="" D
  1. . . S K=""
  1. . . F S K=$O(^TMP("MAGGX",$J,I,J,K)) Q:K="" D
  1. . . . S CT=CT+1
  1. . . . S X="["_J_"]"_$P(^TMP("MAGGX",$J,I,J,K),U,8)
  1. . . . S $P(^TMP("MAGGX",$J,I,J,K),U,8)=X
  1. . . . S @MAGZRY@(CT)=^TMP("MAGGX",$J,I,J,K)
  1. K MAGQUIET
  1. S @MAGZRY@(0)=CT_"^Images for the selected Radiology Exam"
  1. ; Redesign needed for Multiple Image Groups pointing to an exam or note.
  1. ; we now put all images from all groups in one list.
  1. S $P(@MAGZRY@(0),U,5)=$G(MAGIEN1) ; this was last ien from multiple Image Groups.
  1. ;
  1. Q
  1. ONELIST ; Private Call from other parts of this routine.
  1. N MAGTMP
  1. Q:'$D(^MAG(2005,MAGIEN1,0))
  1. ; if a single image just get record for that IEN
  1. I '$O(^MAG(2005,MAGIEN1,1,0)) D Q
  1. . ;S MAGXX=MAGIEN1 D INFO^MAGGTII
  1. . S MAGFILE=$$INFO^MAGGAII(MAGIEN1,"E")
  1. . S ORDCT=ORDCT+1,SINGCT=SINGCT+1
  1. . S ^TMP("MAGGX",$J,ORDCT,"S",SINGCT)="B2^"_MAGFILE
  1. D GROUP^MAGGTIG(.MAGTMP,MAGIEN1) I $P(@MAGTMP@(0),U,2)>0 D
  1. . S ORDCT=ORDCT+1,GCT=GCT+1,X="G"_GCT
  1. . K @MAGTMP@(0)
  1. . M ^TMP("MAGGX",$J,ORDCT,X)=@MAGTMP
  1. Q