PSOORDRG ;BIR/SAB - order entry drug selection ;11/13/97 ;;7.0;OUTPATIENT PHARMACY;**3,29,49,46,81,105,134,144,132,188,207,148,243**;DEC 1997;Build 22 ;External references to ^PSJORUT2 supported by DBIA 2376 ;External reference to ^PS(50.7 supported by DBIA 2223 ;External reference to ^PS(50.605 supported by DBIA 696 ;External reference to ^PSDRUG supported by DBIA 221 ;External reference to ^PS(55 supported by DBIA 2228 ;External reference to ^PS(56 supported by DBIA 2229 ;External reference to ^PS(50.416 supported by DBIA 692 ;External reference to DDIEX^PSNAPIS supported by DBIA 2574 ;External references to ^ORRDI1 supported by DBIA 4659 ;Reference to $$GETNDC^PSSNDCUT supported by IA 4707 ; EN(PSODFN,DREN) ; K ^TMP($J,"DI"),^TMP($J,"DD"),^TMP($J,"DC"),^TMP($J,"DI"_PSODFN),PSOPHI S INDX=0 ;build patient's drug profile outpat/inpat/non-va D BLD,ENCHK^PSJORUT2(PSODFN,.INDX),NVA ;collect drug info DRG ;S X=DREN,DIC="^PSDRUG(",DIC(0)="MQNZO" D ^DIC K DIC,PSOY Q:Y<1 S PSOY=Y,PSOY(0)=Y(0) K X,Y N PSOICT S PSOICT="" S PSOY=DREN_"^"_$P($G(^PSDRUG(DREN,0)),"^"),PSOY(0)=$G(^PSDRUG(DREN,0)) K X,Y S PSODRUG("IEN")=+PSOY,PSODRUG("VA CLASS")=$P(PSOY(0),"^",2),PSODRUG("NAME")=$P(PSOY(0),"^") S:+$G(^PSDRUG(+PSOY,2)) PSODRUG("OI")=+$G(^(2)),PSODRUG("OIN")=$P(^PS(50.7,+$G(^(2)),0),"^") S PSODRUG("NDF")=$S($G(^PSDRUG(+PSOY,"ND"))]"":+^("ND")_"A"_$P(^("ND"),"^",3),1:0) S PSODRUG("MAXDOSE")=$P(PSOY(0),"^",4),PSODRUG("DEA")=$P(PSOY(0),"^",3),PSODRUG("CLN")=$S($D(^PSDRUG(+PSOY,"ND")):+$P(^("ND"),"^",6),1:0) S PSODRUG("SIG")=$P(PSOY(0),"^",5),PSODRUG("NDC")=$$GETNDC^PSSNDCUT(+PSOY,$G(PSOSITE)) S PSODRUG("DAW")=$$GET1^DIQ(50,+PSOY,81) S PSOX1=$G(^PSDRUG(+PSOY,660)),PSODRUG("COST")=$P($G(PSOX1),"^",6),PSODRUG("UNIT")=$P($G(PSOX1),"^",8),PSODRUG("EXPIRATION DATE")=$P($G(PSOX1),"^",9) K PSOX1,PSOY Q:$G(POERR) ;dup drug/class check S DNM=0 F S DNM=$O(^TMP($J,"ORDERS",DNM)) Q:'DNM D .S DRNM=$P(^TMP($J,"ORDERS",DNM),"^",3) .I PSODRUG("NAME")=DRNM S DD=$G(DD)+1,^TMP($J,"DD",DD,0)=PSODRUG("IEN")_"^"_PSODRUG("NAME")_"^"_$P(^TMP($J,"ORDERS",DNM),"^",4)_"^"_$P(^(DNM),"^",5) Q:'$G(PSOPHI) .I PSODRUG("VA CLASS")]"",$E(PSODRUG("VA CLASS"),1,4)=$E($P(^TMP($J,"ORDERS",DNM),"^"),1,4),DRNM'=PSODRUG("NAME") D ..I $E(PSODRUG("VA CLASS"),1,2)="HA",$E($P(^TMP($J,"ORDERS",DNM),"^"),1,2)="HA" Q ..S PSODC=$O(^PS(50.605,"B",PSODRUG("VA CLASS"),0)) Q:'PSODC ..S DC=$G(DC)+1,^TMP($J,"DC",DC,0)=PSODRUG("VA CLASS") ..S PSODC=$P(^PS(50.605,PSODC,0),"^",2),^TMP($J,"DC",DC,0)=^TMP($J,"DC",DC,0)_"^"_PSODC_"^"_$O(^PSDRUG("B",DRNM,0))_"^"_DRNM_"^"_$P(^TMP($J,"ORDERS",DNM),"^",4)_"^"_$P(^(DNM),"^",5) ;drug interaction check S DRG=0 F S DRG=$O(^TMP($J,"ORDERS",DRG)) Q:'DRG S NDF=$P(^TMP($J,"ORDERS",DRG),"^",2) D .S IT=0,PSOICT="" .F S IT=$O(^PS(56,"APD",NDF,PSODRUG("NDF"),IT)) Q:'IT D ..Q:$$DDIEX^PSNAPIS($P(NDF,"A"),$P(NDF,"A",2)) ..Q:$$DDIEX^PSNAPIS($P(PSODRUG("NDF"),"A"),$P(PSODRUG("NDF"),"A",2)) ..Q:$P(^PS(56,IT,0),"^",7)&($P(^PS(56,IT,0),"^",7)