source: WorldVistAEHR/trunk/r/RADIOLOGY_NUCLEAR_MEDICINE-RA/RACTRG5.m@ 619

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

initial load of WorldVistAEHR

File size: 9.2 KB
Line 
1RACTRG5 ; ;01/02/09
2 D DE G BEGIN
3DE S DIE="^RADPT(D0,""DT"",D1,""P"",",DIC=DIE,DP=70.03,DL=3,DIEL=2,DU="" K DG,DE,DB Q:$O(^RADPT(D0,"DT",D1,"P",DA,""))=""
4 I $D(^(0)) S %Z=^(0) S %=$P(%Z,U,4) S:%]"" DE(5)=% S %=$P(%Z,U,6) S:%]"" DE(23)=%,DE(26)=% S %=$P(%Z,U,7) S:%]"" DE(29)=%,DE(32)=% S %=$P(%Z,U,8) S:%]"" DE(16)=% S %=$P(%Z,U,9) S:%]"" DE(11)=% S %=$P(%Z,U,11) S:%]"" DE(1)=%
5 I S %=$P(%Z,U,14) S:%]"" DE(2)=% S %=$P(%Z,U,18) S:%]"" DE(3)=% S %=$P(%Z,U,19) S:%]"" DE(35)=%,DE(38)=% S %=$P(%Z,U,21) S:%]"" DE(40)=% S %=$P(%Z,U,22) S:%]"" DE(41)=%
6 I $D(^("R")) S %Z=^("R") S %=$P(%Z,U,1) S:%]"" DE(8)=%
7 K %Z Q
8 ;
9W W !?DL+DL-2,DLB_": "
10 Q
11O 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
14TR R X:DTIME E S (DTOUT,X)=U W $C(7)
15 Q
16A K DQ(DQ) S DQ=DQ+1
17B G @DQ
18RE G PR:$D(DE(DQ)) D W,TR
19N I X="" G NKEY:$D(^DD("KEY","F",DP,DIFLD)),A:DV'["R",X:'DV,X:D'>0,A
20RD 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
23T 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
25P 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
28V D @("X"_DQ) K YS
29Z 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
30X W:'$D(ZTQUEUED) $C(7),"??" I $D(DB(DQ)) G Z^DIE17
31 S X="?BAD"
32QS S DZ=X D D,QQ^DIEQ G B
33D S D=DIFLD,DQ(DQ)=DLB_U_DV_U_DU_U_DW_U_$P($T(@("X"_DQ))," ",2,99) Q
34Y I '$D(DE(DQ)) D O G RD:"@"'[X,A:DV'["R"&(X="@"),X:X="@" S X=Y G N
35PR S DG=DV,Y=DE(DQ),X=DU I $D(DQ(DQ,2)) X DQ(DQ,2) G RP
36R 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=%
39RP D O I X="" S X=DE(DQ) G A:'DV,A:DC<2,N^DIE17
40I I DV'["I",DV'["#" G RD
41 D E^DIE0 G RD:$D(X),PR
42 Q
43SET 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
47SAVEVALS 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
51NKEY W:'$D(ZTQUEUED) "?? Required key field" S X="?BAD" G QS
52KEYCHK() Q:$G(DE(DW,"KEY"))="" 1 Q @DE(DW,"KEY")
53BEGIN S DNM="RACTRG5",DQ=1
541 S DW="0;11",DV="P75.1'",DU="",DLB="IMAGING ORDER",DIFLD=11
55 S DE(DW)="C1^RACTRG5"
56 S DU="RAO(75.1,"
57 S X=RAOIFN
58 S Y=X
59 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)
60 G RD:X="@",Z
61C1 G C1S:$D(DE(1))[0 K DB
62 S X=DE(1),DIC=DIE
63 K ^RADPT("AO",$E(X,1,30),DA(2),DA(1),DA)
64C1S S X="" G:DG(DQ)=X C1F1 K DB
65 S X=DG(DQ),DIC=DIE
66 S ^RADPT("AO",$E(X,1,30),DA(2),DA(1),DA)=""
67C1F1 Q
68X1 Q
692 D:$D(DG)>9 F^DIE17,DE S DQ=2,DW="0;14",DV="R*P200'X",DU="",DLB="REQUESTING PHYSICIAN",DIFLD=14
70 S DU="VA(200,"
71 S X=$S($D(RAPIFN):RAPIFN,1:"")
72 S Y=X
73 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)
74 G RD:X="@",Z
75X2 Q
763 S DW="0;18",DV="*P78.6'",DU="",DLB="PRIMARY CAMERA/EQUIP/RM",DIFLD=18
77 S DU="RA(78.6,"
78 S X=$S($P(RAPX(RACNI),U,15)]"":$P(RAPX(RACNI),U,15),1:"")
79 S Y=X
80 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)
81 G RD:X="@",Z
82X3 Q
834 S DQ=5 ;@20
845 S DW="0;4",DV="RSX",DU="",DLB="CATEGORY OF EXAM",DIFLD=4
85 S DU="I:INPATIENT;O:OUTPATIENT;C:CONTRACT;S:SHARING;E:EMPLOYEE;R:RESEARCH;"
86 S X=RACAT
87 S Y=X
88 G Y
89X5 I $D(X),$E(X)="I" S DFN=DA(2),VAINDT=9999999.9999-DA(1) D ADM^VADPT2 I 'VADMVT K X W !?3,"Patient not an inpatient at registration time.",!
90 Q
91 ;
926 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
93X6 S RAX=$E(X),Y=$S(RAX="I":"@60",RAX="E":"@45",RAX="R":"@30","CS"[RAX:"@40",1:"@50") K RAX
94 Q
957 S DQ=8 ;@30
968 S DW="R;1",DV="FR",DU="",DLB="RESEARCH SOURCE",DIFLD=9.5
97 S X=$S($D(RARSH):RARSH,1:"")
98 S Y=X
99 G Y
100X8 K:$L(X)>40!($L(X)<3) X
101 I $D(X),X'?.ANP K X
102 Q
103 ;
1049 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=9 D X9 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
105X9 S Y=$S($D(RAWARD):"@60",1:"@50")
106 Q
10710 S DQ=11 ;@40
10811 S DW="0;9",DV="*P34'R",DU="",DLB="CONTRACT/SHARING SOURCE",DIFLD=9
109 S DU="DIC(34,"
110 S X=$S($D(RASHA):RASHA,1:"")
111 S Y=X
112 G Y
113X11 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
114 Q
115 ;
11612 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
117X12 S Y="@100"
118 Q
11913 S DQ=14 ;@45
12014 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
121X14 S:$D(RAWARD) Y="@60"
122 Q
12315 S DQ=16 ;@50
12416 S DW="0;8",DV="*P44'R",DU="",DLB="PRINCIPAL CLINIC",DIFLD=8
125 S DU="SC("
126 S X=$S($D(RACLNC):RACLNC,1:"")
127 S Y=X
128 G Y
129X16 S DIC("S")="I $P(^(0),U,3)=""C""" D ^DIC K DIC S DIC=DIE,X=+Y K:Y<0 X
130 Q
131 ;
13217 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
133X17 S RACLNC=$P(^SC(X,0),U)
134 Q
13518 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
136X18 S Y="@100"
137 Q
13819 S DQ=20 ;@60
13920 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
140X20 S:'$D(RAWARD) RAWARD="Unknown" S:'$D(RASER) RASER="Unknown" S:'$D(RABED) RABED="Unknown"
141 Q
14221 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=21 D X21 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
143X21 W !?5,"Ward: ",RAWARD," Service: ",RASER," Bedsection: ",RABED
144 Q
14522 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
146X22 I RAWARD'="Unknown" S Y="@66"
147 Q
14823 S DW="0;6",DV="P42'R",DU="",DLB="WARD",DIFLD=6
149 S DU="DIC(42,"
150 G RE
151X23 Q
15224 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=24 D X24 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
153X24 S Y="@68"
154 Q
15525 S DQ=26 ;@66
15626 S DW="0;6",DV="P42'",DU="",DLB="WARD",DIFLD=6
157 S DU="DIC(42,"
158 S X=RAWARD
159 S Y=X
160 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)
161 G RD
162X26 Q
16327 S DQ=28 ;@68
16428 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=28 D X28 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
165X28 I RASER'="Unknown" S Y="@80"
166 Q
16729 S DW="0;7",DV="P49'R",DU="",DLB="SERVICE",DIFLD=7
168 S DU="DIC(49,"
169 G RE
170X29 Q
17130 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=30 D X30 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
172X30 S Y="@85"
173 Q
17431 S DQ=32 ;@80
17532 S DW="0;7",DV="P49'",DU="",DLB="SERVICE",DIFLD=7
176 S DU="DIC(49,"
177 S X=RASER
178 S Y=X
179 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)
180 G RD
181X32 Q
18233 S DQ=34 ;@85
18334 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=34 D X34 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
184X34 I RABED'="Unknown" S Y="@95"
185 Q
18635 S DW="0;19",DV="P42.4'R",DU="",DLB="BEDSECTION",DIFLD=19
187 S DU="DIC(42.4,"
188 G RE
189X35 Q
19036 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=36 D X36 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
191X36 S Y="@100"
192 Q
19337 S DQ=38 ;@95
19438 S DW="0;19",DV="P42.4'",DU="",DLB="BEDSECTION",DIFLD=19
195 S DU="DIC(42.4,"
196 S X=RABED
197 S Y=X
198 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)
199 G RD
200X38 Q
20139 S DQ=40 ;@100
20240 S DW="0;21",DV="D",DU="",DLB="REQUESTED DATE",DIFLD=21
203 S X=$S($D(RARDTE):RARDTE,1:"")
204 S Y=X
205 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)
206 G RD:X="@",Z
207X40 Q
20841 S DW="0;22",DV="P44'",DU="",DLB="REQUESTING LOCATION",DIFLD=22
209 S DU="SC("
210 S X=$S($D(RALIFN):RALIFN,1:"")
211 S Y=X
212 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)
213 G RD:X="@",Z
214X41 Q
21542 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=42 D X42 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
216X42 I '$D(^RAMIS(71,RAPRI,"F",0)) S Y="@300"
217 Q
21843 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=43 D X43 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
219X43 S RAI=0
220 Q
22144 S DQ=45 ;@200
22245 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=45 D X45 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
223X45 S RAI=$O(^RAMIS(71,RAPRI,"F",RAI)) S:RAI'>0!('$D(^(+RAI,0))) Y="@300"
224 Q
22546 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=46 D X46 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
226X46 S RAFM(1)=+^RAMIS(71,RAPRI,"F",RAI,0),RAFM1=+$P(^(0),U,2),RAFM=$S($D(^RA(78.4,RAFM(1),0)):$P(^(0),U),1:-1),RAFM=$S('$D(^("I")):RAFM,'^("I"):RAFM,1:-1) S:RAFM<0 Y="@200"
227 Q
22847 D:$D(DG)>9 F^DIE17 G ^RACTRG6
Note: See TracBrowser for help on using the repository browser.