BNITAXE ; IHS/CMI/LAB - taxonomy update community ;
;;1.0;BNI CPHD ACTIVITY DATASYSTEM;;DEC 20, 2006
;; ;
EP ;EP - CALLED FROM OPTION
D EN
Q
EOJ ;EP
D ^XBFMK
K BNIITEM,BNIX,BNITAXI,BNIITMI,BNIHIGH,BNITXLI
Q
;; ;
EN ;EP -- main entry point for
D EN^VALM("BNI TAXONOMY GENERIC EDIT")
D CLEAR^VALM1
D FULL^VALM1
W:$D(IOF) @IOF
D EOJ
Q
;
PAUSE ;EP
Q:$E(IOST)'="C"!(IO'=IO(0))
W ! S DIR(0)="EO",DIR("A")="Press enter to continue...." D ^DIR K DIR S:$D(DUOUT) DIRUT=1
Q
HDR ; -- header code
S VALMHDR(1)="Updating the "_BNITAXN_" taxonomy"
Q
;
INIT ; -- init variables and list array
I BNIFILE=60 D LAB Q
I $P(^ATXAX(BNITAXI,0),U,13) D CANDISP Q
K BNIITEM S BNIHIGH="",C=0
S BNIX=0 F S BNIX=$O(^ATXAX(BNITAXI,21,BNIX)) Q:BNIX'=+BNIX D
.S C=C+1
.S BNIITMI=$P(^ATXAX(BNITAXI,21,BNIX,0),U)
.I BNIFILE=9999999.05 S BNIITEM(C,0)=C_") "_BNIITMI I 1
.E S BNIITEM(C,0)=C_") "_$$VAL^XBDIQ1($P(^ATXAX(BNITAXI,0),U,15),BNIITMI,.01)
.S BNIITEM("IDX",C,C)=BNIITMI
.Q
S (VALMCNT,BNIHIGH)=C
Q
CANDISP ;
K BNIITEM S BNIHIGH="",C=0
S BNIX=0 F S BNIX=$O(^ATXAX(BNITAXI,21,BNIX)) Q:BNIX'=+BNIX D
.S C=C+1
.S BNIITEM(C,0)=C_") "_$P(^ATXAX(BNITAXI,21,BNIX,0),U)_"-"_$P(^ATXAX(BNITAXI,21,BNIX,0),U,2)
.S BNIITEM("IDX",C,C)=BNIX
.Q
S (VALMCNT,BNIHIGH)=C
Q
LAB ;
K BNIITEM S BNIHIGH="",C=0
S BNIX=0 F S BNIX=$O(^ATXLAB(BNITAXI,21,BNIX)) Q:BNIX'=+BNIX D
.S C=C+1
.S BNIITMI=$P(^ATXLAB(BNITAXI,21,BNIX,0),U)
.S BNIITEM(C,0)=C_") "_$P($G(^LAB(60,BNIITMI,0)),U)
.S BNIITEM("IDX",C,C)=BNIITMI
.Q
S (VALMCNT,BNIHIGH)=C
Q
;
HELP ; -- help code
S X="?" D DISP^XQORM1 W !!
Q
;
EXIT ; -- exit code
Q
;
EXPND ; -- expand code
Q
;
BACK ;go back to listman
D TERM^VALM0
S VALMBCK="R"
D INIT
D HDR
K DIR
K X,Y,Z,I
Q
;
REM ;
D FULL^VALM1
W !
I BNIFILE=60,$P(^ATXLAB(BNITAXI,0),U,22) W !!,"The ",$P(^ATXLAB(BNITAXI,0),U)," Taxonomy is READ ONLY.",!,"You can not update it." D PAUSE G REMX
I BNIFILE'=60,$P(^ATXAX(BNITAXI,0),U,22) W !!,"The ",$P(^ATXAX(BNITAXI,0),U)," Taxonomy is READ ONLY.",!,"You can not update it." D PAUSE G REMX
W ! K DIR
I BNIFILE'=60,$P(^ATXTYPE(BNITAXT,0),U,4)=1 D ICD9ADD G REMX
S DIR(0)="NO^1:"_BNIHIGH,DIR("A")="Remove Which Item"
D ^DIR K DIR S:$D(DUOUT) DIRUT=1
I Y="" W !,"No item selected." G REMX
I $D(DIRUT) W !,"No item selected." G REMX
S BNIITMI=BNIITEM("IDX",Y,Y)
;sure
I BNIFILE=60 K DIR S DIR(0)="Y",DIR("A")="Are you sure you want to remove the "_$P(^LAB(60,BNIITMI,0),U)_" lab test",DIR("B")="N" KILL DA D ^DIR KILL DIR
I BNITAXT K DIR D
.S DIR(0)="Y",DIR("A")="Are you sure you want to remove the "_$S(BNIFILE'=9999999.05:$$VAL^XBDIQ1($P(^ATXAX(BNITAXI,0),U,15),BNIITMI,.01),1:BNIITMI)_" "_$$VAL^XBDIQ1(9002226,BNITAXI,.15),DIR("B")="N" KILL DA D ^DIR KILL DIR
I 'Y G REM
I $D(DIRUT) G REMX
D ^XBFMK
I BNIFILE=60 S DA(1)=BNITAXI,DA=$O(^ATXLAB(BNITAXI,21,"B",BNIITMI,0)),DIE="^ATXLAB("_BNITAXI_",21,",DR=".01///@" D ^DIE
I BNIFILE'=60 S DA(1)=BNITAXI,DA=$O(^ATXAX(BNITAXI,21,"B",BNIITMI,0)),DIE="^ATXAX("_BNITAXI_",21,",DR=".01///@" D ^DIE
REMX ;
D ^XBFMK
D BACK
Q
ADD ;EP - add an item to the selected list - called from a protocol
D FULL^VALM1
W !
I BNIFILE=60,$P(^ATXLAB(BNITAXI,0),U,22) W !!,"The ",$P(^ATXLAB(BNITAXI,0),U)," is READ ONLY.",!,"You can not update it." D PAUSE G ADDX
I BNIFILE'=60,$P(^ATXAX(BNITAXI,0),U,22) W !!,"The ",$P(^ATXAX(BNITAXI,0),U)," is READ ONLY.",!,"You can not update it." D PAUSE G ADDX
I BNIFILE=60 D LABADD G ADDX
I BNIFILE=80 D ICD9ADD G ADDX
I BNIFILE=80.1 D ICD0ADD G ADDX
I BNIFILE=81 D ICPTADD G ADDX
K DIC
S DIC(0)="AEMQ",DIC=$P(^ATXAX(BNITAXI,0),U,15) D ^DIC
I Y=-1 G ADDX
I $D(^ATXAX(BNITAXI,21,"B",$S(BNIFILE'=9999999.05:+Y,1:$P(^AUTTCOM(+Y,0),U,1)))) W !!,"That item is already in the taxonomy." H 2 G ADD
S DA=BNITAXI
S (X,BNITXLI)=+Y
I BNIFILE=9999999.05 S (X,BNITXLI)=$P(^AUTTCOM(+Y,0),U) ;special processing for community
S BNIFILE=$P(^ATXAX(BNITAXI,0),U,15)
S DA(1)=BNITAXI
S DIC="^ATXAX("_DA_",21,"
S DIC(0)="L",DIC("DR")=".02////"_BNITXLI K DD,DO
S:'$D(^ATXAX(DA,21,0)) ^ATXAX(DA,21,0)="^9002226.02101A"
D FILE^DICN
I '$D(^ATXAX(BNITAXI,21,"B",BNITXLI)) W !!,"adding ITEM failed." H 2 G ADD
G ADDX
LABADD ;
K DIC
S DIC(0)="AEMQ",DIC="^LAB(60,",DIC("A")="Which LAB Test: " D ^DIC
I Y=-1 G ADDX
I $D(^ATXLAB(BNITAXI,21,"B",+Y)) W !!,"Lab test ",$P(^LAB(60,+Y,0),U)," is already in the taxonomy." H 2 G ADD
S DA=BNITAXI
S (X,BNITXLI)=+Y
S DA(1)=BNITAXI
S DIC="^ATXLAB("_DA_",21,"
S DIC(0)="L" K DD,DO
S:'$D(^ATXLAB(DA,21,0)) ^ATXLAB(DA,21,0)="^9002228.02101PA"
D FILE^DICN
I '$D(^ATXLAB(BNITAXI,21,"B",BNITXLI)) W !!,"adding lab test failed." H 2 G ADD
ADDX ;
K DIC,DA,DR,BNITXLI,DD,DO
D BACK
Q
ICD9ADD ;
;D ICD9ADD^BNITAXF
Q
ICD0ADD ;
;D ICD0ADD^BNITAXH
Q
ICPTADD ;
;D ICPTADD^BNITAXL
Q
BNITAXE ; IHS/CMI/LAB - taxonomy update community ;
+1 ;;1.0;BNI CPHD ACTIVITY DATASYSTEM;;DEC 20, 2006
+2 ;; ;
EP ;EP - CALLED FROM OPTION
+1 DO EN
+2 QUIT
EOJ ;EP
+1 DO ^XBFMK
+2 KILL BNIITEM,BNIX,BNITAXI,BNIITMI,BNIHIGH,BNITXLI
+3 QUIT
+4 ;; ;
EN ;EP -- main entry point for
+1 DO EN^VALM("BNI TAXONOMY GENERIC EDIT")
+2 DO CLEAR^VALM1
+3 DO FULL^VALM1
+4 IF $DATA(IOF)
WRITE @IOF
+5 DO EOJ
+6 QUIT
+7 ;
PAUSE ;EP
+1 IF $EXTRACT(IOST)'="C"!(IO'=IO(0))
QUIT
+2 WRITE !
SET DIR(0)="EO"
SET DIR("A")="Press enter to continue...."
DO ^DIR
KILL DIR
IF $DATA(DUOUT)
SET DIRUT=1
+3 QUIT
HDR ; -- header code
+1 SET VALMHDR(1)="Updating the "_BNITAXN_" taxonomy"
+2 QUIT
+3 ;
INIT ; -- init variables and list array
+1 IF BNIFILE=60
DO LAB
QUIT
+2 IF $PIECE(^ATXAX(BNITAXI,0),U,13)
DO CANDISP
QUIT
+3 KILL BNIITEM
SET BNIHIGH=""
SET C=0
+4 SET BNIX=0
FOR
SET BNIX=$ORDER(^ATXAX(BNITAXI,21,BNIX))
IF BNIX'=+BNIX
QUIT
Begin DoDot:1
+5 SET C=C+1
+6 SET BNIITMI=$PIECE(^ATXAX(BNITAXI,21,BNIX,0),U)
+7 IF BNIFILE=9999999.05
SET BNIITEM(C,0)=C_") "_BNIITMI
IF 1
+8 IF '$TEST
SET BNIITEM(C,0)=C_") "_$$VAL^XBDIQ1($PIECE(^ATXAX(BNITAXI,0),U,15),BNIITMI,.01)
+9 SET BNIITEM("IDX",C,C)=BNIITMI
+10 QUIT
End DoDot:1
+11 SET (VALMCNT,BNIHIGH)=C
+12 QUIT
CANDISP ;
+1 KILL BNIITEM
SET BNIHIGH=""
SET C=0
+2 SET BNIX=0
FOR
SET BNIX=$ORDER(^ATXAX(BNITAXI,21,BNIX))
IF BNIX'=+BNIX
QUIT
Begin DoDot:1
+3 SET C=C+1
+4 SET BNIITEM(C,0)=C_") "_$PIECE(^ATXAX(BNITAXI,21,BNIX,0),U)_"-"_$PIECE(^ATXAX(BNITAXI,21,BNIX,0),U,2)
+5 SET BNIITEM("IDX",C,C)=BNIX
+6 QUIT
End DoDot:1
+7 SET (VALMCNT,BNIHIGH)=C
+8 QUIT
LAB ;
+1 KILL BNIITEM
SET BNIHIGH=""
SET C=0
+2 SET BNIX=0
FOR
SET BNIX=$ORDER(^ATXLAB(BNITAXI,21,BNIX))
IF BNIX'=+BNIX
QUIT
Begin DoDot:1
+3 SET C=C+1
+4 SET BNIITMI=$PIECE(^ATXLAB(BNITAXI,21,BNIX,0),U)
+5 SET BNIITEM(C,0)=C_") "_$PIECE($GET(^LAB(60,BNIITMI,0)),U)
+6 SET BNIITEM("IDX",C,C)=BNIITMI
+7 QUIT
End DoDot:1
+8 SET (VALMCNT,BNIHIGH)=C
+9 QUIT
+10 ;
HELP ; -- help code
+1 SET X="?"
DO DISP^XQORM1
WRITE !!
+2 QUIT
+3 ;
EXIT ; -- exit code
+1 QUIT
+2 ;
EXPND ; -- expand code
+1 QUIT
+2 ;
BACK ;go back to listman
+1 DO TERM^VALM0
+2 SET VALMBCK="R"
+3 DO INIT
+4 DO HDR
+5 KILL DIR
+6 KILL X,Y,Z,I
+7 QUIT
+8 ;
REM ;
+1 DO FULL^VALM1
+2 WRITE !
+3 IF BNIFILE=60
IF $PIECE(^ATXLAB(BNITAXI,0),U,22)
WRITE !!,"The ",$PIECE(^ATXLAB(BNITAXI,0),U)," Taxonomy is READ ONLY.",!,"You can not update it."
DO PAUSE
GOTO REMX
+4 IF BNIFILE'=60
IF $PIECE(^ATXAX(BNITAXI,0),U,22)
WRITE !!,"The ",$PIECE(^ATXAX(BNITAXI,0),U)," Taxonomy is READ ONLY.",!,"You can not update it."
DO PAUSE
GOTO REMX
+5 WRITE !
KILL DIR
+6 IF BNIFILE'=60
IF $PIECE(^ATXTYPE(BNITAXT,0),U,4)=1
DO ICD9ADD
GOTO REMX
+7 SET DIR(0)="NO^1:"_BNIHIGH
SET DIR("A")="Remove Which Item"
+8 DO ^DIR
KILL DIR
IF $DATA(DUOUT)
SET DIRUT=1
+9 IF Y=""
WRITE !,"No item selected."
GOTO REMX
+10 IF $DATA(DIRUT)
WRITE !,"No item selected."
GOTO REMX
+11 SET BNIITMI=BNIITEM("IDX",Y,Y)
+12 ;sure
+13 IF BNIFILE=60
KILL DIR
SET DIR(0)="Y"
SET DIR("A")="Are you sure you want to remove the "_$PIECE(^LAB(60,BNIITMI,0),U)_" lab test"
SET DIR("B")="N"
KILL DA
DO ^DIR
KILL DIR
+14 IF BNITAXT
KILL DIR
Begin DoDot:1
+15 SET DIR(0)="Y"
SET DIR("A")="Are you sure you want to remove the "_$SELECT(BNIFILE'=9999999.05:$$VAL^XBDIQ1($PIECE(^ATXAX(BNITAXI,0),U,15),BNIITMI,.01),1:BNIITMI)_" "_$$VAL^XBDIQ1(9002226,BNITAXI,.15)
SET DIR("B")="N"
KILL DA
DO ^DIR
KILL DIR
End DoDot:1
+16 IF 'Y
GOTO REM
+17 IF $DATA(DIRUT)
GOTO REMX
+18 DO ^XBFMK
+19 IF BNIFILE=60
SET DA(1)=BNITAXI
SET DA=$ORDER(^ATXLAB(BNITAXI,21,"B",BNIITMI,0))
SET DIE="^ATXLAB("_BNITAXI_",21,"
SET DR=".01///@"
DO ^DIE
+20 IF BNIFILE'=60
SET DA(1)=BNITAXI
SET DA=$ORDER(^ATXAX(BNITAXI,21,"B",BNIITMI,0))
SET DIE="^ATXAX("_BNITAXI_",21,"
SET DR=".01///@"
DO ^DIE
REMX ;
+1 DO ^XBFMK
+2 DO BACK
+3 QUIT
ADD ;EP - add an item to the selected list - called from a protocol
+1 DO FULL^VALM1
+2 WRITE !
+3 IF BNIFILE=60
IF $PIECE(^ATXLAB(BNITAXI,0),U,22)
WRITE !!,"The ",$PIECE(^ATXLAB(BNITAXI,0),U)," is READ ONLY.",!,"You can not update it."
DO PAUSE
GOTO ADDX
+4 IF BNIFILE'=60
IF $PIECE(^ATXAX(BNITAXI,0),U,22)
WRITE !!,"The ",$PIECE(^ATXAX(BNITAXI,0),U)," is READ ONLY.",!,"You can not update it."
DO PAUSE
GOTO ADDX
+5 IF BNIFILE=60
DO LABADD
GOTO ADDX
+6 IF BNIFILE=80
DO ICD9ADD
GOTO ADDX
+7 IF BNIFILE=80.1
DO ICD0ADD
GOTO ADDX
+8 IF BNIFILE=81
DO ICPTADD
GOTO ADDX
+9 KILL DIC
+10 SET DIC(0)="AEMQ"
SET DIC=$PIECE(^ATXAX(BNITAXI,0),U,15)
DO ^DIC
+11 IF Y=-1
GOTO ADDX
+12 IF $DATA(^ATXAX(BNITAXI,21,"B",$SELECT(BNIFILE'=9999999.05:+Y,1:$PIECE(^AUTTCOM(+Y,0),U,1))))
WRITE !!,"That item is already in the taxonomy."
HANG 2
GOTO ADD
+13 SET DA=BNITAXI
+14 SET (X,BNITXLI)=+Y
+15 ;special processing for community
IF BNIFILE=9999999.05
SET (X,BNITXLI)=$PIECE(^AUTTCOM(+Y,0),U)
+16 SET BNIFILE=$PIECE(^ATXAX(BNITAXI,0),U,15)
+17 SET DA(1)=BNITAXI
+18 SET DIC="^ATXAX("_DA_",21,"
+19 SET DIC(0)="L"
SET DIC("DR")=".02////"_BNITXLI
KILL DD,DO
+20 IF '$DATA(^ATXAX(DA,21,0))
SET ^ATXAX(DA,21,0)="^9002226.02101A"
+21 DO FILE^DICN
+22 IF '$DATA(^ATXAX(BNITAXI,21,"B",BNITXLI))
WRITE !!,"adding ITEM failed."
HANG 2
GOTO ADD
+23 GOTO ADDX
LABADD ;
+1 KILL DIC
+2 SET DIC(0)="AEMQ"
SET DIC="^LAB(60,"
SET DIC("A")="Which LAB Test: "
DO ^DIC
+3 IF Y=-1
GOTO ADDX
+4 IF $DATA(^ATXLAB(BNITAXI,21,"B",+Y))
WRITE !!,"Lab test ",$PIECE(^LAB(60,+Y,0),U)," is already in the taxonomy."
HANG 2
GOTO ADD
+5 SET DA=BNITAXI
+6 SET (X,BNITXLI)=+Y
+7 SET DA(1)=BNITAXI
+8 SET DIC="^ATXLAB("_DA_",21,"
+9 SET DIC(0)="L"
KILL DD,DO
+10 IF '$DATA(^ATXLAB(DA,21,0))
SET ^ATXLAB(DA,21,0)="^9002228.02101PA"
+11 DO FILE^DICN
+12 IF '$DATA(^ATXLAB(BNITAXI,21,"B",BNITXLI))
WRITE !!,"adding lab test failed."
HANG 2
GOTO ADD
ADDX ;
+1 KILL DIC,DA,DR,BNITXLI,DD,DO
+2 DO BACK
+3 QUIT
ICD9ADD ;
+1 ;D ICD9ADD^BNITAXF
+2 QUIT
ICD0ADD ;
+1 ;D ICD0ADD^BNITAXH
+2 QUIT
ICPTADD ;
+1 ;D ICPTADD^BNITAXL
+2 QUIT