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

DGPFHLU6.m

Go to the documentation of this file.
  1. DGPFHLU6 ;ALB/RPM - PRF HL7 ORU~R01 UTILITIES ; 8/31/05 1:09pm
  1. ;;5.3;Registration;**425,554,1005,1028**;Aug 13, 1993;Build 4
  1. ;Call to $$GET^XPAR supported by ICR #2263
  1. ;
  1. Q ;no direct entry
  1. ;
  1. XMIT(DGPFHIEN,DGHLEID,DGFAC,DGHLROOT,DGHL,DGHC) ;transmit ORU messages
  1. ;This function loops through an array of treating facilities. For
  1. ;each treating facility: the HL7 logical link is determined, the ORU
  1. ;message contained in the DGHLROOT input parameter is transmitted and
  1. ;an entry is created in the PRF HL7 TRANSMISSION LOG (#26.17) file.
  1. ;
  1. ; Supported DBIA #2171: This supported DBIA is used to access the
  1. ; Kernel API to convert a station number
  1. ; to an INSTITUTION (#4) file IEN, and for
  1. ; Kernel API to check whether a station has
  1. ; to Cerner.
  1. ; Supported ICR #2263: This ICR permits the use of $$GET^XPAR to
  1. ; retrieve a parameter value.
  1. ;
  1. ; Input:
  1. ; DGPFHIEN - pointer to PRF ASSIGNMENT HISTORY (#26.14) file
  1. ; DGHLEID - event protocol ID
  1. ; DGFAC - treating facilities array
  1. ; DGHLROOT - name of array containing formatted ORU message
  1. ; DGHL - VistA HL7 environment array
  1. ;
  1. ; Output:
  1. ; Function value - returns 1 on sucess, 0 on failure
  1. ;
  1. N DGHLLNK ;single logical link
  1. N DGHLS ;name of HL7 "HLS" array
  1. N DGI ;generic counter
  1. N DGINST ;pointer to INSTITUTION (#4) file
  1. N DGLOGERR ;error array from transmit log filer
  1. N DGLINST ;pointer to INSTITUTION (#4) file for local site
  1. N DGRSLT ;function value
  1. N HLL ;logical links array
  1. N DGHLRSLT ;message IEN on successful transmit
  1. N DGSTAT ;station number
  1. ;
  1. S DGHLS=$NA(^TMP("HLS",$J))
  1. S DGLINST=$P($$SITE^VASITE(),U,1)
  1. S DGRSLT=0
  1. ;
  1. S DGI=0
  1. F S DGI=$O(DGFAC(DGI)) Q:'DGI D
  1. . N DGHLRSLT
  1. . N DGLOGERR
  1. . N DGSTAT
  1. . ;
  1. . ;convert the station number to INSTITUTION (#4) file IEN
  1. . S DGSTAT=$P(DGFAC(DGI),U,1)
  1. . S DGINST=+$$IEN^XUAF4($P(DGFAC(DGI),U,1))
  1. . Q:('DGINST!(DGINST=DGLINST))
  1. . ;
  1. . ;must be a medical treating facility
  1. . Q:'$$TF^XUAF4(DGINST)
  1. . ;
  1. . ;must not be 200CRNR - patch 1005
  1. . Q:$$STA^XUAF4(DGINST)="200CRNR"
  1. . ;
  1. . ;get the HL7 LOGICAL LINK associated with the institution
  1. . S DGHLLNK=$$GETLINK^DGPFHLUT(DGINST)
  1. . ;
  1. . Q:DGHLLNK=0 ;patch 1028 - Don't try to send if there is no link.
  1. . ;
  1. . ;copy formatted message to HL7 "HLS" array
  1. . K @DGHLS
  1. . M @DGHLS=@DGHLROOT
  1. . ;
  1. . ;build HLL logical link array
  1. . S HLL("LINKS",1)="DGPF PRF ORU/R01 SUBSC"_U_DGHLLNK
  1. . ;
  1. . ;generate the message
  1. . D GENERATE^HLMA(DGHLEID,"GM",1,.DGHLRSLT,"","")
  1. . Q:$P(DGHLRSLT,U,2)]""
  1. . ;
  1. . ;store the message ID and destination site in the HL7 transmission log
  1. . D STOXMIT^DGPFHLL(DGPFHIEN,$P(DGHLRSLT,U),DGINST,.DGLOGERR)
  1. . Q:$D(DGLOGERR)
  1. . ;
  1. . ;success
  1. . S DGRSLT=1
  1. ;
  1. Q DGRSLT
  1. ;
  1. XMIT1(DGPFHIEN,DGHLEID,DGROOT,DGHL,DGSTAT) ;
  1. ; Input:
  1. ; DGPFHIEN - pointer to PRF ASSIGNMENT HISTORY (#26.14) file
  1. ; DGHLEID - event protocol ID
  1. ; DGHLROOT - name of array containing formatted ORU message
  1. ; DGHL - VistA HL7 environment array
  1. ; DGSTAT - station IEN
  1. ; Output:
  1. ; function value - 1 on success, 0 on failure
  1. ;
  1. ; Supported ICR #2171: This supported DBIA is used to access the
  1. ; Kernel API to convert a station number
  1. ; to an INSTITUTION (#4) file IEN, and for
  1. ; Kernel API to check whether a station has
  1. ; to Cerner.
  1. ; Supported ICR #2263: This ICR permits the use of $$GET^XPAR to
  1. ; retrieve a parameter value.
  1. ;
  1. N DGHLS ;name of HL7 "HLS" array
  1. N DGRSLT ;return value
  1. N HLL ;HL7 links array
  1. N DGINST ;pointer to INSTITUTION file
  1. N DGLOGERRR ;logging error
  1. N DGHLP ;HL7 "HLP" array
  1. S DGINST=$$IEN^XUAF4("200CRNR") ;for logging purposes
  1. S DGHLS=$NA(^TMP("HLS",$J))
  1. K @DGHLS
  1. M @DGHLS=@DGROOT ;copy message to "HLS" array
  1. S DGRSLT=0
  1. ;set recipient to HC regional router
  1. S HLL("LINKS",1)="DGPF PRF ORU/R01 SUBSC"_U_$$GET^XPAR("SYS","DG PRF REGIONAL ROUTER",1)
  1. S $P(DGHLP("SUBSCRIBER"),U,5)="200CRNR"
  1. D GENERATE^HLMA(DGHLEID,"GM",1,.DGHLRSLT,"",.DGHLP) ;send the message
  1. Q:$P(DGHLRSLT,U,2)]"" DGRSLT
  1. D STOXMIT^DGPFHLL(DGPFHIEN,$P(DGHLRSLT,U),DGINST,.DGLOGERR) ;log it
  1. Q:$D(DGLOGERR) DGRSLT
  1. S DGRSLT=1 ;success
  1. Q DGRSLT