source: FOIAVistA/tag/r/SCHEDULING-SD-SC/SDOEQ.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: 4.0 KB
Line 
1SDOEQ ;ALB/MJK - Encounter Query Object Methods ;8/12/96
2 ;;5.3;Scheduling;**131,132**;Aug 13, 1993
3 ;
4 ;
5OE0(SDOE) ; -- get only supported 0th node fields
6 N X
7 S X=$G(^SCE(SDOE,0))
8 ; -- null EXTENDED REFERENCE field (piece 9)
9 IF X]"" S $P(X,"^",9)=""
10 Q X
11 ;
12SDOE(SDOE,SDFIL,SDCB,SDSTOP) ; -- do filter and callback
13 N Y,Y0,SDOE0
14 S SDOE0=$$OE0(.SDOE)
15 ;
16 ; -- exit if null record
17 IF SDOE0="" G SDOEXQ
18 ;
19 ; -- execute filter
20 S Y=SDOE,Y0=SDOE0
21 X:SDFIL]"" SDFIL
22 ;
23 ; -- execute callback if passes filter
24 S Y=SDOE,Y0=SDOE0
25 IF $T X SDCB
26SDOEXQ Q
27 ;
28SCAN(SDQ,SDIR,SDERR) ; -- full scan of all needed records
29 N SDCB,SDSTOP,SDIDX,SDFIL,X,SDQDIR
30 S SDSTOP=0
31 S X=$G(SDIR),SDQDIR=$S(X="":"FORWARD",1:X)
32 D INDEX^SDQ(.SDQ,.SDIDX,"GET",$G(SDERR))
33 IF '$$ERRCHK^SDQUT($G(SDERR)) D SCANCB^SDQ(.SDQ,.SDCB,"GET",$G(SDERR))
34 IF '$$ERRCHK^SDQUT($G(SDERR)) D FILTER^SDQ(.SDQ,.SDFIL,"GET",$G(SDERR))
35 IF $$ERRCHK^SDQUT($G(SDERR)) G SCANQ
36 ;
37 IF SDIDX="PATIENT/DATE" D SCANPDT
38 IF SDIDX="VISIT" D SCANVST
39 IF SDIDX="PATIENT" D SCANPAT
40 IF SDIDX="DATE/TIME" D SCANDT
41 ;
42SCANQ Q
43 ;
44SCANPDT ; -- scan by patient and date
45 N SDFN,SDBEG,SDEND,SDDT,SDOE
46 D PAT^SDQ(.SDQ,.SDFN,"GET",$G(SDERR))
47 IF '$$ERRCHK^SDQUT($G(SDERR)) D DATE^SDQ(.SDQ,.SDBEG,.SDEND,"GET",$G(SDERR))
48 IF $$ERRCHK^SDQUT($G(SDERR)) G SCANPDTQ
49 ;
50 IF SDQDIR="FORWARD" D
51 . S SDDT=SDBEG-.000001
52 . F S SDDT=$O(^SCE("ADFN",SDFN,SDDT)) Q:'SDDT!(SDDT>SDEND) D Q:SDSTOP
53 . . S SDOE=""
54 . . F S SDOE=$O(^SCE("ADFN",SDFN,SDDT,SDOE)) Q:SDOE="" D SDOE(.SDOE,.SDFIL,.SDCB,.SDSTOP) Q:SDSTOP
55 . ;
56 ELSE D
57 . S SDDT=SDEND+.000001
58 . F S SDDT=$O(^SCE("ADFN",SDFN,SDDT),-1) Q:'SDDT!(SDDT<SDBEG) D Q:SDSTOP
59 . . S SDOE=""
60 . . F S SDOE=$O(^SCE("ADFN",SDFN,SDDT,SDOE),-1) Q:SDOE="" D SDOE(.SDOE,.SDFIL,.SDCB,.SDSTOP) Q:SDSTOP
61 ;
62SCANPDTQ Q
63 ;
64SCANVST ; -- scan by visit
65 N SDVSIT,SDOE
66 S SDSTOP=0
67 D VISIT^SDQ(.SDQ,.SDVSIT,"GET",$G(SDERR))
68 IF $$ERRCHK^SDQUT($G(SDERR)) G SCANVSTQ
69 ;
70 IF SDQDIR="FORWARD" D
71 . S SDOE=""
72 . F S SDOE=$O(^SCE("AVSIT",SDVSIT,SDOE)) Q:SDOE="" D SDOE(.SDOE,.SDFIL,.SDCB,.SDSTOP) Q:SDSTOP
73 . ;
74 ELSE D
75 . S SDOE=""
76 . F S SDOE=$O(^SCE("AVSIT",SDVSIT,SDOE),-1) Q:SDOE="" D SDOE(.SDOE,.SDFIL,.SDCB,.SDSTOP) Q:SDSTOP
77 ;
78SCANVSTQ Q
79 ;
80SCANDT ; -- date only scan
81 N SDDT,SDBEG,SDEND,SDOE
82 D DATE^SDQ(.SDQ,.SDBEG,.SDEND,"GET",$G(SDERR))
83 IF $$ERRCHK^SDQUT($G(SDERR)) G SCANDTQ
84 ;
85 IF SDQDIR="FORWARD" D
86 . S SDDT=SDBEG-.000001
87 . F S SDDT=$O(^SCE("B",SDDT)) Q:SDDT=""!(SDDT>SDEND) D Q:SDSTOP
88 . . S SDOE=""
89 . . F S SDOE=$O(^SCE("B",SDDT,SDOE)) Q:SDOE="" D SDOE(.SDOE,.SDFIL,.SDCB,.SDSTOP) Q:SDSTOP
90 ;
91 ELSE D
92 . S SDDT=SDEND+.000001
93 . F S SDDT=$O(^SCE("B",SDDT),-1) Q:SDDT=""!(SDDT<SDBEG) D Q:SDSTOP
94 . . S SDOE=""
95 . . F S SDOE=$O(^SCE("B",SDDT,SDOE),-1) Q:SDOE="" D SDOE(.SDOE,.SDFIL,.SDCB,.SDSTOP) Q:SDSTOP
96 ;
97SCANDTQ Q
98 ;
99SCANPAT ; -- patient only scan
100 N SDFN,SDOE
101 S SDSTOP=0
102 D PAT^SDQ(.SDQ,.SDFN,"GET",$G(SDERR))
103 IF $$ERRCHK^SDQUT($G(SDERR)) G SCANPATQ
104 ;
105 IF SDQDIR="FORWARD" D
106 . S SDOE=""
107 . F S SDOE=$O(^SCE("C",SDFN,SDOE)) Q:SDOE="" D SDOE(.SDOE,.SDFIL,.SDCB,.SDSTOP) Q:SDSTOP
108 . ;
109 ELSE D
110 . S SDOE=""
111 . F S SDOE=$O(^SCE("C",SDFN,SDOE),-1) Q:SDOE="" D SDOE(.SDOE,.SDFIL,.SDCB,.SDSTOP) Q:SDSTOP
112 ;
113SCANPATQ Q
114 ;
115PAT(SDQ,SDFN,SDACT,SDERR) ; -- SDQ PATIENT
116 ; API ID: 81
117 ;
118 ;
119PATG ; -- goto entry point
120 ; -- do validation checks
121 IF '$$QRY^SDQVAL(.SDQ,$G(SDERR)) G PATQ
122 IF '$$ACTION^SDQVAL(.SDACT,$G(SDERR)) G PATQ
123 IF SDACT="SET",'$$QRYINACT^SDQVAL(.SDQ,$G(SDERR)) G PATQ
124 IF SDACT="SET",'$$PAT^SDQVAL(.SDFN,$G(SDERR)) G PATQ
125 ;
126 IF SDACT="SET" S @SDQUERY@(SDQ,"MASTER VALUE")=SDFN
127 IF SDACT="GET" S SDFN=$G(@SDQUERY@(SDQ,"MASTER VALUE"))
128PATQ Q
129 ;
130VISIT(SDQ,SDVST,SDACT,SDERR) ; -- SDQ VISIT
131 ; API ID: 84
132 ;
133 ;
134VISITG ; -- goto entry point
135 ; -- do validation checks
136 IF '$$QRY^SDQVAL(.SDQ,$G(SDERR)) G VISITQ
137 IF '$$ACTION^SDQVAL(.SDACT,$G(SDERR)) G VISITQ
138 IF SDACT="SET",'$$QRYINACT^SDQVAL(.SDQ,$G(SDERR)) G VISITQ
139 IF SDACT="SET",'$$VALVST^PXAPIOE(.SDVST,$G(SDERR)) G VISITQ
140 ;
141 IF SDACT="SET" S @SDQUERY@(SDQ,"MASTER VALUE")=SDVST
142 IF SDACT="GET" S SDVST=$G(@SDQUERY@(SDQ,"MASTER VALUE"))
143 ;
144VISITQ Q
145 ;
Note: See TracBrowser for help on using the repository browser.