MAGNVIC ;WOIFO/NST - Utilities for Image Import API ; 09 Mar 2010 4:14 PM
;;3.0;IMAGING;**108**;Mar 19, 2002;Build 1738;May 20, 2010
;; 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. |
;; +---------------------------------------------------------------+
;;
;
;***** RPC TO CHECKS IF PHOTO IMAGE EXISTS FOR A PATIENT
;
; MAGDFN Patient DFN
;
; Return Values
; =============
; MAGRY = 0 Photo doesn't exist
; Date.Timestamp - Photo on file (date timestamp of the most recent photo)
;
RPHASPHT(MAGRY,MAGDFN) ;RPC [MAGN PATIENT HAS PHOTO]
K MAGRY
N EXIST
N $ETRAP,$ESTACK S $ETRAP="D ERR^MAGGTERR"
S EXIST=$$HASPHOTO(+MAGDFN)
S MAGRY=EXIST
Q
;
;##### CHECKS IF PHOTO IMAGE EXISTS FOR A PATIENT MAGDFN
;
; MAGDFN Patient DFN
;
; Return Values
; =============
; 0 - Photo doesn't exist
; Date.Timestamp - Photo on file (date timestamp of the most recent photo)
;
HASPHOTO(MAGDFN) ;
N RDT,IEN,RESULT
S RDT=""
S RESULT=0
F Q:RESULT S RDT=$O(^MAG(2005,"APPXDT",MAGDFN,"PHOTO ID",RDT)) Q:RDT="" D
. S IEN=""
. F Q:RESULT S IEN=$O(^MAG(2005,"APPXDT",MAGDFN,"PHOTO ID",RDT,IEN)) Q:IEN="" D
. . Q:$$ISDEL^MAGGI11(IEN) ; Deleted image
. . S RESULT=9999999.9999-RDT ; need to reverse the date
. . Q
. Q
Q RESULT
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HMAGNVIC 2221 printed Nov 22, 2024@17:17:39 Page 2
MAGNVIC ;WOIFO/NST - Utilities for Image Import API ; 09 Mar 2010 4:14 PM
+1 ;;3.0;IMAGING;**108**;Mar 19, 2002;Build 1738;May 20, 2010
+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 ;
+18 ;***** RPC TO CHECKS IF PHOTO IMAGE EXISTS FOR A PATIENT
+19 ;
+20 ; MAGDFN Patient DFN
+21 ;
+22 ; Return Values
+23 ; =============
+24 ; MAGRY = 0 Photo doesn't exist
+25 ; Date.Timestamp - Photo on file (date timestamp of the most recent photo)
+26 ;
RPHASPHT(MAGRY,MAGDFN) ;RPC [MAGN PATIENT HAS PHOTO]
+1 KILL MAGRY
+2 NEW EXIST
+3 NEW $ETRAP,$ESTACK
SET $ETRAP="D ERR^MAGGTERR"
+4 SET EXIST=$$HASPHOTO(+MAGDFN)
+5 SET MAGRY=EXIST
+6 QUIT
+7 ;
+8 ;##### CHECKS IF PHOTO IMAGE EXISTS FOR A PATIENT MAGDFN
+9 ;
+10 ; MAGDFN Patient DFN
+11 ;
+12 ; Return Values
+13 ; =============
+14 ; 0 - Photo doesn't exist
+15 ; Date.Timestamp - Photo on file (date timestamp of the most recent photo)
+16 ;
HASPHOTO(MAGDFN) ;
+1 NEW RDT,IEN,RESULT
+2 SET RDT=""
+3 SET RESULT=0
+4 FOR
if RESULT
QUIT
SET RDT=$ORDER(^MAG(2005,"APPXDT",MAGDFN,"PHOTO ID",RDT))
if RDT=""
QUIT
Begin DoDot:1
+5 SET IEN=""
+6 FOR
if RESULT
QUIT
SET IEN=$ORDER(^MAG(2005,"APPXDT",MAGDFN,"PHOTO ID",RDT,IEN))
if IEN=""
QUIT
Begin DoDot:2
+7 ; Deleted image
if $$ISDEL^MAGGI11(IEN)
QUIT
+8 ; need to reverse the date
SET RESULT=9999999.9999-RDT
+9 QUIT
End DoDot:2
+10 QUIT
End DoDot:1
+11 QUIT RESULT