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

MAGDHL7.m

Go to the documentation of this file.
  1. MAGDHL7 ;WOIFO/PMK,MLH - Routine to copy HL7 data from HLSDATA to ^MAGDHL7 ;30 Mar 2017 9:33 AM
  1. ;;3.0;IMAGING;**11,30,86,54,183**;12-May-2007;Build 11
  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. EN ; Entry point for HL7 1.6. Called from the MAGD SEND ORU/ORM protocols.
  1. ; Executed after the RA protocols setup the HL7 message segments.
  1. N DA,DIE,DIC,DR,I,J,K,L,MAGRAD,MAGRAN,MAGSAN,MAGTYPE,Y,X
  1. I $D(HLQUIT),HLQUIT Q ; HL7 routines may have failed.
  1. S MAGRAD=""
  1. F I=1:1 X HLNEXT Q:HLQUIT'>0 D
  1. . S MAGRAD(I)=HLNODE,J=0
  1. . F S J=$O(HLNODE(J)) Q:'J S MAGRAD(I)=MAGRAD(I)_HLNODE(J)
  1. . Q
  1. ; Above code needed for segments greater than 245 characters.
  1. S MAGTYPE=$G(HL("MTN")),MAGRAN=$G(HL("RAN")),MAGSAN=$G(HL("SAN"))
  1. ;
  1. ; Add the entry in the MAGDHL7(2006.5 global.
  1. S Y=$$NEWMSG($$NOW^XLFDT()\1)
  1. I +Y<1 Q ; Entry not made in file.
  1. S $P(^MAGDHL7(2006.5,+Y,0),"^",2)=MAGTYPE
  1. ; Add HL7 message into word processing field.
  1. S (L,K)=0 F S K=$O(MAGRAD(K)) Q:'K S L=L+1,^MAGDHL7(2006.5,+Y,1,L,0)=MAGRAD(K) D
  1. . ; If segment has more than one line of data, add as a single line
  1. . ; Peter's code will take care of this.
  1. . S J=0 F S J=$O(MAGRAD(K,J)) Q:'J S L=L+1,^MAGDHL7(2006.5,+Y,1,L,0)=MAGRAD(K,J)
  1. S ^MAGDHL7(2006.5,+Y,1,0)="^2006.502^"_L_"^"_L_"^"_DT
  1. S X=$P($G(^MAGDHL7(2006.5,+Y,0)),"^",3)
  1. K:X ^MAGDHL7(2006.5,"C",X,+Y)
  1. S X=$$NOW^XLFDT
  1. S $P(^MAGDHL7(2006.5,+Y,0),"^",3)=X
  1. S ^MAGDHL7(2006.5,"C",X,+Y)=""
  1. Q
  1. ;
  1. NEWMSG(DATE) ; Add a stub for a new message
  1. N D0,HDR
  1. S DATE=DATE\1
  1. L +^MAGDHL7(2006.5,0):1E9 ; Background process MUST wait
  1. S D0=$O(^MAGDHL7(2006.5," "),-1)+1
  1. S ^MAGDHL7(2006.5,D0,0)=DATE
  1. S:DATE'="" ^MAGDHL7(2006.5,"B",DATE,D0)=""
  1. S HDR=$G(^MAGDHL7(2006.5,0))
  1. S ^MAGDHL7(2006.5,0)="PACS MESSAGE^2006.5D^"_D0_"^"_($P(HDR,"^",4)+1)
  1. L -^MAGDHL7(2006.5,0)
  1. Q D0