1 | VAQCON93 ;ALB/JRP - MESSAGE CONSTRUCTION;22-APR-93
|
---|
2 | ;;1.5;PATIENT DATA EXCHANGE;;NOV 17, 1993
|
---|
3 | SEND10(TRANPTR) ;BUILD AND SEND A 1.0 MESSAGE
|
---|
4 | ;INPUT : TRANPTR - Pointer to VAQ - TRANSACTION file
|
---|
5 | ;OUTPUT : 0 - Success
|
---|
6 | ; -1^Error_Text - Error
|
---|
7 | ;
|
---|
8 | ;CHECK INPUT
|
---|
9 | Q:('(+$G(TRANPTR))) "-1^Did not pass pointer to VAQ - TRANSACTION file"
|
---|
10 | Q:('$D(^VAT(394.61,TRANPTR))) "-1^Did not pass a valid pointer to the VAQ - TRANSACTION file"
|
---|
11 | ;DECLARE VARIABLES
|
---|
12 | N TMP,DOMAIN,XMZ,XMY,XMDUN,TYPE,LINE,SITE,STATUS,XMCHAN
|
---|
13 | S XMCHAN=1
|
---|
14 | ;GET MESSAGE TYPE & STATUS
|
---|
15 | S TMP=$$STATYPE^VAQCON1(TRANPTR)
|
---|
16 | S STATUS=$P(TMP,"^",1)
|
---|
17 | Q:(STATUS="-1") "-1^Could not determine type of message to send"
|
---|
18 | S TYPE=$P(TMP,"^",2)
|
---|
19 | Q:((TYPE="RET")!(STATUS="VAQ-UNACK")) "-1^Equivalent message not available in version 1.0 format"
|
---|
20 | Q:((STATUS="VAQ-AUTO")!(STATUS="VAQ-PROC")!(STATUS="VAQ-TUNSL")) "-1^Message not required"
|
---|
21 | Q:(TYPE="REC") "-1^Transaction is being received, not transmitted"
|
---|
22 | ;GET REMOTE DOMAIN
|
---|
23 | S DOMAIN=""
|
---|
24 | S:(TYPE="REQ") DOMAIN=$P($G(^VAT(394.61,TRANPTR,"ATHR2")),"^",2)
|
---|
25 | S:((TYPE="UNS")!(TYPE="RES")!(TYPE="ACK")) DOMAIN=$P($G(^VAT(394.61,TRANPTR,"RQST2")),"^",2)
|
---|
26 | Q:(DOMAIN="") "-1^Could not determine remote domain"
|
---|
27 | ;GET LOCAL SITE
|
---|
28 | S TMP=+$O(^VAT(394.81,0))
|
---|
29 | S SITE=+$G(^VAT(394.81,TMP,0))
|
---|
30 | S TMP=$P($G(^DIC(4,SITE,0)),"^",1)
|
---|
31 | I (TMP="") S TMP=$P($$SITE^VASITE,"^",2) S:(TMP=-1) TMP="UNKNOWN"
|
---|
32 | S SITE=TMP
|
---|
33 | ;MAKE STUB MESSAGE
|
---|
34 | S TMP="PDX (V1.0) TRANSMISSION FROM "_SITE
|
---|
35 | S XMZ=$$MAKESTUB^VAQCON1(TMP,"PDX")
|
---|
36 | Q:(XMZ<1) "-1^Could not create stub message"
|
---|
37 | ;BUILD MESSAGE
|
---|
38 | S LINE=$$XMIT10^VAQCON94(TRANPTR,XMZ,"",1)
|
---|
39 | I (LINE<0) S TMP=$$KILLSTUB^VAQCON1(XMZ) Q LINE
|
---|
40 | ;SET ZERO NODE
|
---|
41 | S TMP=$$SETZERO^VAQCON1(XMZ,LINE)
|
---|
42 | I (TMP<0) S LINE=$$KILLSTUB^VAQCON1(XMZ) Q TMP
|
---|
43 | ;SEND MESSAGE
|
---|
44 | S TMP="S.VAQ-PDX-SERVER"_"@"_DOMAIN
|
---|
45 | S XMY(TMP)=""
|
---|
46 | S XMDUN="Patient Data eXchange"
|
---|
47 | D ENT1^XMD
|
---|
48 | Q 0
|
---|