MAGGNTI3 ;WOIFO/GEK - Imaging interface to TIU. RPC Calls etc. ; 04 Apr 2002 2:37 PM
;;3.0;IMAGING;**46,59**;Nov 27, 2007;Build 20
;;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. |
;; +---------------------------------------------------------------+
;;
Q
MOD(MAGRY,MAGDFN,MAGTIUDA,MAGADCL,MAGMODE,MAGES,MAGESBY,MAGTEXT) ; RPC [MAG3 TIU MODIFY NOTE]
; RPC call to Modify an Existing Note by:
; Electronically Signing or
; Administratively Closing the Note
;
; - - - Required - - -
; MAGDFN - Patient DFN
; MAGTIUDA - IEN of TIU NOTE in file 8925
; - - - Optional - - -
; MAGADCL - 1 = Mark this Note as Administratively Closed
; MAGMODE - Mode of Admin Closure: "S" = Scanned Document "M" = Manual closure
; MAGES - The encrypted Electronic Signature
; MAGESBY - The DUZ of the Signer (Defaults to DUZ)
; MAGTEXT - Array of Text to add to the New Note. // NOT USED IN 3.0.59
;
N $ETRAP,$ESTACK S $ETRAP="D ERR^"_$T(+0)
S MAGDFN=$G(MAGDFN),MAGTIUDA=$G(MAGTIUDA)
S MAGES=$G(MAGES),MAGADCL=$G(MAGADCL)
S MAGESBY=$S($G(MAGESBY):MAGESBY,1:DUZ)
S MAGMODE=$S($L($G(MAGMODE)):MAGMODE,1:"S")
I '$$VALDATA^MAGGNTI2(.MAGRY,MAGDFN,MAGTIUDA) Q
N MAGXT,I,CT,MAGMRC,X
S CT=1,I=""
; We don't allow Editing/Adding of Text to an existing document.
; If Change Status to Admin Close. Then we Quit
S MAGRY="1^"
I MAGADCL="1" D Q:'MAGRY
. D ADMNCLOS^MAGGNTI2(.MAGTY,MAGDFN,MAGTIUDA,MAGMODE)
. S MAGRY=$S('MAGTY:MAGTY,1:MAGRY_"Note is Administratively Closed.")
. S ^TMP($J,"MAGGNTI1","MOD AFTER ADMNCLOS ")=MAGRY
. Q:'MAGRY
. ; Note has been E-Filed Complete the Consult if one is attached.
. D GET1405^TIUSRVR(.MAGMRC,MAGTIUDA)
. S ^TMP($J,"MAGGNTI1","MOD MAGMRC")=$G(MAGMRC)
. I (+MAGMRC>0)&(MAGMRC["GMR(123") D
. . ;Use GRMC Call to 'Close' the consult. For AdminClos the Consult Status
. . ;went from 'p' to 'pr' this will change it to 'c' (complete).
. . S X=$$SFILE^GMRCGUIB(+MAGMRC,10)
. . Q
. Q
;
; if caller sent esignature to Sign this Addendum.
I $L(MAGES) D Q:'MAGRY
. D SIGN(.MAGTY,MAGDFN,MAGTIUDA,MAGES,MAGESBY)
. S MAGRY=$S('MAGTY:MAGTY,1:MAGRY_"Note is Signed.")
. Q
Q
SIGN(MAGRY,MAGDFN,MAGTIUDA,MAGES,MAGESBY) ;RPC [MAG3 TIU SIGN RECORD]
; RPC Call to 'Sign' a Note.
; - - - Required - - -
; MAGDFN - DFN of Patient.
; MAGTIUDA - TIUDA - IEN of TIU Note file 8925
; MAGES - The encrypted Electronic Signature
; MAGESBY - The DUZ of the Signer (Defaults to DUZ)
;
N RY
S MAGDFN=$G(MAGDFN),MAGTIUDA=$G(MAGTIUDA),MAGES=$G(MAGES),MAGESBY=$G(MAGESBY,DUZ)
I '$$VALDATA^MAGGNTI2(.MAGRY,MAGDFN,MAGTIUDA) Q
;
; Calling TIU SIGN RECORD
D SIGN^TIUSRVP(.RY,MAGTIUDA,MAGES)
; on success RY = 0
; on error RY = error code ^ < message >
I +RY S MAGRY="0^"_$TR(RY,"^","~")
E S MAGRY="1^Success: Note has been Signed."
Q
ERR ; ERROR TRAP
N ERR S ERR=$$EC^%ZOSV
S MAGRY="0^ETRAP: "_ERR
D @^%ZOSF("ERRTN")
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HMAGGNTI3 3889 printed Dec 13, 2024@02:02:35 Page 2
MAGGNTI3 ;WOIFO/GEK - Imaging interface to TIU. RPC Calls etc. ; 04 Apr 2002 2:37 PM
+1 ;;3.0;IMAGING;**46,59**;Nov 27, 2007;Build 20
+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 QUIT
MOD(MAGRY,MAGDFN,MAGTIUDA,MAGADCL,MAGMODE,MAGES,MAGESBY,MAGTEXT) ; RPC [MAG3 TIU MODIFY NOTE]
+1 ; RPC call to Modify an Existing Note by:
+2 ; Electronically Signing or
+3 ; Administratively Closing the Note
+4 ;
+5 ; - - - Required - - -
+6 ; MAGDFN - Patient DFN
+7 ; MAGTIUDA - IEN of TIU NOTE in file 8925
+8 ; - - - Optional - - -
+9 ; MAGADCL - 1 = Mark this Note as Administratively Closed
+10 ; MAGMODE - Mode of Admin Closure: "S" = Scanned Document "M" = Manual closure
+11 ; MAGES - The encrypted Electronic Signature
+12 ; MAGESBY - The DUZ of the Signer (Defaults to DUZ)
+13 ; MAGTEXT - Array of Text to add to the New Note. // NOT USED IN 3.0.59
+14 ;
+15 NEW $ETRAP,$ESTACK
SET $ETRAP="D ERR^"_$TEXT(+0)
+16 SET MAGDFN=$GET(MAGDFN)
SET MAGTIUDA=$GET(MAGTIUDA)
+17 SET MAGES=$GET(MAGES)
SET MAGADCL=$GET(MAGADCL)
+18 SET MAGESBY=$SELECT($GET(MAGESBY):MAGESBY,1:DUZ)
+19 SET MAGMODE=$SELECT($LENGTH($GET(MAGMODE)):MAGMODE,1:"S")
+20 IF '$$VALDATA^MAGGNTI2(.MAGRY,MAGDFN,MAGTIUDA)
QUIT
+21 NEW MAGXT,I,CT,MAGMRC,X
+22 SET CT=1
SET I=""
+23 ; We don't allow Editing/Adding of Text to an existing document.
+24 ; If Change Status to Admin Close. Then we Quit
+25 SET MAGRY="1^"
+26 IF MAGADCL="1"
Begin DoDot:1
+27 DO ADMNCLOS^MAGGNTI2(.MAGTY,MAGDFN,MAGTIUDA,MAGMODE)
+28 SET MAGRY=$SELECT('MAGTY:MAGTY,1:MAGRY_"Note is Administratively Closed.")
+29 SET ^TMP($JOB,"MAGGNTI1","MOD AFTER ADMNCLOS ")=MAGRY
+30 if 'MAGRY
QUIT
+31 ; Note has been E-Filed Complete the Consult if one is attached.
+32 DO GET1405^TIUSRVR(.MAGMRC,MAGTIUDA)
+33 SET ^TMP($JOB,"MAGGNTI1","MOD MAGMRC")=$GET(MAGMRC)
+34 IF (+MAGMRC>0)&(MAGMRC["GMR(123")
Begin DoDot:2
+35 ;Use GRMC Call to 'Close' the consult. For AdminClos the Consult Status
+36 ;went from 'p' to 'pr' this will change it to 'c' (complete).
+37 SET X=$$SFILE^GMRCGUIB(+MAGMRC,10)
+38 QUIT
End DoDot:2
+39 QUIT
End DoDot:1
if 'MAGRY
QUIT
+40 ;
+41 ; if caller sent esignature to Sign this Addendum.
+42 IF $LENGTH(MAGES)
Begin DoDot:1
+43 DO SIGN(.MAGTY,MAGDFN,MAGTIUDA,MAGES,MAGESBY)
+44 SET MAGRY=$SELECT('MAGTY:MAGTY,1:MAGRY_"Note is Signed.")
+45 QUIT
End DoDot:1
if 'MAGRY
QUIT
+46 QUIT
SIGN(MAGRY,MAGDFN,MAGTIUDA,MAGES,MAGESBY) ;RPC [MAG3 TIU SIGN RECORD]
+1 ; RPC Call to 'Sign' a Note.
+2 ; - - - Required - - -
+3 ; MAGDFN - DFN of Patient.
+4 ; MAGTIUDA - TIUDA - IEN of TIU Note file 8925
+5 ; MAGES - The encrypted Electronic Signature
+6 ; MAGESBY - The DUZ of the Signer (Defaults to DUZ)
+7 ;
+8 NEW RY
+9 SET MAGDFN=$GET(MAGDFN)
SET MAGTIUDA=$GET(MAGTIUDA)
SET MAGES=$GET(MAGES)
SET MAGESBY=$GET(MAGESBY,DUZ)
+10 IF '$$VALDATA^MAGGNTI2(.MAGRY,MAGDFN,MAGTIUDA)
QUIT
+11 ;
+12 ; Calling TIU SIGN RECORD
+13 DO SIGN^TIUSRVP(.RY,MAGTIUDA,MAGES)
+14 ; on success RY = 0
+15 ; on error RY = error code ^ < message >
+16 IF +RY
SET MAGRY="0^"_$TRANSLATE(RY,"^","~")
+17 IF '$TEST
SET MAGRY="1^Success: Note has been Signed."
+18 QUIT
ERR ; ERROR TRAP
+1 NEW ERR
SET ERR=$$EC^%ZOSV
+2 SET MAGRY="0^ETRAP: "_ERR
+3 DO @^%ZOSF("ERRTN")
+4 QUIT