source: FOIAVistA/tag/r/REGISTRATION-DGQE-DG-DPT-GRPX-VAD-VAF-VAS-VAT-VAU--VA-VIC--DGBT--DGJ--DGYA--VALM/VAFCMSG0.m@ 1251

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

initial load of FOIAVistA 6/30/08 version

File size: 2.9 KB
Line 
1VAFCMSG0 ;ALB/JRP-ADT/R MESSAGE BUILDING ;12-SEP-1996
2 ;;5.3;Registration;**91,149**;Jun 06, 1996
3 ;
4BCSTADT(DFN,EVNTHL7,EVNTDATE,EVNTINFO) ;Entry point for transmitting HL7 ADT
5 ; messages for a given patient
6 ;
7 ;Input : DFN - Pointer to entry in PATIENT file (#2) to build
8 ; message for
9 ; EVNTHL7 - HL7 ADT event to build message for (Defaults to A08)
10 ; Currently supported event type:
11 ; A04, A08, A28
12 ; EVNTDATE - Date/time event occurred in FileMan format
13 ; - Defaults to current date/time (NOW)
14 ; EVNTINFO - Array containing further event information needed
15 ; when building HL7 segments/message. Use and
16 ; subscripting of array is determined by segment
17 ; and/or message being built.
18 ; - Defaults to ^TMP("VAFCMSG",$J,"EVNTINFO")
19 ; Current subscripts include:
20 ; EVNTINFO("PIVOT") = Pointer to ADT/HL7 PIVOT
21 ; file (#391.71)
22 ; EVNTINFO("REASON",X) = Event reason codes
23 ; EVNTINFO("USER") = User associated with the event
24 ;Output : Message ID = ADT-Axx message built and transmitted
25 ; ErrorCode^ErrorText = Error generating ADT-Axx message
26 ;Notes : The global array ^TMP("HLS",$J) will be initialized (KILLed)
27 ; : The following information will be placed into and killed
28 ; from the event information array:
29 ; EVNTINFO("DFN") = Pointer to PATIENT file (#2)
30 ; EVNTINFO("EVENT") = Event type
31 ; EVNTINFO("DATE") = Event date/time
32 ;
33 ;Check input
34 S DFN=+$G(DFN)
35 Q:('$D(^DPT(DFN,0))) "-1^Could not find entry in PATIENT file"
36 S EVNTHL7=$G(EVNTHL7)
37 S:(EVNTHL7="") EVNTHL7="A08"
38 S EVNTDATE=+$G(EVNTDATE)
39 S:('EVNTDATE) EVNTDATE=$$NOW^VAFCMSG5()
40 S EVNTINFO=$G(EVNTINFO)
41 S:(EVNTINFO="") EVNTINFO="^TMP(""VAFCMSG"","_$J_",""EVNTINFO"")"
42 ;Declare variables
43 N TMP,GLOREF,OK,RETURN
44 ;Initialize global location for building HL7 messages
45 S GLOREF="^TMP(""HLS"","_$J_")"
46 K @GLOREF
47 ;Check for supported event
48 S OK=0
49 F TMP="A04","A08","A28" I TMP=EVNTHL7 S OK=1 Q
50 Q:('OK) "-1^Event type not supported"
51 ;Put patient, event type, and event date/time into info array
52 S @EVNTINFO@("DFN")=DFN
53 S @EVNTINFO@("EVENT")=EVNTHL7
54 S @EVNTINFO@("DATE")=EVNTDATE
55 ;Build ADT-Axx message
56 S RETURN=$$BLDMSG^VAFCMSG1(DFN,EVNTHL7,EVNTDATE,EVNTINFO,GLOREF,1)
57 ;Error
58 I (RETURN<0) D Q RETURN
59 .K @GLOREF,@EVNTINFO@("DFN"),@EVNTINFO@("EVENT"),@EVNTINFO@("DATE")
60 ;Broadcast ADT-Axx message
61 S RETURN=$$SNDMSG^VAFCMSG2(EVNTHL7)
62 ;If message id returned, stuff in pivot file
63 I +RETURN>0 D MESSAGE^VAFCDD01(@EVNTINFO@("PIVOT"),+RETURN)
64 ;Error
65 I (RETURN<0) D Q RETURN
66 .K @GLOREF,@EVNTINFO@("DFN"),@EVNTINFO@("EVENT"),@EVNTINFO@("DATE")
67 ;Done - Clean up and return output of $$SNDMSG()
68 K @GLOREF,@EVNTINFO@("DFN"),@EVNTINFO@("EVENT"),@EVNTINFO@("DATE")
69 Q RETURN
Note: See TracBrowser for help on using the repository browser.