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

MAGGTRA1.m

Go to the documentation of this file.
  1. MAGGTRA1 ;WOIFO/GEK,DAC - RPC Call to list Patient's Rad/Nuc Exams, Reports ; 05 August 2019 7:45AM
  1. ;;3.0;IMAGING;**234,225**;Mar 01, 2002;Build 5
  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. LIST(MAGRY,DATA) ; RPC Call MAGGRADLIST
  1. ;MAGRY - the return array of patient's exams.
  1. ;DATA - DFN ^ begining date ^ end date ^ number to return
  1. ; (only DFN is being sent for now. later we'll enable date
  1. ; ranges and/or counts )
  1. ;
  1. IF $$NEWERR^%ZTER N $ETRAP,$ESTACK S $ETRAP="D ERRA^MAGGTERR"
  1. E S X="ERRA^MAGGTERR",@^%ZOSF("TRAP")
  1. ;
  1. N X,Y,Z,I,J,K,MAGNAME,MAGDFN,MAGCNT,MAGBDT,MAGEDT,MAGEXN
  1. S MAGDFN=+DATA
  1. S MAGNAME=$P($G(^DPT(MAGDFN,0)),U)
  1. I MAGNAME="" S MAGRY(0)="0^INVALID Patient ID" Q
  1. ; We have to account for old Wrkstation code that was returning a
  1. ; 1 as second piece.
  1. I $P(DATA,U,2)=1 S $P(DATA,U,2)=""
  1. ; Set default Begin,End dates and number to return
  1. S MAGBDT=$S($P(DATA,U,2):$P(DATA,U,2),1:"1070101")
  1. S MAGEDT=$S($P(DATA,U,3):$P(DATA,U,3),1:$$DT^XLFDT)
  1. S MAGEXN=$S($P(DATA,U,4):$P(DATA,U,4),1:200)
  1. S MAGRY(0)="0^Compiling list of Radiology Exams..."
  1. ;
  1. D EN1^RAO7PC1(MAGDFN,MAGBDT,MAGEDT,MAGEXN)
  1. I '$D(^TMP($J,"RAE1")) S MAGRY(0)="0^No Radiology Exams for "_MAGNAME Q
  1. ;
  1. ; we'll return MAGRY(0) = return count^message
  1. ; MAGRY(1)=column heading^column heading^column h.....
  1. ; MAGRY(2..n)=info from exam.
  1. D CONVERT
  1. S MAGRY(0)=MAGCNT-1_"^Radiology Exams: "_MAGNAME
  1. S MAGRY(1)="#^Day-Case^Procedure^Exam Date^Exam status / Report status^Imaging Loc"
  1. Q
  1. CONVERT ; Convert the ^TMP($J,"RAE1",MAGDFN to our output array.
  1. N XRPT
  1. S MAGCNT=1
  1. S I=0 F S I=$O(^TMP($J,"RAE1",MAGDFN,I)) Q:'I D
  1. . N SITE,SITEACN,I2,SITEIEN ; P234/P225 - DAC
  1. . S MAGCNT=MAGCNT+1
  1. . S J=^TMP($J,"RAE1",MAGDFN,I) ; Changed to full reference /gek
  1. . S X=9999999.9999-$P(I,"-"),X=$E(X,4,7)_$E(X,2,3)
  1. . S I2=$P(I,"-")
  1. . ; P234 DAC - Add site when there is a long accession number
  1. . ; P225 DAC - Modified to pull data from next node if node(S) are deleted
  1. . S SITEIEN=$O(^RADPT(MAGDFN,"DT",I2,"P",0)) ; ICR #1172 (Private)
  1. . I SITEIEN S SITE="",SITEACN=$P(^RADPT(MAGDFN,"DT",I2,"P",SITEIEN,0),U,31) ; ICR #1172 (Private)
  1. . I SITEACN S SITE=$P(SITEACN,"-",1)_"-"
  1. . ;
  1. . ; Y2K not needed on day-case - Rad uses as string variable.
  1. . ; 1 # 2 day-case 3 desc
  1. . ; P234 DAC - Add site when there is a long accession number
  1. . S Z=MAGCNT-1_U_SITE_X_"-"_$P(J,"^",2)_U_$P(J,U)_U
  1. . S X=9999999.9999-$P(I,"-")
  1. . ; 4 date
  1. . S Z=Z_$E(X,4,5)_"/"_$E(X,6,7)_"/"_(1700+$E(X,1,3))_U
  1. . ; 5 EXAM status / Report status
  1. . S Z=Z_$P($P(J,U,6),"~",2)_" / "_$P(J,U,3)_U
  1. . S K=$$FMTE^XLFDT(X,"1P")
  1. . ; 6 image loc 7 dfn 8 invrs dt 9 case # 10 11 12 output date
  1. . S Z=Z_$P(J,U,7)_U_MAGDFN_U_$P(I,"-")_U_$P(I,"-",2)_U_U_U_K_U
  1. . ; 13 intdt 14 RACN 16 rarpt
  1. . S Z=Z_X_U_$P(J,U,2)_U_U_$P(J,U,5)_U_U
  1. . S XRPT=$P(J,U,5) I XRPT I $P($G(^RARPT(XRPT,0)),U,2)'=MAGDFN D
  1. . . S $P(Z,U,16)=XRPT_"PMRAD"
  1. . . S $P(Z,U,5)="Patient Mismatch. Radiology Files"
  1. . ; If this report has images, we'll display "(I)"
  1. . I $O(^RARPT(+$P(J,U,5),2005,0)) S $P(Z,U,5)=$P(Z,U,5)_" (I)"
  1. . ;
  1. . S MAGRY(MAGCNT)=Z
  1. Q