EASPREC2 ;ALB/KCL - ROUTE INCOMING HL7 (ORU) MESSAGES BY EVENT TYPE ; 11/22/02 1:56pm
;;1.0;ENROLLMENT APPLICATION SYSTEM;**23**; 21-OCT-94
;;Per VHA Directive 10-93-142, this routine should not be modified.
;
; This routine will process (ORU) HL7 messages received from the Edb
; via e*Gate. Currently only the Z06 is being transmitted.
; Event type code indicating type of transmission is in the BHS segment.
; Routines based on type will be called to process these messages. For
; each batch an ACK will be sent to the Edb indicating errors found.
; If any errors are found a batch message with AE(indicating error(s))
; is sent. If no errors only a MSH and MSA with AA(no errors) is sent.
; The following event type codes are processed in the following
; routine(s):
;
; EVENT CODE TRANSMISSION TYPE PROCESSING ROUTINE
; ==============================================================
; Z06 MEANS TEST TRANSMISSIONS EASPREC7
;
;
ORU ; - Receive Observational Results Unsolicited Message
;
N DIC,%,%H,%I D NOW^%DTC S HLDT=%
K HLERR,IVMSEG1,IVMSEG2,IVMSEG3
S (HLEVN,IVMCT,IVMERROR,IVMCNTR)=0
; Make sure POSTMASTER DUZ instead of DUZ of Person who
; started Incoming Logical Link
S DUZ=.5
;
; - get incoming segment from HL7 (#772) file
N IVMRTN,SEGCNT,CNT,STATION,HLEID,HLEIDS
S IVMRTN="IVMPREC2" K ^TMP($J,IVMRTN),^TMP("HLA",$J),^TMP("HLS",$J)
F SEGCNT=1:1 X HLNEXT Q:HLQUIT'>0 D
. S CNT=0
. S ^TMP($J,IVMRTN,SEGCNT,CNT)=HLNODE
. F S CNT=$O(HLNODE(CNT)) Q:'CNT S ^TMP($J,IVMRTN,SEGCNT,CNT)=HLNODE(CNT)
;
S HLDA=HLMTIEN
S IVMSEG=$G(^TMP($J,IVMRTN,1,0)) I IVMSEG']"" G ORUQ
;
; - check for BHS
I $E(IVMSEG,1,3)'="BHS" G ORUQ
;
; - get batch control id
S HLFS=HL("FS")
S HLECH=HL("ECH")
S HLQ=$G(HL("HLQ")) S:HLQ="" HLQ=""""""
S IVMHLMID=$P(IVMSEG,HLFS,11)
S STATION=$P(IVMSEG,HLFS,6)
;
; - get event type code
S IVMETC=$P($P(IVMSEG,HLFS,9),$E(HLECH),3)
S IVMETC=$P(IVMETC,$E(HLECH,2),2)
S HLEID="EAS EDB ORU-"_IVMETC_" SERVER"
S HLEID=$O(^ORD(101,"B",HLEID,0)),HLEIDS=""
I HLEID]"" S HLEIDS=$O(^ORD(101,HLEID,775,"B",0))
;
; - process the message according to the event type code
S IVMDO=$S(IVMETC="Z06":"EN^EASPREC7",1:"ORUQ")
D @IVMDO
Q:IVMDO="ORUQ"
;
; - if no error send ACK 'AA' message
S HLMTN="ACK"
K HLARYTYP,HLMTIENA,HLRESLTA,HLP
I 'IVMERROR S HLMID=IVMHLMID D ACK^IVMPREC S HLARYTYP="GM",HLMTIENA=""
I IVMERROR S HLARYTYP="GB",HLMTIENA=HLMTIEN ;HLMTIEN comes from ACK^IVMPREC
K ^TMP("HLA",$J) M ^TMP("HLA",$J)=^TMP("HLS",$J) K ^TMP("HLS",$J)
D GENACK^HLMA1(HLEID,HLMTIENS,HLEIDS,HLARYTYP,1,.HLRESLTA,HLMTIENA,.HLP)
;
ORUQ ;
K DFN,IVMCNTR,IVMCT,IVMDA,IVMERR,IVMERROR,IVMHLMID,IVMNDE,IVMPTID
K IVMSEG,IVMSEG1,IVMSEG2,IVMSEG3,IVMTEXT,XMSUB
K HLARYTYP,HLMTIENA,HLRESLTA,HLP
K ^TMP($J,IVMRTN),^TMP("HLA",$J),^TMP("HLS",$J)
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HEASPREC2 2931 printed Dec 13, 2024@01:55:35 Page 2
EASPREC2 ;ALB/KCL - ROUTE INCOMING HL7 (ORU) MESSAGES BY EVENT TYPE ; 11/22/02 1:56pm
+1 ;;1.0;ENROLLMENT APPLICATION SYSTEM;**23**; 21-OCT-94
+2 ;;Per VHA Directive 10-93-142, this routine should not be modified.
+3 ;
+4 ; This routine will process (ORU) HL7 messages received from the Edb
+5 ; via e*Gate. Currently only the Z06 is being transmitted.
+6 ; Event type code indicating type of transmission is in the BHS segment.
+7 ; Routines based on type will be called to process these messages. For
+8 ; each batch an ACK will be sent to the Edb indicating errors found.
+9 ; If any errors are found a batch message with AE(indicating error(s))
+10 ; is sent. If no errors only a MSH and MSA with AA(no errors) is sent.
+11 ; The following event type codes are processed in the following
+12 ; routine(s):
+13 ;
+14 ; EVENT CODE TRANSMISSION TYPE PROCESSING ROUTINE
+15 ; ==============================================================
+16 ; Z06 MEANS TEST TRANSMISSIONS EASPREC7
+17 ;
+18 ;
ORU ; - Receive Observational Results Unsolicited Message
+1 ;
+2 NEW DIC,%,%H,%I
DO NOW^%DTC
SET HLDT=%
+3 KILL HLERR,IVMSEG1,IVMSEG2,IVMSEG3
+4 SET (HLEVN,IVMCT,IVMERROR,IVMCNTR)=0
+5 ; Make sure POSTMASTER DUZ instead of DUZ of Person who
+6 ; started Incoming Logical Link
+7 SET DUZ=.5
+8 ;
+9 ; - get incoming segment from HL7 (#772) file
+10 NEW IVMRTN,SEGCNT,CNT,STATION,HLEID,HLEIDS
+11 SET IVMRTN="IVMPREC2"
KILL ^TMP($JOB,IVMRTN),^TMP("HLA",$JOB),^TMP("HLS",$JOB)
+12 FOR SEGCNT=1:1
XECUTE HLNEXT
if HLQUIT'>0
QUIT
Begin DoDot:1
+13 SET CNT=0
+14 SET ^TMP($JOB,IVMRTN,SEGCNT,CNT)=HLNODE
+15 FOR
SET CNT=$ORDER(HLNODE(CNT))
if 'CNT
QUIT
SET ^TMP($JOB,IVMRTN,SEGCNT,CNT)=HLNODE(CNT)
End DoDot:1
+16 ;
+17 SET HLDA=HLMTIEN
+18 SET IVMSEG=$GET(^TMP($JOB,IVMRTN,1,0))
IF IVMSEG']""
GOTO ORUQ
+19 ;
+20 ; - check for BHS
+21 IF $EXTRACT(IVMSEG,1,3)'="BHS"
GOTO ORUQ
+22 ;
+23 ; - get batch control id
+24 SET HLFS=HL("FS")
+25 SET HLECH=HL("ECH")
+26 SET HLQ=$GET(HL("HLQ"))
if HLQ=""
SET HLQ=""""""
+27 SET IVMHLMID=$PIECE(IVMSEG,HLFS,11)
+28 SET STATION=$PIECE(IVMSEG,HLFS,6)
+29 ;
+30 ; - get event type code
+31 SET IVMETC=$PIECE($PIECE(IVMSEG,HLFS,9),$EXTRACT(HLECH),3)
+32 SET IVMETC=$PIECE(IVMETC,$EXTRACT(HLECH,2),2)
+33 SET HLEID="EAS EDB ORU-"_IVMETC_" SERVER"
+34 SET HLEID=$ORDER(^ORD(101,"B",HLEID,0))
SET HLEIDS=""
+35 IF HLEID]""
SET HLEIDS=$ORDER(^ORD(101,HLEID,775,"B",0))
+36 ;
+37 ; - process the message according to the event type code
+38 SET IVMDO=$SELECT(IVMETC="Z06":"EN^EASPREC7",1:"ORUQ")
+39 DO @IVMDO
+40 if IVMDO="ORUQ"
QUIT
+41 ;
+42 ; - if no error send ACK 'AA' message
+43 SET HLMTN="ACK"
+44 KILL HLARYTYP,HLMTIENA,HLRESLTA,HLP
+45 IF 'IVMERROR
SET HLMID=IVMHLMID
DO ACK^IVMPREC
SET HLARYTYP="GM"
SET HLMTIENA=""
+46 ;HLMTIEN comes from ACK^IVMPREC
IF IVMERROR
SET HLARYTYP="GB"
SET HLMTIENA=HLMTIEN
+47 KILL ^TMP("HLA",$JOB)
MERGE ^TMP("HLA",$JOB)=^TMP("HLS",$JOB)
KILL ^TMP("HLS",$JOB)
+48 DO GENACK^HLMA1(HLEID,HLMTIENS,HLEIDS,HLARYTYP,1,.HLRESLTA,HLMTIENA,.HLP)
+49 ;
ORUQ ;
+1 KILL DFN,IVMCNTR,IVMCT,IVMDA,IVMERR,IVMERROR,IVMHLMID,IVMNDE,IVMPTID
+2 KILL IVMSEG,IVMSEG1,IVMSEG2,IVMSEG3,IVMTEXT,XMSUB
+3 KILL HLARYTYP,HLMTIENA,HLRESLTA,HLP
+4 KILL ^TMP($JOB,IVMRTN),^TMP("HLA",$JOB),^TMP("HLS",$JOB)
+5 QUIT