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

HLFNC1.m

Go to the documentation of this file.
  1. HLFNC1 ;AISC/SAW,JRP-Continuation of HLFNC, Additional Functions/Calls Used for HL7 Messages ;11/30/94 15:01
  1. ;;1.6;HEALTH LEVEL SEVEN;;Oct 13, 1995
  1. ;This routine is used for the Version 1.5 Interface Only
  1. HLFLDS(APP,SEG) ;Returns HL7 fields used by a DHCP application for a
  1. ;specified segment
  1. ;
  1. ;This is an extrinsic function call that returns a string containing
  1. ;a list of HL7 fields separated by uparrows (e.g., 1^2^3)
  1. ;
  1. ;Required variables:
  1. ;APP - the internal entry number of the DHCP application
  1. ; from file 771
  1. ;SEG - the name of the HL7 segment for which fields are
  1. ; to be returned
  1. ;
  1. ;Check for required input parameters
  1. I 'APP!(SEG']"") Q ""
  1. I '$D(^HL(771,APP,0)) Q ""
  1. N X S X=$O(^HL(771.3,"B",SEG,0)) I 'X Q ""
  1. S X=$O(^HL(771,APP,"SEG","B",X,0)) I 'X Q ""
  1. ;Return string
  1. Q $TR($G(^HL(771,APP,"SEG",X,"F")),",","^")
  1. MSH(HLMTN,HLSEC) ;Create an MSH Segment for an Outgoing HL7 Message
  1. ;
  1. ;Input : HLMTN - Three to seven character HL7 message type name
  1. ; HLSEC - Security to be included in field #8 of the segment
  1. ; (optional - field left blank when not passed)
  1. ; All variables created by a call to INIT^HLTRANS
  1. ;
  1. ;Output : An HL7 MSH segment
  1. ;
  1. ;Note : NULL is returned on error/bad input
  1. ; : Existance of variables from INIT^HLTRANS is assumed
  1. ;
  1. ;Check for required parameters
  1. Q:($G(HLMTN)="") ""
  1. Q:('$D(HLNDAP0)) ""
  1. S HLSEC=$G(HLSEC)
  1. ;Make sure pointer to Message Text file is valid
  1. Q:('$D(HLDA)) ""
  1. Q:('$D(^HL(772,HLDA,0))) ""
  1. ;Declare variables
  1. N MID,NODE,MSH
  1. ;Get message ID
  1. S NODE=$G(^HL(772,HLDA,0))
  1. S MID=$P(NODE,"^",6)
  1. Q:(MID="") ""
  1. ;Build MSH segment
  1. S MSH="MSH"_HLFS_HLECH_HLFS_HLDAN_HLFS_$P(HLNDAP0,"^",2)
  1. S MSH=MSH_HLFS_$P(HLNDAP0,"^",1)_HLFS_$P(HLNDAP0,"^",3)_HLFS_HLDT1
  1. S MSH=MSH_HLFS_HLSEC_HLFS_HLMTN_HLFS_MID_HLFS_HLPID_HLFS_HLVER
  1. ;Return MSH segment
  1. Q MSH
  1. BHS(HLMTN,HLSEC,HLMSA) ;Create a BHS Segment for an Outgoing HL7 Batch Message
  1. ;
  1. ;This is an extrinsic function call that returns an HL7 BHS segment
  1. ;
  1. ;Input : HLMTN - The three to seven character HL7 message type name
  1. ; HLSEC - Security to be included in field #8 of the segment
  1. ; (optional - field left blank when not passed)
  1. ; HLMSA - Three components (separated by the HL7 component
  1. ; separator character) consisting of the first
  1. ; three fields in the MSA segment. This variable is
  1. ; required if the message you are building is a
  1. ; batch response.
  1. ; All variables created by a call to INIT^HLTRANS
  1. ;
  1. ;Output : An HL7 BHS segment
  1. ;
  1. ;Note : NULL is returned on error/bad input
  1. ; : Existance of variables from INIT^HLTRANS is assumed
  1. ;
  1. ;Check for required parameters
  1. Q:($G(HLMTN)="") ""
  1. S HLSEC=$G(HLSEC)
  1. S HLMSA=$G(HLMSA)
  1. Q:('$D(HLNDAP0)) ""
  1. ;Declare variables
  1. N BHS,FIELD9,FIELD10,TMP,BID,BRID
  1. ;Get batch ID
  1. S TMP=$G(^HL(772,HLDA,0))
  1. S BID=$P(TMP,"^",6)
  1. Q:(BID="") ""
  1. ;Build field # 9 (batch name/processing ID/type/version)
  1. S FIELD9=$E(HLECH)_HLPID_$E(HLECH)_$E(HLMTN,1,3)_$E(HLECH)_HLVER
  1. ;Build field # 10 (batch comment)
  1. S FIELD10=""
  1. I (HLMSA'="") D
  1. .S FIELD10=$P(HLMSA,$E(HLECH))
  1. .S TMP=$P(HLMSA,$E(HLECH),3)
  1. .S:(TMP'="") FIELD10=FIELD10_$E(HLECH)_TMP
  1. ;Get batch reference ID
  1. S BRID=""
  1. S TMP=$P(HLMSA,$E(HLECH),2)
  1. S:(TMP'="") BRID=TMP
  1. ;Build BHS segment
  1. S BHS="BHS"_HLFS_HLECH_HLFS_HLDAN_HLFS_$P(HLNDAP0,"^",2)
  1. S BHS=BHS_HLFS_$P(HLNDAP0,"^")_HLFS_$P(HLNDAP0,"^",3)_HLFS_HLDT1
  1. S BHS=BHS_HLFS_HLSEC_HLFS_FIELD9_HLFS_FIELD10_HLFS_BID_HLFS_BRID
  1. ;Return BHS segment
  1. Q BHS