Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: HLTP

HLTP.m

Go to the documentation of this file.
  1. HLTP ;AISC/SAW-Transaction Processor Module ;09/13/2006
  1. ;;1.6;HEALTH LEVEL SEVEN;**14,43,133**;Oct 13, 1995;Build 13
  1. ;Per VHA Directive 2004-038, this routine should not be modified.
  1. GENERATE(HLMID,HLMTIEN,HLEID,HLARYTYP,HLFORMAT,HLRESLT,HLP) ;Generate an
  1. ;outgoing message
  1. ;
  1. ;This is a subroutine call with parameter passing. It returns a value
  1. ;in the variable HLRESLT of null if no error occurs, or the following
  1. ;two piece value if an error occurs: error code^error description
  1. ;
  1. ;Required Input Parameters
  1. ; HLMID = Message ID of message being generated
  1. ; HLMTIEN = IEN in Message Text file where message being generated
  1. ; will be stored
  1. ; HLEID = IEN of event driver protocol in the Protocol file
  1. ; HLARYTYP = Array type. One of the following codes:
  1. ; LM = local array containing a single message
  1. ; LB = local array containig a batch of messages
  1. ; GM = global array containing a single message
  1. ; GB = global array containing a batch of messages
  1. ; HLFORMAT = Format of array, 1 for pre-formatted in HL7 format,
  1. ; otherwise 0
  1. ;NOTE: The parameter HLRESLT must be passed by reference
  1. ; HLRESLT = The variable that will be returned to the calling
  1. ; application as descibed above
  1. ;Optional Parameters
  1. ; HLP("SECURITY") = A 1 to 40 character string
  1. ; HLP("CONTPTR") = Continuation pointer, a 1 to 180 character string
  1. ; HLP("GROUTINE") = The M code to execute to generate the HL7 message
  1. ;
  1. S HLRESLT=""
  1. ;
  1. ;Check for required parameters
  1. 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
  1. ;Extract data from file 101 and store in separate variables
  1. D EVENT^HLUTIL1(HLEID,770,.HLN) S HLSAN=$P($G(^HL(771,+$P(HLN(770),"^"),0)),"^"),HLQ=""""""
  1. S HLP("MSGTYPE")=$E(HLARYTYP,2)
  1. ;Update zero node of Message Text file
  1. D UPDATE^HLTF0(HLMTIEN,HLMTIEN,"O",HLEID,"",+$P(HLN(770),"^"),HLPRIO,"","",.HLP)
  1. ;Update status to Being Generated
  1. D STATUS^HLTF0(HLMTIEN,8)
  1. ;Check that local/global array exists and store in Message Text file
  1. ; if pre-compiled
  1. I HLFORMAT D I +$G(HLRESLT) G EXIT
  1. .I $E(HLARYTYP)="G" D I +$G(HLRESLT) D STATUS^HLTF0(HLMTIEN,4,+HLRESLT) Q
  1. ..I $O(^TMP("HLS",$J,0))']"" S HLRESLT="8^"_$G(^HL(771.7,8,0)) Q
  1. ..D MERGE^HLTF1("G",HLMTIEN,"HLS")
  1. .I $E(HLARYTYP)="L" D I +$G(HLRESLT) D STATUS^HLTF0(HLMTIEN,4,+HLRESLT) Q
  1. ..I $O(HLA("HLS",0))']"" S HLRESLT="8^"_$G(^HL(771.7,8,0)) Q
  1. ..D MERGE^HLTF1("L",HLMTIEN,"HLS")
  1. ;If array is not pre-compiled, call message generation routine
  1. I 'HLFORMAT N HLERR D I $D(HLERR) S HLRESLT="9^"_HLERR D STATUS^HLTF0(HLMTIEN,4,9,HLERR) G EXIT
  1. .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_")"
  1. .X HLP("GROUTINE")
  1. ;**CIRN**
  1. S ZMID=HLMID ; Save original parent message IEN
  1. I $D(HLL("LINKS")),HLPRIO'="I" D FWD^HLCS2 K HLL
  1. ;Invoke communication server module to
  1. ;send message to subscribers
  1. ;K HLARYTYP,HLFORMAT,HLN,HLP,HLQ
  1. D SEND^HLCS(HLMTIEN,HLEID,.HLRESLT)
  1. EXIT Q