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

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

initial load of WorldVistAEHR

File size: 2.5 KB
Line 
1DGQEHLOR ;ALB/RPM - VIC REPLACEMENT HL7 BUILD ORC SEGMENT ; 2/23/04
2 ;;5.3;Registration;**571**;Aug 13, 1993
3 ;
4 Q
5 ;
6ORC(DGREQ,DGFLD,DGHL) ;ORC Segment API
7 ;This function wraps the data retrieval and segment creation APIs and
8 ;returns a formatted ORC 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 - ORC segment on success, "" on failure
18 ;
19 N DGORC
20 N DGVAL
21 ;
22 S DGORC=""
23 I $D(DGREQ) D
24 . S DGFLD=$$CKSTR^DGQEHLUT("1",DGFLD) ;validate the field string
25 . S DGFLD=","_DGFLD_","
26 . I $$ORCVAL(DGFLD,.DGREQ,.DGVAL) D
27 . . S DGORC=$$BLDSEG^DGQEHLUT("ORC",.DGVAL,.DGHL)
28 Q DGORC
29 ;
30ORCVAL(DGFLD,DGREQ,DGVAL) ;build ORC value array
31 ;
32 ; Input:
33 ; DGFLD - (required) Fields string
34 ; DGREQ - (required) VIC REQUEST data array
35 ;
36 ; Output:
37 ; Function Value - 1 on sucess, 0 on failure
38 ; DGVAL - ORC field array [SUB1:field, SUB2:repetition,
39 ; SUB3:component, SUB4:sub-component]
40 ;
41 N DGRSLT ;function value
42 N DGSTAT ;temp value of DGREQ("CPRSTAT")
43 ;
44 S DGRSLT=0
45 I $G(DGFLD)]"",+$G(DGREQ("DFN"))>0,$G(DGREQ("CARDID"))]"" D
46 . ;
47 . ; seq 1 Order Control
48 . I DGFLD[",1," D ;required field
49 . . S DGSTAT=$G(DGREQ("CPRSTAT"))
50 . . S DGVAL(1)=$S(DGSTAT="P":"RL",DGSTAT="C":"CA",DGSTAT="I":"CA",1:"")
51 . Q:DGVAL(1)=""
52 . ;
53 . ; seq 2 Placer Order Number
54 . I DGFLD[",2," D
55 . ;
56 . ; seq 3 Filler Order Number
57 . I DGFLD[",3," D
58 . ;
59 . ; seq 4 Placer Group Number
60 . I DGFLD[",4," D
61 . ;
62 . ; seq 5 Order Status
63 . I DGFLD[",5," D
64 . ;
65 . ; seq 6 Response Flag
66 . I DGFLD[",6," D
67 . ;
68 . ; seq 7 Quantity/Timing
69 . I DGFLD[",7," D
70 . ;
71 . ; seq 8 Parent
72 . I DGFLD[",8," D
73 . ;
74 . ; seq 9 Date/Time of Transaction
75 . I DGFLD[",9," D
76 . ;
77 . ; seq 10 Entered By
78 . I DGFLD[",10," D
79 . ;
80 . ; seq 11 Verified By
81 . I DGFLD[",11," D
82 . ;
83 . ; seq 12 Ordering Provider
84 . I DGFLD[",12," D
85 . ;
86 . ; seq 13 Enterer's Location
87 . I DGFLD[",13," D
88 . ;
89 . ; seq 14 Call Back Phone Number
90 . I DGFLD[",14," D
91 . ;
92 . ; seq 15 Order Effective Date/Time
93 . I DGFLD[",15," D
94 . ;
95 . ; seq 16 Order Control Code Reason
96 . I DGFLD[",16," D
97 . ;
98 . ; seq 17 Entering Organization
99 . I DGFLD[",17," D
100 . ;
101 . ; seq 18 Entering Device
102 . I DGFLD[",18," D
103 . ;
104 . ; seq 19 Action By
105 . I DGFLD[",19," D
106 . ;
107 . S DGRSLT=1
108 I 'DGRSLT K DGVAL
109 Q DGRSLT
Note: See TracBrowser for help on using the repository browser.