source: WorldVistAEHR/trunk/r/REGISTRATION-DGQE-DG-DPT-GRPX-VAD-VAF-VAS-VAT-VAU--VA-VIC--DGBT--DGJ--DGYA--VALM/DGROHLQ1.m@ 1438

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

initial load of WorldVistAEHR

File size: 3.4 KB
Line 
1DGROHLQ1 ;DJH/AMA - ROM HL7 BUILD QRD SEGMENT ; 28 Apr 2004 4:31 PM
2 ;;5.3;Registration;**533,572**;Aug 13, 1993
3 ;
4QRD(DGDFN,DGICN,DGFLD,DGHL,DGUSER) ;QRD HL7 segment API
5 ;This function wraps the data retrieval and segment creation APIs
6 ;and returns a formatted QRD segment.
7 ; Called from BLDQRY and BLDORF^DGROHLQ
8 ;
9 ; Input:
10 ; DGDFN - (required) DFN
11 ; DGICN - (required) 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 ; DGUSER - (optional) String of user data from New Person File
16 ; (SSN~Name~DUZ~Phone). If this is populated, it means
17 ; this is the QRY to the LST. If not, it's the ORF going
18 ; back to the Querying Site. ;added in DG*5.3*572
19 ;
20 ; Output:
21 ; Function Value - QRD segment on success, "" on failure
22 ;
23 N DGQRD,DGVAL
24 ;
25 S DGQRD=""
26 I $G(DGDFN)>0,$G(DGICN)]"" D
27 . S DGFLD=$$CKSTR^DGROHLUT("1,2,3,4,5,6,7,8,9,10",DGFLD) ;validte flds
28 . S DGFLD=","_DGFLD_","
29 . I $$QRDVAL(DGFLD,DGDFN,DGICN,.DGVAL,$G(DGUSER)) D ;DG*5.3*572 added DGUSER
30 . . S DGQRD=$$BLDSEG^DGROHLUT("QRD",.DGVAL,.DGHL)
31 Q DGQRD
32 ;
33QRDVAL(DGFLD,DGDFN,DGICN,DGVAL,DGUSER) ;build QRD value array
34 ;
35 ; Input:
36 ; DGFLD - Fields string
37 ; DGDFN - DFN
38 ; DGICN - ICN
39 ; DGUSER - (optional) String of user data from New Person File
40 ; (SSN~Name~DUZ~Phone) ;DG*5.3*572
41 ;
42 ; Output:
43 ; Function Value - 1 on success, 0 on failure
44 ; DGVAL - QRD field array [SUB1:field, SUB2:repetition,
45 ; SUB3:component, SUB4:sub-component]
46 ;
47 N DGRSLT
48 ;
49 S DGRSLT=0
50 I $G(DGDFN)>0,$G(DGICN)]"",$G(DGFLD)]"" D
51 . ;
52 . ; seq 1 (required) Query Date/Time
53 . I DGFLD[",1," D Q:(+DGVAL(1)'>0)
54 . . S DGVAL(1)=$$FMTHL7^XLFDT($$NOW^XLFDT())
55 . ;
56 . ; seq 2 (required) Query Format Code
57 . I DGFLD[",2," D
58 . . S DGVAL(2)="R" ;always "R"ecord
59 . ;
60 . ; seq 3 (required) Query Priority
61 . I DGFLD[",3," D
62 . . S DGVAL(3)="I" ;always "I"mmediate
63 . ;
64 . ; seq 4 (required) Identifying Information
65 . ;DG*5.3*572 - if the QRY to the LST, send the QS DFN and User info
66 . ; - if the ORF back to the QS, just send the QS DFN
67 . I DGFLD[",4," D
68 . . S DGVAL(4)=DGDFN_$S($G(DGUSER):"~"_DGUSER,1:"") ;DG*5.3*572
69 . ;
70 . ; seq 5 (optional) Deferred Response Type
71 . ; Indicates version of ROM messages
72 . I DGFLD[",5," D
73 . . S DGVAL(5)="572"
74 . ;
75 . ; seq 6 (optional) Deferred Response Date/Time
76 . I DGFLD[",6," D
77 . . S DGVAL(6)=""
78 . ;
79 . ; seq 7 (required) Quantity Limited Request
80 . I DGFLD[",7," D
81 . . S DGVAL(7,1,1)=10
82 . . S DGVAL(7,1,2)="RD" ;records
83 . ;
84 . ; seq 8 (required) ICN
85 . I DGFLD[",8," D
86 . . S DGVAL(8,1,1)=DGICN
87 . . S DGVAL(8,1,9,1)="USVHA"
88 . . S DGVAL(8,1,9,2)=""
89 . . S DGVAL(8,1,9,3)="L"
90 . ;
91 . ; seq 9 (required) What Subject Filter
92 . I DGFLD[",9," D
93 . . S DGVAL(9,1,1)="OTH"
94 . . S DGVAL(9,1,2)="Other"
95 . . S DGVAL(9,1,3)="HL0048"
96 . ;
97 . ; seq 10 (required) What Dept. Data Code
98 . I DGFLD[",10," D
99 . . S DGVAL(10,1,1)="ROMDD"
100 . . S DGVAL(10,1,2)="Register Once Messaging Demographic Data"
101 . . S DGVAL(10,1,3)="L"
102 . ;
103 . ; seq 11 (optional) What Data Code Value Qual.
104 . I DGFLD[",11," D
105 . . S DGVAL(11)=""
106 . ;
107 . ; seq 12 (optional) Query Results Level
108 . I DGFLD[",12," D
109 . . S DGVAL(12)=""
110 . ;
111 . S DGRSLT=1
112 I 'DGRSLT K DGVAL
113 Q DGRSLT
Note: See TracBrowser for help on using the repository browser.