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

MAGDHLL.m

Go to the documentation of this file.
  1. MAGDHLL ;WOIFO/MLH/PMK - IHE-based ADT interface for PACS - log to gateway ;07 Nov 2017 2:59 PM
  1. ;;3.0;IMAGING;**49,138,183**;Mar 19, 2002;Build 11;Jul 26, 2012
  1. ;; Per VHA Directive 2004-038, this routine should not be modified.
  1. ;; +---------------------------------------------------------------+
  1. ;; | Property of the US Government. |
  1. ;; | No permission to copy or redistribute this software is given. |
  1. ;; | Use of unreleased versions of this software requires the user |
  1. ;; | to execute a written test agreement with the VistA Imaging |
  1. ;; | Development Office of the Department of Veterans Affairs, |
  1. ;; | telephone (301) 734-0100. |
  1. ;; | The Food and Drug Administration classifies this software as |
  1. ;; | a medical device. As such, it may not be changed in any way. |
  1. ;; | Modifications to this software may result in an adulterated |
  1. ;; | medical device under 21CFR820, the use of which is considered |
  1. ;; | to be a violation of US Federal Statutes. |
  1. ;; +---------------------------------------------------------------+
  1. ;;
  1. Q
  1. ;
  1. LOGGW(XTYP) ; SUBROUTINE - log a generated message to the DICOM/text gateway
  1. ; input: XTYP message type (= MSH-9.1)
  1. ; expects: HL() array of HL7 variables
  1. ; HLHDR() array containing MSH segment info
  1. ; HLA() array of HL7 segments
  1. ;
  1. N MSGDT ; ----- message date and time from MSH-7 (in HL7 format)
  1. N MSGDFM ; ---- MSGDT date only (no time) in FileMan format
  1. N MSGDTFM ; --- MSGDT date and time in FileMan format
  1. N GWIX ; ------ gateway message index
  1. N GWHDR ; ----- 0 node of gateway message file
  1. N MSH ; ------- message header for gateway
  1. N GWSGIX ; ---- gateway segment index
  1. N FS ; -------- field separator
  1. N I,IX ;------- scratch variables
  1. ;
  1. ;
  1. ; MSH, the HL7 message header segment, is passed in two different
  1. ; variables, depending upon the subscribers to the event driver.
  1. ;
  1. ; Originally, with just the MAG CPACS Axy SUBS subscriber, the value
  1. ; was passed in HLHDR(1).
  1. ;
  1. ; When the MAG CPACS Axy SUBS-HLO subscriber was added, because it has
  1. ; a processing routine, the value was passed in HLREC("HDR") instead.
  1. ;
  1. ; The code on the line below handles both situations.
  1. ;
  1. S MSH=$G(HLHDR(1),$G(HLREC("HDR")))
  1. I MSH'="" S FS=$E(MSH,4) D MAGDHL7
  1. Q
  1. ;
  1. MAGDHL7 ; output the ADT message to ^MAGDHL7
  1. L +^MAGDHL7(2006.5,0):1E9 E Q
  1. S GWIX=$O(^MAGDHL7(2006.5," "),-1)+1
  1. S GWHDR=$G(^MAGDHL7(2006.5,0))
  1. S $P(GWHDR,U,3)=GWIX,$P(GWHDR,U,4)=$P(GWHDR,U,4)+1
  1. S ^MAGDHL7(2006.5,0)=GWHDR
  1. S $P(MSH,FS,5)="VISTA DICOM/TEXT GATEWAY"
  1. S ^MAGDHL7(2006.5,GWIX,1,1,0)=MSH
  1. S IX=0,GWSGIX=1
  1. F I=1:1 S IX=$O(HLA("HLS",IX)) Q:'IX D
  1. . S GWSGIX=GWSGIX+1
  1. . S ^MAGDHL7(2006.5,GWIX,1,GWSGIX,0)=HLA("HLS",IX)
  1. . Q
  1. S MSGDT=$P($P(MSH,FS,7),"-",1) ; omit TZ offset
  1. S MSGDFM=$E(MSGDT,1,8)-17000000
  1. S MSGDTFM=+(MSGDFM_"."_$E(MSGDT,9,12))
  1. S ^MAGDHL7(2006.5,GWIX,1,0)=U_U_GWSGIX_U_GWSGIX_U_MSGDFM
  1. S ^MAGDHL7(2006.5,GWIX,0)=MSGDFM_U_XTYP_U_MSGDTFM
  1. S ^MAGDHL7(2006.5,"B",MSGDFM,GWIX)="" ; P183 PMK 3/6/17
  1. S ^MAGDHL7(2006.5,"C",MSGDTFM,GWIX)="" ; P183 PMK 3/6/17
  1. L -^MAGDHL7(2006.5,0)
  1. Q