PSSDIN ;BIR/WRT-API for National Formulary Indicator ;03/13/00
;;1.0;PHARMACY DATA MANAGEMENT;**38**;9/30/97
;
; Input: PSSOI=Orderable Item (optional), PSSDD=Dispense Drug(optional)
; Output: ^TMP("PSSDIN",$J,"OI",PSSOI,dtien,index)=text
; Output: ^TMP("PSSDIN",$J,"DD",PSSDD,dtien,index)=text
;
EN(PSSOI,PSSDD) ;entry point returns nfi text
K ^TMP("PSSDIN",$J) N IDX,IEN,WP,TY,TD
I $D(PSSOI),$G(PSSOI) D OITM
I $D(PSSDD),$G(PSSDD) D DPDRG
Q
OITM ;returns nfi text for a single orderable item
Q:'$O(^PS(50.7,PSSOI,1,0))
S TY="OI",TD=PSSOI F IDX=0:0 S IDX=$O(^PS(50.7,TD,1,IDX)) Q:'IDX S IEN=$P($G(^PS(50.7,PSSOI,1,IDX,0)),"^") D FTX
Q
FTX I $G(IEN),$D(^PS(51.7,IEN)) D:$P($G(^PS(51.7,IEN,0)),"^",2)=""!($P($G(^PS(51.7,IEN,0)),"^",2)>(DT-1))
.F WP=0:0 S WP=$O(^PS(51.7,IEN,2,WP)) Q:'WP S:$D(^PS(51.7,IEN,2,WP,0)) ^TMP("PSSDIN",$J,TY,TD,IEN,WP)=^PS(51.7,IEN,2,WP,0)
Q
DPDRG ;returns nfi text for a single dispense drug
Q:'$O(^PSDRUG(PSSDD,9,0))
S TY="DD",TD=PSSDD F IDX=0:0 S IDX=$O(^PSDRUG(TD,9,IDX)) Q:'IDX S IEN=$P($G(^PSDRUG(PSSDD,9,IDX,0)),"^") D FTX
Q
PROMPT() ;conditional read
Q:'$O(^TMP("PSSDIN",$J,"OI",0))&('$O(^TMP("PSSDIN",$J,"DD",0))) ""
S PSSOI=$O(^TMP("PSSDIN",$J,"OI",0)),PSSDD=$O(^TMP("PSSDIN",$J,"DD",0))
READ1 K DIR S DIR(0)="SB^N:NO"_$S($G(PSSDD):";D:DISPENSE DRUG",1:"")_$S($G(PSSOI):";O:ORDERABLE ITEM",1:"")_$S($G(PSSDD)&($G(PSSOI)):";B:ORDERABLE ITEM AND DISPENSE DRUG",1:"")
S DIR("A")=" Restriction/Guideline(s) exist. Display? ",DIR("B")="No" D ^DIR K DIR,PSSOI,PSSDD
Q $S(Y="B":"Y",1:Y)
PSSDIN ;BIR/WRT-API for National Formulary Indicator ;03/13/00
+1 ;;1.0;PHARMACY DATA MANAGEMENT;**38**;9/30/97
+2 ;
+3 ; Input: PSSOI=Orderable Item (optional), PSSDD=Dispense Drug(optional)
+4 ; Output: ^TMP("PSSDIN",$J,"OI",PSSOI,dtien,index)=text
+5 ; Output: ^TMP("PSSDIN",$J,"DD",PSSDD,dtien,index)=text
+6 ;
EN(PSSOI,PSSDD) ;entry point returns nfi text
+1 KILL ^TMP("PSSDIN",$JOB)
NEW IDX,IEN,WP,TY,TD
+2 IF $DATA(PSSOI)
IF $GET(PSSOI)
DO OITM
+3 IF $DATA(PSSDD)
IF $GET(PSSDD)
DO DPDRG
+4 QUIT
OITM ;returns nfi text for a single orderable item
+1 IF '$ORDER(^PS(50.7,PSSOI,1,0))
QUIT
+2 SET TY="OI"
SET TD=PSSOI
FOR IDX=0:0
SET IDX=$ORDER(^PS(50.7,TD,1,IDX))
IF 'IDX
QUIT
SET IEN=$PIECE($GET(^PS(50.7,PSSOI,1,IDX,0)),"^")
DO FTX
+3 QUIT
FTX IF $GET(IEN)
IF $DATA(^PS(51.7,IEN))
IF $PIECE($GET(^PS(51.7,IEN,0)),"^",2)=""!($PIECE($GET(^PS(51.7,IEN,0)),"^",2)>(DT-1))
Begin DoDot:1
+1 FOR WP=0:0
SET WP=$ORDER(^PS(51.7,IEN,2,WP))
IF 'WP
QUIT
IF $DATA(^PS(51.7,IEN,2,WP,0))
SET ^TMP("PSSDIN",$JOB,TY,TD,IEN,WP)=^PS(51.7,IEN,2,WP,0)
End DoDot:1
+2 QUIT
DPDRG ;returns nfi text for a single dispense drug
+1 IF '$ORDER(^PSDRUG(PSSDD,9,0))
QUIT
+2 SET TY="DD"
SET TD=PSSDD
FOR IDX=0:0
SET IDX=$ORDER(^PSDRUG(TD,9,IDX))
IF 'IDX
QUIT
SET IEN=$PIECE($GET(^PSDRUG(PSSDD,9,IDX,0)),"^")
DO FTX
+3 QUIT
PROMPT() ;conditional read
+1 IF '$ORDER(^TMP("PSSDIN",$JOB,"OI",0))&('$ORDER(^TMP("PSSDIN",$JOB,"DD",0)))
QUIT ""
+2 SET PSSOI=$ORDER(^TMP("PSSDIN",$JOB,"OI",0))
SET PSSDD=$ORDER(^TMP("PSSDIN",$JOB,"DD",0))
READ1 KILL DIR
SET DIR(0)="SB^N:NO"_$SELECT($GET(PSSDD):";D:DISPENSE DRUG",1:"")_$SELECT($GET(PSSOI):";O:ORDERABLE ITEM",1:"")_$SELECT($GET(PSSDD)&($GET(PSSOI)):";B:ORDERABLE ITEM AND DISPENSE DRUG",1:"")
+1 SET DIR("A")=" Restriction/Guideline(s) exist. Display? "
SET DIR("B")="No"
DO ^DIR
KILL DIR,PSSOI,PSSDD
+2 QUIT $SELECT(Y="B":"Y",1:Y)