source: WorldVistAEHR/trunk/r/PATIENT_DATA_EXCHANGE-VAQ/VAQBUL06.m@ 1663

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

initial load of WorldVistAEHR

File size: 4.0 KB
RevLine 
[613]1VAQBUL06 ;ALB/JRP - BULLETINS;09-JUN-93
2 ;;1.5;PATIENT DATA EXCHANGE;**9**;NOV 17, 1993
3UNSOL(TRANPTR) ;SEND UNSOLICITED RECEIVED BULLETIN
4 ;INPUT : TRANPTR - Pointer to VAQ - TRANSACTION file
5 ;OUTPUT : 0 - Bulletin sent
6 ; -1^Error_Text - Bulletin not sent
7 ;
8 ;CHECK INPUT
9 S TRANPTR=+$G(TRANPTR)
10 Q:(('TRANPTR)!('$D(^VAT(394.61,TRANPTR)))) "-1^Did not pass valid transaction"
11 ;DECLARE VARIABLES
12 N TRANNUM,NAME,PID,DOB,ATHRBY,SITE,DOMAIN,RCVON
13 N TMP,TMPARR,LINE,OFFSET,SPACE,COMMENT,X,DIWL,DIWR,DIWF
14 N SENSITVE,XMY,Y,ERROR
15 S TMPARR="^TMP(""VAQ-BUL"","_$J_")"
16 K @TMPARR,^UTILITY($J,"W")
17 S SPACE=" "
18 ;MAKE SURE TRANSACTION IS AN UNSOLICITED
19 S TMP=$$STATYPE^VAQCON1(TRANPTR,1)
20 Q:($P(TMP,"^",1)="-1") TMP
21 Q:($P(TMP,"^",2)'="UNS") "-1^Transaction was not an Unsolicited PDX"
22 ;GET TRANSACTION NUMBER
23 S TMP=$G(^VAT(394.61,TRANPTR,0))
24 S TRANNUM=+TMP
25 Q:('TRANNUM) "-1^Transaction did not contain a transaction number"
26 ;CHECK REMOTE SENSITIVITY
27 S SENSITVE=+$P(TMP,"^",4)
28 ;GET PATIENT INFORMATION
29 S TMP=$G(^VAT(394.61,TRANPTR,"QRY"))
30 S NAME=$P(TMP,"^",1)
31 S:(NAME="") NAME="Not listed"
32 S DOB=$$DOBFMT^VAQUTL99($P(TMP,"^",3),0)
33 S:(DOB="") DOB="Not listed"
34 S PID=$P(TMP,"^",4)
35 I (PID="") D
36 .;GET PID FROM SSN
37 .S PID=$P(TMP,"^",2)
38 .I (PID="") S PID="Not listed" Q
39 .S PID=$$DASHSSN^VAQUTL99(PID)
40 ;GET TRANSACTION INFORMATION
41 S TMP=$G(^VAT(394.61,TRANPTR,"ATHR1"))
42 S RCVON=$$DOBFMT^VAQUTL99($P(TMP,"^",1),1)
43 S:(RCVON="") RCVON="Could not be determined"
44 S ATHRBY=$P(TMP,"^",2)
45 S:(ATHRBY="") ATHBY="Uknown"
46 S TMP=$G(^VAT(394.61,TRANPTR,"ATHR2"))
47 S SITE=$P(TMP,"^",1)
48 S:(SITE="") SITE="Could not be determined"
49 S DOMAIN=$P(TMP,"^",2)
50 S:(DOMAIN="") DOMAIN="Could not be determined"
51 ;BUILD MESSAGE
52 S LINE=1
53 S TMP="The following Unsolicited PDX has been received ..."
54 S @TMPARR@(LINE,0)=TMP
55 S LINE=LINE+1
56 S TMP=""
57 S @TMPARR@(LINE,0)=TMP
58 S LINE=LINE+1
59 ;PUT IN TRANSACTION INFO
60 S TMP=SPACE_"Transaction number: "_TRANNUM
61 S @TMPARR@(LINE,0)=TMP
62 S LINE=LINE+1
63 S TMP=SPACE_"Name: "_NAME
64 S @TMPARR@(LINE,0)=TMP
65 S LINE=LINE+1
66 S TMP=SPACE_"PID: "_PID
67 S @TMPARR@(LINE,0)=TMP
68 S LINE=LINE+1
69 S TMP=SPACE_"DOB: "_DOB
70 S @TMPARR@(LINE,0)=TMP
71 S LINE=LINE+1
72 S TMP=""
73 S @TMPARR@(LINE,0)=TMP
74 S LINE=LINE+1
75 ;PRINT SENSITIVITY
76 I (SENSITVE) D
77 .S TMP="*** PATIENT WAS LISTED AS SENSITIVE AT THE REMOTE FACILITY ***"
78 .S TMP=SPACE_TMP
79 .S @TMPARR@(LINE,0)=TMP
80 .S LINE=LINE+1
81 .S TMP=""
82 .S @TMPARR@(LINE,0)=TMP
83 .S LINE=LINE+1
84 ;PUT IN RECEIVING INFO
85 S TMP=SPACE_"Received on: "_RCVON
86 S @TMPARR@(LINE,0)=TMP
87 S LINE=LINE+1
88 S TMP=""
89 S @TMPARR@(LINE,0)=TMP
90 S LINE=LINE+1
91 ;PUT IN AUTHORIZING INFO
92 S TMP=SPACE_"Sent by: "_ATHRBY
93 S @TMPARR@(LINE,0)=TMP
94 S LINE=LINE+1
95 S TMP=SPACE_"Site: "_SITE
96 S @TMPARR@(LINE,0)=TMP
97 S LINE=LINE+1
98 S TMP=SPACE_"Domain: "_DOMAIN
99 S @TMPARR@(LINE,0)=TMP
100 S LINE=LINE+1
101 S TMP=""
102 S @TMPARR@(LINE,0)=TMP
103 S LINE=LINE+1
104 ;DETERMINE IF COMMENT EXIST
105 S COMMENT=0
106 S COMMENT=$D(^VAT(394.61,TRANPTR,"CMNT"))
107 S:(COMMENT) COMMENT=+$O(^VAT(394.61,TRANPTR,"CMNT",0))
108 ;NO COMMENT/REASON
109 I ('COMMENT) D
110 .S TMP=SPACE_"Comments: None listed"
111 .S @TMPARR@(LINE,0)=TMP
112 .S LINE=LINE+1
113 ;COMMENT/REASON
114 I (COMMENT) D
115 .S TMP=SPACE_"Comments:"
116 .S @TMPARR@(LINE,0)=TMP
117 .S LINE=LINE+1
118 .;FORMAT TEXT
119 .K ^UTILITY($J,"W")
120 .S OFFSET=0
121 .F S OFFSET=+$O(^VAT(394.61,TRANPTR,"CMNT",OFFSET)) Q:('OFFSET) D
122 ..S X=$G(^VAT(394.61,TRANPTR,"CMNT",OFFSET,0))
123 ..S DIWL=0
124 ..S DIWR=0
125 ..S DIWF="I"_$L(SPACE)_"C75"
126 ..D ^DIWP
127 .;PUT COMMENT INTO MESSAGE
128 .S OFFSET=""
129 .F S OFFSET=$O(^UTILITY($J,"W",0,OFFSET)) Q:(OFFSET="") D
130 ..S TMP=$G(^UTILITY($J,"W",0,OFFSET,0))
131 ..S @TMPARR@(LINE,0)=TMP
132 ..S LINE=LINE+1
133 .K ^UTILITY($J,"W")
134 ;SEND TO UNSOLICITED MAIL GROUP
135 S XMY("G.VAQ UNSOLICITED RECEIVED")=""
136 ;ADD SECURITY OFFICER IF PATIENT IS SENSITIVE AT REMOTE FACILITY
137 S:(SENSITVE) X=$$LOADXMY^DGSEC()
138 ;SEND BULLETIN
139 S TMP="Unsolicited PDX for "_NAME
140 S X="PDX"
141 S Y="Patient Data eXchange"
142 S ERROR=$$SENDBULL^VAQBUL(TMP,X,Y,TMPARR)
143 S:(ERROR>0) ERROR=0
144 ;DONE (CLEAN UP)
145 K @TMPARR,^UTILITY($J,"W")
146 Q ERROR
Note: See TracBrowser for help on using the repository browser.