[613] | 1 | VAFHLA04 ;ALB/JLU;CREATES THE REGISTRATION MESSAGE;
|
---|
| 2 | ;;5.3;Registration;**91,179**;Jun 06, 1996
|
---|
| 3 | ;hl7v1.6
|
---|
| 4 | EN(VAFHDFN,VAFHDT) ;THE MAIN ENTRY POINT FOR THE A04 MESSAGE TYPE
|
---|
| 5 | ;
|
---|
| 6 | S ERR="^TMP(""VAFHERR"",$J)" K ^TMP("VAFHERR",$J)
|
---|
| 7 | I '$D(VAFHDFN)!('$D(VAFHDT)) S @ERR@(1)="-1^Can not build the A04 message. Parameters not defined correctly." D EBULL^VAFHUTL2("","","",ERR) G EX
|
---|
| 8 | I VAFHDFN=""!(VAFHDT="") S @ERR@(1)="-1^Can not build the A04 message. Parameters are null." D EBULL^VAFHUTL2(VAFHDFN,VAFHDT,"",ERR) G EX
|
---|
| 9 | ;
|
---|
| 10 | S VAFHPID="1,2,4,6,7,8,11,12,13,14,16,19"
|
---|
| 11 | S VAFHZPD="2,3,4,5,6,7,8,9,10,11,12,13,14,15"
|
---|
| 12 | K HLERR
|
---|
| 13 | S CTR=1,HLSDT="VAFHREG"
|
---|
| 14 | K HL D INIT^HLFNC2("VAFH A04",.HL)
|
---|
| 15 | I $D(HL)#2 G EX
|
---|
| 16 | ;. S @ERR@(1)="-1^Can not build the A04 message. Failed during HLFNC2"
|
---|
| 17 | ;. S @ERR@(2)=HL
|
---|
| 18 | ;. D EBULL^VAFHUTL2(VAFHDFN,VAFHDT,"",ERR)
|
---|
| 19 | S HLMTN="ADT"_$E(HL("ECH"))_"A04"
|
---|
| 20 | S VAFHGBL="^TMP(""HLS"",$J)" K ^TMP("HLS",$J)
|
---|
| 21 | S SING="" ;SINGLE MESSAGES (NOT BATCH)
|
---|
| 22 | ;
|
---|
| 23 | BAT ;THIS ENTRY POINT IS TO BE CONSIDERED IF A BATCH PROCESS IS NEEDED.
|
---|
| 24 | ;
|
---|
| 25 | S VAFHPTR=VAFHDFN_";DPT("
|
---|
| 26 | S VAFHPIV=$$PIVNW^VAFHPIVT(VAFHDFN,VAFHDT,3,VAFHPTR)
|
---|
| 27 | I VAFHPIV<0 S @ERR@(1)="-1^Can not build the A04 message. Failed to get a PIVOT entry." D EBULL^VAFHUTL2(VAFHDFN,VAFHDT,"",ERR) G EX
|
---|
| 28 | S EVN=$$EVN^VAFHLEVN("A04","05") I +EVN=-1 S @ERR@(1)=EVN D EBULL^VAFHUTL2(VAFHDFN,VAFHDT,+VAFHPIV,ERR) G EX
|
---|
| 29 | S @VAFHGBL@(CTR)=EVN
|
---|
| 30 | S CTR=CTR+1,@VAFHGBL@(CTR)=$$EN^VAFHLPID(VAFHDFN,VAFHPID)
|
---|
| 31 | S CTR=CTR+1,@VAFHGBL@(CTR)=$$EN^VAFHLZPD(VAFHDFN,VAFHZPD)
|
---|
| 32 | S PV1=$$OPV1^VAFHCPV(VAFHDFN,+VAFHPIV,VAFHDT,VAFHPTR,50) I +PV1=-1 S @ERR@(1)=PV1 D EBULL^VAFHUTL2(VAFHDFN,VAFHDT,+VAFHPIV,ERR) G EX
|
---|
| 33 | ;;;I $P(PV1,HLFS,3)'="O" S $P(PV1,HLFS,3)="T"
|
---|
| 34 | ;;;I $P(PV1,HLFS,3)]"",$P(PV1,HLFS,3)'="O" S $P(PV1,HLFS,3)="T"
|
---|
| 35 | S $P(PV1,HLFS,3)="T"
|
---|
| 36 | S CTR=CTR+1,@VAFHGBL@(CTR)=PV1
|
---|
| 37 | I $D(SING) DO
|
---|
| 38 | .D GENERATE^HLMA("VAFH A04","GM",1,.HLRST)
|
---|
| 39 | ;
|
---|
| 40 | EX ;
|
---|
| 41 | D KILL^HLTRANS
|
---|
| 42 | K VAFHGBL,VAFHDT,VAFHPTR,VAFHPID,VAFHZPD,PV1,EVN,CTR,SING,ERR
|
---|
| 43 | K ^TMP("HLS",$J),^TMP("VAFHERR",$J)
|
---|
| 44 | Q
|
---|