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

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

initial load of FOIAVistA 6/30/08 version

File size: 4.4 KB
Line 
1DGQEHL73 ;ALB/JFP - VIC HL7 Message Builder (A08); 09/01/96
2 ;;5.3;REGISTRATION;**73,120,148**;DEC 11,1996
3 ;;Per VHA Directive 10-93-142, this routine should not be modified.
4 ;
5BLDA08(XMITPTR,HL,MID,XMITARRY,INSRTPNT) ;
6 ; -- Build either a batch or single HL7 A08 message for VIC
7 ;
8 ;Input : XMITPTR - Pointer to entry in PATIENT file (#2)
9 ; HL - Array containing HL7 variables - pass by reference
10 ; (This is the output of the call to INIT^HLFNC2())
11 ; MID - Message Control ID to use in batch MSH segment
12 ; XMITARRY - Array to store HL7 message in (full global ref)
13 ; (Defaults to ^TMP("HLS",$J))
14 ; INSRTPNT - Line to begin inserting message text at
15 ; (Defaults to 1)
16 ;Output : LINES - Number of lines in message (success)
17 ; XMITARRY(N) = Line N of HL7 message
18 ; XMITARRY(N,M) = Continuation number M of line N
19 ; -1^Error - Unable to build message / bad input
20 ;
21 ;Notes 1. It is the responsibility of the calling program to
22 ; initialize (i.e. KILL) XMITARRY
23 ; 2. If MID is defined in the parameter list, a batch MSH segment
24 ; will be built. Otherwise a HL7 v1.6 will build the MSH
25 ; segment.
26 ;
27 ; -- Check input
28 S XMITPTR=+$G(XMITPTR)
29 Q:('$D(^DPT(XMITPTR,0))) "-1^Did not pass valid pointer to PATIENT file"
30 Q:($O(HL(""))="") "-1^Did not pass variables required to interact with the HL7 package"
31 S MID=$G(MID)
32 S XMITARRY=$G(XMITARRY)
33 S:(XMITARRY="") XMITARRY="^TMP(""HLS"","_$J_")"
34 S INSRTPNT=$G(INSRTPNT)
35 S:(INSRTPNT="") INSRTPNT=1
36 ; -- Declare variables
37 N LINESADD,CURLINE,RESULT,ERROR,VAFSTR
38 N VAFEVN,VAFPID,VAFPV1,VAFZEL,VAFZSP,VAFZPD
39 ;
40 S LINESADD=0
41 S CURLINE=INSRTPNT
42 S ERROR=0
43 ; -- Build MSH segment for BATCH transmission, otherwise skip
44 I (MID'="") D
45 .; -- Build MSH segment
46 .K RESULT D MSH^HLFNC2(.HL,MID,.RESULT)
47 .; -- Check for results of call
48 .I (RESULT="") S ERROR="-1^Unable to create MSH segment for a batch transmission" Q
49 .; -- Copy MSH segment into HL7 message
50 .S @XMITARRY@(CURLINE)=RESULT
51 .; -- Increment number of lines added
52 .S LINESADD=LINESADD+1
53 ; -- Error building MSH segment - done
54 Q:(ERROR) ERROR
55 ; -- Build Segments associated with an A08 Message
56 ;
57 ; -- -- Build EVN
58 S VAFEVN=$$EVN^VAFHLEVN("A08","")
59 S CURLINE=CURLINE+1
60 S LINESADD=LINESADD+1
61 S @HL7XMIT@(CURLINE)=VAFEVN
62 ; -- -- Build PID
63 S VAFSTR="1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,19"
64 S VAFPID=$$EN^VAFHLPID(XMITPTR,VAFSTR)
65 S CURLINE=CURLINE+1
66 S LINESADD=LINESADD+1
67 S @HL7XMIT@(CURLINE)=VAFPID
68 ; -- -- Build PV1 (note: this is a null segment)
69 S VAFPV1="PV1^1"
70 S CURLINE=CURLINE+1
71 S LINESADD=LINESADD+1
72 S @HL7XMIT@(CURLINE)=VAFPV1
73 ; -- -- Build ZEL
74 S VAFSTR="1,2,3,4,5,6,7,8,9,10,11,12,13"
75 S VAFZEL=$$EN^VAFHLZEL(XMITPTR,VAFSTR,1)
76 S CURLINE=CURLINE+1
77 S LINESADD=LINESADD+1
78 ; -- The Datacards side of interface is hard coded, to the number of
79 ; fields specified in the original interface specification. If
80 ; fields are added to the segment definition, it causes the VIC
81 ; machine error. This code corrects the problem by truncating the
82 ; results of the national call after the 14th piece.
83 S VAFZEL=$P(VAFZEL,HLFS,1,14)
84 S @HL7XMIT@(CURLINE)=VAFZEL
85 ; -- -- Build ZSP
86 S VAFZSP=$$EN^VAFHLZSP(XMITPTR)
87 S LINESADD=LINESADD+1
88 S CURLINE=CURLINE+1
89 ; -- The Datacards side of interface is hard coded, to the number of
90 ; fields specified in the original interface specification. If
91 ; fields are added to the segment definition, it causes the VIC
92 ; machine error. This code corrects the problem by truncating the
93 ; results of the national call after the 5th piece.
94 S VAFZSP=$P(VAFZSP,HLFS,1,5)
95 S @HL7XMIT@(CURLINE)=VAFZSP
96 ;
97 ; -- -- Build ZPD
98 S VAFSTR="1,17"
99 S VAFZPD=$$EN^VAFHLZPD(XMITPTR,VAFSTR)
100 S LINESADD=LINESADD+1
101 S CURLINE=CURLINE+1
102 ; -- Change POW indicator in piece 17 from Y/N to 1/0
103 ; to work with the DataCard interface.
104 S $P(VAFZPD,"^",18)=$S($P(VAFZPD,"^",18)="Y":1,1:0)
105 ; -- The Datacards side of interface is hard coded, to the number of
106 ; fields specified in the original interface specification. If
107 ; fields are added to the segment definition, it causes the VIC
108 ; machine error. This code corrects the problem by truncating the
109 ; results of the national call after the 18th piece.
110 S VAFZPD=$P(VAFZPD,HLFS,1,18)
111 S @HL7XMIT@(CURLINE)=VAFZPD
112 ;
113 Q LINESADD
114END ; -- End of code
115 ;
Note: See TracBrowser for help on using the repository browser.