DGPFHLU6 ;ALB/RPM - PRF HL7 ORU~R01 UTILITIES ; 8/31/05 1:09pm
;;5.3;Registration;**425,554,1015**;Aug 13, 1993;Build 21
;
Q ;no direct entry
;
XMIT(DGPFHIEN,DGHLEID,DGFAC,DGHLROOT,DGHL) ;transmit ORU messages
;This function loops through an array of treating facilities. For
;each treating facility: the HL7 logical link is determined, the ORU
;message contained in the DGHLROOT input parameter is transmitted and
;an entry is created in the PRF HL7 TRANSMISSION LOG (#26.17) file.
;
; Supported DBIA #2171: This supported DBIA is used to access the
; Kernel API to convert a station number
; to an INSTITUTION (#4) file IEN.
;
; Input:
; DGPFHIEN - pointer to PRF ASSIGNMENT HISTORY (#26.14) file
; DGHLEID - event protocol ID
; DGFAC - treating facilities array
; DGHLROOT - name of array containing formatted ORU message
; DGHL - VistA HL7 environment array
;
; Output:
; Function value - returns 1 on sucess, 0 on failure
;
N DGHLLNK ;single logical link
N DGHLS ;name of HL7 "HLS" array
N DGI ;generic counter
N DGINST ;pointer to INSTITUTION (#4) file
N DGLOGERR ;error array from transmit log filer
N DGLINST ;pointer to INSTITUTION (#4) file for local site
N DGRSLT ;function value
N HLL ;logical links array
N DGHLRSLT ;message IEN on successful transmit
;
S DGHLS=$NA(^TMP("HLS",$J))
S DGLINST=$P($$SITE^VASITE(),U,1)
S DGRSLT=0
;
S DGI=0
F S DGI=$O(DGFAC(DGI)) Q:'DGI D
. N DGHLRSLT
. N DGLOGERR
. ;
. ;convert the station number to INSTITUTION (#4) file IEN
. S DGINST=+$$IEN^XUAF4($P(DGFAC(DGI),U,1))
. Q:'DGINST!(DGINST=DGLINST)
. ;
. ;must be a medical treating facility
. Q:'$$TF^XUAF4(DGINST)
. ;
. ;get the HL7 LOGICAL LINK associated with the institution
. S DGHLLNK=$$GETLINK^DGPFHLUT(DGINST)
. Q:DGHLLNK=0
. ;
. ;copy formatted message to HL7 "HLS" array
. K @DGHLS
. M @DGHLS=@DGHLROOT
. ;
. ;build HLL logical link
. S HLL("LINKS",1)="DGPF PRF ORU/R01 SUBSC"_U_DGHLLNK
. ;
. ;generate the message
. D GENERATE^HLMA(DGHLEID,"GM",1,.DGHLRSLT,"","")
. Q:$P(DGHLRSLT,U,2)]""
. ;
. ;store the message ID and destination site in the HL7 transmission log
. D STOXMIT^DGPFHLL(DGPFHIEN,$P(DGHLRSLT,U),DGINST,.DGLOGERR)
. Q:$D(DGLOGERR)
. ;
. ;success
. S DGRSLT=1
;
Q DGRSLT
DGPFHLU6 ;ALB/RPM - PRF HL7 ORU~R01 UTILITIES ; 8/31/05 1:09pm
+1 ;;5.3;Registration;**425,554,1015**;Aug 13, 1993;Build 21
+2 ;
+3 ;no direct entry
QUIT
+4 ;
XMIT(DGPFHIEN,DGHLEID,DGFAC,DGHLROOT,DGHL) ;transmit ORU messages
+1 ;This function loops through an array of treating facilities. For
+2 ;each treating facility: the HL7 logical link is determined, the ORU
+3 ;message contained in the DGHLROOT input parameter is transmitted and
+4 ;an entry is created in the PRF HL7 TRANSMISSION LOG (#26.17) file.
+5 ;
+6 ; Supported DBIA #2171: This supported DBIA is used to access the
+7 ; Kernel API to convert a station number
+8 ; to an INSTITUTION (#4) file IEN.
+9 ;
+10 ; Input:
+11 ; DGPFHIEN - pointer to PRF ASSIGNMENT HISTORY (#26.14) file
+12 ; DGHLEID - event protocol ID
+13 ; DGFAC - treating facilities array
+14 ; DGHLROOT - name of array containing formatted ORU message
+15 ; DGHL - VistA HL7 environment array
+16 ;
+17 ; Output:
+18 ; Function value - returns 1 on sucess, 0 on failure
+19 ;
+20 ;single logical link
NEW DGHLLNK
+21 ;name of HL7 "HLS" array
NEW DGHLS
+22 ;generic counter
NEW DGI
+23 ;pointer to INSTITUTION (#4) file
NEW DGINST
+24 ;error array from transmit log filer
NEW DGLOGERR
+25 ;pointer to INSTITUTION (#4) file for local site
NEW DGLINST
+26 ;function value
NEW DGRSLT
+27 ;logical links array
NEW HLL
+28 ;message IEN on successful transmit
NEW DGHLRSLT
+29 ;
+30 SET DGHLS=$NAME(^TMP("HLS",$JOB))
+31 SET DGLINST=$PIECE($$SITE^VASITE(),U,1)
+32 SET DGRSLT=0
+33 ;
+34 SET DGI=0
+35 FOR
SET DGI=$ORDER(DGFAC(DGI))
IF 'DGI
QUIT
Begin DoDot:1
+36 NEW DGHLRSLT
+37 NEW DGLOGERR
+38 ;
+39 ;convert the station number to INSTITUTION (#4) file IEN
+40 SET DGINST=+$$IEN^XUAF4($PIECE(DGFAC(DGI),U,1))
+41 IF 'DGINST!(DGINST=DGLINST)
QUIT
+42 ;
+43 ;must be a medical treating facility
+44 IF '$$TF^XUAF4(DGINST)
QUIT
+45 ;
+46 ;get the HL7 LOGICAL LINK associated with the institution
+47 SET DGHLLNK=$$GETLINK^DGPFHLUT(DGINST)
+48 IF DGHLLNK=0
QUIT
+49 ;
+50 ;copy formatted message to HL7 "HLS" array
+51 KILL @DGHLS
+52 MERGE @DGHLS=@DGHLROOT
+53 ;
+54 ;build HLL logical link
+55 SET HLL("LINKS",1)="DGPF PRF ORU/R01 SUBSC"_U_DGHLLNK
+56 ;
+57 ;generate the message
+58 DO GENERATE^HLMA(DGHLEID,"GM",1,.DGHLRSLT,"","")
+59 IF $PIECE(DGHLRSLT,U,2)]""
QUIT
+60 ;
+61 ;store the message ID and destination site in the HL7 transmission log
+62 DO STOXMIT^DGPFHLL(DGPFHIEN,$PIECE(DGHLRSLT,U),DGINST,.DGLOGERR)
+63 IF $DATA(DGLOGERR)
QUIT
+64 ;
+65 ;success
+66 SET DGRSLT=1
End DoDot:1
+67 ;
+68 QUIT DGRSLT