PSSWRNC ;DAL/RJS-NEW WARNING SOURCE CUSTOM WARNING LIST BUILDER CONT;
;;1.0;PHARMACY DATA MANAGEMENT;**98**;10/12/05
;
;IA: 3735 ^PSNDF(50.68
;IA: 4445 ^PS(50.625
;IA: 4446 ^PS(50.626
;IA: 4448 ^PS(50.627
SEL1 ;
S DR=0 F S DR=$O(^PSDRUG(DR)) Q:'DR D
.I '$D(^PSDRUG(DR,0)) Q
.S WARN54=$P(^PSDRUG(DR,0),"^",8) I WARN54="" Q
.I SKIP,$P($G(^PSDRUG(DR,"WARN")),"^")'="" Q
.D ACTIVE^PSSWRNB I 'ACTIVE Q
.D DRUG^PSSWRNB I PSSWRN="" S ^TMP("PSSWRNB",$J,$P(^PSDRUG(DR,0),"^"))=WARN54_"^"_NDF
Q
SEL2 ;
S DR=0 F S DR=$O(^PSDRUG(DR)) Q:'DR D
.I '$D(^PSDRUG(DR,0)) Q
.S WARN54=$P(^PSDRUG(DR,0),"^",8) I WARN54="" Q
.I SKIP,$P($G(^PSDRUG(DR,"WARN")),"^")'="" Q
.D ACTIVE^PSSWRNB I 'ACTIVE Q
.F I=1:1:$L(WARN54,",") S WARN=$P(WARN54,",",I) I WARN>20 D
..I '$D(^PS(54,WARN)) Q
..S ^TMP("PSSWRNB",$J,$P(^PSDRUG(DR,0),"^"))=WARN54
Q
SEL3 ;
W ! K DIR S DIR(0)="FO^1:30",DIR("A")="Enter starting drug name" D ^DIR K DIR I Y["^"!(Y="") S QUIT=1 Q
S X=$$ENLU^PSSGMI(Y)
S DRUG=X
W ! K DIR S DIR(0)="FO^1:30",DIR("A")="Enter ending drug name" D ^DIR K DIR I Y["^"!(Y="") S QUIT=1 Q
S EDRUG=Y
W !!,"WARNINGS FOR DRUGS FROM "_DRUG_" TO "_EDRUG
W ! K DIR S DIR(0)="E" D ^DIR K DIR I 'Y S PSSOUT=1,QUIT=1 Q
I $D(^PSDRUG("B",DRUG)) S I=$L(DRUG),DRUG=$E(DRUG,1,I-1)
F S DRUG=$O(^PSDRUG("B",DRUG)) Q:DRUG="" Q:DRUG]EDRUG D
.S DR=$O(^PSDRUG("B",DRUG,0)) I DR="" Q
.I SKIP,$P($G(^PSDRUG(DR,"WARN")),"^")'="" Q
.D ACTIVE^PSSWRNB I 'ACTIVE Q
.S ^TMP("PSSWRNB",$J,DRUG)=""
Q
SEL4 ;
S DR=0 F S DR=$O(^PSDRUG(DR)) Q:'DR D
.I SKIP,$P($G(^PSDRUG(DR,"WARN")),"^")'="" Q
.D ACTIVE^PSSWRNB I 'ACTIVE Q
.D DRUG^PSSWRNB I PSSWRN="" Q
.N XX S XX=DR D CHECK20^PSSWRNA
.I $L(PSSWRN,",")>5 S ^TMP("PSSWRNB",$J,$P(^PSDRUG(DR,0),"^"))=PSSWRN
Q
SEL59 ;
S DIC=54,DIC(0)="AEQM",DIC("A")="Select drugs containing RX Consult number:" D ^DIC K DIC I Y<0 Q
S RXNUM=$P(Y,"^")
I '$D(^PS(54,RXNUM)) W !,RXNUM_" is not in the RX Consult file.",! K DIR S DIR(0)="E" D ^DIR K DIR I 'Y S PSSOUT=1 Q
I SEL=9,'$G(^PS(54,RXNUM,2)) W !,RXNUM," is not mapped to a new data source warning",! K DIR S DIR(0)="E" D ^DIR K DIR I 'Y S PSSOUT=1 Q
I SEL=9 S PSO9=$G(^PS(54,RXNUM,2))_"N" W " ",RXNUM," is mapped to ",PSO9 H 1
S DR=0 F S DR=$O(^PSDRUG(DR)) Q:'DR D
.I '$D(^PSDRUG(DR,0)) Q
.S WARN54=$P(^PSDRUG(DR,0),"^",8) I WARN54="" Q
.I SKIP,$P($G(^PSDRUG(DR,"WARN")),"^")'="" Q
.D ACTIVE^PSSWRNB I 'ACTIVE Q
.I ","_WARN54_","[(","_RXNUM_",") D
..I SEL=9 D DRUG^PSSWRNB I PSSWRN="" Q
..I SEL=9,","_PSSWRN_","[(","_PSO9_",") Q
..S ^TMP("PSSWRNB",$J,$P(^PSDRUG(DR,0),"^"))=WARN54
Q
SEL6 ;
S DR=0 F S DR=$O(^PSDRUG(DR)) Q:'DR D
.I '$D(^PSDRUG(DR,0)) Q
.S WARN54=$P(^PSDRUG(DR,0),"^",8) I WARN54="" Q
.I SKIP,$P($G(^PSDRUG(DR,"WARN")),"^")'="" Q
.D ACTIVE^PSSWRNB I 'ACTIVE Q
.F I=1:1:$L(WARN54,",") S WARN=$P(WARN54,",",I) I WARN,$D(^PS(54,WARN,1)),$G(^PS(54,WARN,2))="" D
..S ^TMP("PSSWRNB",$J,$P(^PSDRUG(DR,0),"^"))=WARN54
Q
SEL7 ;
W !! K DIR S DIR("A")="Select drugs containing New warning number"
S DIR("?",1)="Answer using format # or #N"
S DIR("?")="Example: 15 or 15N"
S DIR(0)="FO"
D ^DIR S RXNUM=Y
I Y="N"!(Y="n")!(Y="Y")!(Y="y") W !,$C(7),?5,RXNUM_" is not a valid entry" H 2 S QUIT=1 Q
I RXNUM["N"!(RXNUM["n") S RXNUM=$TR(RXNUM,"Nn","")
I RXNUM="^"!(RXNUM="")!(RXNUM=" ") S QUIT=1 Q
I '$D(^PS(50.625,RXNUM)) W !,$C(7),RXNUM_" is not in the New warning file" H 1 S QUIT=1 Q
W @IOF
W "Searching for drugs that contain new warning number "_RXNUM
S PSOWARN=RXNUM_"N",STAR="" D NEWWARN^PSSWRNE
K DIR S DIR(0)="E" D ^DIR K DIR I 'Y S PSSOUT=1 Q
S DR=0 F S DR=$O(^PSDRUG(DR)) Q:'DR D
.I SKIP,$P($G(^PSDRUG(DR,"WARN")),"^")'="" Q
.D ACTIVE^PSSWRNB I 'ACTIVE Q
.D DRUG^PSSWRNB I PSSWRN="" Q
.I ","_PSSWRN_","[(","_RXNUM_"N,") S ^TMP("PSSWRNB",$J,$P(^PSDRUG(DR,0),"^"))=PSSWRN
Q
SEL8 ;
N WARN,GEND
S WARN=0 F S WARN=$O(^PS(50.625,WARN)) Q:'WARN I $G(^PS(50.625,WARN,2))'="" S GEND(WARN_"N")=""
I $O(GEND(""))="" Q
S DR=0 F S DR=$O(^PSDRUG(DR)) Q:'DR D
.I SKIP,$P($G(^PSDRUG(DR,"WARN")),"^")'="" Q
.D ACTIVE^PSSWRNB I 'ACTIVE Q
.D DRUG^PSSWRNB I PSSWRN="" Q
.S WARN=0 F S WARN=$O(GEND(WARN)) Q:'WARN I ","_PSSWRN_","[(","_WARN_",") D
..S ^TMP("PSSWRNB",$J,$P(^PSDRUG(DR,0),"^"))=PSSWRN
Q
PSSWRNC ;DAL/RJS-NEW WARNING SOURCE CUSTOM WARNING LIST BUILDER CONT;
+1 ;;1.0;PHARMACY DATA MANAGEMENT;**98**;10/12/05
+2 ;
+3 ;IA: 3735 ^PSNDF(50.68
+4 ;IA: 4445 ^PS(50.625
+5 ;IA: 4446 ^PS(50.626
+6 ;IA: 4448 ^PS(50.627
SEL1 ;
+1 SET DR=0
FOR
SET DR=$ORDER(^PSDRUG(DR))
IF 'DR
QUIT
Begin DoDot:1
+2 IF '$DATA(^PSDRUG(DR,0))
QUIT
+3 SET WARN54=$PIECE(^PSDRUG(DR,0),"^",8)
IF WARN54=""
QUIT
+4 IF SKIP
IF $PIECE($GET(^PSDRUG(DR,"WARN")),"^")'=""
QUIT
+5 DO ACTIVE^PSSWRNB
IF 'ACTIVE
QUIT
+6 DO DRUG^PSSWRNB
IF PSSWRN=""
SET ^TMP("PSSWRNB",$JOB,$PIECE(^PSDRUG(DR,0),"^"))=WARN54_"^"_NDF
End DoDot:1
+7 QUIT
SEL2 ;
+1 SET DR=0
FOR
SET DR=$ORDER(^PSDRUG(DR))
IF 'DR
QUIT
Begin DoDot:1
+2 IF '$DATA(^PSDRUG(DR,0))
QUIT
+3 SET WARN54=$PIECE(^PSDRUG(DR,0),"^",8)
IF WARN54=""
QUIT
+4 IF SKIP
IF $PIECE($GET(^PSDRUG(DR,"WARN")),"^")'=""
QUIT
+5 DO ACTIVE^PSSWRNB
IF 'ACTIVE
QUIT
+6 FOR I=1:1:$LENGTH(WARN54,",")
SET WARN=$PIECE(WARN54,",",I)
IF WARN>20
Begin DoDot:2
+7 IF '$DATA(^PS(54,WARN))
QUIT
+8 SET ^TMP("PSSWRNB",$JOB,$PIECE(^PSDRUG(DR,0),"^"))=WARN54
End DoDot:2
End DoDot:1
+9 QUIT
SEL3 ;
+1 WRITE !
KILL DIR
SET DIR(0)="FO^1:30"
SET DIR("A")="Enter starting drug name"
DO ^DIR
KILL DIR
IF Y["^"!(Y="")
SET QUIT=1
QUIT
+2 SET X=$$ENLU^PSSGMI(Y)
+3 SET DRUG=X
+4 WRITE !
KILL DIR
SET DIR(0)="FO^1:30"
SET DIR("A")="Enter ending drug name"
DO ^DIR
KILL DIR
IF Y["^"!(Y="")
SET QUIT=1
QUIT
+5 SET EDRUG=Y
+6 WRITE !!,"WARNINGS FOR DRUGS FROM "_DRUG_" TO "_EDRUG
+7 WRITE !
KILL DIR
SET DIR(0)="E"
DO ^DIR
KILL DIR
IF 'Y
SET PSSOUT=1
SET QUIT=1
QUIT
+8 IF $DATA(^PSDRUG("B",DRUG))
SET I=$LENGTH(DRUG)
SET DRUG=$EXTRACT(DRUG,1,I-1)
+9 FOR
SET DRUG=$ORDER(^PSDRUG("B",DRUG))
IF DRUG=""
QUIT
IF DRUG]EDRUG
QUIT
Begin DoDot:1
+10 SET DR=$ORDER(^PSDRUG("B",DRUG,0))
IF DR=""
QUIT
+11 IF SKIP
IF $PIECE($GET(^PSDRUG(DR,"WARN")),"^")'=""
QUIT
+12 DO ACTIVE^PSSWRNB
IF 'ACTIVE
QUIT
+13 SET ^TMP("PSSWRNB",$JOB,DRUG)=""
End DoDot:1
+14 QUIT
SEL4 ;
+1 SET DR=0
FOR
SET DR=$ORDER(^PSDRUG(DR))
IF 'DR
QUIT
Begin DoDot:1
+2 IF SKIP
IF $PIECE($GET(^PSDRUG(DR,"WARN")),"^")'=""
QUIT
+3 DO ACTIVE^PSSWRNB
IF 'ACTIVE
QUIT
+4 DO DRUG^PSSWRNB
IF PSSWRN=""
QUIT
+5 NEW XX
SET XX=DR
DO CHECK20^PSSWRNA
+6 IF $LENGTH(PSSWRN,",")>5
SET ^TMP("PSSWRNB",$JOB,$PIECE(^PSDRUG(DR,0),"^"))=PSSWRN
End DoDot:1
+7 QUIT
SEL59 ;
+1 SET DIC=54
SET DIC(0)="AEQM"
SET DIC("A")="Select drugs containing RX Consult number:"
DO ^DIC
KILL DIC
IF Y<0
QUIT
+2 SET RXNUM=$PIECE(Y,"^")
+3 IF '$DATA(^PS(54,RXNUM))
WRITE !,RXNUM_" is not in the RX Consult file.",!
KILL DIR
SET DIR(0)="E"
DO ^DIR
KILL DIR
IF 'Y
SET PSSOUT=1
QUIT
+4 IF SEL=9
IF '$GET(^PS(54,RXNUM,2))
WRITE !,RXNUM," is not mapped to a new data source warning",!
KILL DIR
SET DIR(0)="E"
DO ^DIR
KILL DIR
IF 'Y
SET PSSOUT=1
QUIT
+5 IF SEL=9
SET PSO9=$GET(^PS(54,RXNUM,2))_"N"
WRITE " ",RXNUM," is mapped to ",PSO9
HANG 1
+6 SET DR=0
FOR
SET DR=$ORDER(^PSDRUG(DR))
IF 'DR
QUIT
Begin DoDot:1
+7 IF '$DATA(^PSDRUG(DR,0))
QUIT
+8 SET WARN54=$PIECE(^PSDRUG(DR,0),"^",8)
IF WARN54=""
QUIT
+9 IF SKIP
IF $PIECE($GET(^PSDRUG(DR,"WARN")),"^")'=""
QUIT
+10 DO ACTIVE^PSSWRNB
IF 'ACTIVE
QUIT
+11 IF ","_WARN54_","[(","_RXNUM_",")
Begin DoDot:2
+12 IF SEL=9
DO DRUG^PSSWRNB
IF PSSWRN=""
QUIT
+13 IF SEL=9
IF ","_PSSWRN_","[(","_PSO9_",")
QUIT
+14 SET ^TMP("PSSWRNB",$JOB,$PIECE(^PSDRUG(DR,0),"^"))=WARN54
End DoDot:2
End DoDot:1
+15 QUIT
SEL6 ;
+1 SET DR=0
FOR
SET DR=$ORDER(^PSDRUG(DR))
IF 'DR
QUIT
Begin DoDot:1
+2 IF '$DATA(^PSDRUG(DR,0))
QUIT
+3 SET WARN54=$PIECE(^PSDRUG(DR,0),"^",8)
IF WARN54=""
QUIT
+4 IF SKIP
IF $PIECE($GET(^PSDRUG(DR,"WARN")),"^")'=""
QUIT
+5 DO ACTIVE^PSSWRNB
IF 'ACTIVE
QUIT
+6 FOR I=1:1:$LENGTH(WARN54,",")
SET WARN=$PIECE(WARN54,",",I)
IF WARN
IF $DATA(^PS(54,WARN,1))
IF $GET(^PS(54,WARN,2))=""
Begin DoDot:2
+7 SET ^TMP("PSSWRNB",$JOB,$PIECE(^PSDRUG(DR,0),"^"))=WARN54
End DoDot:2
End DoDot:1
+8 QUIT
SEL7 ;
+1 WRITE !!
KILL DIR
SET DIR("A")="Select drugs containing New warning number"
+2 SET DIR("?",1)="Answer using format # or #N"
+3 SET DIR("?")="Example: 15 or 15N"
+4 SET DIR(0)="FO"
+5 DO ^DIR
SET RXNUM=Y
+6 IF Y="N"!(Y="n")!(Y="Y")!(Y="y")
WRITE !,$CHAR(7),?5,RXNUM_" is not a valid entry"
HANG 2
SET QUIT=1
QUIT
+7 IF RXNUM["N"!(RXNUM["n")
SET RXNUM=$TRANSLATE(RXNUM,"Nn","")
+8 IF RXNUM="^"!(RXNUM="")!(RXNUM=" ")
SET QUIT=1
QUIT
+9 IF '$DATA(^PS(50.625,RXNUM))
WRITE !,$CHAR(7),RXNUM_" is not in the New warning file"
HANG 1
SET QUIT=1
QUIT
+10 WRITE @IOF
+11 WRITE "Searching for drugs that contain new warning number "_RXNUM
+12 SET PSOWARN=RXNUM_"N"
SET STAR=""
DO NEWWARN^PSSWRNE
+13 KILL DIR
SET DIR(0)="E"
DO ^DIR
KILL DIR
IF 'Y
SET PSSOUT=1
QUIT
+14 SET DR=0
FOR
SET DR=$ORDER(^PSDRUG(DR))
IF 'DR
QUIT
Begin DoDot:1
+15 IF SKIP
IF $PIECE($GET(^PSDRUG(DR,"WARN")),"^")'=""
QUIT
+16 DO ACTIVE^PSSWRNB
IF 'ACTIVE
QUIT
+17 DO DRUG^PSSWRNB
IF PSSWRN=""
QUIT
+18 IF ","_PSSWRN_","[(","_RXNUM_"N,")
SET ^TMP("PSSWRNB",$JOB,$PIECE(^PSDRUG(DR,0),"^"))=PSSWRN
End DoDot:1
+19 QUIT
SEL8 ;
+1 NEW WARN,GEND
+2 SET WARN=0
FOR
SET WARN=$ORDER(^PS(50.625,WARN))
IF 'WARN
QUIT
IF $GET(^PS(50.625,WARN,2))'=""
SET GEND(WARN_"N")=""
+3 IF $ORDER(GEND(""))=""
QUIT
+4 SET DR=0
FOR
SET DR=$ORDER(^PSDRUG(DR))
IF 'DR
QUIT
Begin DoDot:1
+5 IF SKIP
IF $PIECE($GET(^PSDRUG(DR,"WARN")),"^")'=""
QUIT
+6 DO ACTIVE^PSSWRNB
IF 'ACTIVE
QUIT
+7 DO DRUG^PSSWRNB
IF PSSWRN=""
QUIT
+8 SET WARN=0
FOR
SET WARN=$ORDER(GEND(WARN))
IF 'WARN
QUIT
IF ","_PSSWRN_","[(","_WARN_",")
Begin DoDot:2
+9 SET ^TMP("PSSWRNB",$JOB,$PIECE(^PSDRUG(DR,0),"^"))=PSSWRN
End DoDot:2
End DoDot:1
+10 QUIT