DGPFHLQ3 ;ALB/RPM - PRF HL7 QRY PROCESSING ; 12/13/04
;;5.3;Registration;**425,650**;Aug 13, 1993;Build 3
;
PARSQRY(DGWRK,DGHL,DGQRY,DGPFERR) ;Parse QRY~R02 Message/Segments
;
; Input:
; DGWRK - Closed root global reference
; DGHL - VistA HL7 environment array
;
; Output:
; DGQRY - Patient lookup components array
; DGPFERR - Undefined on success, ERR segment data array on failure
; Format: DGPFERR(seg_id,sequence,fld_pos)=error_code
;
N DGRSLT ;result from CHK^DIE
N DGFS ;field separator
N DGCS ;component separator
N DGRS ;repetition separator
N DGSS ;sub-component separator
N DGCURLIN ;current segment line
N DGSEG ;segment field data array
N DGERR ;error processing array
;
S DGFS=DGHL("FS")
S DGCS=$E(DGHL("ECH"),1)
S DGRS=$E(DGHL("ECH"),2)
S DGSS=$E(DGHL("ECH"),4)
S DGCURLIN=0
;
;loop through the message segments and retrieve the field data
F D Q:'DGCURLIN
. N DGSEG
. S DGCURLIN=$$NXTSEG^DGPFHLUT(DGWRK,DGCURLIN,DGFS,.DGSEG)
. Q:'DGCURLIN
. D @(DGSEG("TYPE")_"(.DGSEG,DGCS,DGRS,DGSS,.DGQRY,.DGPFERR)")
Q
;
MSH(DGSEG,DGCS,DGRS,DGSS,DGQRY,DGERR) ;
;
; Input:
; DGSEG - MSH segment field array
; DGCS - HL7 component separator
; DGRS - HL7 repetition separator
; DGSS - HL7 sub-component separator
;
; Output:
; DGQRY - array of ORF results
; "SNDFAC" - sending facility
; "RCVFAC" - receiving facility
; "MSGDTM" - message creation date/time in FileMan format
; DGERR - undefined on success, error array on failure
;
D MSH^DGPFHLU4(.DGSEG,DGCS,DGRS,DGSS,.DGQRY,.DGERR)
Q
;
QRD(DGSEG,DGCS,DGRS,DGSS,DGQRY,DGERR) ;
;
; Input:
; DGSEG - MSH segment field array
; DGCS - HL7 component separator
; DGRS - HL7 repetition separator
; DGSS - HL7 sub-component separator
;
; Output:
; DGQRY("ICN") - Patient's Integrated Control Number
; DGQRY("QID") - Query ID
; DGERR - undefined on success, error array on failure
; format: DGERR(seg_id,sequence,fld_pos)=error code
;
S DGQRY("QID")=$G(DGSEG(4))
S DGQRY("ICN")=+$P($G(DGSEG(8)),DGCS,1)
Q
;
QRF(DGSEG,DGCS,DGRS,DGSS,DGQRY,DGERR) ;
; This procedure is a placeholder to allow parsing loop to continue.
;
; Input:
; DGSEG - PID segment field array
; DGCS - HL7 component separator
; DGRS - HL7 repetition separator
; DGSS - HL7 sub-component separator
;
; Output:
; DGERR - undefined on success, error array on failure
; format: DGERR(seg_id,sequence,fld_pos)=error code
;
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HDGPFHLQ3 2712 printed Nov 22, 2024@17:57:41 Page 2
DGPFHLQ3 ;ALB/RPM - PRF HL7 QRY PROCESSING ; 12/13/04
+1 ;;5.3;Registration;**425,650**;Aug 13, 1993;Build 3
+2 ;
PARSQRY(DGWRK,DGHL,DGQRY,DGPFERR) ;Parse QRY~R02 Message/Segments
+1 ;
+2 ; Input:
+3 ; DGWRK - Closed root global reference
+4 ; DGHL - VistA HL7 environment array
+5 ;
+6 ; Output:
+7 ; DGQRY - Patient lookup components array
+8 ; DGPFERR - Undefined on success, ERR segment data array on failure
+9 ; Format: DGPFERR(seg_id,sequence,fld_pos)=error_code
+10 ;
+11 ;result from CHK^DIE
NEW DGRSLT
+12 ;field separator
NEW DGFS
+13 ;component separator
NEW DGCS
+14 ;repetition separator
NEW DGRS
+15 ;sub-component separator
NEW DGSS
+16 ;current segment line
NEW DGCURLIN
+17 ;segment field data array
NEW DGSEG
+18 ;error processing array
NEW DGERR
+19 ;
+20 SET DGFS=DGHL("FS")
+21 SET DGCS=$EXTRACT(DGHL("ECH"),1)
+22 SET DGRS=$EXTRACT(DGHL("ECH"),2)
+23 SET DGSS=$EXTRACT(DGHL("ECH"),4)
+24 SET DGCURLIN=0
+25 ;
+26 ;loop through the message segments and retrieve the field data
+27 FOR
Begin DoDot:1
+28 NEW DGSEG
+29 SET DGCURLIN=$$NXTSEG^DGPFHLUT(DGWRK,DGCURLIN,DGFS,.DGSEG)
+30 if 'DGCURLIN
QUIT
+31 DO @(DGSEG("TYPE")_"(.DGSEG,DGCS,DGRS,DGSS,.DGQRY,.DGPFERR)")
End DoDot:1
if 'DGCURLIN
QUIT
+32 QUIT
+33 ;
MSH(DGSEG,DGCS,DGRS,DGSS,DGQRY,DGERR) ;
+1 ;
+2 ; Input:
+3 ; DGSEG - MSH segment field array
+4 ; DGCS - HL7 component separator
+5 ; DGRS - HL7 repetition separator
+6 ; DGSS - HL7 sub-component separator
+7 ;
+8 ; Output:
+9 ; DGQRY - array of ORF results
+10 ; "SNDFAC" - sending facility
+11 ; "RCVFAC" - receiving facility
+12 ; "MSGDTM" - message creation date/time in FileMan format
+13 ; DGERR - undefined on success, error array on failure
+14 ;
+15 DO MSH^DGPFHLU4(.DGSEG,DGCS,DGRS,DGSS,.DGQRY,.DGERR)
+16 QUIT
+17 ;
QRD(DGSEG,DGCS,DGRS,DGSS,DGQRY,DGERR) ;
+1 ;
+2 ; Input:
+3 ; DGSEG - MSH segment field array
+4 ; DGCS - HL7 component separator
+5 ; DGRS - HL7 repetition separator
+6 ; DGSS - HL7 sub-component separator
+7 ;
+8 ; Output:
+9 ; DGQRY("ICN") - Patient's Integrated Control Number
+10 ; DGQRY("QID") - Query ID
+11 ; DGERR - undefined on success, error array on failure
+12 ; format: DGERR(seg_id,sequence,fld_pos)=error code
+13 ;
+14 SET DGQRY("QID")=$GET(DGSEG(4))
+15 SET DGQRY("ICN")=+$PIECE($GET(DGSEG(8)),DGCS,1)
+16 QUIT
+17 ;
QRF(DGSEG,DGCS,DGRS,DGSS,DGQRY,DGERR) ;
+1 ; This procedure is a placeholder to allow parsing loop to continue.
+2 ;
+3 ; Input:
+4 ; DGSEG - PID segment field array
+5 ; DGCS - HL7 component separator
+6 ; DGRS - HL7 repetition separator
+7 ; DGSS - HL7 sub-component separator
+8 ;
+9 ; Output:
+10 ; DGERR - undefined on success, error array on failure
+11 ; format: DGERR(seg_id,sequence,fld_pos)=error code
+12 ;
+13 QUIT