1 | RACTOE3 ; ;01/02/09
|
---|
2 | D DE G BEGIN
|
---|
3 | DE S DIE="^RAO(75.1,",DIC=DIE,DP=75.1,DL=1,DIEL=0,DU="" K DG,DE,DB Q:$O(^RAO(75.1,DA,""))=""
|
---|
4 | I $D(^(0)) S %Z=^(0) S %=$P(%Z,U,4) S:%]"" DE(2)=% S %=$P(%Z,U,5) S:%]"" DE(33)=% S %=$P(%Z,U,9) S:%]"" DE(8)=% S %=$P(%Z,U,12) S:%]"" DE(13)=% S %=$P(%Z,U,13) S:%]"" DE(19)=% S %=$P(%Z,U,14) S:%]"" DE(1)=% S %=$P(%Z,U,17) S:%]"" DE(23)=%
|
---|
5 | I S %=$P(%Z,U,18) S:%]"" DE(34)=% S %=$P(%Z,U,21) S:%]"" DE(26)=%,DE(30)=% S %=$P(%Z,U,22) S:%]"" DE(10)=%
|
---|
6 | I $D(^("R")) S %Z=^("R") S %=$P(%Z,U,1) S:%]"" DE(5)=%
|
---|
7 | K %Z Q
|
---|
8 | ;
|
---|
9 | W W !?DL+DL-2,DLB_": "
|
---|
10 | Q
|
---|
11 | O D W W Y W:$X>45 !?9
|
---|
12 | I $L(Y)>19,'DV,DV'["I",(DV["F"!(DV["K")) G RW^DIR2
|
---|
13 | W:Y]"" "// " I 'DV,DV["I",$D(DE(DQ))#2 S X="" W " (No Editing)" Q
|
---|
14 | TR R X:DTIME E S (DTOUT,X)=U W $C(7)
|
---|
15 | Q
|
---|
16 | A K DQ(DQ) S DQ=DQ+1
|
---|
17 | B G @DQ
|
---|
18 | RE G PR:$D(DE(DQ)) D W,TR
|
---|
19 | N I X="" G NKEY:$D(^DD("KEY","F",DP,DIFLD)),A:DV'["R",X:'DV,X:D'>0,A
|
---|
20 | RD G QS:X?."?" I X["^" D D G ^DIE17
|
---|
21 | I X="@" D D G Z^DIE2
|
---|
22 | I X=" ",DV["d",DV'["P",$D(^DISV(DUZ,"DIE",DLB)) S X=^(DLB) I DV'["D",DV'["S" W " "_X
|
---|
23 | T G M^DIE17:DV,^DIE3:DV["V",P:DV'["S" X:$D(^DD(DP,DIFLD,12.1)) ^(12.1) I X?.ANP D SET I 'DDER X:$D(DIC("S")) DIC("S") I W:'$D(DB(DQ)) " "_% G V
|
---|
24 | K DDER G X
|
---|
25 | P I DV["P" S DIC=U_DU,DIC(0)=$E("EN",$D(DB(DQ))+1)_"M"_$E("L",DV'["'") S:DIC(0)["L" DLAYGO=+$P(DV,"P",2) G:DV["*" AST^DIED D NOSCR^DIED S X=+Y,DIC=DIE G X:X<0
|
---|
26 | G V:DV'["N" D D I $L($P(X,"."))>24 K X G Z
|
---|
27 | I $P(DQ(DQ),U,5)'["$",X?.1"-".N.1".".N,$P(DQ(DQ),U,5,99)["+X'=X" S X=+X
|
---|
28 | V D @("X"_DQ) K YS
|
---|
29 | Z K DIC("S"),DLAYGO I $D(X),X'=U D:$G(DE(DW,"INDEX")) SAVEVALS G:'$$KEYCHK UNIQFERR^DIE17 S DG(DW)=X S:DV["d" ^DISV(DUZ,"DIE",DLB)=X G A
|
---|
30 | X W:'$D(ZTQUEUED) $C(7),"??" I $D(DB(DQ)) G Z^DIE17
|
---|
31 | S X="?BAD"
|
---|
32 | QS S DZ=X D D,QQ^DIEQ G B
|
---|
33 | D S D=DIFLD,DQ(DQ)=DLB_U_DV_U_DU_U_DW_U_$P($T(@("X"_DQ))," ",2,99) Q
|
---|
34 | Y I '$D(DE(DQ)) D O G RD:"@"'[X,A:DV'["R"&(X="@"),X:X="@" S X=Y G N
|
---|
35 | PR S DG=DV,Y=DE(DQ),X=DU I $D(DQ(DQ,2)) X DQ(DQ,2) G RP
|
---|
36 | R I DG["P",@("$D(^"_X_"0))") S X=+$P(^(0),U,2) G RP:'$D(^(Y,0)) S Y=$P(^(0),U),X=$P(^DD(X,.01,0),U,3),DG=$P(^(0),U,2) G R
|
---|
37 | I DG["V",+Y,$P(Y,";",2)["(",$D(@(U_$P(Y,";",2)_"0)")) S X=+$P(^(0),U,2) G RP:'$D(^(+Y,0)) S Y=$P(^(0),U) I $D(^DD(+X,.01,0)) S DG=$P(^(0),U,2),X=$P(^(0),U,3) G R
|
---|
38 | X:DG["D" ^DD("DD") I DG["S" S %=$P($P(";"_X,";"_Y_":",2),";") S:%]"" Y=%
|
---|
39 | RP D O I X="" S X=DE(DQ) G A:'DV,A:DC<2,N^DIE17
|
---|
40 | I I DV'["I",DV'["#" G RD
|
---|
41 | D E^DIE0 G RD:$D(X),PR
|
---|
42 | Q
|
---|
43 | SET N DIR S DIR(0)="SV"_$E("o",$D(DB(DQ)))_U_DU,DIR("V")=1
|
---|
44 | I $D(DB(DQ)),'$D(DIQUIET) N DIQUIET S DIQUIET=1
|
---|
45 | D ^DIR I 'DDER S %=Y(0),X=Y
|
---|
46 | Q
|
---|
47 | SAVEVALS S @DIEZTMP@("V",DP,DIIENS,DIFLD,"O")=$G(DE(DQ)) S:$D(^("F"))[0 ^("F")=$G(DE(DQ))
|
---|
48 | I $D(DE(DW,"4/")) S @DIEZTMP@("V",DP,DIIENS,DIFLD,"4/")=""
|
---|
49 | E K @DIEZTMP@("V",DP,DIIENS,DIFLD,"4/")
|
---|
50 | Q
|
---|
51 | NKEY W:'$D(ZTQUEUED) "?? Required key field" S X="?BAD" G QS
|
---|
52 | KEYCHK() Q:$G(DE(DW,"KEY"))="" 1 Q @DE(DW,"KEY")
|
---|
53 | BEGIN S DNM="RACTOE3",DQ=1
|
---|
54 | 1 S DW="0;14",DV="R*P200'X",DU="",DLB="REQUESTING PHYSICIAN",DIFLD=14
|
---|
55 | S DU="VA(200,"
|
---|
56 | S X=RAPIFN
|
---|
57 | S Y=X
|
---|
58 | S X=Y,DB(DQ)=1,DE(DW,"4/")="" G:X="" N^DIE17:DV,A I $D(DE(DQ)),DV["I"!(DV["#") D E^DIE0 G A:'$D(X)
|
---|
59 | G RD:X="@",Z
|
---|
60 | X1 Q
|
---|
61 | 2 S DW="0;4",DV="SX",DU="",DLB="CATEGORY OF EXAM",DIFLD=4
|
---|
62 | S DU="I:INPATIENT;O:OUTPATIENT;C:CONTRACT;S:SHARING;E:EMPLOYEE;R:RESEARCH;"
|
---|
63 | S X=RACAT
|
---|
64 | S Y=X
|
---|
65 | G Y
|
---|
66 | X2 Q
|
---|
67 | 3 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=3 D X3 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
|
---|
68 | X3 S Y=$E(X),Y=$S(Y="R":"@30",(Y'="")&("CS"[Y):"@40",1:"@50")
|
---|
69 | Q
|
---|
70 | 4 S DQ=5 ;@30
|
---|
71 | 5 S DW="R;1",DV="FR",DU="",DLB="RESEARCH SOURCE",DIFLD=9.5
|
---|
72 | S X=$S($D(RARSH):RARSH,1:"")
|
---|
73 | S Y=X
|
---|
74 | G Y
|
---|
75 | X5 K:$L(X)>40!($L(X)<3) X
|
---|
76 | I $D(X),X'?.ANP K X
|
---|
77 | Q
|
---|
78 | ;
|
---|
79 | 6 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=6 D X6 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
|
---|
80 | X6 S Y="@50"
|
---|
81 | Q
|
---|
82 | 7 S DQ=8 ;@40
|
---|
83 | 8 S DW="0;9",DV="*P34'R",DU="",DLB="CONTRACT/SHARING SOURCE",DIFLD=9
|
---|
84 | S DU="DIC(34,"
|
---|
85 | S X=$S($D(RASHA):RASHA,1:"")
|
---|
86 | S Y=X
|
---|
87 | G Y
|
---|
88 | X8 S DIC("S")="I $S('$D(^(""I"")):1,'^(""I""):1,DT'>^(""I""):1,1:0)" D ^DIC K DIC S DIC=DIE,X=+Y K:Y<0 X
|
---|
89 | Q
|
---|
90 | ;
|
---|
91 | 9 S DQ=10 ;@50
|
---|
92 | 10 S DW="0;22",DV="P44'",DU="",DLB="REQUESTING LOCATION",DIFLD=22
|
---|
93 | S DU="SC("
|
---|
94 | S X=RALIFN
|
---|
95 | S Y=X
|
---|
96 | S X=Y,DB(DQ)=1,DE(DW,"4/")="" G:X="" N^DIE17:DV,A I $D(DE(DQ)),DV["I"!(DV["#") D E^DIE0 G A:'$D(X)
|
---|
97 | G RD:X="@",Z
|
---|
98 | X10 Q
|
---|
99 | 11 S DQ=12 ;@100
|
---|
100 | 12 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=12 D X12 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
|
---|
101 | X12 W !,"IS PATIENT SCHEDULED FOR PRE-OP" S %=2 D YN^DICN S:%<0 Y="@999" S:%=2 Y="@120" I '% W !!,"Enter 'YES' if patient is scheduled for pre-op, or 'NO' if not.",! S Y="@100"
|
---|
102 | Q
|
---|
103 | 13 S DW="0;12",DV="D",DU="",DLB="PRE-OP SCHEDULED DATE (TIME optional)",DIFLD=12
|
---|
104 | S X="TODAY"
|
---|
105 | S Y=X
|
---|
106 | G Y
|
---|
107 | X13 S %DT="ETX" D ^%DT S X=Y K:Y<1 X
|
---|
108 | Q
|
---|
109 | ;
|
---|
110 | 14 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=14 D X14 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
|
---|
111 | X14 S:$D(RAEXMUL) RAPREOP1=X
|
---|
112 | Q
|
---|
113 | 15 S DQ=16 ;@120
|
---|
114 | 16 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=16 D X16 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
|
---|
115 | X16 I RASEX="M" S Y="@130"
|
---|
116 | Q
|
---|
117 | 17 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=17 D X17 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
|
---|
118 | X17 I RASEX'="F" W !,"THE SEX OF THIS PATIENT IS NOT AVAILABLE. IS PATIENT FEMALE" S %=2 D YN^DICN S:%<0 Y="@999" S:%=2 Y="@130" I '% W !!,"Enter 'YES' if patient is female, or 'NO' if patient is male.",! S Y="@120"
|
---|
119 | Q
|
---|
120 | 18 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=18 D X18 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
|
---|
121 | X18 S RASEX="F"
|
---|
122 | Q
|
---|
123 | 19 S DW="0;13",DV="RS",DU="",DLB="PREGNANT",DIFLD=13
|
---|
124 | S DU="y:YES;n:NO;u:UNKNOWN;"
|
---|
125 | S X=$S($D(RAPREG):$$EXTERNAL^DILFD(75.1,13,"",RAPREG),1:"")
|
---|
126 | S Y=X
|
---|
127 | G Y
|
---|
128 | X19 Q
|
---|
129 | 20 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=20 D X20 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
|
---|
130 | X20 S RAPREG=X
|
---|
131 | Q
|
---|
132 | 21 S DQ=22 ;@130
|
---|
133 | 22 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=22 D X22 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
|
---|
134 | X22 I '$D(RAVSTFLG)!('$D(RAVLEDTI)) S Y="@135"
|
---|
135 | Q
|
---|
136 | 23 S DW="0;17",DV="D",DU="",DLB="PAST VISIT DATE/TIME",DIFLD=17
|
---|
137 | S X=9999999.9999-RAVLEDTI
|
---|
138 | S Y=X
|
---|
139 | S X=Y,DB(DQ)=1 G:X="" N^DIE17:DV,A I $D(DE(DQ)),DV["I"!(DV["#") D E^DIE0 G A:'$D(X)
|
---|
140 | G RD
|
---|
141 | X23 S %DT="TXR" D ^%DT S X=Y K:Y<1 X
|
---|
142 | Q
|
---|
143 | ;
|
---|
144 | 24 S DQ=25 ;@135
|
---|
145 | 25 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=25 D X25 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
|
---|
146 | X25 S:$D(RAWHEN)#2 Y="@145"
|
---|
147 | Q
|
---|
148 | 26 S DW="0;21",DV="DR",DU="",DLB="DATE DESIRED (Not guaranteed)",DIFLD=21
|
---|
149 | S DE(DW)="C26^RACTOE3"
|
---|
150 | G RE
|
---|
151 | C26 G C26S:$D(DE(26))[0 K DB
|
---|
152 | S X=DE(26),DIC=DIE
|
---|
153 | K ^RAO(75.1,"AP",+$P(^RAO(75.1,DA,0),U),+$P(^(0),U,2),9999999.9999-$E(X,1,30),DA)
|
---|
154 | C26S S X="" G:DG(DQ)=X C26F1 K DB
|
---|
155 | S X=DG(DQ),DIC=DIE
|
---|
156 | S ^RAO(75.1,"AP",+$P(^RAO(75.1,DA,0),U),+$P(^(0),U,2),9999999.9999-$E(X,1,30),DA)=""
|
---|
157 | C26F1 Q
|
---|
158 | X26 S %DT="ETX" D ^%DT S X=Y K:Y<1 X
|
---|
159 | Q
|
---|
160 | ;
|
---|
161 | 27 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=27 D X27 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
|
---|
162 | X27 S Y="@150"
|
---|
163 | Q
|
---|
164 | 28 S DQ=29 ;@145
|
---|
165 | 29 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=29 G A
|
---|
166 | 30 D:$D(DG)>9 F^DIE17,DE S DQ=30,DW="0;21",DV="DR",DU="",DLB="DATE DESIRED (Not guaranteed)",DIFLD=21
|
---|
167 | S DE(DW)="C30^RACTOE3"
|
---|
168 | S X=RAWHEN
|
---|
169 | S Y=X
|
---|
170 | G Y
|
---|
171 | C30 G C30S:$D(DE(30))[0 K DB
|
---|
172 | S X=DE(30),DIC=DIE
|
---|
173 | K ^RAO(75.1,"AP",+$P(^RAO(75.1,DA,0),U),+$P(^(0),U,2),9999999.9999-$E(X,1,30),DA)
|
---|
174 | C30S S X="" G:DG(DQ)=X C30F1 K DB
|
---|
175 | S X=DG(DQ),DIC=DIE
|
---|
176 | S ^RAO(75.1,"AP",+$P(^RAO(75.1,DA,0),U),+$P(^(0),U,2),9999999.9999-$E(X,1,30),DA)=""
|
---|
177 | C30F1 Q
|
---|
178 | X30 S %DT="ETX" D ^%DT S X=Y K:Y<1 X
|
---|
179 | Q
|
---|
180 | ;
|
---|
181 | 31 S DQ=32 ;@150
|
---|
182 | 32 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=32 D X32 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
|
---|
183 | X32 S:$D(RAEXMUL)#2 RAWHEN=$$FMTE^XLFDT(X,1)
|
---|
184 | Q
|
---|
185 | 33 D:$D(DG)>9 F^DIE17,DE S DQ=33,DW="0;5",DV="SX",DU="",DLB="REQUEST STATUS",DIFLD=5
|
---|
186 | S DE(DW)="C33^RACTOE3"
|
---|
187 | S DU="1:DISCONTINUED;2:COMPLETE;3:HOLD;5:PENDING;6:ACTIVE;8:SCHEDULED;11:UNRELEASED;"
|
---|
188 | S X=$S($D(RAPKG):5,$$ORVR^RAORDU()=2.5:11,1:5)
|
---|
189 | S Y=X
|
---|
190 | S X=Y,DB(DQ)=1,DE(DW,"4/")="" G:X="" N^DIE17:DV,A I $D(DE(DQ)),DV["I"!(DV["#") D E^DIE0 G A:'$D(X)
|
---|
191 | G RD:X="@",Z
|
---|
192 | C33 G C33S:$D(DE(33))[0 K DB
|
---|
193 | S X=DE(33),DIC=DIE
|
---|
194 | K ^RAO(75.1,"AS",+$P(^RAO(75.1,DA,0),U),X,DA)
|
---|
195 | S X=DE(33),DIC=DIE
|
---|
196 | ;
|
---|
197 | C33S S X="" G:DG(DQ)=X C33F1 K DB
|
---|
198 | S X=DG(DQ),DIC=DIE
|
---|
199 | S ^RAO(75.1,"AS",+$P(^RAO(75.1,DA,0),U),X,DA)=""
|
---|
200 | S X=DG(DQ),DIC=DIE
|
---|
201 | D:$$ORVR^RAORDU()=2.5&((X=1)!(X=3)) CH^RADD2(DA,X)
|
---|
202 | C33F1 Q
|
---|
203 | X33 Q
|
---|
204 | 34 D:$D(DG)>9 F^DIE17,DE S DQ=34,DW="0;18",DV="D",DU="",DLB="LAST ACTIVITY DATE/TIME",DIFLD=18
|
---|
205 | S DE(DW)="C34^RACTOE3"
|
---|
206 | S X="NOW"
|
---|
207 | S Y=X
|
---|
208 | S X=Y,DB(DQ)=1 G:X="" N^DIE17:DV,A I $D(DE(DQ)),DV["I"!(DV["#") D E^DIE0 G A:'$D(X)
|
---|
209 | G RD
|
---|
210 | C34 G C34S:$D(DE(34))[0 K DB
|
---|
211 | S X=DE(34),DIC=DIE
|
---|
212 | K ^RAO(75.1,"AO",$E(X,1,30),DA)
|
---|
213 | C34S S X="" G:DG(DQ)=X C34F1 K DB
|
---|
214 | S X=DG(DQ),DIC=DIE
|
---|
215 | S ^RAO(75.1,"AO",$E(X,1,30),DA)=""
|
---|
216 | C34F1 Q
|
---|
217 | X34 S %DT="TXR" D ^%DT S X=Y K:Y<1 X
|
---|
218 | Q
|
---|
219 | ;
|
---|
220 | 35 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=35 D X35 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
|
---|
221 | X35 S Y=$S('$D(^RA(79,+RADIV,.1)):"@160",$P(^(.1),"^",19)="y":"@155",1:"@160")
|
---|
222 | Q
|
---|
223 | 36 S DQ=37 ;@155
|
---|
224 | 37 D:$D(DG)>9 F^DIE17,DE S DQ=37,D=0 K DE(1) ;75
|
---|
225 | S DIFLD=75,DGO="^RACTOE4",DC="4^75.12DA^T^",DV="75.12D",DW="0;1",DOW="STATUS CHANGE DATE/TIME",DLB="Select "_DOW S:D DC=DC_D
|
---|
226 | I $D(DSC(75.12))#2,$P(DSC(75.12),"I $D(^UTILITY(",1)="" X DSC(75.12) S D=$O(^(0)) S:D="" D=-1 G M37
|
---|
227 | S D=$S($D(^RAO(75.1,DA,"T",0)):$P(^(0),U,3,4),$O(^(0))'="":$O(^(0)),1:-1)
|
---|
228 | M37 I D>0 S DC=DC_D I $D(^RAO(75.1,DA,"T",+D,0)) S DE(37)=$P(^(0),U,1)
|
---|
229 | S X="""NOW"""
|
---|
230 | S Y=X
|
---|
231 | S X=Y,DB(DQ)=1 G:X="" N^DIE17:DV,A I $D(DE(DQ)),DV["I"!(DV["#") D E^DIE0 G A:'$D(X)
|
---|
232 | G RD
|
---|
233 | R37 D DE
|
---|
234 | G A
|
---|
235 | ;
|
---|
236 | 38 S DQ=39 ;@160
|
---|
237 | 39 D:$D(DG)>9 F^DIE17 G ^RACTOE5
|
---|