source: FOIAVistA/trunk/r/REGISTRATION-DGQE-DG-DPT-GRPX-VAD-VAF-VAS-VAT-VAU--VA-VIC--DGBT--DGJ--DGYA--VALM/VAFHLEVN.m@ 1397

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

initial load of FOIAVistA 6/30/08 version

File size: 1.8 KB
Line 
1VAFHLEVN ;ALB/CM/ESD HL7 EVN SEGMENT BUILDING ;05/01/95
2 ;;5.3;Registration;**94,220,190**;Aug 13, 1993
3 ;
4 ;This routine will build an HL7 EVN segment
5 ;
6EVN(TYPE,FLAG,VAEVDT) ;
7 ;
8 ;Input:
9 ;TYPE - the HL7 Event Type
10 ;FLAG - HL7 Event Reason Code
11 ; The codes will be 04 for update to "old" event
12 ; or 05 for "new"/"current" event
13 ;VAEVDT - Event Date/Time [Optional]
14 ;
15 N ET,EVN
16 D NOW^%DTC S ET=$$HLDATE^HLFNC(%,"TS") K %,X,%H,%I
17 S EVN="EVN"_HLFS_TYPE_HLFS_ET_HLFS_HLFS_FLAG
18 S VAEVDT=$G(VAEVDT) I +VAEVDT'>0 S VAEVDT=$G(VAFHDT)
19 I +VAEVDT>0 S EVN=EVN_HLFS_HLFS_$$HLDATE^HLFNC(VAEVDT,"TS")
20 Q EVN
21 ;
22 ;
23EN(VAFEVTYP,VAFEVDT,VAFSTR,VAFHLQ,VAFHLFS) ;
24 ; Entry point for Ambulatory Care Database Project
25 ;
26 ; Entry point to return the HL7 EVN (Event Type) segment
27 ;
28 ; Input: VAFEVTYP - Event Type Code
29 ; VAFEVDT - Event Date/Time
30 ; Date/Time Event Occurred (same as Encounter Date/Time)
31 ;
32 ; VAFSTR - String of fields requested separated by commas.
33 ;
34 ; VAFHLQ - Optional HL7 null variable. If not there, use
35 ; default HL7 variable.
36 ;
37 ; VAFHLFS - Optional HL7 field separator. If not there, use
38 ; default HL7 variable.
39 ;
40 ; Output: String containing desired components of the EVN segment.
41 ;
42 ;
43 N VAFY,X
44 ;I ($G(VAFEVTYP)="")!($G(VAFSTR)="") G ENQ
45 S:$G(VAFSTR)="" VAFSTR="1,2"
46 S VAFHLQ=$S($D(VAFHLQ):VAFHLQ,1:$G(HLQ)),VAFHLFS=$S($D(VAFHLFS):VAFHLFS,1:$G(HLFS)) ; If VAFHLQ or VAFHLFS aren't passed in, use default HL7 variables
47 S $P(VAFY,VAFHLFS,2)="",VAFSTR=","_VAFSTR_","
48 I VAFSTR[",1," S $P(VAFY,VAFHLFS,1)=$G(VAFEVTYP) ; Event Type Code
49 I VAFSTR[",2," S X=$$HLDATE^HLFNC($G(VAFEVDT)),$P(VAFY,VAFHLFS,2)=$S(X]"":X,1:VAFHLQ) ; Event Date/Time
50 ;
51ENQ ; Return segment
52 Q "EVN"_VAFHLFS_$G(VAFY)
Note: See TracBrowser for help on using the repository browser.