MAGDHLI ;WOIFO/MLH/PMK - IHE-based ADT interface for PACS ;22 Mar 2017 8:07 AM
;;3.0;IMAGING;**49,183**;05-October-2009;Build 11;Build 1463
;; Per VHA Directive 2004-038, this routine should not be modified.
;; +---------------------------------------------------------------+
;; | Property of the US Government. |
;; | No permission to copy or redistribute this software is given. |
;; | Use of unreleased versions of this software requires the user |
;; | to execute a written test agreement with the VistA Imaging |
;; | Development Office of the Department of Veterans Affairs, |
;; | telephone (301) 734-0100. |
;; | The Food and Drug Administration classifies this software as |
;; | a medical device. As such, it may not be changed in any way. |
;; | Modifications to this software may result in an adulterated |
;; | medical device under 21CFR820, the use of which is considered |
;; | to be a violation of US Federal Statutes. |
;; +---------------------------------------------------------------+
;;
Q
;
ADT ; MAIN ENTRY POINT - Generate the appropriate ADT message.
N STAT ; status of HL7 message generation
N OCCURRED ; date/time the event occurred (from DGPMA)
;
I DGPMT=1 D Q ; admission
. S OCCURRED=$P($G(DGPMA),"^",1)
. S STAT=$S(OCCURRED:$$A01^MAGDHLT(DFN,OCCURRED),1:$$A11^MAGDHLT(DFN,DGNOW))
. Q
I DGPMT=2 D Q ; transfer
. S OCCURRED=$P($G(DGPMA),"^",1)
. S STAT=$S(OCCURRED:$$A02^MAGDHLT(DFN,OCCURRED),1:$$A12^MAGDHLT(DFN,DGNOW))
. Q
I DGPMT=3 D Q ; discharge
. S OCCURRED=$P($G(DGPMA),"^",1)
. S STAT=$S(OCCURRED:$$A03^MAGDHLT(DFN,OCCURRED),1:$$A13^MAGDHLT(DFN,DGNOW))
. Q
I DGPMT=8 D Q ; patient information update - P183 PMK 3/9/17
. S STAT=$$A08^MAGDHLT(DFN)
. Q
I DGPMT=47 D Q ; change patient identifier list - P183 PMK 3/9/17
. N DATETIME,NEWSSN,OLDSSN
. ; send the last SSN change for VAFC ADT-A08 SERVER event, or
. ; all SSN changes for a call from the SENDA08 API entry point
. S DATETIME=""
. F S DATETIME=$O(SSNCHANGES(DATETIME)) Q:DATETIME="" D
. . S NEWSSN=SSNCHANGES(DATETIME,"NEW")
. . S OLDSSN=SSNCHANGES(DATETIME,"OLD")
. . S STAT=$$A47^MAGDHLT(DFN,OLDSSN,NEWSSN,DATETIME)
. . Q
. ; finally, send A08 to change the PID-19 SSN
. S STAT=$$A08^MAGDHLT(DFN,NEWSSN,DATETIME)
. Q
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HMAGDHLI 2428 printed Oct 16, 2024@18:00:42 Page 2
MAGDHLI ;WOIFO/MLH/PMK - IHE-based ADT interface for PACS ;22 Mar 2017 8:07 AM
+1 ;;3.0;IMAGING;**49,183**;05-October-2009;Build 11;Build 1463
+2 ;; Per VHA Directive 2004-038, this routine should not be modified.
+3 ;; +---------------------------------------------------------------+
+4 ;; | Property of the US Government. |
+5 ;; | No permission to copy or redistribute this software is given. |
+6 ;; | Use of unreleased versions of this software requires the user |
+7 ;; | to execute a written test agreement with the VistA Imaging |
+8 ;; | Development Office of the Department of Veterans Affairs, |
+9 ;; | telephone (301) 734-0100. |
+10 ;; | The Food and Drug Administration classifies this software as |
+11 ;; | a medical device. As such, it may not be changed in any way. |
+12 ;; | Modifications to this software may result in an adulterated |
+13 ;; | medical device under 21CFR820, the use of which is considered |
+14 ;; | to be a violation of US Federal Statutes. |
+15 ;; +---------------------------------------------------------------+
+16 ;;
+17 QUIT
+18 ;
ADT ; MAIN ENTRY POINT - Generate the appropriate ADT message.
+1 ; status of HL7 message generation
NEW STAT
+2 ; date/time the event occurred (from DGPMA)
NEW OCCURRED
+3 ;
+4 ; admission
IF DGPMT=1
Begin DoDot:1
+5 SET OCCURRED=$PIECE($GET(DGPMA),"^",1)
+6 SET STAT=$SELECT(OCCURRED:$$A01^MAGDHLT(DFN,OCCURRED),1:$$A11^MAGDHLT(DFN,DGNOW))
+7 QUIT
End DoDot:1
QUIT
+8 ; transfer
IF DGPMT=2
Begin DoDot:1
+9 SET OCCURRED=$PIECE($GET(DGPMA),"^",1)
+10 SET STAT=$SELECT(OCCURRED:$$A02^MAGDHLT(DFN,OCCURRED),1:$$A12^MAGDHLT(DFN,DGNOW))
+11 QUIT
End DoDot:1
QUIT
+12 ; discharge
IF DGPMT=3
Begin DoDot:1
+13 SET OCCURRED=$PIECE($GET(DGPMA),"^",1)
+14 SET STAT=$SELECT(OCCURRED:$$A03^MAGDHLT(DFN,OCCURRED),1:$$A13^MAGDHLT(DFN,DGNOW))
+15 QUIT
End DoDot:1
QUIT
+16 ; patient information update - P183 PMK 3/9/17
IF DGPMT=8
Begin DoDot:1
+17 SET STAT=$$A08^MAGDHLT(DFN)
+18 QUIT
End DoDot:1
QUIT
+19 ; change patient identifier list - P183 PMK 3/9/17
IF DGPMT=47
Begin DoDot:1
+20 NEW DATETIME,NEWSSN,OLDSSN
+21 ; send the last SSN change for VAFC ADT-A08 SERVER event, or
+22 ; all SSN changes for a call from the SENDA08 API entry point
+23 SET DATETIME=""
+24 FOR
SET DATETIME=$ORDER(SSNCHANGES(DATETIME))
if DATETIME=""
QUIT
Begin DoDot:2
+25 SET NEWSSN=SSNCHANGES(DATETIME,"NEW")
+26 SET OLDSSN=SSNCHANGES(DATETIME,"OLD")
+27 SET STAT=$$A47^MAGDHLT(DFN,OLDSSN,NEWSSN,DATETIME)
+28 QUIT
End DoDot:2
+29 ; finally, send A08 to change the PID-19 SSN
+30 SET STAT=$$A08^MAGDHLT(DFN,NEWSSN,DATETIME)
+31 QUIT
End DoDot:1
QUIT
+32 QUIT