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

MAGDHLTC.m

Go to the documentation of this file.
  1. MAGDHLTC ;WOIFO/MLH/PMK - IHE-based ADT interface for PACS - trigger events - A11, A12, A13 ;20 Mar 2017 12:15 PM
  1. ;;3.0;IMAGING;**49,183**;Mar 19, 2002;Build 11;Apr 07, 2011
  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. A11 ; GOTO entry point from MAGDHLT - patient admission cancel
  1. ; INPUT: XDFN IEN of pt whose admission is being cancelled
  1. ; XDT date/time of cancellation
  1. ; function return: result of message generation from call to GENERATE^HLMA
  1. ;
  1. N HL ; -------- HL7 initialization function status return
  1. N HLA ; ------- array of HL7 message segments
  1. N MSGA11A ; --- A11 message array
  1. N MSG ; ------- message status
  1. ;
  1. D INIT^HLFNC2("MAG CPACS A11",.HL)
  1. I $G(HL) Q -1_U_$P(HL,"^",2) ; error
  1. ;
  1. ; build a dummy MSH segment for the $$MAKE^MAG7UM function
  1. S MSGA11A(1,0)="MSH"
  1. S MSGA11A(1,1,1,1,1)=HLFS
  1. S MSGA11A(1,2,1,1,1)=HLECH
  1. S MSGA11A(1,9,1,1,1)="ADT"
  1. S MSGA11A(1,9,1,2,1)="A11"
  1. ;
  1. ; gather patient information and populate segment array elements
  1. S MSG=$$EVN^MAGDHLS("A11",XDT,XDT,"MSGA11A")
  1. S MSG=$$PID^MAGDHLS(XDFN,"MSGA11A")
  1. S MSG=$$PV1^MAGDHLS(XDFN,"A11",XDT,"MSGA11A")
  1. ;
  1. ; assemble message into segments
  1. S MSG=$$MAKE^MAG7UM("MSGA11A",$NA(HLA("HLS")))
  1. K HLA("HLS",1) ; remove dummy MSH segment
  1. ;
  1. ; send message to receiver and gateway
  1. D GENERATE^HLMA("MAG CPACS A11","LM",1,.RESULT) ; generate & send message
  1. D LOGGW^MAGDHLL("ADT") ; log message to gateway
  1. Q $S($P($G(RESULT),U,2,$L(RESULT,U))="":0,1:-1_U_RESULT)
  1. ;
  1. A12 ; GOTO entry point from MAGDHLT - cancel patient transfer
  1. ; INPUT: XDFN IEN of pt whose admission is being cancelled
  1. ; XDT date/time of cancellation
  1. ; function return: result of message generation from call to GENERATE^HLMA
  1. ;
  1. N HL ; -------- HL7 initialization function status return
  1. N HLA ; ------- array of HL7 message segments
  1. N MSGA12A ; --- A02 message array
  1. N MSG ; ------- message status
  1. ;
  1. D INIT^HLFNC2("MAG CPACS A12",.HL)
  1. I $G(HL) Q -1_U_$P(HL,"^",2) ; error
  1. ;
  1. ; build a dummy MSH segment for the $$MAKE^MAG7UM function
  1. S MSGA12A(1,0)="MSH"
  1. S MSGA12A(1,1,1,1,1)=HLFS
  1. S MSGA12A(1,2,1,1,1)=HLECH
  1. S MSGA12A(1,9,1,1,1)="ADT"
  1. S MSGA12A(1,9,1,2,1)="A12"
  1. ;
  1. ; gather patient information and populate segment array elements
  1. S MSG=$$EVN^MAGDHLS("A12",XDT,XDT,"MSGA12A")
  1. S MSG=$$PID^MAGDHLS(XDFN,"MSGA12A")
  1. S MSG=$$PV1^MAGDHLS(XDFN,"A12",XDT,"MSGA12A")
  1. S MSG=$$ROL^MAGDHLS(XDFN,"MSGA12A")
  1. S MSG=$$OBXADT^MAGDHLS(XDFN,"MSGA12A")
  1. ;
  1. ; assemble message into segments
  1. S MSG=$$MAKE^MAG7UM("MSGA12A",$NA(HLA("HLS")))
  1. K HLA("HLS",1) ; remove dummy MSH segment
  1. ;
  1. ; send message to receiver and gateway
  1. D GENERATE^HLMA("MAG CPACS A12","LM",1,.RESULT) ; generate & send message
  1. D LOGGW^MAGDHLL("ADT") ; log message to gateway
  1. Q $S($P($G(RESULT),U,2,$L(RESULT,U))="":0,1:-1_U_RESULT)
  1. ;
  1. A13 ; GOTO entry point from MAGDHLT - cancel patient discharge
  1. ; INPUT: XDFN IEN of pt whose admission is being cancelled
  1. ; XDT date/time of cancellation
  1. ; function return: result of message generation from call to GENERATE^HLMA
  1. ;
  1. N HL ; -------- HL7 initialization function status return
  1. N HLA ; ------- array of HL7 message segments
  1. N MSGA13A ; --- A13 message array
  1. N MSG ; ------- message status
  1. ;
  1. D INIT^HLFNC2("MAG CPACS A13",.HL)
  1. I $G(HL) Q -1_U_$P(HL,"^",2) ; error
  1. ;
  1. ; build a dummy MSH segment for the $$MAKE^MAG7UM function
  1. S MSGA13A(1,0)="MSH"
  1. S MSGA13A(1,1,1,1,1)=HLFS
  1. S MSGA13A(1,2,1,1,1)=HLECH
  1. S MSGA13A(1,9,1,1,1)="ADT"
  1. S MSGA13A(1,9,1,2,1)="A13"
  1. ;
  1. ; gather patient information and populate segment array elements
  1. S MSG=$$EVN^MAGDHLS("A13",XDT,XDT,"MSGA13A")
  1. S MSG=$$PID^MAGDHLS(XDFN,"MSGA13A")
  1. S MSG=$$PV1^MAGDHLS(XDFN,"A13",XDT,"MSGA13A")
  1. S MSG=$$ROL^MAGDHLS(XDFN,"MSGA13A")
  1. ;
  1. ; assemble message into segments
  1. S MSG=$$MAKE^MAG7UM("MSGA13A",$NA(HLA("HLS")))
  1. K HLA("HLS",1) ; remove dummy MSH segment
  1. ;
  1. ; send message to receiver and gateway
  1. D GENERATE^HLMA("MAG CPACS A13","LM",1,.RESULT) ; generate & send message
  1. D LOGGW^MAGDHLL("ADT") ; log message to gateway
  1. Q $S($P($G(RESULT),U,2,$L(RESULT,U))="":0,1:-1_U_RESULT)