1 | VAFHUTL9 ;ALB/RJS - UTILTIES FOR ADT/R HL7 INTERFACE - 6/15/95
|
---|
2 | ;;5.3;Registration;**91**;Jun 06, 1996
|
---|
3 | ;
|
---|
4 | ;This Routine contains several utilities used by the PIMS
|
---|
5 | ;HL7 ADT software
|
---|
6 | ;
|
---|
7 | SEG(SEGMENT,PIECE,CODE) ;Return segment from VADC array and kill node
|
---|
8 | N VANODE,VADATA,VADONE K VADONE
|
---|
9 | S VANODE=0
|
---|
10 | F S VANODE=$O(VADC(VANODE)) Q:VANODE=""!($D(VADONE)) D
|
---|
11 | .S VADATA=VADC(VANODE)
|
---|
12 | .I ($P(VADATA,HLFS,1)=SEGMENT)&($P($P(VADATA,HLFS,PIECE),VAC,1)=CODE) S VADONE=1 K VADC(VANODE)
|
---|
13 | Q:$D(VADONE) $G(VADATA)
|
---|
14 | Q ""
|
---|
15 | SEG1(SEGMENT,PIECE,CODE) ;Return segment from VADC array
|
---|
16 | N VANODE,VADATA,VADONE K VADONE
|
---|
17 | S VANODE=0
|
---|
18 | F S VANODE=$O(VADC(VANODE)) Q:VANODE=""!($D(VADONE)) D
|
---|
19 | .S VADATA=VADC(VANODE)
|
---|
20 | .I ($P(VADATA,HLFS,1)=SEGMENT) S VADONE=1
|
---|
21 | Q:$D(VADONE) $G(VADATA)
|
---|
22 | Q ""
|
---|
23 | INITIZE(HLDA) ;Initialize VADC array with incoming message
|
---|
24 | N VANODE S VANODE=0
|
---|
25 | F S VANODE=$O(^HL(772,HLDA,"IN",VANODE)) Q:VANODE'>0 D
|
---|
26 | .S VADC(VANODE)=^HL(772,HLDA,"IN",VANODE,0)
|
---|
27 | Q
|
---|
28 | INIT1 ;
|
---|
29 | F I=1:1 X HLNEXT Q:HLQUIT'>0 S X(I)=HLNODE MERGE X(I)=HLNODE
|
---|
30 | MERGE VADC=X
|
---|
31 | Q
|
---|
32 | SSNDFN(SSN) ;Input ssn output DFN
|
---|
33 | Q:$G(SSN)="" -1
|
---|
34 | S DFN=$O(^DPT("SSN",+SSN,0))
|
---|
35 | Q:$L(DFN) DFN
|
---|
36 | S DFN=$O(^DPT("SSN",SSN,0))
|
---|
37 | Q:$L(DFN) DFN
|
---|
38 | Q -1
|
---|