source: FOIAVistA/tag/r/REGISTRATION-DGQE-DG-DPT-GRPX-VAD-VAF-VAS-VAT-VAU--VA-VIC--DGBT--DGJ--DGYA--VALM/DGPFHLQ1.m@ 949

Last change on this file since 949 was 628, checked in by George Lilly, 15 years ago

initial load of FOIAVistA 6/30/08 version

File size: 2.7 KB
Line 
1DGPFHLQ1 ;ALB/RPM - PRF HL7 BUILD QRD SEGMENT ; 02/02/03
2 ;;5.3;Registration;**425**;Aug 13, 1993
3 ;
4 ;
5QRD(DGQID,DGWHO,DGFLD,DGHL) ;QRD HL7 segment API
6 ;This function wraps the data retrieval and segment creation APIs and
7 ;returns a formatted QRD segment.
8 ;
9 ; Input:
10 ; DGQID - (required) Query ID (DFN)
11 ; DGWHO - (required) Who Subject Filter (Integrated Control Number)
12 ; DGFLD - (optional) List of comma-separated fields (sequence #'s)
13 ; to include. Defaults to all required fields (1-4,7-10).
14 ; DGHL - VistA HL7 environment array
15 ;
16 ; Output:
17 ; Function Value - QRD segment on success, "" on failure
18 ;
19 N DGQRD
20 N DGVAL
21 ;
22 S DGQRD=""
23 I $G(DGQID)>0,$G(DGWHO)]"" D
24 . S DGFLD=$$CKSTR^DGPFHLUT("1,2,3,4,7,8,9,10",DGFLD) ;validate fields
25 . S DGFLD=","_DGFLD_","
26 . I $$QRDVAL(DGFLD,DGQID,DGWHO,.DGVAL) D
27 . . S DGQRD=$$BLDSEG^DGPFHLUT("QRD",.DGVAL,.DGHL)
28 Q DGQRD
29 ;
30QRDVAL(DGFLD,DGQID,DGWHO,DGVAL) ;build QRD value array
31 ;
32 ; Input:
33 ; DGFLD - Fields string
34 ; DGQID - Query ID (DFN)
35 ; DGWHO - Who Subject filter (ICN)
36 ;
37 ; Output:
38 ; Function Value - 1 on success, 0 on failure
39 ; DGVAL - QRD field array [SUB1:field, SUB2:repetition,
40 ; SUB3:component, SUB4:sub-component
41 ;
42 N DGRSLT
43 ;
44 S DGRSLT=0
45 I $G(DGQID)>0,$G(DGWHO)]"",$G(DGFLD)]"" D
46 . ;
47 . ; seq 1 (required) Query Date/Time
48 . I DGFLD[",1," D Q:(+DGVAL(1)'>0)
49 . . S DGVAL(1)=$$FMTHL7^XLFDT($$NOW^XLFDT())
50 . ;
51 . ; seq 2 (required) Query Format Code
52 . I DGFLD[",2," D
53 . . S DGVAL(2)="R" ;always "R"ecord
54 . ;
55 . ; seq 3 (required) Query Priority
56 . I DGFLD[",3," D
57 . . S DGVAL(3)="I" ;always "I"mmediate
58 . ;
59 . ; seq 4 (required) Query ID
60 . I DGFLD[",4," D
61 . . S DGVAL(4)=DGQID
62 . ;
63 . ; seq 5 (optional) Deferred Response Type
64 . I DGFLD[",5," D
65 . . S DGVAL(5)=""
66 . ;
67 . ; seq 6 (optional) Deferred Response Date/Time
68 . I DGFLD[",6," D
69 . . S DGVAL(6)=""
70 . ;
71 . ; seq 7 (required) Quantity Limited Request
72 . I DGFLD[",7," D
73 . . S DGVAL(7,1,1)=10
74 . . S DGVAL(7,1,2)="RD" ;records
75 . ;
76 . ; seq 8 (required) Who Subject Filter
77 . I DGFLD[",8," D
78 . . S DGVAL(8,1,1)=DGWHO
79 . . S DGVAL(8,1,9,1)="USVHA"
80 . . S DGVAL(8,1,9,2)=""
81 . . S DGVAL(8,1,9,3)="L"
82 . ;
83 . ; seq 9 (required) What Subject Filter
84 . I DGFLD[",9," D
85 . . S DGVAL(9,1,1)="OTH"
86 . . S DGVAL(9,1,2)="Other"
87 . . S DGVAL(9,1,3)="HL0048"
88 . ;
89 . ; seq 10 (required) What Dept. Data Code
90 . I DGFLD[",10," D
91 . . S DGVAL(10,1,1)="PRFA"
92 . . S DGVAL(10,1,2)="Patient Record Flag Assignments"
93 . . S DGVAL(10,1,3)="L"
94 . ;
95 . ; seq 11 (optional) What Data Code Value Qual.
96 . I DGFLD[",11," D
97 . . S DGVAL(11)=""
98 . ;
99 . ; seq 12 (optional) Query Results Level
100 . I DGFLD[",12," D
101 . . S DGVAL(12)=""
102 . ;
103 . S DGRSLT=1
104 I 'DGRSLT K DGVAL
105 Q DGRSLT
Note: See TracBrowser for help on using the repository browser.