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

ATXDELA.m

Go to the documentation of this file.
ATXDELA ; IHS/OHPRD/TMJ -  ICD CODES FOR A GIVEN TAXONOMY BEFORE MODIFICATION ; 
 ;;2.0;IHS PCC SUITE;;MAY 14, 2009
 ;
 W !!,"Delete a taxonomy created by any user.",!!
 S U="^",ATXDEL="",ATXFLG="" ;ATXDEL ALLOWS DELETING OF A TAXONOMY
 ;SINCE A DELETE NODE FOR THE TAXONOMY FILE CHECKS $D(ATXDEL)
 F ATXL=0:0 D START Q:ATXSTP
 D EOJ
 Q
 ;
START ;
 D ASK Q:ATXSTP
 Q
 ;
ASK ;
 S ATXSTP=0
 S DIC="^ATXAX(",DIC(0)="AEMQ",DIC("DR")="",DIC("S")="I $P(^(0),U,4)=""""" D ^DIC K DIC
 I Y<1 S ATXSTP=1 Q
 W !,$C(7),"Are you sure you want to delete this entire taxonomy" S %=1 D YN^DICN
 I %=1 S ATXX=+Y,ATXQT="" D TSKMN Q
 I %=2 Q
 I %=0 G ASK
 I %=-1 S ATXSTP=1 Q
 Q
 ;
TSKMN ;
 W !!,"deleting taxonomy...hold on"
 D DFNS
 D CALLDIK
 K ^TMP("ATXTAX",ATXX)
 I $D(ZTQUEUED) S ZTREQ="@"
 K ATXLOV,ATXHIVO,ATXHI,ATXDFN,ATXQT,ATXX,ATXSS
 Q
 ;
DFNS ;GET LO AND HIGH DFNS FOR THIS TAXONOMY
 Q:$P(^ATXAX(ATXX,0),U,15)'=80
 ;S ATXSS=0 F ATXL=0:0 S ATXSS=$O(^ATXAX(ATXX,21,ATXSS)) Q:ATXSS'=+ATXSS  S ATXLOV=$P(^(ATXSS,0),U)_" ",ATXHIV=$P(^(0),U,2)_" " D GETVAL
 S ATXSS=0 F ATXL=0:0 S ATXSS=$O(^ATXAX(ATXX,21,ATXSS)) Q:ATXSS'=+ATXSS  S ATXLOV=$P(^(ATXSS,0),U) S:ATXLOV'[" " ATXLOV=ATXLOV_" " S ATXHIV=$P(^(0),U,2) S:ATXHIV'[" " ATXHIV=ATXHIV_" " D GETVAL
 Q
 ;
GETVAL ;GET RANGE OF DFNS
 S ATXDFN=$O(^ICD9("BA",ATXLOV,"")) D DIEDELT
 Q:'ATXHIV!(ATXHIV=ATXLOV)
 F  S ATXLOV=$O(^ICD9("BA",ATXLOV)) Q:ATXLOV](ATXHIV)!(ATXLOV="")  S ATXDFN=$O(^ICD9("BA",ATXLOV,"")) D DIEDELT
 Q
 ;
DIEDELT ;
 Q:'$D(^ICD9(ATXDFN,9999999.41,ATXX,0))#2
 S DIE="^ICD9(",DR="9999999.41///"_"`"_ATXX,DR(2,80.999999941)=".01///@",DA=ATXDFN D ^DIE K DIE
 Q
 ;
CALLDIK ;
 ;I $P(^ATXAX(ATXX,0),U,7) S DIK="^XMB(3.6,",DA=$P(^(0),U,7) D ^DIK K DIK
 S DIK="^ATXAX(",DA=ATXX D ^DIK K DIK
 S DIK="^ATXPAT(",DA=ATXX D ^DIK K DIK
 Q
 ;
EOJ ;
 K ATXLOV,ATXHIV,ATXLO,ATXHI,ATXDFN,ATXL,ATXQT,ATXX,ATXDEL,ATXSS,ATXSTP,ATXFLG
 Q
 ;