VAFHUTL9 ;ALB/RJS - UTILTIES FOR ADT/R HL7 INTERFACE - 6/15/95
;;5.3;Registration;**91**;Jun 06, 1996
;
;This Routine contains several utilities used by the PIMS
;HL7 ADT software
;
SEG(SEGMENT,PIECE,CODE) ;Return segment from VADC array and kill node
N VANODE,VADATA,VADONE K VADONE
S VANODE=0
F S VANODE=$O(VADC(VANODE)) Q:VANODE=""!($D(VADONE)) D
.S VADATA=VADC(VANODE)
.I ($P(VADATA,HLFS,1)=SEGMENT)&($P($P(VADATA,HLFS,PIECE),VAC,1)=CODE) S VADONE=1 K VADC(VANODE)
Q:$D(VADONE) $G(VADATA)
Q ""
SEG1(SEGMENT,PIECE,CODE) ;Return segment from VADC array
N VANODE,VADATA,VADONE K VADONE
S VANODE=0
F S VANODE=$O(VADC(VANODE)) Q:VANODE=""!($D(VADONE)) D
.S VADATA=VADC(VANODE)
.I ($P(VADATA,HLFS,1)=SEGMENT) S VADONE=1
Q:$D(VADONE) $G(VADATA)
Q ""
INITIZE(HLDA) ;Initialize VADC array with incoming message
N VANODE S VANODE=0
F S VANODE=$O(^HL(772,HLDA,"IN",VANODE)) Q:VANODE'>0 D
.S VADC(VANODE)=^HL(772,HLDA,"IN",VANODE,0)
Q
INIT1 ;
F I=1:1 X HLNEXT Q:HLQUIT'>0 S X(I)=HLNODE MERGE X(I)=HLNODE
MERGE VADC=X
Q
SSNDFN(SSN) ;Input ssn output DFN
Q:$G(SSN)="" -1
S DFN=$O(^DPT("SSN",+SSN,0))
Q:$L(DFN) DFN
S DFN=$O(^DPT("SSN",SSN,0))
Q:$L(DFN) DFN
Q -1
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HVAFHUTL9 1230 printed Dec 13, 2024@03:03:53 Page 2
VAFHUTL9 ;ALB/RJS - UTILTIES FOR ADT/R HL7 INTERFACE - 6/15/95
+1 ;;5.3;Registration;**91**;Jun 06, 1996
+2 ;
+3 ;This Routine contains several utilities used by the PIMS
+4 ;HL7 ADT software
+5 ;
SEG(SEGMENT,PIECE,CODE) ;Return segment from VADC array and kill node
+1 NEW VANODE,VADATA,VADONE
KILL VADONE
+2 SET VANODE=0
+3 FOR
SET VANODE=$ORDER(VADC(VANODE))
if VANODE=""!($DATA(VADONE))
QUIT
Begin DoDot:1
+4 SET VADATA=VADC(VANODE)
+5 IF ($PIECE(VADATA,HLFS,1)=SEGMENT)&($PIECE($PIECE(VADATA,HLFS,PIECE),VAC,1)=CODE)
SET VADONE=1
KILL VADC(VANODE)
End DoDot:1
+6 if $DATA(VADONE)
QUIT $GET(VADATA)
+7 QUIT ""
SEG1(SEGMENT,PIECE,CODE) ;Return segment from VADC array
+1 NEW VANODE,VADATA,VADONE
KILL VADONE
+2 SET VANODE=0
+3 FOR
SET VANODE=$ORDER(VADC(VANODE))
if VANODE=""!($DATA(VADONE))
QUIT
Begin DoDot:1
+4 SET VADATA=VADC(VANODE)
+5 IF ($PIECE(VADATA,HLFS,1)=SEGMENT)
SET VADONE=1
End DoDot:1
+6 if $DATA(VADONE)
QUIT $GET(VADATA)
+7 QUIT ""
INITIZE(HLDA) ;Initialize VADC array with incoming message
+1 NEW VANODE
SET VANODE=0
+2 FOR
SET VANODE=$ORDER(^HL(772,HLDA,"IN",VANODE))
if VANODE'>0
QUIT
Begin DoDot:1
+3 SET VADC(VANODE)=^HL(772,HLDA,"IN",VANODE,0)
End DoDot:1
+4 QUIT
INIT1 ;
+1 FOR I=1:1
XECUTE HLNEXT
if HLQUIT'>0
QUIT
SET X(I)=HLNODE
MERGE X(I)=HLNODE
+2 MERGE VADC=X
+3 QUIT
SSNDFN(SSN) ;Input ssn output DFN
+1 if $GET(SSN)=""
QUIT -1
+2 SET DFN=$ORDER(^DPT("SSN",+SSN,0))
+3 if $LENGTH(DFN)
QUIT DFN
+4 SET DFN=$ORDER(^DPT("SSN",SSN,0))
+5 if $LENGTH(DFN)
QUIT DFN
+6 QUIT -1