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

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

initial load of WorldVistAEHR

File size: 2.0 KB
RevLine 
[613]1DGQEHLRQ ;ALB/RPM - VIC REPLACEMENT HL7 BUILD RQD SEGMENT ;1/20/04
2 ;;5.3;Registration;**571**;Aug 13, 1993
3 ;
4 Q
5 ;
6RQD(DGREQ,DGFLD,DGHL) ;RQD Segment API
7 ;This function wraps the data retrieval and segment creation APIs and
8 ;returns a formatted RQD segment.
9 ;
10 ; Input:
11 ; DGREQ - (required) VIC REQUEST data array
12 ; DGFLD - (optional) List of comma-separated fields (sequence #'s)
13 ; to include. Defaults to all required fields (4).
14 ; DGHL - HL7 environment array
15 ;
16 ; Output:
17 ; Function Value - RQD segment on success, "" on failure
18 ;
19 N DGI
20 N DGRQD
21 N DGVAL
22 ;
23 S DGRQD=""
24 I $D(DGREQ) D
25 . S DGFLD=","_DGFLD_","
26 . ;validate the field string - at least one of the three fields RQD-2,
27 . ;RQD-3 or RQD-4 must be valued.
28 . F DGI=2:1:4 I DGFLD[(","_DGI_",") D Q
29 . . I $$RQDVAL(DGFLD,.DGREQ,.DGVAL) D
30 . . . S DGRQD=$$BLDSEG^DGQEHLUT("RQD",.DGVAL,.DGHL)
31 Q DGRQD
32 ;
33RQDVAL(DGFLD,DGREQ,DGVAL) ;build RQD value array
34 ;
35 ; Input:
36 ; DGFLD - (required) Fields string
37 ; DGREQ - (required) VIC REQUEST data array
38 ;
39 ; Output:
40 ; Function Value - 1 on sucess, 0 on failure
41 ; DGVAL - RQD field array [SUB1:field, SUB2:repetition,
42 ; SUB3:component, SUB4:sub-component]
43 ;
44 N DGRSLT ;function value
45 ;
46 S DGRSLT=0
47 I $G(DGFLD)]"",+$G(DGREQ("DFN"))>0 D
48 . ;
49 . ; seq 1 Requisition Line Number
50 . I DGFLD[",1," D
51 . . S DGVAL(1)=1 ;always "1"
52 . ;
53 . ; seq 2 Item Code - Internal
54 . I DGFLD[",2," D
55 . ;
56 . ; seq 3 Item Code - External ;required
57 . I DGFLD[",3," D
58 . . S DGVAL(3)=$G(DGREQ("CARDID"))
59 . Q:DGVAL(3)=""
60 . ;
61 . ; seq 4 Hospital Item Code
62 . I DGFLD[",4," D
63 . ;
64 . ; seq 5 Requisition Quantity
65 . I DGFLD[",5," D
66 . ;
67 . ; seq 6 Requisition Unit of Measure
68 . I DGFLD[",6," D
69 . ;
70 . ; seq 7 Dept. Cost Center
71 . I DGFLD[",7," D
72 . ;
73 . ; seq 8 Item Natural Account Code
74 . I DGFLD[",8," D
75 . ;
76 . ; seq 9 Deliver To ID
77 . I DGFLD[",9," D
78 . ;
79 . ; seq 10 Date Needed
80 . I DGFLD[",10," D
81 . ;
82 . S DGRSLT=1
83 I 'DGRSLT K DGVAL
84 Q DGRSLT
Note: See TracBrowser for help on using the repository browser.