DGROHLQ2 ;DJH/AMA - ROM HL7 BUILD QRF SEGMENT ; 24 Jun 2003 3:53 PM
;;5.3;Registration;**533**;Aug 13, 1993
;
;
QRF(DGSSN,DGDOB,DGFLD,DGHL) ;QRF HL7 segment API
;This function wraps the data retrieval and segment crateion APIs and
;returns a formatted QRF segment. Called from BLDQRY^DGROHLQ
;
; Input:
; DGSSN - (required) Patient's Social Security Number
; DGDOB - (required) Patient's Date of Birth in FileMan format
; DGFLD - (optional) List of comma-separated fields (sequence #'s)
; to include. Defaults to all required fields (1).
; DGHL - VistA HL7 environment array
;
; Output:
; Function Value - QRF segment on success, "" on failure
;
N DGQRF,DGVAL
;
S DGQRF=""
I $G(DGSSN),$G(DGDOB) D
. S DGFLD=$$CKSTR^DGROHLUT("1",DGFLD) ;validate field string
. S DGFLD=","_DGFLD_","
. I $$QRFVAL(DGFLD,DGSSN,DGDOB,.DGVAL) D
. . S DGQRF=$$BLDSEG^DGROHLUT("QRF",.DGVAL,.DGHL)
Q DGQRF
;
QRFVAL(DGFLD,DGSSN,DGDOB,DGVAL) ;build QRF field value array
;
; Input:
; DGFLD - (required) Fields string
; DGSSN - (required) Patient's Social Security Number
; DGDOB - (required) Patient's Date of Birth
;
; Output:
; Function Value - 1 on success, 0 on failure
; DGVAL - QRF field array [SUB1:field, SUB2:repetition,
; SUB3:component, SUB4:sub-component]
;
N DGRSLT
;
S DGRSLT=0
I $G(DGFLD)]"",$G(DGSSN),$G(DGDOB) D
. ;
. ; seq 1 (required) Where Subj Filter
. I DGFLD[",1," D
. . S DGVAL(1)="ROM"
. ;
. ; seq 2 (optional) When Data Start Date/Time
. I DGFLD[",2," D
. . S DGVAL(2)=""
. ;
. ; seq 3 (optional) When Data End Date/Time
. I DGFLD[",3," D
. . S DGVAL(3)=""
. ;
. ; seq 4 (optional) What User Qualifier
. I DGFLD[",4," D
. . S DGVAL(4)=DGSSN
. ;
. ; seq 5 (optional) Other Query Subj Filter
. I DGFLD[",5," D
. . S DGVAL(5)=$$FMTHL7^XLFDT(DGDOB)
. ;
. ;- seq 6 (optional) Which Date/Time Qualifier
. I DGFLD[",6," D
. . S DGVAL(6)=""
. ;
. ; seq 7 (optional) Which Date/Time Status Qualifier
. I DGFLD[",7," D
. . S DGVAL(7)=""
. ;
. ; seq 8 (optional) Date/Time Selection Qualifier
. I DGFLD[",8," D
. . S DGVAL(8)=""
. ;
. ; seq 9 (optional) When Quantity/Timing Qualifier
. I DGFLD[",9," D
. . S DGVAL(9)=""
. ;
. S DGRSLT=1
I 'DGRSLT K DGVAL
Q DGRSLT
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HDGROHLQ2 2413 printed Nov 22, 2024@18:05:12 Page 2
DGROHLQ2 ;DJH/AMA - ROM HL7 BUILD QRF SEGMENT ; 24 Jun 2003 3:53 PM
+1 ;;5.3;Registration;**533**;Aug 13, 1993
+2 ;
+3 ;
QRF(DGSSN,DGDOB,DGFLD,DGHL) ;QRF HL7 segment API
+1 ;This function wraps the data retrieval and segment crateion APIs and
+2 ;returns a formatted QRF segment. Called from BLDQRY^DGROHLQ
+3 ;
+4 ; Input:
+5 ; DGSSN - (required) Patient's Social Security Number
+6 ; DGDOB - (required) Patient's Date of Birth in FileMan format
+7 ; DGFLD - (optional) List of comma-separated fields (sequence #'s)
+8 ; to include. Defaults to all required fields (1).
+9 ; DGHL - VistA HL7 environment array
+10 ;
+11 ; Output:
+12 ; Function Value - QRF segment on success, "" on failure
+13 ;
+14 NEW DGQRF,DGVAL
+15 ;
+16 SET DGQRF=""
+17 IF $GET(DGSSN)
IF $GET(DGDOB)
Begin DoDot:1
+18 ;validate field string
SET DGFLD=$$CKSTR^DGROHLUT("1",DGFLD)
+19 SET DGFLD=","_DGFLD_","
+20 IF $$QRFVAL(DGFLD,DGSSN,DGDOB,.DGVAL)
Begin DoDot:2
+21 SET DGQRF=$$BLDSEG^DGROHLUT("QRF",.DGVAL,.DGHL)
End DoDot:2
End DoDot:1
+22 QUIT DGQRF
+23 ;
QRFVAL(DGFLD,DGSSN,DGDOB,DGVAL) ;build QRF field value array
+1 ;
+2 ; Input:
+3 ; DGFLD - (required) Fields string
+4 ; DGSSN - (required) Patient's Social Security Number
+5 ; DGDOB - (required) Patient's Date of Birth
+6 ;
+7 ; Output:
+8 ; Function Value - 1 on success, 0 on failure
+9 ; DGVAL - QRF field array [SUB1:field, SUB2:repetition,
+10 ; SUB3:component, SUB4:sub-component]
+11 ;
+12 NEW DGRSLT
+13 ;
+14 SET DGRSLT=0
+15 IF $GET(DGFLD)]""
IF $GET(DGSSN)
IF $GET(DGDOB)
Begin DoDot:1
+16 ;
+17 ; seq 1 (required) Where Subj Filter
+18 IF DGFLD[",1,"
Begin DoDot:2
+19 SET DGVAL(1)="ROM"
End DoDot:2
+20 ;
+21 ; seq 2 (optional) When Data Start Date/Time
+22 IF DGFLD[",2,"
Begin DoDot:2
+23 SET DGVAL(2)=""
End DoDot:2
+24 ;
+25 ; seq 3 (optional) When Data End Date/Time
+26 IF DGFLD[",3,"
Begin DoDot:2
+27 SET DGVAL(3)=""
End DoDot:2
+28 ;
+29 ; seq 4 (optional) What User Qualifier
+30 IF DGFLD[",4,"
Begin DoDot:2
+31 SET DGVAL(4)=DGSSN
End DoDot:2
+32 ;
+33 ; seq 5 (optional) Other Query Subj Filter
+34 IF DGFLD[",5,"
Begin DoDot:2
+35 SET DGVAL(5)=$$FMTHL7^XLFDT(DGDOB)
End DoDot:2
+36 ;
+37 ;- seq 6 (optional) Which Date/Time Qualifier
+38 IF DGFLD[",6,"
Begin DoDot:2
+39 SET DGVAL(6)=""
End DoDot:2
+40 ;
+41 ; seq 7 (optional) Which Date/Time Status Qualifier
+42 IF DGFLD[",7,"
Begin DoDot:2
+43 SET DGVAL(7)=""
End DoDot:2
+44 ;
+45 ; seq 8 (optional) Date/Time Selection Qualifier
+46 IF DGFLD[",8,"
Begin DoDot:2
+47 SET DGVAL(8)=""
End DoDot:2
+48 ;
+49 ; seq 9 (optional) When Quantity/Timing Qualifier
+50 IF DGFLD[",9,"
Begin DoDot:2
+51 SET DGVAL(9)=""
End DoDot:2
+52 ;
+53 SET DGRSLT=1
End DoDot:1
+54 IF 'DGRSLT
KILL DGVAL
+55 QUIT DGRSLT