[613] | 1 | DGPFHLQ3 ;ALB/RPM - PRF HL7 QRY PROCESSING ; 12/13/04
|
---|
| 2 | ;;5.3;Registration;**425,650**;Aug 13, 1993;Build 3
|
---|
| 3 | ;
|
---|
| 4 | PARSQRY(DGWRK,DGHL,DGQRY,DGPFERR) ;Parse QRY~R02 Message/Segments
|
---|
| 5 | ;
|
---|
| 6 | ; Input:
|
---|
| 7 | ; DGWRK - Closed root global reference
|
---|
| 8 | ; DGHL - VistA HL7 environment array
|
---|
| 9 | ;
|
---|
| 10 | ; Output:
|
---|
| 11 | ; DGQRY - Patient lookup components array
|
---|
| 12 | ; DGPFERR - Undefined on success, ERR segment data array on failure
|
---|
| 13 | ; Format: DGPFERR(seg_id,sequence,fld_pos)=error_code
|
---|
| 14 | ;
|
---|
| 15 | N DGRSLT ;result from CHK^DIE
|
---|
| 16 | N DGFS ;field separator
|
---|
| 17 | N DGCS ;component separator
|
---|
| 18 | N DGRS ;repetition separator
|
---|
| 19 | N DGSS ;sub-component separator
|
---|
| 20 | N DGCURLIN ;current segment line
|
---|
| 21 | N DGSEG ;segment field data array
|
---|
| 22 | N DGERR ;error processing array
|
---|
| 23 | ;
|
---|
| 24 | S DGFS=DGHL("FS")
|
---|
| 25 | S DGCS=$E(DGHL("ECH"),1)
|
---|
| 26 | S DGRS=$E(DGHL("ECH"),2)
|
---|
| 27 | S DGSS=$E(DGHL("ECH"),4)
|
---|
| 28 | S DGCURLIN=0
|
---|
| 29 | ;
|
---|
| 30 | ;loop through the message segments and retrieve the field data
|
---|
| 31 | F D Q:'DGCURLIN
|
---|
| 32 | . N DGSEG
|
---|
| 33 | . S DGCURLIN=$$NXTSEG^DGPFHLUT(DGWRK,DGCURLIN,DGFS,.DGSEG)
|
---|
| 34 | . Q:'DGCURLIN
|
---|
| 35 | . D @(DGSEG("TYPE")_"(.DGSEG,DGCS,DGRS,DGSS,.DGQRY,.DGPFERR)")
|
---|
| 36 | Q
|
---|
| 37 | ;
|
---|
| 38 | MSH(DGSEG,DGCS,DGRS,DGSS,DGQRY,DGERR) ;
|
---|
| 39 | ;
|
---|
| 40 | ; Input:
|
---|
| 41 | ; DGSEG - MSH segment field array
|
---|
| 42 | ; DGCS - HL7 component separator
|
---|
| 43 | ; DGRS - HL7 repetition separator
|
---|
| 44 | ; DGSS - HL7 sub-component separator
|
---|
| 45 | ;
|
---|
| 46 | ; Output:
|
---|
| 47 | ; DGQRY - array of ORF results
|
---|
| 48 | ; "SNDFAC" - sending facility
|
---|
| 49 | ; "RCVFAC" - receiving facility
|
---|
| 50 | ; "MSGDTM" - message creation date/time in FileMan format
|
---|
| 51 | ; DGERR - undefined on success, error array on failure
|
---|
| 52 | ;
|
---|
| 53 | D MSH^DGPFHLU4(.DGSEG,DGCS,DGRS,DGSS,.DGQRY,.DGERR)
|
---|
| 54 | Q
|
---|
| 55 | ;
|
---|
| 56 | QRD(DGSEG,DGCS,DGRS,DGSS,DGQRY,DGERR) ;
|
---|
| 57 | ;
|
---|
| 58 | ; Input:
|
---|
| 59 | ; DGSEG - MSH segment field array
|
---|
| 60 | ; DGCS - HL7 component separator
|
---|
| 61 | ; DGRS - HL7 repetition separator
|
---|
| 62 | ; DGSS - HL7 sub-component separator
|
---|
| 63 | ;
|
---|
| 64 | ; Output:
|
---|
| 65 | ; DGQRY("ICN") - Patient's Integrated Control Number
|
---|
| 66 | ; DGQRY("QID") - Query ID
|
---|
| 67 | ; DGERR - undefined on success, error array on failure
|
---|
| 68 | ; format: DGERR(seg_id,sequence,fld_pos)=error code
|
---|
| 69 | ;
|
---|
| 70 | S DGQRY("QID")=$G(DGSEG(4))
|
---|
| 71 | S DGQRY("ICN")=+$P($G(DGSEG(8)),DGCS,1)
|
---|
| 72 | Q
|
---|
| 73 | ;
|
---|
| 74 | QRF(DGSEG,DGCS,DGRS,DGSS,DGQRY,DGERR) ;
|
---|
| 75 | ; This procedure is a placeholder to allow parsing loop to continue.
|
---|
| 76 | ;
|
---|
| 77 | ; Input:
|
---|
| 78 | ; DGSEG - PID segment field array
|
---|
| 79 | ; DGCS - HL7 component separator
|
---|
| 80 | ; DGRS - HL7 repetition separator
|
---|
| 81 | ; DGSS - HL7 sub-component separator
|
---|
| 82 | ;
|
---|
| 83 | ; Output:
|
---|
| 84 | ; DGERR - undefined on success, error array on failure
|
---|
| 85 | ; format: DGERR(seg_id,sequence,fld_pos)=error code
|
---|
| 86 | ;
|
---|
| 87 | Q
|
---|