source: FOIAVistA/trunk/r/PATIENT_DATA_EXCHANGE-VAQ/VAQCON2.m@ 1397

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

initial load of FOIAVistA 6/30/08 version

File size: 3.8 KB
Line 
1VAQCON2 ;ALB/JRP - MESSAGE CONSTRUCTION;12-APR-93
2 ;;1.5;PATIENT DATA EXCHANGE;;NOV 17, 1993
3SENDER(TRAN) ;DETERMINE MESSAGE SENDER
4 ;INPUT : TRAN - Pointer to VAQ - TRANSACTION file
5 ;OUTPUT : Name_of_sender^DUZ_of_sender - Success
6 ; Null - Error
7 ;NOTE : Defaults to current user
8 ;
9 ;CHECK INPUT
10 Q:('(+$G(TRAN))) ""
11 Q:('$D(^VAT(394.61,TRAN))) ""
12 ;DECLARE VARIABLES
13 N TYPE,USER,TMP
14 ;GET MESSAGE TYPE & STATUS
15 S TMP=$$STATYPE^VAQCON1(TRAN)
16 Q:($P(TMP,"^",1)="-1") ""
17 S TYPE=$P(TMP,"^",2)
18 Q:(TYPE="REC") ""
19 ;DETERMINE CURRENT USER
20 S USER=""
21 S:((TYPE="ACK")!(TYPE="RET")) USER="PDX Server"
22 S:(TYPE="REQ") USER=$P($G(^VAT(394.61,TRAN,"RQST1")),"^",2)
23 S:((TYPE="RES")!(TYPE="UNS")) USER=$P($G(^VAT(394.61,TRAN,"ATHR1")),"^",2)
24 I (USER="") D
25 .S TMP=+$G(DUZ)
26 .Q:('TMP)
27 .S X=$P($G(^VA(200,TMP,0)),"^",1)
28 .S USER=X
29 Q:(USER="") ""
30 S TMP=+$O(^VA(200,"B",USER,""))
31 S:(('TMP)&(USER="PDX Server")) TMP=.5
32 Q USER_"^"_TMP
33 ;
34HEADER(TRANPTR,MESSNUM,ARRAY,OFFSET) ;CONSTRUCT HEADER BLOCK
35 ;INPUT : TRANPTR - Pointer to VAQ - TRANSACTION file
36 ; MESSNUM - Message number to place block into
37 ; (if 0, block will be placed in ARRAY)
38 ; ARRAY - Array to store block in (full global reference)
39 ; OFFSET - Where to begin placing information (defaults to 0)
40 ;OUTPUT : N - Number of lines in block
41 ; -1^Error_Text - Error
42 ;NOTES : If MESSNUM=0, then the block will be placed into
43 ; ARRAY(LineNumber)=Line_of_info
44 ; If MESSNUM>0 then the block will be placed into
45 ; ^XMB(3.9,MESSNUM,2,LineNumber,0)=Line_of_info
46 ;
47 ;CHECK INPUT
48 S TRANPTR=+$G(TRANPTR)
49 Q:(('TRANPTR)!('$D(^VAT(394.61,TRANPTR)))) "-1^Did not pass a valid pointer to VAQ - TRANSACTION file"
50 S MESSNUM=+$G(MESSNUM)
51 I (('MESSNUM)&($G(ARRAY)="")) Q "-1^Did not pass message number or reference to array"
52 I (MESSNUM) Q:('$D(^XMB(3.9,MESSNUM))) "-1^Valid message number not passed"
53 S OFFSET=+$G(OFFSET)
54 ;DECLARE VARIABLES
55 N LINE,TYPE,STATUS,DATETIME,TRANNUM,ENCMTHD,PDXVER,TMP,X
56 S LINE=OFFSET
57 ;DETERMINE STATUS
58 S TMP=$$STATYPE^VAQCON1(TRANPTR)
59 Q:($P(TMP,"^",1)="-1") TMP
60 S STATUS=$P(TMP,"^",1)
61 ;DETERMINE MESSAGE TYPE
62 S TYPE=$P(TMP,"^",2)
63 Q:(TYPE="REC") "-1^Transaction is being received, not transmitted"
64 ;GET VERSION NUMBER
65 S PDXVER=$$PDXVER^VAQUTL1
66 Q:(PDXVER<0) PDXVER
67 ;DETERMINE TRANSACTION NUMBER
68 S TMP=$G(^VAT(394.61,TRANPTR,0))
69 ;DEFAULT TO LOCAL TRANSACTION NUMBER
70 S TRANNUM=+TMP
71 ;CHANGE TO REMOTE TRANSACTION IF NECCESSARY
72 S:((TYPE="RES")!(TYPE="ACK")!(TYPE="RET")) TRANNUM=+$P(TMP,"^",6)
73 Q:('TRANNUM) "-1^Could not determine remote transaction number"
74 ;DETERMINE ENCRYPTION METHOD
75 S ENCMTHD=$$TRANENC^VAQUTL3(TRANPTR,3)
76 ;DETERMINE DATE/TIME
77 S DATETIME=$$NOW^VAQUTL99
78 ;BUILD HEADER
79 ;LINE 1
80 S TMP="$HEADER"
81 S:('MESSNUM) @ARRAY@(LINE)=TMP
82 S:(MESSNUM) X=$$ADDLINE^VAQCON1(TMP,MESSNUM,LINE)
83 S LINE=LINE+1
84 ;LINE 2
85 S TMP=TYPE
86 S:('MESSNUM) @ARRAY@(LINE)=TMP
87 S:(MESSNUM) X=$$ADDLINE^VAQCON1(TMP,MESSNUM,LINE)
88 S LINE=LINE+1
89 ;LINE 3
90 S TMP=STATUS
91 S:('MESSNUM) @ARRAY@(LINE)=TMP
92 S:(MESSNUM) X=$$ADDLINE^VAQCON1(TMP,MESSNUM,LINE)
93 S LINE=LINE+1
94 ;LINE 4
95 S TMP=PDXVER
96 S:('MESSNUM) @ARRAY@(LINE)=TMP
97 S:(MESSNUM) X=$$ADDLINE^VAQCON1(TMP,MESSNUM,LINE)
98 S LINE=LINE+1
99 ;LINE 5
100 S TMP=DATETIME
101 S:('MESSNUM) @ARRAY@(LINE)=TMP
102 S:(MESSNUM) X=$$ADDLINE^VAQCON1(TMP,MESSNUM,LINE)
103 S LINE=LINE+1
104 ;LINE 6
105 S TMP=$S('MESSNUM:"",1:MESSNUM)
106 S:('MESSNUM) @ARRAY@(LINE)=TMP
107 S:(MESSNUM) X=$$ADDLINE^VAQCON1(TMP,MESSNUM,LINE)
108 S LINE=LINE+1
109 ;LINE 7
110 S TMP=TRANNUM
111 S:('MESSNUM) @ARRAY@(LINE)=TMP
112 S:(MESSNUM) X=$$ADDLINE^VAQCON1(TMP,MESSNUM,LINE)
113 S LINE=LINE+1
114 ;LINE 8
115 S TMP=ENCMTHD
116 S:('MESSNUM) @ARRAY@(LINE)=TMP
117 S:(MESSNUM) X=$$ADDLINE^VAQCON1(TMP,MESSNUM,LINE)
118 S LINE=LINE+1
119 ;LINE 9
120 S TMP="$$HEADER"
121 S:('MESSNUM) @ARRAY@(LINE)=TMP
122 S:(MESSNUM) X=$$ADDLINE^VAQCON1(TMP,MESSNUM,LINE)
123 S LINE=LINE+1
124 ;DONE
125 Q (LINE-OFFSET)
Note: See TracBrowser for help on using the repository browser.