| 1 | VAFHQRY ;ALB/RJS - MCCR DATA CAPTURE HANDLES QUERY MESSAGES ; 6/7/95
|
---|
| 2 | ;;5.3;Registration;**91,415**;Jun 06, 1996
|
---|
| 3 | ;;HL7v1.6
|
---|
| 4 | ;
|
---|
| 5 | ; THIS ROUTINE HANDLES THE QUERY MESSAGES FOR THE HL7 ADT
|
---|
| 6 | ; PROJECT
|
---|
| 7 | ;
|
---|
| 8 | ; INPUT IS THE IEN OF THE MESSAGE IN THE ^HL(772 GLOBAL, "HLDA"
|
---|
| 9 | ;
|
---|
| 10 | ; THE ROUTINE PARSES THE MESSAGE AND DETERMINES IF THERE IS A QUERY
|
---|
| 11 | ; SEGMENT PRESENT. IF SO, THE QUERY IS REQUESTING PATIENT DEMOGRAPHIC
|
---|
| 12 | ; DATA IN A PID SEGMENT
|
---|
| 13 | ;
|
---|
| 14 | N ERR1,ERR2,ERR3,COMPNENT,SSN,DFN,VAQD
|
---|
| 15 | S ERR1="Invalid or missing access code"
|
---|
| 16 | S ERR2="Missing QRD Segment"
|
---|
| 17 | S ERR3="Could not resolve DFN"
|
---|
| 18 | ;I $G(HLDUZ)'>0 S HLERR=ERR1 G ACK ;Invalid or missing access code
|
---|
| 19 | S HLQ=HL("Q"),HLFS=HL("FS"),HLECH=HL("ECH")
|
---|
| 20 | ;
|
---|
| 21 | S COMPNENT=$E(HL("ECH")) ;hlech
|
---|
| 22 | K VADC,HLERR
|
---|
| 23 | ;D INITIZE^VAFHUTL9(HLDA) ;QUERY MESSAGE RETURNED IN VADC() ARRAY
|
---|
| 24 | D INIT1
|
---|
| 25 | S VAQD=$$SEG1^VAFHUTL9("QRD",1,"QRD")
|
---|
| 26 | I VAQD="" S HLERR=ERR2 G ACK ;Missing QRD segment
|
---|
| 27 | ;
|
---|
| 28 | PARSE ;
|
---|
| 29 | S SSN=$P(VAQD,HLFS,9)
|
---|
| 30 | S DFN=$$SSNDFN^VAFHUTL9(SSN)
|
---|
| 31 | I DFN'>0 S HLERR=ERR3 G ACK
|
---|
| 32 | ;
|
---|
| 33 | S HLA("HLS",1)="MSA"_HL("FS")_$S(HL:$S(HL("VER")=2.1:"AR",1:"CR"),1:"CA")_HL("FS")_HL("MID")_HL("FS")_$P(HL,"^",2)
|
---|
| 34 | S HLA("HLS",2)=VAQD
|
---|
| 35 | ;
|
---|
| 36 | S HLA("HLS",3)=$$EN^VAFHLPID(DFN,",2,3,4,5,6,7,8,9,10B,11,12,13,14,15,16,17,18,19,22B")
|
---|
| 37 | ;
|
---|
| 38 | ACK I $D(HLERR) S HLA("HLS",2)="MSA"_HLFS_"AE"_HLFS_HLMID_HLFS_HLERR G EXIT
|
---|
| 39 | ;
|
---|
| 40 | EXIT S HLDT=$$NOW^XLFDT()
|
---|
| 41 | D GENERATE^HLMA("VAFH A19","LM",1,.HLRESLT,"",.HL)
|
---|
| 42 | Q
|
---|
| 43 | ;
|
---|
| 44 | INIT1 F I=1:1 X HLNEXT Q:HLQUIT'>0 S X(I)=HLNODE MERGE X(I)=HLNODE
|
---|
| 45 | MERGE VADC=X
|
---|
| 46 | Q
|
---|