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

APSQFUTI.m

Go to the documentation of this file.
APSQFUTI ;IHS/DSD/JCM - ASKS DATA FOR RX ORDER ENTRY CONT. [ 05/25/2001  4:06 PM ]
 ;;6.0;IHS PHARMACY MODIFICATIONS;**1,3**;09/03/97
 ;;6.0;OUTPATIENT PHARMACY;**34,61,86,73,113**;09/03/97
 ;THIS ROUTINE IS A COPY OF PSODIR1
 ;----------------------------------------------------------------
TEST ;FOR UTILITY
 ;IHS/OKCAO/POC 5/11/2001
 N TEST
 S TEST=1 ;OK
 D  ; 
 .I $S('$D(^PSDRUG(+Y,"I")):0,DT'>^("I"):0,1:1) S TEST=0 W !,"INACTIVE" Q
 .I $S($P($G(^PSDRUG(+Y,2)),"^",3)'["O":1,1:0) S TEST=0 W !,"INACTIVE" Q
 .;I $P($G(^PSDRUG(+Y,9999999)),U,3)'=+PSOSITE S TEST=0 W !,"MUST BE SAME DIVISION" Q ;PATCH 4
 ;I '$O(^APSQFAST(DA,2,0)) S TEST2=1
 Q:TEST
 K X
 Q
 S APSQTEST=DA
PTSTAT(PSODIR) ;
PTSTATEN K DIC,DR,DIE S PSODIR("FIELD")=0
 ;S:$G(PSORX("PATIENT STATUS"))]"" DIC("B")=PSORX("PATIENT STATUS")
 ;S:$G(PSODIR("PATIENT STATUS"))]"" DIC("B")=PSODIR("PATIENT STATUS")
 ;S DIC("A")="PATIENT STATUS: "
 ;S DIC(0)="QEAMZ",DIC=53 D ^DIC K DIC
 ;I X[U,$L(X)>1 D JUMP G PTSTATX
 ;I $D(DUOUT)!$D(DTOUT) S PSODIR("DFLG")=1 G PTSTATX
 ;I Y=-1 W *7," Required" G PTSTATEN
 ;S (PSODIR("PATIENT STATUS"),PSORX("PATIENT STATUS"))=+Y
 S (PSODIR("PATIENT STATUS"),PSORX("PATIENT STATUS"))=$G(APST) ;IHS/DSD/ENM 01/26/98
 ;S PSODIR("PTST NODE")=Y(0)
 S PSODIR("PTST NODE")=$G(^PS(53,APST,0))
 L +^PS(55,PSODFN):0 I '$T G PTSTATX
 ;S DIE="55",DR="3////"_+Y,DA=PSODFN D ^DIE K DIE,DA,D0
 S DIE="55",DR="3////"_APST,DA=PSODFN D ^DIE K DIE,DA,D0
 L -^PS(55,PSODFN)
PTSTATX ;K DTOUT,DUOUT,X,Y,DA,APST
 K DTOUT,DUOUT,X,Y,DA ;DONT KILL APST IHS/OKCAO/POC 5/26/98
 Q
SIG(PSODIR) ;
 K DIR,DIC
 S DIR(0)="52,10"
 S:$G(PSODRUG("SIG"))]"" DIR("B")=PSODRUG("SIG")
 S:$G(PSODIR("SIG"))]"" DIR("B")=PSODIR("SIG")
 D DIR G:PSODIR("DFLG")!PSODIR("FIELD") SIGX
 S PSODIR("SIG")=Y
SIGX K X,Y
 Q
QTY(PSODIR) ;
 K DIR,DIC
 S DIR(0)="52,7" S DIR("A")="QTY ( "_$G(PSODRUG("UNIT"))_" ) "
 S:$G(PSODIR("QTY"))]"" DIR("B")=PSODIR("QTY")
 D DIR G:PSODIR("DFLG")!PSODIR("FIELD") QTYX
 S PSODIR("QTY")=Y
QTYX K X,Y
 Q
COPIES(PSODIR) ;
 K DIR,DIC
 S DIR(0)="52,10.6"
 S DIR("B")=$S($G(PSODIR("COPIES"))]"":PSODIR("COPIES"),1:1)
 D DIR G:PSODIR("DFLG")!PSODIR("FIELD") COPIESX
 S PSODIR("COPIES")=Y
COPIESX K X,Y
 Q
 ;
DAYS(PSODIR) ;
DAYSEN K DIR,DIC
 S X="PSORDAY" X ^%ZOSF("TEST") I $T D ^PSORDAY ;IHS/DSD/ENM/POC 05/11/98 DAYS SUPPLY CAL BY POC
 S DIR(0)="N^1:180" ;IHS/DSD/ENM 6/8/95
 ;S DIR(0)="N^1:90"
 I $D(PSOZDAY) S DIR("B")=PSOZDAY K PSOZDAY ;IHS/DSD/ENM/POC 05/11/98
 E  S DIR("B")=$S($G(PSODIR("DAYS SUPPLY"))]"":PSODIR("DAYS SUPPLY"),$P($G(PSODIR("PTST NODE")),"^",3):$P(PSODIR("PTST NODE"),"^",3),1:30) ;IHS/DSD/ENM/POC 05/11/98
 S DIR("A")="DAYS SUPPLY",DIR("?")="Enter a whole number between 1 and 180" ;IHS/DSD/ENM 02/06/96 90 REPLACED WITH 180
 D DIR G:PSODIR("DFLG")!PSODIR("FIELD") DAYSX
 I $G(PSODRUG("MAXDOSE"))]"",$G(PSODIR("QTY"))]"",(+PSODIR("QTY")/Y>PSODRUG("MAXDOSE")) W !,*7," Greater than Maximum dose of ",PSODRUG("MAXDOSE")," per day" G DAYSEN
 S PSODIR("DAYS SUPPLY")=Y
