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

HLOCNRT.m

Go to the documentation of this file.
  1. HLOCNRT ;DAOU/ALA-Generate HL7 Optimized Message ; 17 Jun 2005 12:57 PM
  1. ;;1.6;HEALTH LEVEL SEVEN;**126**;Oct 13, 1995
  1. ;
  1. ;**Program Description**
  1. ; This program takes a current HL7 1.6 message and converts
  1. ; it to use the new HL Optimized code if it follows the standard
  1. ; 1.6 methodology of protocols.
  1. ;
  1. ; **If the VistA HL7 Protocol does not exist, calls to HL Optimized
  1. ; will have to be coded separately and this program cannot be used**
  1. Q
  1. ;
  1. EN(HLOPRTCL,ARYTYP,HLP) ;Entry Point
  1. ; Input Parameters
  1. ; HLOPRTCL = Protocol IEN or Protocol Name
  1. ; ARYTYP = The array where HL7 message resides
  1. ; HLP = Additional HL7 message parameters
  1. ;
  1. ; Output
  1. ; ZTSTOP = Stop processing flag (used by HDR)
  1. ; HLORESL = Error parameter
  1. ;
  1. NEW HLORESL,HLMSTATE,APPARMS,WHOTO,WHO,ERROR,HLOMESG
  1. S ZTSTOP=0,HLORESL=1
  1. ;
  1. ; Get IEN of protocol if name is passed
  1. I HLOPRTCL'?.N S HLOPRTCL=+$O(^ORD(101,"B",HLOPRTCL,0))
  1. I '$D(^ORD(101,HLOPRTCL)) S HLORESL="^99^HL7 1.6 Protocol not found",ZTSTOP=1 Q HLORESL
  1. ;
  1. ; If the VistA HL7 Protocol exists, call the Conversion Utility
  1. ; to set up the APPARMS, WHO or WHOTO arrays from protocol
  1. ; logical link
  1. D APAR^HLOCVU(HLOPRTCL,.APPARMS,.WHO,.WHOTO)
  1. ;
  1. ; If special HLP parameters are defined, convert them
  1. I $D(HLP) D
  1. . I $G(HLP("SECURITY"))'="" S APPARMS("SECURITY")=HLP("SECURITY")
  1. . I $G(HLP("CONTPTR"))'="" S APPARMS("CONTINUATION POINTER")=HLP("CONTPTR")
  1. . I $G(HLP("QUEUE"))'="" S APPARMS("QUEUE")=HLP("QUEUE")
  1. ;
  1. ; Create HL Optimized message
  1. I '$$NEWMSG^HLOAPI(.APPARMS,.HLMSTATE,.ERROR) S HLORESL="^99^"_ERROR,ZTSTOP=1 Q HLORESL
  1. I $E(ARYTYP,1)="G" S HLOMESG="^TMP(""HLS"",$J)"
  1. I $E(ARYTYP,1)="L" S HLOMESG="HLA(""HLS"")"
  1. ;
  1. ; Move the existing message from array into HL Optimized
  1. D MOVEMSG^HLOAPI(.HLMSTATE,HLOMESG)
  1. ;
  1. ; Send message via HL Optimized
  1. I $D(WHOTO) D Q HLORESL
  1. . I '$$SENDMANY^HLOAPI1(.HLMSTATE,.APPARMS,.WHOTO) S HLORESL="^99^Unable to send message",ZTSTOP=1 Q
  1. . S HLORESL=1
  1. ;
  1. I '$$SENDONE^HLOAPI1(.HLMSTATE,.APPARMS,.WHO,.ERROR) S HLORESL="^99^"_ERROR,ZTSTOP=1 Q HLORESL
  1. Q HLORESL