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

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

initial load of FOIAVistA 6/30/08 version

File size: 2.6 KB
Line 
1DGSDU ;ALB/TMP - ACRP API UTILITIES ; 12/8/97 15:09
2 ;;5.3;Registration;**151**;Aug 13, 1993
3 ;;
4SCAN(DGINDX,DGVAL,DGFILTER,DGCBK,DGCLOSE,DGQUERY,DGDIR) ; Scan encounters
5 ; *** NOTE *** When using this call, the variable passed as DGQUERY
6 ; must be newed or killed in the callling program
7 ; DGINDX = index name property of the query object
8 ; DGVAL = array of data elements for start/end of search
9 ; DGVAL("DFN") = patient DFN
10 ; DGVAL("BDT") = begin date
11 ; DGVAL("EDT") = end date
12 ; DGVAL("VIS") = encounter file ien
13 ; DGFILTER = the executable code to use to screen entries
14 ; DGCBK = the executable scan callback code to create the result set
15 ; DGCLOSE = Flag that says whether or not to close the QUERY object
16 ; 1 = Perform close 0 or null = Do not close object
17 ; DGQUERY = the # of the current query, if not a new query. If passed by
18 ; reference and query closed, this variable will be nulled
19 ; DGDIR = the direction of the scan (optional)
20 ; null, undefined or FORWARD : Scan forwards
21 ; BACKWARD : Scan backwards
22 ;
23 N QUERY
24 S QUERY=$G(DGQUERY)
25 I '$G(QUERY) D
26 .D OPEN^SDQ(.DGQUERY) Q:'$G(DGQUERY)
27 .D INDEX^SDQ(.DGQUERY,DGINDX,"SET")
28 .I $G(DGFILTER)'="" D FILTER^SDQ(.DGQUERY,DGFILTER,"SET")
29 .D SCANCB^SDQ(.DGQUERY,DGCBK,"SET")
30 I $G(QUERY) D ACTIVE^SDQ(.DGQUERY,"FALSE","SET")
31 D SETINDX(.DGQUERY,DGINDX)
32 D ACTIVE^SDQ(.DGQUERY,"TRUE","SET")
33 S:$G(DGDIR)="" DGDIR="FORWARD"
34 D SCAN^SDQ(.DGQUERY,DGDIR)
35 I $G(DGCLOSE) D CLOSE(.DGQUERY)
36SCANQ Q
37 ;
38CLOSE(DGQUERY) ; Close the query
39 G:'$G(DGQUERY) CLOSEQ
40 D CLOSE^SDQ(.DGQUERY)
41CLOSEQ Q
42 ;
43SETINDX(DGQUERY,DGINDX) ;
44 I DGINDX="PATIENT/DATE" D PAT,DATE
45 I DGINDX="DATE/TIME" D DATE
46 I DGINDX="PATIENT" D PAT
47 I DGINDX="VISIT" D VIS
48 Q
49 ;
50PAT ; Verify patient
51 D PAT^SDQ(.DGQUERY,$G(DGVAL("DFN")),"SET")
52 Q
53 ;
54DATE ; Verify date range
55 D DATE^SDQ(.DGQUERY,$G(DGVAL("BDT")),$G(DGVAL("EDT")),"SET")
56 Q
57 ;
58VIS ; Verify visit
59 D VISIT^SDQ(.DGQUERY,$G(DGVAL("VIS")),"SET")
60 Q
61 ;
62SCE(DGOE,PC,NODE,ZXERR) ; Returns the specific piece or entire node of the enctr
63 ; NODE = the node to return ... if undefined, the 0-node is assumed
64 ; If PC is null or undefined, the whole node is returned, otherwise
65 ; just the PC-piece is returned
66 ; DGERR = the name of the array where errors should be passed back in
67 ; (pass in quotes I.E.: "DGERR"). If no name passed, errors are
68 ; not returned
69 N DGX
70 S:$G(NODE)="" NODE=0
71 D GETGEN^SDOE(DGOE,"DGX",$G(ZXERR))
72 I $G(ZXERR)="" K ^TMP("DIERR",$J)
73 S DGX=$S($G(PC):$P($G(DGX(NODE)),U,+PC),1:$G(DGX(NODE)))
74 Q DGX
75 ;
Note: See TracBrowser for help on using the repository browser.