source: WorldVistAEHR/trunk/r/IMAGING-MAG-ZMAG/MAGDHRC0.m@ 1297

Last change on this file since 1297 was 613, checked in by George Lilly, 15 years ago

initial load of WorldVistAEHR

File size: 2.4 KB
Line 
1MAGDHRC0 ;WOIFO/PMK - Read HL7 and generate DICOM ; 08/29/2006 15:16
2 ;;3.0;IMAGING;**46**;16-February-2007;;Build 1023
3 ;; Per VHA Directive 2004-038, this routine should not be modified.
4 ;; +---------------------------------------------------------------+
5 ;; | Property of the US Government. |
6 ;; | No permission to copy or redistribute this software is given. |
7 ;; | Use of unreleased versions of this software requires the user |
8 ;; | to execute a written test agreement with the VistA Imaging |
9 ;; | Development Office of the Department of Veterans Affairs, |
10 ;; | telephone (301) 734-0100. |
11 ;; | The Food and Drug Administration classifies this software as |
12 ;; | a medical device. As such, it may not be changed in any way. |
13 ;; | Modifications to this software may result in an adulterated |
14 ;; | medical device under 21CFR820, the use of which is considered |
15 ;; | to be a violation of US Federal Statutes. |
16 ;; +---------------------------------------------------------------+
17 ;;
18 Q
19 ; Functions for accessing parsed HL7 data
20 ;
21GETDATA(FLD,REP,CMP,SUB) ; get an element from HL7PARSE
22 Q:'$D(FLD) $G(@HL7PARSE@(HL7SEGNO)) ; segment
23 Q:'$D(REP) $G(@HL7PARSE@(HL7SEGNO,FLD)) ; field
24 Q:'$D(CMP) $G(@HL7PARSE@(HL7SEGNO,FLD,REP)) ; repetition
25 Q:'$D(SUB) $G(@HL7PARSE@(HL7SEGNO,FLD,REP,CMP)) ; component
26 Q $G(@HL7PARSE@(HL7SEGNO,FLD,REP,CMP,SUB)) ; subcomponent
27 ;
28GETEXIST(FLD,REP,CMP,SUB) ; does the element (segment/field/rep/comp) exist
29 Q:'$D(FLD) $D(@HL7PARSE@(HL7SEGNO)) ; segment
30 Q:'$D(REP) $D(@HL7PARSE@(HL7SEGNO,FLD)) ; field
31 Q:'$D(CMP) $D(@HL7PARSE@(HL7SEGNO,FLD,REP)) ; repetition
32 Q:'$D(SUB) $D(@HL7PARSE@(HL7SEGNO,FLD,REP,CMP)) ; component
33 Q $D(@HL7PARSE@(HL7SEGNO,FLD,REP,CMP,SUB)) ; subcomponent
34 ;
35GETSEG(SEGMENT) ; check if the named segment exists
36 Q:SEGMENT'="" $O(@HL7PARSE@("B",SEGMENT,""))
37 Q 0
38 ;
39GETCOUNT() ; get value of highest index number in HL7PARSE
40 Q $O(@HL7PARSE@(" "),-1)
41 ;
42GETNAME(J) ; get a person's name - return in DICOM format
43 ; also used for provider's name - first piece is code - others shifted
44 N I,LAST,NAME,X
45 S NAME="",LAST=0 F I=1:1:6 D
46 . N X ; name component: last ^ first ^ mi ^ prefix ^ suffix
47 . S X=$$GETDATA^MAGDHRC0(J,1,I) I $L(X) S LAST=I
48 . S NAME=NAME_$S(I>1:"^",1:"")_$TR(X,"^\","") ; no ^ or \ chars in name
49 . Q
50 Q $P(NAME,"^",1,LAST)
51 ;
Note: See TracBrowser for help on using the repository browser.