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

MAGDHRC0.m

Go to the documentation of this file.
  1. MAGDHRC0 ;WOIFO/PMK - Read HL7 and generate DICOM ; 28 Mar 2011 10:30 AM
  1. ;;3.0;IMAGING;**46,54,49**;Mar 19, 2002;Build 2033;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. ; Functions for accessing parsed HL7 data
  1. ;
  1. GETDATA(FLD,REP,CMP,SUB) ; get an element from HL7PARSE
  1. Q:'$D(FLD) $$DEQUOTE($G(@HL7PARSE@(HL7SEGNO))) ; segment
  1. Q:'$D(REP) $$DEQUOTE($G(@HL7PARSE@(HL7SEGNO,FLD))) ; field
  1. Q:'$D(CMP) $$DEQUOTE($G(@HL7PARSE@(HL7SEGNO,FLD,REP))) ; repetition
  1. Q:'$D(SUB) $$DEQUOTE($G(@HL7PARSE@(HL7SEGNO,FLD,REP,CMP))) ; component
  1. Q $$DEQUOTE($G(@HL7PARSE@(HL7SEGNO,FLD,REP,CMP,SUB))) ; subcomponent
  1. ;
  1. DEQUOTE(X) ; convert HL7 double quote data (that is, "") to empty string
  1. Q $S(X="""""":"",1:X)
  1. ;
  1. GETEXIST(FLD,REP,CMP,SUB) ; does the element (segment/field/rep/comp) exist
  1. Q:'$D(FLD) $D(@HL7PARSE@(HL7SEGNO)) ; segment
  1. Q:'$D(REP) $D(@HL7PARSE@(HL7SEGNO,FLD)) ; field
  1. Q:'$D(CMP) $D(@HL7PARSE@(HL7SEGNO,FLD,REP)) ; repetition
  1. Q:'$D(SUB) $D(@HL7PARSE@(HL7SEGNO,FLD,REP,CMP)) ; component
  1. Q $D(@HL7PARSE@(HL7SEGNO,FLD,REP,CMP,SUB)) ; subcomponent
  1. ;
  1. GETSEG(SEGMENT) ; check if the named segment exists
  1. Q:SEGMENT'="" $O(@HL7PARSE@("B",SEGMENT,""))
  1. Q 0
  1. ;
  1. GETCOUNT() ; get highest index number from HL7PARSE
  1. Q $O(@HL7PARSE@(" "),-1)
  1. ;
  1. GETNAME(J,K) ; get a person's name - return in DICOM format
  1. ; also used for provider's name - first piece is code - others shifted
  1. N I,LAST,NAME,X
  1. S NAME="",LAST=0,K=$G(K,1) F I=1:1:6 D
  1. . N X ; name component: last ^ first ^ mi ^ prefix ^ suffix
  1. . S X=$$GETDATA^MAGDHRC0(J,K,I) I $L(X) S LAST=I
  1. . S NAME=NAME_$S(I>1:"^",1:"")_$TR(X,"^\","") ; no ^ or \ chars in name
  1. . Q
  1. Q $P(NAME,"^",1,LAST)
  1. ;