source: WorldVistAEHR/trunk/r/PATIENT_DATA_EXCHANGE-VAQ/VAQCON1.m@ 1739

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

initial load of WorldVistAEHR

File size: 4.0 KB
Line 
1VAQCON1 ;ALB/JRP - MESSAGE CONSTRUCTION;9-APR-93
2 ;;1.5;PATIENT DATA EXCHANGE;;NOV 17, 1993
3MAKESTUB(XMSUB,XMDUZ) ;CREATE STUB MAILMAN MESSAGE
4 ;INPUT : XMSUB - Subject of message
5 ; XMDUZ - Sender of message; Pointer to NEW PERSON file
6 ; or text to be used as the sender (defaults to DUZ)
7 ;OUTPUT : XMZ - Message number
8 ; -1^Error_Text - Error
9 ;
10 ;CHECK INPUT
11 Q:($G(XMSUB)="") "-1^Subject of message not passed"
12 S:($G(XMDUZ)="") XMDUZ=$G(DUZ)
13 Q:(XMDUZ="") "-1^Could not determine sender of message"
14 ;DECLARE VARIABLES
15 N XMZ
16 ;CREATE STUB
17 D XMZ^XMA2
18 S:(XMZ<1) XMZ="-1^Could not create stub message"
19 Q XMZ
20 ;
21ADDLINE(TEXT,MESSAGE,LINE) ;ADD LINE OF TEXT TO MESSAGE
22 ;INPUT : TEXT - Line of text to add
23 ; MESSAGE - Message number
24 ; LINE - Line number
25 ;OUTPUT : 0 - Success
26 ; -1^Error_Text - Error
27 ;NOTES : NULL lines of text will be converted to <SPACE>
28 ;
29 ;CHECK INPUT
30 S:($G(TEXT)="") TEXT=" "
31 S MESSAGE=+$G(MESSAGE)
32 Q:(('MESSAGE)!('$D(^XMB(3.9,MESSAGE)))) "-1^Valid message number not passed"
33 Q:('(+$G(LINE))) "-1^Line number not passed"
34 ;INSERT TEXT
35 S ^XMB(3.9,MESSAGE,2,LINE,0)=TEXT
36 Q 0
37 ;
38KILLSTUB(XMZ) ;DELETE STUB MESSAGE
39 ;INPUT : XMZ - Message number
40 ;OUTPUT : 0 - "Success"
41 ; -1^Error_Text - Message number not passed
42 ;NOTE : This should be used when errors occur while building
43 ; message
44 ;
45 ;CHECK INPUT
46 S XMZ=+$G(XMZ)
47 Q:(('XMZ)!('$D(^XMB(3.9,XMZ)))) "-1^Valid message number not passed"
48 ;DECLARE VARIABLES
49 N XMDUN,XMY,TMP,ZTSK,ZTRTN,ZTDESC,ZTDTH,ZTSAVE
50 ;SET ZERO NODE
51 S TMP=$$SETZERO(XMZ,0)
52 ;SEND MESSAGE TO POSTMASTER
53 S XMDUN="Patient Data eXchange"
54 S XMY(.5)=""
55 D ENT1^XMD
56 ;DELETE MESSAGE FROM POSTMASTER'S BASKET
57 ;THIS IS TASKED TO GIVE TIME FOR MESSAGE DELIVERY
58 S ZTRTN="KILLMES^VAQCON1"
59 S ZTDESC="Killing of bad PDX messages"
60 S ZTDTH=$H
61 S ZTSAVE("XMZ")=XMZ
62 S ZTSAVE("XMDUZ")=.5
63 D ^%ZTLOAD
64 I ('$D(ZTSK)) Q "-1^Could not task deletion of message"
65 Q 0
66 ;
67KILLMES ;KILL MESSAGES (TASKED)
68 ;INPUT : XMK - Basket number (optional)
69 ; XMZ - Message number
70 ; XMDUZ - User's DUZ
71 ;OUTPUT : None
72 ;NOTE : This is used to delete the message by KILLSTUB
73 ; : All input variables are deleted upon exit
74 ;
75 ;CHECK INPUT
76 I (('$G(XMZ))!('$G(XMDUZ))) K XMK,XMZ,XMDUZ Q
77 ;KILL MESSAGE
78 D KLQ^XMA1B
79 K XMK,XMZ,XMDUZ
80 S:($D(ZTQUEUED)) ZTREQ="@"
81 Q
82SETZERO(MESSAGE,LINES) ;SET ZERO NODE OF MAILMAN MESSAGE
83 ;INPUT : MESSAGE - Message number
84 ; LINES - Number of lines in message (defaults to 0)
85 ;OUTPUT : 0 - Success
86 ; -1^Error_Text - Error
87 ;
88 ;CHECK INPUT
89 S MESSAGE=+$G(MESSAGE)
90 Q:(('MESSAGE)!('$D(^XMB(3.9,MESSAGE)))) "-1^Valid message number not passed"
91 S LINES=+$G(LINES)
92 ;SET ZERO NODE
93 S ^XMB(3.9,MESSAGE,2,0)="^3.92A^"_LINES_"^"_LINES_"^"_+$G(DT)
94 Q 0
95 ;
96STATYPE(TRAN,CURRENT) ;DETERMINE MESSAGE STATUS & TYPE OF TRANSACTION
97 ;INPUT : TRAN - Pointer to VAQ - TRANSACTION file
98 ; CURRENT - Flag indicating if which status to use
99 ; If 0, return release status (default)
100 ; If 1, return current status
101 ;OUTPUT : Message_Status^Message_Type - Success
102 ; -1^Error_Text - Error
103 ;CHECK INPUT
104 Q:('(+$G(TRAN))) "-1^Did not pass pointer to VAQ - TRANSACTION file"
105 S CURRENT=+$G(CURRENT)
106 ;DECLARE VARIABLES
107 N TMP,STATUS,TYPE
108 S TMP=$G(^VAT(394.61,TRAN,0))
109 Q:(TMP="") "-1^Did not pass a valid transaction"
110 S:(CURRENT) TMP=+$P(TMP,"^",2)
111 S:('CURRENT) TMP=+$P(TMP,"^",5)
112 Q:('TMP) "-1^Could not determine status of message"
113 S STATUS=$P($G(^VAT(394.85,TMP,0)),"^",1)
114 Q:(STATUS="") "-1^Could not determine status of message"
115 ;DETERMINE MESSAGE TYPE
116 S TYPE=0
117 S:((STATUS="VAQ-TUNSL")!(STATUS="VAQ-PROC")) TYPE=""
118 S:(STATUS="VAQ-RQST") TYPE="REQ"
119 S:((STATUS="VAQ-AMBIG")!(STATUS="VAQ-AUTO")!(STATUS="VAQ-NTFND")!(STATUS="VAQ-REJ")!(STATUS="VAQ-RSLT")) TYPE="RES"
120 S:(STATUS="VAQ-UNSOL") TYPE="UNS"
121 S:((STATUS="VAQ-RQACK")!(STATUS="VAQ-UNACK")) TYPE="ACK"
122 S:(STATUS="VAQ-RTRNS") TYPE="RET"
123 S:(STATUS="VAQ-RCVE") TYPE="REC"
124 Q:(TYPE=0) "-1^Could not determine message type"
125 Q STATUS_"^"_TYPE
Note: See TracBrowser for help on using the repository browser.