source: WorldVistAEHR/trunk/r/HEALTH_LEVEL_SEVEN-HL/HLFNC1.m@ 1259

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

initial load of WorldVistAEHR

File size: 3.5 KB
Line 
1HLFNC1 ;AISC/SAW,JRP-Continuation of HLFNC, Additional Functions/Calls Used for HL7 Messages ;11/30/94 15:01
2 ;;1.6;HEALTH LEVEL SEVEN;;Oct 13, 1995
3 ;This routine is used for the Version 1.5 Interface Only
4HLFLDS(APP,SEG) ;Returns HL7 fields used by a DHCP application for a
5 ;specified segment
6 ;
7 ;This is an extrinsic function call that returns a string containing
8 ;a list of HL7 fields separated by uparrows (e.g., 1^2^3)
9 ;
10 ;Required variables:
11 ;APP - the internal entry number of the DHCP application
12 ; from file 771
13 ;SEG - the name of the HL7 segment for which fields are
14 ; to be returned
15 ;
16 ;Check for required input parameters
17 I 'APP!(SEG']"") Q ""
18 I '$D(^HL(771,APP,0)) Q ""
19 N X S X=$O(^HL(771.3,"B",SEG,0)) I 'X Q ""
20 S X=$O(^HL(771,APP,"SEG","B",X,0)) I 'X Q ""
21 ;Return string
22 Q $TR($G(^HL(771,APP,"SEG",X,"F")),",","^")
23MSH(HLMTN,HLSEC) ;Create an MSH Segment for an Outgoing HL7 Message
24 ;
25 ;Input : HLMTN - Three to seven character HL7 message type name
26 ; HLSEC - Security to be included in field #8 of the segment
27 ; (optional - field left blank when not passed)
28 ; All variables created by a call to INIT^HLTRANS
29 ;
30 ;Output : An HL7 MSH segment
31 ;
32 ;Note : NULL is returned on error/bad input
33 ; : Existance of variables from INIT^HLTRANS is assumed
34 ;
35 ;Check for required parameters
36 Q:($G(HLMTN)="") ""
37 Q:('$D(HLNDAP0)) ""
38 S HLSEC=$G(HLSEC)
39 ;Make sure pointer to Message Text file is valid
40 Q:('$D(HLDA)) ""
41 Q:('$D(^HL(772,HLDA,0))) ""
42 ;Declare variables
43 N MID,NODE,MSH
44 ;Get message ID
45 S NODE=$G(^HL(772,HLDA,0))
46 S MID=$P(NODE,"^",6)
47 Q:(MID="") ""
48 ;Build MSH segment
49 S MSH="MSH"_HLFS_HLECH_HLFS_HLDAN_HLFS_$P(HLNDAP0,"^",2)
50 S MSH=MSH_HLFS_$P(HLNDAP0,"^",1)_HLFS_$P(HLNDAP0,"^",3)_HLFS_HLDT1
51 S MSH=MSH_HLFS_HLSEC_HLFS_HLMTN_HLFS_MID_HLFS_HLPID_HLFS_HLVER
52 ;Return MSH segment
53 Q MSH
54BHS(HLMTN,HLSEC,HLMSA) ;Create a BHS Segment for an Outgoing HL7 Batch Message
55 ;
56 ;This is an extrinsic function call that returns an HL7 BHS segment
57 ;
58 ;Input : HLMTN - The three to seven character HL7 message type name
59 ; HLSEC - Security to be included in field #8 of the segment
60 ; (optional - field left blank when not passed)
61 ; HLMSA - Three components (separated by the HL7 component
62 ; separator character) consisting of the first
63 ; three fields in the MSA segment. This variable is
64 ; required if the message you are building is a
65 ; batch response.
66 ; All variables created by a call to INIT^HLTRANS
67 ;
68 ;Output : An HL7 BHS segment
69 ;
70 ;Note : NULL is returned on error/bad input
71 ; : Existance of variables from INIT^HLTRANS is assumed
72 ;
73 ;Check for required parameters
74 Q:($G(HLMTN)="") ""
75 S HLSEC=$G(HLSEC)
76 S HLMSA=$G(HLMSA)
77 Q:('$D(HLNDAP0)) ""
78 ;Declare variables
79 N BHS,FIELD9,FIELD10,TMP,BID,BRID
80 ;Get batch ID
81 S TMP=$G(^HL(772,HLDA,0))
82 S BID=$P(TMP,"^",6)
83 Q:(BID="") ""
84 ;Build field # 9 (batch name/processing ID/type/version)
85 S FIELD9=$E(HLECH)_HLPID_$E(HLECH)_$E(HLMTN,1,3)_$E(HLECH)_HLVER
86 ;Build field # 10 (batch comment)
87 S FIELD10=""
88 I (HLMSA'="") D
89 .S FIELD10=$P(HLMSA,$E(HLECH))
90 .S TMP=$P(HLMSA,$E(HLECH),3)
91 .S:(TMP'="") FIELD10=FIELD10_$E(HLECH)_TMP
92 ;Get batch reference ID
93 S BRID=""
94 S TMP=$P(HLMSA,$E(HLECH),2)
95 S:(TMP'="") BRID=TMP
96 ;Build BHS segment
97 S BHS="BHS"_HLFS_HLECH_HLFS_HLDAN_HLFS_$P(HLNDAP0,"^",2)
98 S BHS=BHS_HLFS_$P(HLNDAP0,"^")_HLFS_$P(HLNDAP0,"^",3)_HLFS_HLDT1
99 S BHS=BHS_HLFS_HLSEC_HLFS_FIELD9_HLFS_FIELD10_HLFS_BID_HLFS_BRID
100 ;Return BHS segment
101 Q BHS
Note: See TracBrowser for help on using the repository browser.