source: WorldVistAEHR/trunk/r/HEALTH_LEVEL_SEVEN-HL/HLTP.m@ 623

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

initial load of WorldVistAEHR

File size: 3.2 KB
Line 
1HLTP ;AISC/SAW-Transaction Processor Module ;09/13/2006
2 ;;1.6;HEALTH LEVEL SEVEN;**14,43,133**;Oct 13, 1995;Build 13
3 ;Per VHA Directive 2004-038, this routine should not be modified.
4GENERATE(HLMID,HLMTIEN,HLEID,HLARYTYP,HLFORMAT,HLRESLT,HLP) ;Generate an
5 ;outgoing message
6 ;
7 ;This is a subroutine call with parameter passing. It returns a value
8 ;in the variable HLRESLT of null if no error occurs, or the following
9 ;two piece value if an error occurs: error code^error description
10 ;
11 ;Required Input Parameters
12 ; HLMID = Message ID of message being generated
13 ; HLMTIEN = IEN in Message Text file where message being generated
14 ; will be stored
15 ; HLEID = IEN of event driver protocol in the Protocol file
16 ; HLARYTYP = Array type. One of the following codes:
17 ; LM = local array containing a single message
18 ; LB = local array containig a batch of messages
19 ; GM = global array containing a single message
20 ; GB = global array containing a batch of messages
21 ; HLFORMAT = Format of array, 1 for pre-formatted in HL7 format,
22 ; otherwise 0
23 ;NOTE: The parameter HLRESLT must be passed by reference
24 ; HLRESLT = The variable that will be returned to the calling
25 ; application as descibed above
26 ;Optional Parameters
27 ; HLP("SECURITY") = A 1 to 40 character string
28 ; HLP("CONTPTR") = Continuation pointer, a 1 to 180 character string
29 ; HLP("GROUTINE") = The M code to execute to generate the HL7 message
30 ;
31 S HLRESLT=""
32 ;
33 ;Check for required parameters
34 I '$G(HLMID)!('$G(HLMTIEN))!('$G(HLEID))!($G(HLARYTYP)']"")!($G(HLFORMAT)']"") S HLRESLT="7^"_$G(^HL(771.7,7,0))_" at GENERATE^HLTP entry point" G EXIT
35 ;Extract data from file 101 and store in separate variables
36 D EVENT^HLUTIL1(HLEID,770,.HLN) S HLSAN=$P($G(^HL(771,+$P(HLN(770),"^"),0)),"^"),HLQ=""""""
37 S HLP("MSGTYPE")=$E(HLARYTYP,2)
38 ;Update zero node of Message Text file
39 D UPDATE^HLTF0(HLMTIEN,HLMTIEN,"O",HLEID,"",+$P(HLN(770),"^"),HLPRIO,"","",.HLP)
40 ;Update status to Being Generated
41 D STATUS^HLTF0(HLMTIEN,8)
42 ;Check that local/global array exists and store in Message Text file
43 ; if pre-compiled
44 I HLFORMAT D I +$G(HLRESLT) G EXIT
45 .I $E(HLARYTYP)="G" D I +$G(HLRESLT) D STATUS^HLTF0(HLMTIEN,4,+HLRESLT) Q
46 ..I $O(^TMP("HLS",$J,0))']"" S HLRESLT="8^"_$G(^HL(771.7,8,0)) Q
47 ..D MERGE^HLTF1("G",HLMTIEN,"HLS")
48 .I $E(HLARYTYP)="L" D I +$G(HLRESLT) D STATUS^HLTF0(HLMTIEN,4,+HLRESLT) Q
49 ..I $O(HLA("HLS",0))']"" S HLRESLT="8^"_$G(^HL(771.7,8,0)) Q
50 ..D MERGE^HLTF1("L",HLMTIEN,"HLS")
51 ;If array is not pre-compiled, call message generation routine
52 I 'HLFORMAT N HLERR D I $D(HLERR) S HLRESLT="9^"_HLERR D STATUS^HLTF0(HLMTIEN,4,9,HLERR) G EXIT
53 .S HLP("GROUTINE")=HLP("GROUTINE")_"("_HLMID_","_HLMTIEN_","_HLQ_HLARYTYP_HLQ_","_HLSAN_","_$P($G(^HL(771.2,$P(HLN(770),"^",3),0)),"^")_","_$P($G(^HL(779.001,$P(HLN(770),"^",4),0)),"^")_","_HLQ_$TR($P(HLN(770),"^",6),"id","ID")_HLQ_")"
54 .X HLP("GROUTINE")
55 ;**CIRN**
56 S ZMID=HLMID ; Save original parent message IEN
57 I $D(HLL("LINKS")),HLPRIO'="I" D FWD^HLCS2 K HLL
58 ;Invoke communication server module to
59 ;send message to subscribers
60 ;K HLARYTYP,HLFORMAT,HLN,HLP,HLQ
61 D SEND^HLCS(HLMTIEN,HLEID,.HLRESLT)
62EXIT Q
Note: See TracBrowser for help on using the repository browser.