VAFHLA34 ;ALB/JLU;creates the A34 message.
;;5.3;Registration;**91**;Jun 06, 1996
;
EN(DFN,GBL,CTR,APL,BEF,STAT,PID,ZPD,ID) ;builds the actual A34 message content. INIT OF
;HLTRANS and all of the HL7 varaiables most have been set up.
;
;DFN - The DFN of the Patient
;GBL - The GLOBAL to store message
;CTR - the counter to start at
;APL - The HL7 application or HLMTN
;BEF - This is the before value of the PID
;STAT - The status of this event (old or new)
;PID - The fields to be returned from the PID call
;ZPD - The fields to be returned from the ZPD call
;ID - Contains the set ID field for HL7 (OPTIONAL)
;
N VAR
DO
.I $S('$D(DFN):1,DFN="":1,1:0) S VAR="Patient not identified" Q
.I $S('$D(GBL):1,GBL="":1,1:0) S VAR="Storage global not identified" Q
.I $S('$D(CTR):1,CTR="":1,1:0) S VAR="Counter to start at not identified" Q
.I $S('$D(APL):1,APL="":1,1:0) S VAR="Calling application not identified" Q
.I $S('$D(BEF):1,BEF="":1,1:0) S VAR="Before value of PID not identified" Q
.I $S('$D(STAT):1,STAT="":1,1:0) S VAR="Status of event not identified" Q
.I $S('$D(PID):1,PID="":1,1:0) S VAR="Fields for PID not identified" Q
.I $S('$D(ZPD):1,ZPD="":1,1:0) S VAR="Fields for ZPD not identified" Q
.Q
I $D(VAR) G ERR
S @GBL@(CTR)=$$EVN^VAFHLEVN("A34",STAT) ;creates the EVN segment
S CTR=CTR+1
S @GBL@(CTR)=$$EN^VAFHLPID(DFN,PID) ;creates the PID segment
S CTR=CTR+1
S @GBL@(CTR)=$$EN^VAFHLZPD(DFN,ZPD) ;creates the ZPD segment
S CTR=CTR+1
S @GBL@(CTR)=$$EN^VAFHLMRG(DFN,BEF) ;creates the MRG segment
Q 1_U_CTR
ERR Q -1_U_VAR
VAFHLA34 ;ALB/JLU;creates the A34 message.
+1 ;;5.3;Registration;**91**;Jun 06, 1996
+2 ;
EN(DFN,GBL,CTR,APL,BEF,STAT,PID,ZPD,ID) ;builds the actual A34 message content. INIT OF
+1 ;HLTRANS and all of the HL7 varaiables most have been set up.
+2 ;
+3 ;DFN - The DFN of the Patient
+4 ;GBL - The GLOBAL to store message
+5 ;CTR - the counter to start at
+6 ;APL - The HL7 application or HLMTN
+7 ;BEF - This is the before value of the PID
+8 ;STAT - The status of this event (old or new)
+9 ;PID - The fields to be returned from the PID call
+10 ;ZPD - The fields to be returned from the ZPD call
+11 ;ID - Contains the set ID field for HL7 (OPTIONAL)
+12 ;
+13 NEW VAR
+14 Begin DoDot:1
+15 IF $SELECT('$DATA(DFN):1,DFN="":1,1:0)
SET VAR="Patient not identified"
QUIT
+16 IF $SELECT('$DATA(GBL):1,GBL="":1,1:0)
SET VAR="Storage global not identified"
QUIT
+17 IF $SELECT('$DATA(CTR):1,CTR="":1,1:0)
SET VAR="Counter to start at not identified"
QUIT
+18 IF $SELECT('$DATA(APL):1,APL="":1,1:0)
SET VAR="Calling application not identified"
QUIT
+19 IF $SELECT('$DATA(BEF):1,BEF="":1,1:0)
SET VAR="Before value of PID not identified"
QUIT
+20 IF $SELECT('$DATA(STAT):1,STAT="":1,1:0)
SET VAR="Status of event not identified"
QUIT
+21 IF $SELECT('$DATA(PID):1,PID="":1,1:0)
SET VAR="Fields for PID not identified"
QUIT
+22 IF $SELECT('$DATA(ZPD):1,ZPD="":1,1:0)
SET VAR="Fields for ZPD not identified"
QUIT
+23 QUIT
End DoDot:1
+24 IF $DATA(VAR)
GOTO ERR
+25 ;creates the EVN segment
SET @GBL@(CTR)=$$EVN^VAFHLEVN("A34",STAT)
+26 SET CTR=CTR+1
+27 ;creates the PID segment
SET @GBL@(CTR)=$$EN^VAFHLPID(DFN,PID)
+28 SET CTR=CTR+1
+29 ;creates the ZPD segment
SET @GBL@(CTR)=$$EN^VAFHLZPD(DFN,ZPD)
+30 SET CTR=CTR+1
+31 ;creates the MRG segment
SET @GBL@(CTR)=$$EN^VAFHLMRG(DFN,BEF)
+32 QUIT 1_U_CTR
ERR QUIT -1_U_VAR