Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: ONCOSUR3

ONCOSUR3.m

Go to the documentation of this file.
ONCOSUR3 ;HINES OIFO/RTK - ONCOSUR continued ;08/03/23
 ;;2.2;ONCOLOGY;**18,20**;Jul 31, 2013;Build 5
 ;
 Q
 ;
SPSIT23 ;Input transform for 2023+ surgery primary site fields (58.8,58.9)
 S X=$TR(X,"ab","AB")
 N TOP S TOP=$P($G(^ONCO(165.5,D0,2)),U,1) I TOP="" W "  No PRIMARY SITE" K X Q
 N ICD S ICD=""
 S HST14=$E($$GET1^DIQ(165.5,D0,22.1),1,4)
 I $$HEMATO^ONCFUNC(D0) S ICD=67420
 I ICD'=67420 S ICD=$P($G(^ONCO(164,TOP,0)),U,16) I ICD="" S Y="" Q
 S ONCEDVAL=""
 N COD S COD="" F  S COD=$O(^ONCO(164,ICD,"SPS","D",COD)) Q:COD=""  D
 .S ONCEDVAL=ONCEDVAL_"^"_COD
 I ONCEDVAL'[X K X Q
 S ONCCDIEN=$O(^ONCO(164,ICD,"SPS","D",X,"")) I ONCCDIEN="" W "??" K X Q
 W "  ",$P($G(^ONCO(164,ICD,"SPS",ONCCDIEN,0)),U,1)
 K ONCEDVAL,ONCCDIEN Q
 ;
SPSOT23 ;Output transform for 2023+ surgery primary site fields (58.8,58.9)
 N TOP S TOP=$P($G(^ONCO(165.5,D0,2)),U,1) I TOP="" Q
 N INTSRVAL
 I $G(FIELD)=58.8 S INTSRVAL=$P($G(^ONCO(165.5,D0,3.2)),U,8) I INTSRVAL="" Q
 I $G(FIELD)=58.9 S INTSRVAL=$P($G(^ONCO(165.5,D0,3.2)),U,9) I INTSRVAL="" Q
 N ICD S ICD=""
 S HST14=$E($$GET1^DIQ(165.5,D0,22.1),1,4)
 I $$HEMATO^ONCFUNC(D0) S ICD=67420
 I ICD'=67420 S ICD=$P($G(^ONCO(164,TOP,0)),U,16) I ICD="" Q
 S SRVALIEN=$O(^ONCO(164,ICD,"SPS","D",INTSRVAL,"")) I SRVALIEN="" Q
 S Y=$P($G(^ONCO(164,ICD,"SPS",SRVALIEN,0)),U,3)_" "_$P($G(^ONCO(164,ICD,"SPS",SRVALIEN,0)),U,1)
 Q
 ;
SPSHP23 ;Help for 2023+ surgery primary site fields (58.8,58.9)
 N SYSDIS S SYSDIS=""
 S TOP=$P($G(^ONCO(165.5,D0,2)),U,1) I TOP="" W !,"No PRIMARY SITE" Q
 S SCDXDT=$P($G(^ONCO(165.5,D0,0)),U,16) I SCDXDT="" Q
 D
 .S (EX,CTR)=0
 .S TOP=$P($G(^ONCO(165.5,D0,2)),U,1) I TOP="" W !,"No TOPOGRAPHY!" Q
 .S HST14=$E($$GET1^DIQ(165.5,D0,22.1),1,4)
 .I $$HEMATO^ONCFUNC(D0) S ICD=67420,SYSDIS=1
 .I SYSDIS="" S ICD=$P($G(^ONCO(164,TOP,0)),U,16) I ICD="" W !,"No ICD Codes!" Q
 .;I ($G(FIELD)=58.2)!($G(FIELD)=50.2),($E(TOP,3,4)=76)!(TOP=67809)!(TOP=67420)!(TOP=67421)!(TOP=67423)!(TOP=67424) S ICD=67141
 .;I ($G(FIELD)=58.2)!($G(FIELD)=50.2),TOP=67422 S ICD=67770
 .I $G(SYSDIS)=1 W !?3,"SURGICAL PROCEDURE codes for systemic disease: ",!
 .E  W !?3,"SURGICAL PROCEDURE codes for site ",$P($G(^ONCO(164,TOP,0)),U,2)," ",$P($G(^ONCO(164,TOP,0)),U,1),": ",!
 .S XSP="" F  S XSP=$O(^ONCO(164,ICD,"SPS","D",XSP)) Q:XSP=""  S SPSIEN=$O(^ONCO(164,ICD,"SPS","D",XSP,0)) D  Q:EX=U
 ..S ONCDESC=$P($G(^ONCO(164,ICD,"SPS",SPSIEN,0)),U,1)
 ..S ONCOLDCD=$P($G(^ONCO(164,ICD,"SPS",SPSIEN,0)),U,2)
 ..S ONC23CD=$P($G(^ONCO(164,ICD,"SPS",SPSIEN,0)),U,3)
 ..I ONC23CD="" Q
 ..S CTR=CTR+1 I CTR#20=0 D P Q:EX=U
 ..I (ICD=67000)!(ICD=67090)!(ICD=67250)!(ICD=67569) D TRANSLT
 ..W !?5,ONC23CD,?12,ONCDESC
 ..K ONCOLDCD,ONC23CD,ONCDESC Q
 W !
 K CTR,EX,HST14,ICD,SCDXDT,SPSIEN,TOP,XSP
 Q
 ;
TRANSLT ; Convert some 2 digit codes in description to new 4 character codes
 I ONCDESC["41" S ONCDESC=$P(ONCDESC,"41",1)_"A410"_$P(ONCDESC,"41",2)
 I ONCDESC["42" S ONCDESC=$P(ONCDESC,"42",1)_"A420"_$P(ONCDESC,"42",2)
 I ONCDESC["51" S ONCDESC=$P(ONCDESC,"51",1)_"A510"_$P(ONCDESC,"51",2)
 I ONCDESC["52" S ONCDESC=$P(ONCDESC,"52",1)_"A520"_$P(ONCDESC,"52",2)
 I ONCDESC["54" S ONCDESC=$P(ONCDESC,"54",1)_"A540"_$P(ONCDESC,"54",2)
 I ONCDESC["61" S ONCDESC=$P(ONCDESC,"61",1)_"A610"_$P(ONCDESC,"61",2)
 I ONCDESC["62" S ONCDESC=$P(ONCDESC,"62",1)_"A620"_$P(ONCDESC,"62",2)
 Q
P D  Q:EX=U  W !
 .W ! K DIR S DIR(0)="E" D ^DIR I 'Y S EX=U Q
 Q