source: WorldVistAEHR/trunk/r/HEALTH_LEVEL_SEVEN-HL/HLTF2.m@ 862

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

revised back to 6/30/08 version

File size: 4.1 KB
Line 
1HLTF2 ;AISC/SAW/MTC-Process Message Text File Entries (Cont'd) ;02/24/97 13:56
2 ;;1.6;HEALTH LEVEL SEVEN;**25**;Oct 13, 1995
3MERGEIN(LLD0,LLD1,MTIEN,HDR,MSA) ;Merge Data From Communication Server
4 ;Module Logical Link File into Message Text File
5 ;
6 ;This is a subroutine call with parameter passing. The output
7 ;parameters HDR (and optionally) MSA are returned by this call.
8 ;
9 ;Required input parameters
10 ; LLD0 = Internal entry number where message is stored in Logical Link
11 ; file or XM if message is stored in MailMan
12 ; LLD1 = Internal entry number of IN QUEUE multiple entry in Logical
13 ; Link file (Only required for messages stored in Logical
14 ; Link file)
15 ; MTIEN = Internal entry number where message is to be copied to in
16 ; Message Text file
17 ; HDR = The variable in which the message header segment will
18 ; be returned
19 ; MSA = The variable in which the message acknowledgement segment
20 ; will be returned, if one exists for this message
21 ;
22 ;Check for required parameters
23 I $G(LLD0)']""!('$G(MTIEN)) Q
24 I LLD0'="XM",'$G(LLD1) Q
25 N FLG,HLCHAR,HLEVN,HLFS,I,X,X1,HLDONE
26 S (FLG,HLCHAR,HLEVN,X)=0
27 ;
28 ;Move data from Logical Link file to Message Text file
29 I LLD0'="XM" D
30 .S I=0 F S X=$O(^HLCS(870,LLD0,1,LLD1,1,X)) Q:X'>0 S X1=$G(^(X,0)) S:"FHS,BHS,MSH"[$E(X1,1,3) FLG=1 I FLG S HLCHAR=HLCHAR+$L(X1) D
31 ..;If header segment, process it and set HDR equal to it
32 ..I X1'="","FHS,BHS,MSH"[$E(X1,1,3) D
33 ...I '$D(HDR) S HDR=X1,HLFS=$E(X1,4) I $E(HDR,1,3)="BHS" S MSA="MSA"_HLFS_$P($P(HDR,HLFS,10),$E(HDR,5),1)_HLFS_$P(HDR,HLFS,12)_HLFS_$P($P(HDR,HLFS,10),$E(HDR,5),2)
34 ...S $P(X1,HLFS,8)=""
35 ...S:$E(X1,1,3)="MSH" HLEVN=HLEVN+1
36 ..;If acknowledgement segment, set MSA equal to it
37 ..I $E(X1,1,3)="MSA",'$D(MSA),$E($G(HDR),1,3)="MSH" S MSA=X1
38 ..S I=I+1,^HL(772,MTIEN,"IN",I,0)=X1
39 ;
40 ;Move data from MailMan Message file to Message Text file
41 I LLD0="XM" D
42 .S I=0 F X XMREC Q:XMER<0 S:"FHS,BHS,MSH"[$E(XMRG,1,3) FLG=1 I FLG S HLCHAR=HLCHAR+$L(XMRG) D Q:XMER<0
43 ..;If header segment, process it and set HDR equal to it
44 ..I XMRG'="","FHS,BHS,MSH"[$E(XMRG,1,3) D
45 ...I '$D(HDR) S HDR=XMRG,HLFS=$E(XMRG,4) I $E(HDR,1,3)="BHS" S MSA="MSA"_HLFS_$P($P(HDR,HLFS,10),$E(HDR,5),1)_HLFS_$P(HDR,HLFS,12)_HLFS_$P($P(HDR,HLFS,10),$E(HDR,5),2)
46 ...S $P(XMRG,HLFS,8)=""
47 ...S:$E(XMRG,1,3)="MSH" HLEVN=HLEVN+1
48 ..;If acknowledgement segment, set MSA equal to it
49 ..I $E(XMRG,1,3)="MSA",'$D(MSA),$E($G(HDR),1,3)="MSH" S MSA=XMRG
50 ..S I=I+1,^HL(772,MTIEN,"IN",I,0)=XMRG
51 S ^HL(772,MTIEN,"IN",0)="^^"_I_"^"_I_"^"_$$DT^XLFDT_"^"
52 ;Update statistics in Message Text file for this entry
53 D STATS^HLTF0(MTIEN,HLCHAR,HLEVN)
54 Q
55MERGEOUT(MTIEN,LLD0,LLD1,HDR) ;Merge Text in Message Text File into
56 ;Communication Server Module Logical Link File
57 ;
58 ;This is a routine call with parameter passing. There are no output
59 ;parameters returned by this call.
60 ;
61 ;Required input parameters
62 ; MTIEN = Internal entry number where message is stored in Message
63 ; Text file
64 ; LLD0 = Internal entry number where message is to be copied to in
65 ; Logical Link file
66 ; LLD1 = Internal entry number of IN QUEUE multiple entry in Logical
67 ; Link file
68 ; HDR = Name of the array that contains HL7 Header segment
69 ; format: HLHDR - Used with indirection to build message in out
70 ; queue
71 ; This routine will first take the header information in the array
72 ; specified by HDR and merge into the Message Text field of file 870.
73 ; Then it will move the message contained in 772 (MTIEN) into 870.
74 ;
75 ;Check for required parameters
76 I '$G(MTIEN)!('$G(LLD0))!('$G(LLD1))!(HDR="") Q
77 ;
78 ;-- initilize
79 N I,X
80 S I=0
81 ;
82 ;-- move header into 870 from HDR array
83 S X="" F S X=$O(@HDR@(X)) Q:'X D
84 . S I=I+1,^HLCS(870,LLD0,2,LLD1,1,I,0)=@HDR@(X)
85 S I=I+1,^HLCS(870,LLD0,2,LLD1,1,I,0)=""
86 ;
87 ;Move data from Message Text file to Logical Link file
88 S X=0 F S X=$O(^HL(772,MTIEN,"IN",X)) Q:X="" D
89 . S I=I+1,^HLCS(870,LLD0,2,LLD1,1,I,0)=$G(^HL(772,MTIEN,"IN",X,0))
90 ;
91 ;-- update 0 node of message and format arrays
92 S ^HLCS(870,LLD0,2,LLD1,1,0)="^^"_I_"^"_I_"^"_$$DT^XLFDT_"^"
93 ;
94 Q
Note: See TracBrowser for help on using the repository browser.