[613] | 1 | DGROHLQ2 ;DJH/AMA - ROM HL7 BUILD QRF SEGMENT ; 24 Jun 2003 3:53 PM
|
---|
| 2 | ;;5.3;Registration;**533**;Aug 13, 1993
|
---|
| 3 | ;
|
---|
| 4 | ;
|
---|
| 5 | QRF(DGSSN,DGDOB,DGFLD,DGHL) ;QRF HL7 segment API
|
---|
| 6 | ;This function wraps the data retrieval and segment crateion APIs and
|
---|
| 7 | ;returns a formatted QRF segment. Called from BLDQRY^DGROHLQ
|
---|
| 8 | ;
|
---|
| 9 | ; Input:
|
---|
| 10 | ; DGSSN - (required) Patient's Social Security Number
|
---|
| 11 | ; DGDOB - (required) Patient's Date of Birth in FileMan format
|
---|
| 12 | ; DGFLD - (optional) List of comma-separated fields (sequence #'s)
|
---|
| 13 | ; to include. Defaults to all required fields (1).
|
---|
| 14 | ; DGHL - VistA HL7 environment array
|
---|
| 15 | ;
|
---|
| 16 | ; Output:
|
---|
| 17 | ; Function Value - QRF segment on success, "" on failure
|
---|
| 18 | ;
|
---|
| 19 | N DGQRF,DGVAL
|
---|
| 20 | ;
|
---|
| 21 | S DGQRF=""
|
---|
| 22 | I $G(DGSSN),$G(DGDOB) D
|
---|
| 23 | . S DGFLD=$$CKSTR^DGROHLUT("1",DGFLD) ;validate field string
|
---|
| 24 | . S DGFLD=","_DGFLD_","
|
---|
| 25 | . I $$QRFVAL(DGFLD,DGSSN,DGDOB,.DGVAL) D
|
---|
| 26 | . . S DGQRF=$$BLDSEG^DGROHLUT("QRF",.DGVAL,.DGHL)
|
---|
| 27 | Q DGQRF
|
---|
| 28 | ;
|
---|
| 29 | QRFVAL(DGFLD,DGSSN,DGDOB,DGVAL) ;build QRF field value array
|
---|
| 30 | ;
|
---|
| 31 | ; Input:
|
---|
| 32 | ; DGFLD - (required) Fields string
|
---|
| 33 | ; DGSSN - (required) Patient's Social Security Number
|
---|
| 34 | ; DGDOB - (required) Patient's Date of Birth
|
---|
| 35 | ;
|
---|
| 36 | ; Output:
|
---|
| 37 | ; Function Value - 1 on success, 0 on failure
|
---|
| 38 | ; DGVAL - QRF field array [SUB1:field, SUB2:repetition,
|
---|
| 39 | ; SUB3:component, SUB4:sub-component]
|
---|
| 40 | ;
|
---|
| 41 | N DGRSLT
|
---|
| 42 | ;
|
---|
| 43 | S DGRSLT=0
|
---|
| 44 | I $G(DGFLD)]"",$G(DGSSN),$G(DGDOB) D
|
---|
| 45 | . ;
|
---|
| 46 | . ; seq 1 (required) Where Subj Filter
|
---|
| 47 | . I DGFLD[",1," D
|
---|
| 48 | . . S DGVAL(1)="ROM"
|
---|
| 49 | . ;
|
---|
| 50 | . ; seq 2 (optional) When Data Start Date/Time
|
---|
| 51 | . I DGFLD[",2," D
|
---|
| 52 | . . S DGVAL(2)=""
|
---|
| 53 | . ;
|
---|
| 54 | . ; seq 3 (optional) When Data End Date/Time
|
---|
| 55 | . I DGFLD[",3," D
|
---|
| 56 | . . S DGVAL(3)=""
|
---|
| 57 | . ;
|
---|
| 58 | . ; seq 4 (optional) What User Qualifier
|
---|
| 59 | . I DGFLD[",4," D
|
---|
| 60 | . . S DGVAL(4)=DGSSN
|
---|
| 61 | . ;
|
---|
| 62 | . ; seq 5 (optional) Other Query Subj Filter
|
---|
| 63 | . I DGFLD[",5," D
|
---|
| 64 | . . S DGVAL(5)=$$FMTHL7^XLFDT(DGDOB)
|
---|
| 65 | . ;
|
---|
| 66 | . ;- seq 6 (optional) Which Date/Time Qualifier
|
---|
| 67 | . I DGFLD[",6," D
|
---|
| 68 | . . S DGVAL(6)=""
|
---|
| 69 | . ;
|
---|
| 70 | . ; seq 7 (optional) Which Date/Time Status Qualifier
|
---|
| 71 | . I DGFLD[",7," D
|
---|
| 72 | . . S DGVAL(7)=""
|
---|
| 73 | . ;
|
---|
| 74 | . ; seq 8 (optional) Date/Time Selection Qualifier
|
---|
| 75 | . I DGFLD[",8," D
|
---|
| 76 | . . S DGVAL(8)=""
|
---|
| 77 | . ;
|
---|
| 78 | . ; seq 9 (optional) When Quantity/Timing Qualifier
|
---|
| 79 | . I DGFLD[",9," D
|
---|
| 80 | . . S DGVAL(9)=""
|
---|
| 81 | . ;
|
---|
| 82 | . S DGRSLT=1
|
---|
| 83 | I 'DGRSLT K DGVAL
|
---|
| 84 | Q DGRSLT
|
---|