DAYSX K X,Y
 Q
 ;
REFILL ;
 S APSQFX=X
 D ^PSOLSET:'$D(PSOPAR)
 ;S APSQFDAY=SAVED VALUE IN TEMPLATE OF DAYS SUPPLY
 Q:'$D(APSQFDAY)!('$D(APSQFDRU))!('$D(PSOPAR))
 S APSQFY=APSQFDRU ;VALUE IN TEMPLATE IE DRUG APSQFDRU
 S APSQFY(0)=$G(^PSDRUG(+APSQFY,0))
 D SET
 S APSQFOUT=$S($O(^PS(53,"B","OUTPATIENT","")):$O(^("")),+$O(^PS(53,"")):$O(^("")),1:0)
 S:APSQFOUT APSQFNOU=$G(^PS(53,APSQFOUT,0))
 S PSOX1=$S($P($G(APSQFNOU),U,4):$P(APSQFNOU,U,4),1:12) ;MAX # REFILLS
 ;
 K DIR,DIC,PSOX
 S PSOX=$S(PSODRUG("DEA")["S":$P(PSOPAR,"^",9),1:12) ;IHS/DSD/ENM 02/06/96 REFILL NBR INCREASED TO 12
 S PSOX=$S((PSOX=+$P(PSOPAR,"^",9))&(PSOX1=12)&(PSODRUG("DEA")["S"):PSOX,1:PSOX1) ;IHS/DSD/ENM 02/06/96
 S PSOX=$S('PSOX:0,APSQFDAY>120:1,1:PSOX) ;IHS/DSD/ENM 02/06/96
 S PSDY=APSQFDAY,PSDY1=$S(PSDY<31:11,PSDY'<31&(PSDY'>60):5,PSDY'<61&(PSDY'>90):3,PSDY'<91&(PSDY'>120):2,PSDY>120:1,1:0) S PSOX=$S(PSOX'>PSDY1:PSOX,1:PSDY1) S:PSODRUG("DEA")["S" PSOX=$S($P(PSOPAR,"^",9)'="":$P(PSOPAR,"^",9),1:PSOX)
 I PSODRUG("DEA")["A",PSODRUG("DEA")'["B" W !,"No refills allowed on Narcotics .." S PSOX=0
 I PSOX>5,PSODRUG("DEA")["A",PSODRUG("DEA")["B",PSODRUG("DEA")>2,PSODRUG("DEA")<6 S PSOX=5
 W !,"MAXIMUM NUMBER OF REFILLS IS ",PSOX
 ;K:X>PSOX X
 I APSQFX>PSOX K X,APSQFX
 E  S X=APSQFX
 K PSOX,PSOX1,PSDY,PSDY1
 K PSODRUG
 Q
SET ;
 S PSODRUG("IEN")=+APSQFY,PSODRUG("VA CLASS")=$P(APSQFY(0),"^",2)
 S PSODRUG("NAME")=$P(APSQFY(0),"^")
 S PSODRUG("NDF")=$S($G(^PSDRUG(+APSQFY,"ND"))]"":+^("ND")_"A"_$P(^("ND"),"^",3),1:0)
 S PSODRUG("MAXDOSE")=$P(APSQFY(0),"^",4),PSODRUG("DEA")=$P(APSQFY(0),"^",3)
 S PSODRUG("CLN")=$S($D(^PSDRUG(+APSQFY,"ND")):+$P(^("ND"),"^",6),1:0)
 S PSODRUG("SIG")=$P(APSQFY(0),"^",5)
 S PSODRUG("NDC")=$P($G(^PSDRUG(+APSQFY,2)),"^",4)
 S PSODRUG("STKLVL")=$G(^PSDRUG(+APSQFY,660.1))
 G:$G(^PSDRUG(+APSQFY,660))']"" QUIT
 S PSOX1=$G(^PSDRUG(+APSQFY,660))
 S PSODRUG("COST")=$P($G(PSOX1),"^",6)
 S PSODRUG("UNIT")=$P($G(PSOX1),"^",8)
QUIT Q
CM(PSODIR) ;IHS/DSD/ENM CHRONIC MED ENTER/ED 10-05-94
 K DIR,DIC
 S DIR(0)="52,9999999.02"
 S DIR("B")=$S($G(PSODIR("CM"))]"":PSODIR("CM"),1:"N")
 D DIR G:PSODIR("DFLG")!PSODIR("FIELD") CMX
 S PSODIR("CM")=Y,APSP("CM")=Y ;IHS/DSD/ENM 09/19/96
CMX K X,Y
 Q
 ;
DIR ;
 S PSODIR("FIELD")=0
 G:$G(DIR(0))']"" DIRX
 D ^DIR K DIR,DIE,DIC,DA
 I $D(DUOUT)!($D(DTOUT))!($D(DIROUT)),$L($G(X))'>1 S PSODIR("DFLG")=1 G DIRX
 I X[U,$L(X)>1 D JUMP
DIRX K DIRUT,DTOUT,DUOUT,DIROUT,PSOX
 Q
 ;
JUMP ;
 S X=$P(X,"^",2),DIC="^DD(52,",DIC(0)="QM" D ^DIC K DIC
 I Y=-1 S PSODIR("FIELD")=PSODIR("FLD") G JUMPX
 I $G(PSONEW1)=0 D JUMP^PSONEW1 G JUMPX
 I $G(PSOREF1)=0 D JUMP^PSOREF1 G JUMPX
 I $G(PSONEW3)=0 D JUMP^PSONEW3 G JUMPX
 I $G(PSORENW3)=0 D JUMP^PSORENW3 G JUMPX
JUMPX S X="^"_X
 Q