VAFHLEVN ;ALB/CM/ESD HL7 EVN SEGMENT BUILDING ;05/01/95
;;5.3;Registration;**94,220,190**;Aug 13, 1993
;
;This routine will build an HL7 EVN segment
;
EVN(TYPE,FLAG,VAEVDT) ;
;
;Input:
;TYPE - the HL7 Event Type
;FLAG - HL7 Event Reason Code
; The codes will be 04 for update to "old" event
; or 05 for "new"/"current" event
;VAEVDT - Event Date/Time [Optional]
;
N ET,EVN
D NOW^%DTC S ET=$$HLDATE^HLFNC(%,"TS") K %,X,%H,%I
S EVN="EVN"_HLFS_TYPE_HLFS_ET_HLFS_HLFS_FLAG
S VAEVDT=$G(VAEVDT) I +VAEVDT'>0 S VAEVDT=$G(VAFHDT)
I +VAEVDT>0 S EVN=EVN_HLFS_HLFS_$$HLDATE^HLFNC(VAEVDT,"TS")
Q EVN
;
;
EN(VAFEVTYP,VAFEVDT,VAFSTR,VAFHLQ,VAFHLFS) ;
; Entry point for Ambulatory Care Database Project
;
; Entry point to return the HL7 EVN (Event Type) segment
;
; Input: VAFEVTYP - Event Type Code
; VAFEVDT - Event Date/Time
; Date/Time Event Occurred (same as Encounter Date/Time)
;
; VAFSTR - String of fields requested separated by commas.
;
; VAFHLQ - Optional HL7 null variable. If not there, use
; default HL7 variable.
;
; VAFHLFS - Optional HL7 field separator. If not there, use
; default HL7 variable.
;
; Output: String containing desired components of the EVN segment.
;
;
N VAFY,X
;I ($G(VAFEVTYP)="")!($G(VAFSTR)="") G ENQ
S:$G(VAFSTR)="" VAFSTR="1,2"
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
S $P(VAFY,VAFHLFS,2)="",VAFSTR=","_VAFSTR_","
I VAFSTR[",1," S $P(VAFY,VAFHLFS,1)=$G(VAFEVTYP) ; Event Type Code
I VAFSTR[",2," S X=$$HLDATE^HLFNC($G(VAFEVDT)),$P(VAFY,VAFHLFS,2)=$S(X]"":X,1:VAFHLQ) ; Event Date/Time
;
ENQ ; Return segment
Q "EVN"_VAFHLFS_$G(VAFY)
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HVAFHLEVN 1881 printed Oct 16, 2024@19:03:28 Page 2
VAFHLEVN ;ALB/CM/ESD HL7 EVN SEGMENT BUILDING ;05/01/95
+1 ;;5.3;Registration;**94,220,190**;Aug 13, 1993
+2 ;
+3 ;This routine will build an HL7 EVN segment
+4 ;
EVN(TYPE,FLAG,VAEVDT) ;
+1 ;
+2 ;Input:
+3 ;TYPE - the HL7 Event Type
+4 ;FLAG - HL7 Event Reason Code
+5 ; The codes will be 04 for update to "old" event
+6 ; or 05 for "new"/"current" event
+7 ;VAEVDT - Event Date/Time [Optional]
+8 ;
+9 NEW ET,EVN
+10 DO NOW^%DTC
SET ET=$$HLDATE^HLFNC(%,"TS")
KILL %,X,%H,%I
+11 SET EVN="EVN"_HLFS_TYPE_HLFS_ET_HLFS_HLFS_FLAG
+12 SET VAEVDT=$GET(VAEVDT)
IF +VAEVDT'>0
SET VAEVDT=$GET(VAFHDT)
+13 IF +VAEVDT>0
SET EVN=EVN_HLFS_HLFS_$$HLDATE^HLFNC(VAEVDT,"TS")
+14 QUIT EVN
+15 ;
+16 ;
EN(VAFEVTYP,VAFEVDT,VAFSTR,VAFHLQ,VAFHLFS) ;
+1 ; Entry point for Ambulatory Care Database Project
+2 ;
+3 ; Entry point to return the HL7 EVN (Event Type) segment
+4 ;
+5 ; Input: VAFEVTYP - Event Type Code
+6 ; VAFEVDT - Event Date/Time
+7 ; Date/Time Event Occurred (same as Encounter Date/Time)
+8 ;
+9 ; VAFSTR - String of fields requested separated by commas.
+10 ;
+11 ; VAFHLQ - Optional HL7 null variable. If not there, use
+12 ; default HL7 variable.
+13 ;
+14 ; VAFHLFS - Optional HL7 field separator. If not there, use
+15 ; default HL7 variable.
+16 ;
+17 ; Output: String containing desired components of the EVN segment.
+18 ;
+19 ;
+20 NEW VAFY,X
+21 ;I ($G(VAFEVTYP)="")!($G(VAFSTR)="") G ENQ
+22 if $GET(VAFSTR)=""
SET VAFSTR="1,2"
+23 ; If VAFHLQ or VAFHLFS aren't passed in, use default HL7 variables
SET VAFHLQ=$SELECT($DATA(VAFHLQ):VAFHLQ,1:$GET(HLQ))
SET VAFHLFS=$SELECT($DATA(VAFHLFS):VAFHLFS,1:$GET(HLFS))
+24 SET $PIECE(VAFY,VAFHLFS,2)=""
SET VAFSTR=","_VAFSTR_","
+25 ; Event Type Code
IF VAFSTR[",1,"
SET $PIECE(VAFY,VAFHLFS,1)=$GET(VAFEVTYP)
+26 ; Event Date/Time
IF VAFSTR[",2,"
SET X=$$HLDATE^HLFNC($GET(VAFEVDT))
SET $PIECE(VAFY,VAFHLFS,2)=$SELECT(X]"":X,1:VAFHLQ)
+27 ;
ENQ ; Return segment
+1 QUIT "EVN"_VAFHLFS_$GET(VAFY)