source: WorldVistAEHR/trunk/r/IMAGING-MAG-ZMAG/MAGGNTI3.m@ 1096

Last change on this file since 1096 was 623, checked in by George Lilly, 15 years ago

revised back to 6/30/08 version

File size: 3.7 KB
Line 
1MAGGNTI3 ;WOIFO/GEK - Imaging interface to TIU RPC Calls etc. ; 04 Apr 2002 2:37 PM
2 ;;3.0;IMAGING;**46**;16-February-2007;;Build 1023
3 ;; Per VHA Directive 2004-038, this routine should not be modified.
4 ;; +---------------------------------------------------------------+
5 ;; | Property of the US Government. |
6 ;; | No permission to copy or redistribute this software is given. |
7 ;; | Use of unreleased versions of this software requires the user |
8 ;; | to execute a written test agreement with the VistA Imaging |
9 ;; | Development Office of the Department of Veterans Affairs, |
10 ;; | telephone (301) 734-0100. |
11 ;; | The Food and Drug Administration classifies this software as |
12 ;; | a medical device. As such, it may not be changed in any way. |
13 ;; | Modifications to this software may result in an adulterated |
14 ;; | medical device under 21CFR820, the use of which is considered |
15 ;; | to be a violation of US Federal Statutes. |
16 ;; +---------------------------------------------------------------+
17 ;;
18 Q
19MOD(MAGRY,MAGDFN,MAGTIUDA,MAGADCL,MAGMODE,MAGES,MAGESBY,MAGTEXT) ; RPC [MAG3 TIU MODIFY NOTE]
20 ; RPC call to Modify an Existing Note by:
21 ; Electronically Signing or
22 ; Administratively Closing the Note
23 ;
24 ; - - - Required - - -
25 ; MAGDFN - Patient DFN
26 ; MAGTIUDA - IEN of TIU NOTE in file 8925
27 ; - - - Optional - - -
28 ; MAGADCL - 1 = Mark this Note as Administratively Closed
29 ; MAGMODE - Mode of Admin Closure: "S" = Scanned Document "M" = Manual closure
30 ; MAGES - The encrypted Electronic Signature
31 ; MAGESBY - The DUZ of the Signer (Defaults to DUZ)
32 ; MAGTEXT - Array of Text to add to the New Note. // NOT USED IN 3.0.59
33 ;
34 N $ETRAP,$ESTACK S $ETRAP="D ERR^"_$T(+0)
35 S MAGDFN=$G(MAGDFN),MAGTIUDA=$G(MAGTIUDA)
36 S MAGES=$G(MAGES),MAGADCL=$G(MAGADCL)
37 S MAGESBY=$S($G(MAGESBY):MAGESBY,1:DUZ)
38 S MAGMODE=$S($L($G(MAGMODE)):MAGMODE,1:"S")
39 I '$$VALDATA^MAGGNTI2(.MAGRY,MAGDFN,MAGTIUDA) Q
40 N MAGXT,I,CT,MAGMRC,X
41 S CT=1,I=""
42 ; We don't allow Editing/Adding of Text to an existing document.
43 ; If Change Status to Admin Close. Then we Quit
44 S MAGRY="1^"
45 I MAGADCL="1" D Q:'MAGRY
46 . D ADMNCLOS^MAGGNTI2(.MAGTY,MAGDFN,MAGTIUDA,MAGMODE)
47 . S MAGRY=$S('MAGTY:MAGTY,1:MAGRY_"Note is Administratively Closed.")
48 . S ^TMP($J,"MAGGNTI1","MOD AFTER ADMNCLOS ")=MAGRY
49 . Q:'MAGRY
50 . ; Note has been E-Filed Complete the Consult if one is attached.
51 . D GET1405^TIUSRVR(.MAGMRC,MAGTIUDA)
52 . S ^TMP($J,"MAGGNTI1","MOD MAGMRC")=$G(MAGMRC)
53 . I (+MAGMRC>0)&(MAGMRC["GMR(123") D
54 . . ;Use GRMC Call to 'Close' the consult. For AdminClos the Consult Status
55 . . ;went from 'p' to 'pr' this will change it to 'c' (complete).
56 . . S X=$$SFILE^GMRCGUIB(+MAGMRC,10)
57 . . Q
58 . Q
59 ;
60 ; if caller sent esignature to Sign this Addendum.
61 I $L(MAGES) D Q:'MAGRY
62 . D SIGN(.MAGTY,MAGDFN,MAGTIUDA,MAGES,MAGESBY)
63 . S MAGRY=$S('MAGTY:MAGTY,1:MAGRY_"Note is Signed.")
64 . Q
65 Q
66SIGN(MAGRY,MAGDFN,MAGTIUDA,MAGES,MAGESBY) ;RPC [MAG3 TIU SIGN RECORD]
67 ; RPC Call to 'Sign' a Note.
68 ; - - - Required - - -
69 ; MAGDFN - DFN of Patient.
70 ; MAGTIUDA - TIUDA - IEN of TIU Note file 8925
71 ; MAGES - The encrypted Electronic Signature
72 ; MAGESBY - The DUZ of the Signer (Defaults to DUZ)
73 ;
74 N RY
75 S MAGDFN=$G(MAGDFN),MAGTIUDA=$G(MAGTIUDA),MAGES=$G(MAGES),MAGESBY=$G(MAGESBY,DUZ)
76 I '$$VALDATA^MAGGNTI2(.MAGRY,MAGDFN,MAGTIUDA) Q
77 ;
78 ; Calling TIU SIGN RECORD
79 D SIGN^TIUSRVP(.RY,MAGTIUDA,MAGES)
80 ; on success RY = 0
81 ; on error RY = error code ^ < message >
82 I +RY S MAGRY="0^"_$TR(RY,"^","~")
83 E S MAGRY="1^Success: Note has been Signed."
84 Q
85ERR ; ERROR TRAP
86 N ERR S ERR=$$EC^%ZOSV
87 S MAGRY="0^ETRAP: "_ERR
88 D @^%ZOSF("ERRTN")
89 Q
Note: See TracBrowser for help on using the repository browser.