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

MAGGSTI.m

Go to the documentation of this file.
  1. MAGGSTI ;WOIFO/GEK - Imaging interface to TIU RPC Calls etc. ; 01 Nov 2001 12:32 PM
  1. ;;3.0;IMAGING;**7**;Jul 12, 2002
  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. LISTC(ATMP,PROC,MAGDFN,BDT,EDT,NUM,DETAILS) ;Get Short list of TIU notes
  1. ; given a CLASS in PROC parameter
  1. ; The compressed listing, 4 columns "Date^Spec^Desc^Img Count^procedure info"
  1. N MAGX,I,ACT,NODE,TMP
  1. D CONTEXT^TIUSRVLO(.MAGX,PROC,1,MAGDFN)
  1. I '$D(@MAGX) Q
  1. S ACT=+$O(@ATMP@(""),-1)
  1. S I="" F S I=$O(@MAGX@(I)) Q:I="" D
  1. . ;
  1. . S X=$S(DETAILS:$$DETINF(@MAGX@(I)),1:$$CMPINF(@MAGX@(I)))
  1. . S ACT=ACT+1
  1. . S @ATMP@(ACT)=X
  1. I DETAILS S @ATMP@(1)="Date^Title^Images^Author^Status^Visit" ;^|TIUDA^
  1. Q
  1. CMPINF(NODE) ;
  1. N RY
  1. S RY=$$EXTDT^MAGGSU1($P(NODE,U,3))_U_"TIU"_U_$P(NODE,U,2)_U
  1. S RY=RY_$$IMGCT($P(NODE,U))_U_$P($P(NODE,U,5),";",2)_U
  1. S RY=RY_"|TIU^"_$P(NODE,U)
  1. Q RY
  1. ;
  1. DETINF(NODE) ;
  1. ; The node info from TIUSRVLO is
  1. ; TIUDA Desc date patient duz;author status
  1. ; x)=2452^General Note^2910528.1533^HOOD, ROBIN (H2591)^10;MELANIE BUECHLER
  1. ; service status visit info ? ? ?
  1. ; ^CARDIOLOGY^completed^Visit: 05/28/91^ ^^0^
  1. N RY
  1. ; DATE^DESC^IMGCT^AUTHOR^STATUS^VISIT^|"TIU^"TIUDA^
  1. S RY=$$EXTDT^MAGGSU1($P(NODE,U,3))_U_$P(NODE,U,2)_U_$$IMGCT($P(NODE,U))_U
  1. S RY=RY_$P($P(NODE,U,5),";",2)_U_$P(NODE,U,7)_U_$P(NODE,U,8)
  1. S RY=RY_U_"|TIU"_U_$P(NODE,U)_U
  1. Q RY
  1. IMGCT(TIUDA) ; Get count of images for this TIU Document
  1. ; If more than one group (or image) is pointing to this Document
  1. ; then return "Group count : total images" i.e. "3:134"
  1. ;
  1. N MAGARR,MAGIEN,CT,GCT,ICT,I
  1. S I="",CT=0,GCT=0
  1. D GETILST^TIUSRVPL(.MAGARR,TIUDA)
  1. F S I=$O(MAGARR(I)) Q:'I D
  1. . S ICT=+$P($G(^MAG(2005,MAGARR(I),1,0)),U,4)
  1. . S ICT=$S(ICT:ICT,1:1) ;If no group images, set count =1 (single image)
  1. . S GCT=GCT+1
  1. . S CT=CT+ICT
  1. I (GCT>1) Q GCT_":"_CT
  1. Q CT
  1. FILE(MAGRY,MAGDA,TIUDA) ; RPC Call to file TIU and Imaging Pointers
  1. ; TIU API to add image to TIU
  1. ; TODO; have to validate that the Imaging patient matches the TIU patient.
  1. D PUTIMAGE^TIUSRVPL(.MAGRY,TIUDA,MAGDA) ;
  1. I 'MAGRY Q
  1. ; Now SET the Parent fields in the Image File
  1. S $P(^MAG(2005,MAGDA,2),U,6,8)=8925_U_TIUDA_U_+MAGRY
  1. ; DONE.
  1. S MAGRY="1^Image pointer filed successfully"
  1. Q
  1. DATA(MAGRY,TIUDA) ;RPC Call to get TIU data from the TIUDA
  1. ; Return = TIUDA^Document Type ^Document Date^DFN
  1. ; returning DFN is new, We'll need IA for it ;TODO
  1. ;
  1. S MAGRY=TIUDA_U_$$GET1^DIQ(8925,TIUDA,".01","E")_U_$$GET1^DIQ(8925,TIUDA,"1201","I")_U_$$GET1^DIQ(8925,TIUDA,".02","I")
  1. ;
  1. Q
  1. IMAGES(MAGRY,TIUDA) ;RPC Call to get all images for a given TIU DA
  1. ; We first get all Image IEN's breaking groups into seperate images
  1. ; Then get Image Info for each one.
  1. ; MAGRY - Return array of Image Data entries
  1. ; MAGRY(0) is 1 ^ message if successful
  1. ; 0 ^ Error message if error;
  1. ; TIUDA is IEN in ^TIU(8925
  1. ;
  1. ; Call TIU API to get list of Image IEN's
  1. N MAGARR,CT K ^TMP("MAGGX",$J)
  1. N MAGZZ
  1. D GETILST^TIUSRVPL(.MAGARR,TIUDA)
  1. S CT=0
  1. K ^TMP("MAGGX",$J)
  1. ; Now get all images for all groups and single images.
  1. S I="" F S I=$O(MAGARR(I)) Q:'I S DA=MAGARR(I) D
  1. . I $O(^MAG(2005,DA,1,0)) D Q
  1. . . S J=0 F S J=$O(^MAG(2005,DA,1,J)) Q:'J S CT=CT+1,^TMP("MAGGX",$J,CT)=^(J,0)
  1. . S CT=CT+1
  1. . S ^TMP("MAGGX",$J,CT)=DA
  1. ; Now get image info for each image
  1. ;
  1. S CT=0,Z=""
  1. S MAGQUIET=1
  1. F S Z=$O(^TMP("MAGGX",$J,Z)) Q:Z="" D
  1. . S CT=CT+1,MAGXX=^TMP("MAGGX",$J,Z)
  1. . ;GEK 8/24/00 Stoping the Invalid Image IEN's and Deleted Images
  1. . I '$D(^MAG(2005,MAGXX)) D Q
  1. . . D INVALID^MAGGTIG(MAGXX,.MSGX) S MAGRY(CT)=MSGX
  1. . D BOTH^MAGFILEB
  1. . S MAGRY(CT)="B2^"_MAGFILE
  1. K MAGQUIET
  1. S MAGRY(0)=CT_"^"_CT_" Images for the selected TIU NOTE"
  1. ; PUT THE Image IEN of the last image into the group ien field.
  1. Q:'CT
  1. S $P(MAGRY(0),U,3)=TIUDA
  1. D DATA(.MAGZZ,TIUDA)
  1. S $P(MAGRY(0),U,4)=$$GET1^DIQ(8925,TIUDA,".02","E")_" "_$P(MAGZZ,U,2)_" "_$$FMTE^XLFDT($P(MAGZZ,U,3),"8")
  1. ;
  1. S $P(MAGRY(0),U,5)=$S($P($G(MAGFILE),U):$P(MAGFILE,U),1:MAGXX)
  1. Q
  1. ;