source: FOIAVistA/trunk/r/ONCOLOGY-ONC/ONCOTN.m@ 1783

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

initial load of FOIAVistA 6/30/08 version

File size: 9.1 KB
Line 
1ONCOTN ;Hines OIFO/GWB - TNM Staging ;9/27/93
2 ;;2.11;ONCOLOGY;**1,3,6,7,11,15,19,22,25,28,29,35,36,37,41,42,43,44,46,47**;Mar 07, 1995;Build 19
3 S DATEDX=$P(^ONCO(165.5,D0,0),U,16)
4 N YR S YR=$E(DATEDX,1,3)
5 S ONCED=$S(YR<283:1,YR<288:2,YR<292:3,YR<298:4,YR<303:5,1:6)
6 S S=$P(^ONCO(165.5,D0,0),U,1)
7 S T=$P($G(^ONCO(165.5,D0,2)),U,1)
8 I T="" W !!?5,"PRIMARY SITE not defined.",! S Y=20 Q
9 S H=$$HIST^ONCFUNC(D0)
10 S Y=69
11 ;
12 ;Mycosis fungoides and Sezary Disease of Skin, Vulva, Penis, Scrotum
13 I (H=97003)!(H=97013),($E(T,3,4)=44)!($E(T,3,4)=51)!($E(T,3,4)=60)!(T=67632),ONCED>5 Q
14 ;
15 I (S=62)!($$LYMPHOMA^ONCFUNC(D0)) D S Y="@376" Q
16 .W !!?3,"No TNM classification is available for Lymphoid Neoplasms.",!
17 .D CTNM88,PTNM88
18 ;
19 I (T=67301)!(T=67339)!(T=67379)!($E(T,1,4)=6739)!(T=67630)!(T=67631)!(T=67637)!(T=67638)!(T=67639)!(T=67691)!($E(T,1,4)=6774)!(T=67750)!(T=67754)!(T=67755)!(T=67758)!(T=67759)!($E(T,1,4)=6776)!($E(T,1,4)=6726) D S Y="@313" Q
20 .W !!?3,"AJCC does not define staging for this site.",!
21 .D CTNM88,CSTG88,CSB,PTNM88,PSTG88,PSB
22 ;
23 I (T=67254)!(T=67312)!(T=67313)!(T=67318)!(T=67319) D S Y="@313" Q
24 .W !!?3,"AJCC does not define staging for this site.",!
25 .D CTNM88,CSTG88,CSB,PTNM88,PSTG88,PSB
26 ;
27 I ONCED>5,$$MELANOMA^ONCOU55(D0),($E(T,3,4)=44)!($E(T,3,4)=51)!($E(T,3,4)=60)!(T=67632),(H=87233)!(H=87283)!(H=87303)!(H=87403)!(H=87412)!(H=87413)!(H=87463)!(H=87703)!(H=87733)!(H=87743)!(H=87422) D S Y="@313" Q
28 .W !!?1,"Histology ",$E(H,1,4)_"/"_$E(H,5)," is not appropriate for or relevant to the staging of melanoma.",!
29 .D CTNM88,CSTG88,CSB,PTNM88,PSTG88,PSB
30 ;
31 I ONCED>5,(T=67140)!(T=67142)!(T=67148) D S Y="@313" Q
32 .W !!?3,"AJCC does not define staging for this site.",!
33 .D CTNM88,CSTG88,CSB,PTNM88,PSTG88,PSB
34 ;
35 I (T=67250)!($E(T,1,4)=6715)!($E(T,1,4)=6716)!($E(T,1,4)=6717)!($E(T,1,4)=6718),$E(H,1,4)=8936,ONCED>5 D S Y="@313" Q
36 .W !!," No TNM coding/staging available for GASTROINTESTINAL STROMA of ",$S($E(T,1,4)=6715:"ESOPHAGUS",$E(T,1,4)=6716:"STOMACH",$E(T,1,4)=6717:"SMALL INTESTINE",$E(T,1,4)=6718:"COLON",T=67250:"PANCREAS, HEAD",1:""),".",!
37 .D CTNM88,CSTG88,CSB,PTNM88,PSTG88,PSB
38 ;
39 I (T=67199)!(T=67209)!($E(T,3,4)=18)!($E(T,3,4)=21)!($E(T,3,4)=16)!($E(T,3,4)=17)!(T=67239)!($E(T,3,4)=24)!($E(T,3,4)=25),($E(H,1,4)=8240)!($E(H,1,4)=8241)!($E(H,1,4)=8242)!($E(H,1,4)=8243)!($E(H,1,4)=8249)!($E(H,1,4)=9091) D S Y="@313" Q
40 .W !!?3,"No TNM coding/staging is available for carcinoid tumors" D
41 ..I ($E(T,3,4)=16)!($E(T,3,4)=17)!($E(T,3,4)=18)!($E(T,3,4)=21)!(T=67239)!($E(T,3,4)=24)!(T=67241)!($E(T,3,4)=25) W !?3,"of the ",$P($G(^ONCO(164,T,0)),U,1),"."
42 ..W !
43 .D CTNM88,CSTG88,CSB,PTNM88,PSTG88,PSB
44 ;
45 I $E(T,1,4)=6734 D ^ONCLNG,^ONCLNG1 I $D(ONCLUNG(H)) D S Y="@313" Q
46 .W !!?3,"No TNM coding/staging available for sarcomas and rare tumors of the lung.",!
47 .D CTNM88,CSTG88,CSB,PTNM88,PSTG88,PSB
48 .K ONCLUNG
49 K ONCLUNG
50 ;
51 I (T=67380)!(T=67381)!(T=67382)!(T=67383)!(T=67388)!($E(T,1,4)=6747)!($E(T,1,4)=6748)!($E(T,1,4)=6749),(H=91203)!(H=89903) D S Y="@313" Q
52 .W !!?3,"No TNM coding/staging available for angiosarcoma or malignant mesenchymoma.",! D
53 .D CTNM88,CSTG88,CSB,PTNM88,PSTG88,PSB
54 ;
55 ;Fallopian Tube (C57.0)
56 ;Other/unspecified female genitalia (C57.1-C57.9)
57 I ((T=67570)&(ONCED<5))!(($E(T,1,4)=6757)&(T'=67570)) D S Y="@313" Q
58 .W !!?3,"AJCC does not define staging for this site.",!
59 .D CTNM88,CSTG88,CSB,PTNM88,PSTG88,PSB
60 ;
61 ;Paraurethral gland (C68.1)
62 ;Overlapping lesion of urinary organs (C68.8)
63 ;Urinary system, NOS (C68.9)
64 I ONCED>5,((T=67681)!(T=67688)!(T=67689)) D S Y="@313" Q
65 .W !!?3,"AJCC does not define staging for this site.",!
66 .D CTNM88,CSTG88,CSB,PTNM88,PSTG88,PSB
67 ;
68 ;Melanoma of the Eyelid
69 I ONCED<5,T=67441,$$MELANOMA^ONCOU55(D0) D S Y=37.2 Q
70 .W !!?3,"No classification is recommended at present.",!
71 .S $P(^ONCO(165.5,D0,2),U,25)=88
72 .W !,"CLINICAL T: T88 NA"
73 ;
74 ;Brain and Spinal Cord
75 I ONCED>4,(T=67700)!(T=67701)!(T=67709)!(T=67751)!(T=67752)!(T=67753)!($E(T,3,4)=71)!($E(T,3,4)=72) D S Y="@313" Q
76 .W !!?3,"Central Nervous System Tumors have no TNM designation.",!
77 .D CTNM88,CSTG88,CSB,PTNM88,PSTG88,PSB
78 ;
79 ;Kaposi's sarcoma
80 I H=91403 D S Y="@313" Q
81 .W !!?3,"No TNM classification or staging is available for Kaposi's sarcoma.",!
82 .D CTNM88,CSTG88,CSB,PTNM88,PSTG88,PSB
83 ;
84 I $P(^ONCO(164,T,0),U,11)="" D S Y="@313" Q
85 .W !!?3,"No stage grouping is presently recommended.",!
86 .D CTNM88,CSTG88,CSB,PTNM88,PSTG88,PSB
87 Q
88 ;
89CN2 ;GTT - clinical
90 S T=$P($G(^ONCO(165.5,D0,2)),U,1)
91 I T=67589 D S Y=37.3 Q
92 .W !!," Regional lymph node (N) classification does not apply to these tumors.",!
93 .S $P(^ONCO(165.5,D0,2),U,26)=88
94 .W !,"CLINICAL N: N88 NA"
95 Q
96 ;
97CN4 ;GTT - pathologic
98 S T=$P($G(^ONCO(165.5,D0,2)),U,1)
99 I T=67589 D S Y=87 Q
100 .W !!," Regional lymph node (N) classification does not apply to these tumors.",!
101 .S $P(^ONCO(165.5,D0,2.1),U,2)=88
102 .W !,"PATHOLOGIC N: N88 NA"
103 Q
104 ;
105CN5 ;GTT - other
106 S T=$P($G(^ONCO(165.5,D0,2)),U,1)
107 I T=67589 D S Y=99 Q
108 .W !!," Regional lymph node (N) classification does not apply to these tumors.",!
109 .S $P(^ONCO(165.5,D0,2.1),U,7)=88
110 .W !,"OTHER N: N88 NA"
111 Q
112 ;
113RECN ;GTT - Subsequent Recurrences - other
114 S T=$P($G(^ONCO(165.5,D0,2)),U,1)
115 I T=67589 D S Y=3 Q
116 .W !!," Regional lymph node (N) classification does not apply to these tumors.",!
117 .S $P(^ONCO(165.5,D0,23,D1,0),U,8)=88
118 .W !,"OTHER N: N88 NA"
119 Q
120 ;
121ES ;Automatic Staging
122 N YR S YR=$E($P($G(^ONCO(165.5,D0,0)),U,16),1,3)
123 S ONCED=$S(YR<283:1,YR<288:2,YR<292:3,YR<298:4,YR<303:5,1:6)
124 I ONCED<3 D Q
125 .W !!,"DATE DX prior to 1988. Automatic staging unavailable.",!
126 S STGTYP=$S(STGIND="C":"CLINICAL",STGIND="P":"PATHOLOGIC",STGIND="O":"OTHER",STGIND="R":"RECURRENCE",1:"")
127 S XX=$G(^ONCO(165.5,D0,2))
128 G EX:XX=""
129 S ST=$P(^ONCO(165.5,D0,0),U,1)
130 S G=$P(^ONCO(165.5,D0,2),U,5)
131 S TX=$P(^ONCO(165.5,D0,2),U,1)
132 S HT=$$HIST^ONCFUNC(D0)
133 S SP=$P($G(^ONCO(164,+TX,0)),U,11)
134 I STGIND="C" D
135 .S XXX=$G(^ONCO(165.5,D0,2))
136 .S T=$P(XXX,U,25)
137 .S N=$P(XXX,U,26)
138 .S M=$P(XXX,U,27)
139 I STGIND="P" D
140 .S XXX=$G(^ONCO(165.5,D0,2.1))
141 .S T=$P(XXX,U,1)
142 .S N=$P(XXX,U,2)
143 .S M=$P(XXX,U,3)
144 .I $E(M,1)'=1 D
145 ..S M=$P($G(^ONCO(165.5,D0,2)),U,27)
146 ..W !!?12,"CLINICAL M will be used to calculate PATHOLOGIC STAGE GROUPING."
147 I STGIND="O" D
148 .S XXX=$G(^ONCO(165.5,D0,2.1))
149 .S T=$P(XXX,U,6)
150 .S N=$P(XXX,U,7)
151 .S M=$P(XXX,U,8)
152 I STGIND="R" D
153 .S XXX=$G(^ONCO(165.5,D0,23,DA,0))
154 .S T=$P(XXX,U,6)
155 .S N=$P(XXX,U,7)
156 .S M=$P(XXX,U,8)
157 I T="" D G SG
158 .W !!?3,"No ",STGTYP," T category has been assigned."
159 .S SG=99
160 I N="",ST'=58 D G SG
161 .W !!?3,"No ",STGTYP," N category has been assigned."
162 .S SG=99
163 I M="" D G SG
164 .W !?3,"No ",STGTYP," M category has been assigned."
165 .S SG=99
166 ;
167 ;Melanoma of the Eyelid (C44.1)
168 I TX=67441,ONCED<5,$$MELANOMA^ONCOU55(D0) S AG=37 G AG
169 ;
170 ;Melanoma of the Skin
171 I $$MELANOMA^ONCOU55(D0),$P($G(^ONCO(164,+TX,0)),U,15) S AG=22 G AG
172 ;
173 ;GTT
174 I TX=67589 S AG=54 G AG
175 ;
176 ;Urethra (C68.9)
177 ;Urothelial (Transitional Cell) Carcinoma of the Prostate
178 I ONCED>4,TX=67619,(HT=81203)!(HT=81303)!(HT=81223)!(HT=81202) D G AG
179 .S AG=35
180 ;
181 ;Melanoma of the Conjunctiva
182 I $$MELANOMA^ONCOU55(D0),TX=67690 S AG=39 G AG
183 ;
184 ;Melanoma of the Uvea
185 I $$MELANOMA^ONCOU55(D0),((TX=67693)!(TX=67694)) S AG=40 G AG
186 ;
187 ;Lymphoid Neoplasms
188 ;Mycosis fungoides (9700/3)
189 ;Sezary Disease (9701/3)
190 I ONCED>5,(HT=97003)!(HT=97013) S AG=55 G AG
191 ;
192 S AG=$P($G(^ONCO(164,+TX,0)),U,12)
193 ;
194AG ;DO staging subroutine
195 S SG=99
196 I T=88,N=88,M=88 S SG=88 G SG
197 D @(AG_"^ONCOTN0")
198 W:SG=99 !!,?12,"TNM combination not in staging table."
199 ;
200SG ;Computed stage
201 I STGIND="C" S $P(^ONCO(165.5,D0,2),U,20)=SG
202 I STGIND="P" S $P(^ONCO(165.5,D0,2.1),U,4)=SG
203 I STGIND="O" S $P(^ONCO(165.5,D0,2.1),U,9)=SG
204 I STGIND="R" S $P(^ONCO(165.5,D0,23,DA,0),U,9)=SG
205 I SG'="" S X=SG D KSG^ONCOCRC D
206 .I STGIND="C" D CSSG^ONCOCRC Q
207 .I STGIND="P" D PSSG^ONCOCRC Q
208 S CMPFLG="COMPUTING TNM"
209 W !!?12,"Computed "_$S(STGIND="C":"CLINICAL",STGIND="P":"PATHOLOGIC",STGIND="O":"OTHER",STGIND="R":"RECURRENCE",1:"")," STAGE GROUPING: ",$$SGOUT^ONCOTNO(D0),!
210EX Q
211 ;
212CTNM88 ;CLINICAL TNM 88
213 S $P(^ONCO(165.5,D0,2),U,25)=88
214 S $P(^ONCO(165.5,D0,2),U,26)=88
215 S $P(^ONCO(165.5,D0,2),U,27)=88
216 W !,"CLINICAL T: T88 NA"
217 W !,"CLINICAL N: N88 NA"
218 W !,"CLINICAL M: M88 NA",!
219 S:$P($G(^ONCO(165.5,D0,7)),U,7)="" $P(^ONCO(165.5,D0,7),U,7)="0000000"
220 S:$P($G(^ONCO(165.5,D0,7)),U,14)="" $P(^ONCO(165.5,D0,7),U,14)="0000000"
221 Q
222 ;
223CSB I DATEDX>2951231 D
224 .S $P(^ONCO(165.5,D0,3),U,32)=0
225 .W !,"STAGED BY (CLINICAL STAGE): Not staged",!
226 Q
227 ;
228PTNM88 ;PATHOLOGIC TNM 88
229 S $P(^ONCO(165.5,D0,7),U,17)="N"
230 S $P(^ONCO(165.5,D0,2.1),U,1)=88
231 S $P(^ONCO(165.5,D0,2.1),U,2)=88
232 S $P(^ONCO(165.5,D0,2.1),U,3)=88
233 W !,"MULTIMODALITY THERAPY: NO"
234 W !,"PATHOLOGIC T: T88 NA"
235 W !,"PATHOLOGIC N: N88 NA"
236 W !,"PATHOLOGIC M: M88 NA",!
237 Q
238 ;
239PSB I DATEDX>2951231 D
240 .S $P(^ONCO(165.5,D0,2.1),U,5)=0
241 .W !,"STAGED BY (PATHOLOGIC STAGE): Not staged",!
242 Q
243 ;
244CSTG88 ;CLINICAL STAGE 88
245 S $P(^ONCO(165.5,D0,2),U,20)=88
246 W !,"STAGE GROUP CLINICAL: NA",!
247 S TMP=$G(X),X=88 D CSSG^ONCOCRC S X=TMP
248 Q
249 ;
250PSTG88 ;PATHOLOGIC STAGE 88
251 S $P(^ONCO(165.5,D0,2.1),U,4)=88
252 W !,"STAGE GROUP PATHOLOGIC: NA",!
253 S TMP=$G(X),X=88 D PSSG^ONCOCRC S X=TMP
254 Q
255 ;
256CN1 ;No longer used. Called by PCEs.
257CN3 ;No longer used. Called by PCEs.
258 Q
Note: See TracBrowser for help on using the repository browser.