source: WorldVistAEHR/trunk/r/SCHEDULING-SD-SC/SDVWHLE2.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.8 KB
Line 
1SDVWHLE2 ;ENHANCED HL7 TRANSMIT DRIVERS (continued) FOR SDAPI and MAKE AN APPOINTMENT REQUEST 11/18/06
2 ;;5.3;Scheduling;**502**;Aug 13, 1993 ;Build 14
3 ; Copyright (C) 2007 WorldVistA
4 ;
5 ; This program is free software; you can redistribute it and/or modify
6 ; it under the terms of the GNU General Public License as published by
7 ; the Free Software Foundation; either version 2 of the License, or
8 ; (at your option) any later version.
9 ;
10 ; This program is distributed in the hope that it will be useful,
11 ; but WITHOUT ANY WARRANTY; without even the implied warranty of
12 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 ; GNU General Public License for more details.
14 ;
15 ; You should have received a copy of the GNU General Public License
16 ; along with this program; if not, write to the Free Software
17 ; Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 ;
19TRNSDAPI(SDARRAY,MSGCTRL) ;
20 ; VERSION 3.1
21 N APPARMS,HLSTATS,ERROR,SEG,WHO
22 N HLMSTATE,ERROR,INDEX,CONSTRUC,IFLAG,X,Y,INTE,ERR
23 ;
24 ;
25 ;HL7 TRANSMIT DRIVER FOR
26 ;REQUEST SDAPI LIST OF APPOINTMENTS USING VWSDAPI CALLUP PARAMETERS
27 ;
28 ;
29 ;HOWEVER, DATE/TIMES ARE EXTERNAL FORM,PATIENT SSN OR OTHER LOOKUP ID INSTEAD OF PATIENT DFN
30 ;( FOR PARTIENTS IN FILE 2)
31 ;AND LOCATION (CLINIC) ( IN FILE 44) EXTERNAL NAMES INSTEAD OF INTERNAL IEN.ALSO FOR DATA ENTRY CLERK, EXTERNAL
32 ;FORMAT (IN FILE 200 NEW PERSON FILE)
33 ;
34 ;INPUT : MSGCTRL PASSED BY REFERENCE TO RECEIVE THIS BACK AFTER TRANSMITTING
35 ; SDARRAY
36 ;
37 ;EXAMPLE ANALOGOUS CALL: S SDARRAY(1)="Nov 10,2006;Nov 14,2006"
38 ; S SDARRAY(3)="R;I"
39 ;; S SDARRAY(2)="HOSPLOC" EXTERNAL NAMES
40 ;; S SDARRAY(4)=100001234 ;SSN OR OTHER LOOKUP ID INSTEAD OF DFN ;ZZ PATIENT,TEST ONE
41 ; S SDARRAY("MAX")=3
42 ; S SDARRAY("FLDS")="1;2;3"
43 ; D $$SDAPI^SDAMA301(.SDARRAY)
44 ;
45 ; (PASSED ARRAYS WITH NUMERIC INFO W/O QUOTES AND NON-NUMERIC ENCLOSED WITH QUOTES)
46 ;OUTPUT :
47 ; RETURN
48 ; IER="OK"
49 ; ="NEW MESSAGE ERROR"
50 ; ="QRD" ERROR
51 ; ="QRF" ERROR
52 ; ="NTE"_INDEX
53 ; =ERROR VALUE
54 ;
55 ;BUILD PARAMETERS
56 S APPARMS("COUNTRY")="USA"
57 S APPARMS("FIELD SEPARATOR")="|"
58 S APPARMS("ENCODING CHARACTERS")="^~\&"
59 S APPARMS("VERSION")=2.4
60 S APPARMS("MESSAGE TYPE")="ADT"
61 S APPARMS("EVENT")="A19" ; PATIENT INQUIRY
62 ;
63 ;;CREATE NEW MESSAGE
64 ;;
65 ;
66 S ERR=""
67 S ERROR=""
68 I '$$NEWMSG^HLOAPI(.APPARMS,.HLMSTATE,.ERROR) Q "NEW MESSAGE ERROR"
69 ;
70 ;
71 ;
72 ;Use message control ID in MSH segment for sync flag later in returned application ack
73 ;
74 ;;CREATE SEGMENT
75 ;
76 D SET^HLOAPI(.SEG,"QRD",0)
77 D SET^HLOAPI(.SEG,$$HLDATE^HLFNC($$NOW^XLFDT(),"TS"),1)
78 ;
79 ;; ADD SEGMENT
80 I '$$ADDSEG^HLOAPI(.HLMSTATE,.SEG) S ERR="QRD"
81 ;CREATE SEGMENT
82 ;
83 D SET^HLOAPI(.SEG,"QRF",0)
84 S X=$P(SDARRAY(1),";",1) D ^%DT S INTE=Y ;EXT TO FM INTERNAL
85 D SET^HLOAPI(.SEG,$$HLDATE^HLFNC(INTE,"TS"),2) ;WHEN START DATE
86 S X=$P(SDARRAY(1),";",2) D ^%DT S INTE=Y ;EXT TO FM INTERNAL
87 D SET^HLOAPI(.SEG,$$HLDATE^HLFNC(INTE,"TS"),3) ;WHEN END DATE
88 D SET^HLOAPI(.SEG,"SCHED",6) ;WHICH DATE/TIME QUALIFIER
89 D SET^HLOAPI(.SEG,"REP",7) ; WHICH DATE/TIME STATUS QUALIFIER
90 D SET^HLOAPI(.SEG,"ALL",8) ; DATE/TIME SELECTION QUALIFIER
91 ;
92 ;ADD SEGMENT TO MESSAGE
93 ;
94 I '$$ADDSEG^HLOAPI(.HLMSTATE,.SEG) S ERR="QRF"
95 ;
96 ;
97 ;CREATE NTE SEGMENTS FROM SDARRAY ELEMENTS
98 S INDEX=0
99 F S INDEX=$O(SDARRAY(INDEX)) Q:INDEX="" D
100 .D SET^HLOAPI(.SEG,"NTE",0)
101 .I INDEX=+INDEX S CONSTRUC="SDARRAY("_INDEX_")="
102 .I INDEX'=+INDEX S CONSTRUC="SDARRAY("_""""_INDEX_""""_")="
103 .I SDARRAY(INDEX)=+SDARRAY(INDEX) S CONSTRUC=CONSTRUC_SDARRAY(INDEX)
104 .I SDARRAY(INDEX)'=+SDARRAY(INDEX) S CONSTRUC=CONSTRUC_""""_SDARRAY(INDEX)_""""
105 .D SET^HLOAPI(.SEG,CONSTRUC,3) ; COMMENTS STORING SDARRAY(?)ARRAY ELEMENT
106 .;
107 .;ADD SEGMENT TO MESSAGE
108 .;
109 .;
110 .S IFLAG=0
111 .I '$$ADDSEG^HLOAPI(.HLMSTATE,.SEG) S IFLAG="NTE"_INDEX
112 .;
113 .I IFLAG'=0 Q
114 I IFLAG'=0 Q IFLAG
115 ; DEFINE SENDING AND RECEIVING PARAMETERS
116 S APPARMS("SENDING APPLICATION")="VWSD HLO EXT"
117 S APPARMS("ACCEPT ACK TYPE")="NE" ;"AL"
118 ;S APPARMS("APP ACK RESPONSE")="APPACKRR^SDVWHLEX"
119 ;S APPARMS("ACCEPT ACK RESPONSE")="MSGPROC^SDVWHLEX"
120 ;REVERSE BELOW
121 S APPARMS("ACCEPT ACK RESPONSE")="APPACKRR^SDVWHLEX" ; WHEN COMIT ACK , SU OR AE RETURN MADE
122 S APPARMS("APP ACK RESPONSE")="MSGPROC^SDVWHLEX" ; WHEN NO ACK RETURN MADE
123 S APPARMS("APP ACK TYPE")="NE" ;"AL"
124 S WHO("RECEIVING APPLICATION")="VWSD RECEIVER"
125 S WHO("FACILITY LINK NAME")="VWSDTSMML"
126 ;
127 ;SEND MESSAGE
128 ;
129 I '$$SENDONE^HLOAPI1(.HLMSTATE,.APPARMS,.WHO,.ERROR) Q "ERR="_ERR_" ERROR="_ERROR
130 S MSGCTRL=HLMSTATE("HDR","MESSAGE CONTROL ID") ;HLMSTATE("ID")
131 Q "OK"
Note: See TracBrowser for help on using the repository browser.