VAFEOHL1 ;ALB/JLU/CAW;generates the HL7 message to be sent(con't);6/29/93
;;5.3;Registration;**38**;Aug 13, 1993
;
MSH ;builds the MSH segment
N X
S VAFEDLCT=VAFEDLCT+1
S X=HLMTN_$E(HLECH)_"R01"
S VAFEDHL=$$MSH^HLFNC1(X)
S $P(VAFEDHL,U,10)=$P(VAFEDHL,U,10)_"-"_HLEVN
D LOG^VAFEDOHL
Q
;
PID ;Builds the PID segment fields 2,3,5,7,8,11,19
N VAFEDHL
S VAFEDLCT=VAFEDLCT+1
S $P(VAFEDHL,HLFS,1)="PID"
S $P(VAFEDHL,HLFS,3)=$$M11^HLFNC($TR($G(VA("PID")),"-",""))
S $P(VAFEDHL,HLFS,4)=$$M11^HLFNC(DFN)
S $P(VAFEDHL,HLFS,6)=$$HLNAME^HLFNC(VADM(1))
S $P(VAFEDHL,HLFS,8)=$$HLDATE^HLFNC(+VADM(3))
S $P(VAFEDHL,HLFS,9)=$P(VADM(5),U)
S $P(VAFEDHL,HLFS,12)=$$ADDR^VAFHLFNC(VAPA(1)_U_VAPA(2)_U_VAPA(3)_U_VAPA(4)_U_+VAPA(5)_U_$P(VAPA(11),U,2),+VAPA(7))
S $P(VAFEDHL,HLFS,20)=$E($P(VADM(2),U,1),1,9)
D LOG^VAFEDOHL
Q
;
ZEL ;sets up the ZEL segment, fields 1,2 with elig of outpatient encounter
N VAFEDHL
S VAFEDLCT=VAFEDLCT+1
I VAFELIG D G LOG
.S $P(VAFEDHL,HLFS,1)="ZEL",$P(VAFEDHL,HLFS,13)=""
.S $P(VAFEDHL,HLFS,2)=1 ; Sequential number
.S $P(VAFEDHL,HLFS,3)=VAFELIG ; Eligibility code
S VAFEDHL=$$EN^VAFHLZEL(DFN,"1,2",1)
LOG D LOG^VAFEDOHL
QUIT Q
;
PV1 ;sets up the PV1 segment and the fields 2,3,7,10,19,39
N VAFEDHL,PROV
S VAFEDLCT=VAFEDLCT+1
S $P(VAFEDHL,HLFS,1)="PV1"
S $P(VAFEDHL,HLFS,3)="O"
S $P(VAFEDHL,HLFS,4)=HLQ
S PROV=$P(VAFEDST1,U,4)
I PROV]"" DO
.S PROV=$P(^VA(200,+PROV,0),U,1)
.S $P(VAFEDHL,HLFS,8)=$P(VAFEDST1,U,4)_$E(HLECH)_$$HLNAME^HLFNC(PROV)
S $P(VAFEDHL,HLFS,11)=$S(VAFEDT=98:$P(VAFEDST1,U,3),1:HLQ)
S $P(VAFEDHL,HLFS,20)=VAFEDD
S $P(VAFEDHL,HLFS,40)=$P(VAFEDST1,U,2)
D LOG^VAFEDOHL
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HVAFEOHL1 1691 printed Oct 16, 2024@19:03:10 Page 2
VAFEOHL1 ;ALB/JLU/CAW;generates the HL7 message to be sent(con't);6/29/93
+1 ;;5.3;Registration;**38**;Aug 13, 1993
+2 ;
MSH ;builds the MSH segment
+1 NEW X
+2 SET VAFEDLCT=VAFEDLCT+1
+3 SET X=HLMTN_$EXTRACT(HLECH)_"R01"
+4 SET VAFEDHL=$$MSH^HLFNC1(X)
+5 SET $PIECE(VAFEDHL,U,10)=$PIECE(VAFEDHL,U,10)_"-"_HLEVN
+6 DO LOG^VAFEDOHL
+7 QUIT
+8 ;
PID ;Builds the PID segment fields 2,3,5,7,8,11,19
+1 NEW VAFEDHL
+2 SET VAFEDLCT=VAFEDLCT+1
+3 SET $PIECE(VAFEDHL,HLFS,1)="PID"
+4 SET $PIECE(VAFEDHL,HLFS,3)=$$M11^HLFNC($TRANSLATE($GET(VA("PID")),"-",""))
+5 SET $PIECE(VAFEDHL,HLFS,4)=$$M11^HLFNC(DFN)
+6 SET $PIECE(VAFEDHL,HLFS,6)=$$HLNAME^HLFNC(VADM(1))
+7 SET $PIECE(VAFEDHL,HLFS,8)=$$HLDATE^HLFNC(+VADM(3))
+8 SET $PIECE(VAFEDHL,HLFS,9)=$PIECE(VADM(5),U)
+9 SET $PIECE(VAFEDHL,HLFS,12)=$$ADDR^VAFHLFNC(VAPA(1)_U_VAPA(2)_U_VAPA(3)_U_VAPA(4)_U_+VAPA(5)_U_$PIECE(VAPA(11),U,2),+VAPA(7))
+10 SET $PIECE(VAFEDHL,HLFS,20)=$EXTRACT($PIECE(VADM(2),U,1),1,9)
+11 DO LOG^VAFEDOHL
+12 QUIT
+13 ;
ZEL ;sets up the ZEL segment, fields 1,2 with elig of outpatient encounter
+1 NEW VAFEDHL
+2 SET VAFEDLCT=VAFEDLCT+1
+3 IF VAFELIG
Begin DoDot:1
+4 SET $PIECE(VAFEDHL,HLFS,1)="ZEL"
SET $PIECE(VAFEDHL,HLFS,13)=""
+5 ; Sequential number
SET $PIECE(VAFEDHL,HLFS,2)=1
+6 ; Eligibility code
SET $PIECE(VAFEDHL,HLFS,3)=VAFELIG
End DoDot:1
GOTO LOG
+7 SET VAFEDHL=$$EN^VAFHLZEL(DFN,"1,2",1)
LOG DO LOG^VAFEDOHL
QUIT QUIT
+1 ;
PV1 ;sets up the PV1 segment and the fields 2,3,7,10,19,39
+1 NEW VAFEDHL,PROV
+2 SET VAFEDLCT=VAFEDLCT+1
+3 SET $PIECE(VAFEDHL,HLFS,1)="PV1"
+4 SET $PIECE(VAFEDHL,HLFS,3)="O"
+5 SET $PIECE(VAFEDHL,HLFS,4)=HLQ
+6 SET PROV=$PIECE(VAFEDST1,U,4)
+7 IF PROV]""
Begin DoDot:1
+8 SET PROV=$PIECE(^VA(200,+PROV,0),U,1)
+9 SET $PIECE(VAFEDHL,HLFS,8)=$PIECE(VAFEDST1,U,4)_$EXTRACT(HLECH)_$$HLNAME^HLFNC(PROV)
End DoDot:1
+10 SET $PIECE(VAFEDHL,HLFS,11)=$SELECT(VAFEDT=98:$PIECE(VAFEDST1,U,3),1:HLQ)
+11 SET $PIECE(VAFEDHL,HLFS,20)=VAFEDD
+12 SET $PIECE(VAFEDHL,HLFS,40)=$PIECE(VAFEDST1,U,2)
+13 DO LOG^VAFEDOHL
+14 QUIT