source: FOIAVistA/trunk/r/OUTPATIENT_PHARMACY-PSO-APSP-HUIP/PSODRG.m@ 677

Last change on this file since 677 was 628, checked in by George Lilly, 15 years ago

initial load of FOIAVistA 6/30/08 version

File size: 5.9 KB
Line 
1PSODRG ;IHS/DSD/JCM-ORDER ENTRY DRUG SELECTION ;03/30/93
2 ;;7.0;OUTPATIENT PHARMACY;**20,23,36,53,54,46,112,139,207,148,243,268**;DEC 1997;Build 9
3 ;Reference ^PSDRUG supported by DBIA 221
4 ;Reference ^PS(50.7 supported by DBIA 2223
5 ;Reference to PSSDIN supported by DBIA 3166
6 ;Reference to $$NDCFMT^PSSNDCUT supported by IA 4707
7 ;----------------------------------------------------------
8START ;
9 S (PSONEW("DFLG"),PSONEW("FIELD"),PSODRG("QFLG"))=0
10 D @($S(+$G(PSOEDIT)=1&('$D(DA)):"SELECT^PSODRGN",1:"SELECT"))
11 G:$G(PSORXED("DFLG")) END ; Select Drug
12 I $G(PSORX("EDIT")),$G(PSOY),$G(PSODRUG("IEN"))=+PSOY D G:$G(PSORXED("DFLG")) END
13 . N NDC D NDC(+$G(PSORXED("IRXN")),0,+PSOY,.NDC) I $G(NDC)="^" S PSORXED("DFLG")=1 Q
14 . I $G(NDC)'="" S (PSODRUG("NDC"),PSORXED("FLD",27))=NDC
15 ;
16 I $G(PSORX("EDIT"))]"",'PSONEW("FIELD") D TRADE
17 G:PSONEW("DFLG")!(PSODRG("QFLG"))!($G(PSORXED("DFLG"))) END
18 D SET ; Set various drug information
19 D NFI ; Display dispense drug/orderable item text
20 D:'$G(PSOEDIT) POST I $G(PSORX("DFLG")) S PSONEW("DFLG")=1 K:'$G(PSORX("EDIT")) PSORX("DFLG") ; Do any post selection action
21END ;D EOJ
22 Q
23 ;------------------------------------------------------------
24 ;
25SELECT ;
26 K:'$G(PSORXED) CLOZPAT
27 K DIC,X,Y,PSODRUG("TRADE NAME"),PSODRUG("NDC"),PSODRUG("DAW") S:$G(POERR)&($P($G(OR0),"^",9)) Y=$P(^PSDRUG($P(OR0,"^",9),0),"^")
28 I $G(PSODRUG("IEN"))]"" S Y=PSODRUG("NAME"),PSONEW("OLD VAL")=PSODRUG("IEN")
29 W !,"DRUG: "_$S($G(Y)]"":Y_"// ",1:"") R X:$S($D(DTIME):DTIME,1:300) I '$T S DTOUT=1
30 I X="",$G(Y)]"" S:Y X=Y S:'X X=$G(PSODRUG("IEN")) S:X X="`"_X
31 G:X="" SELECT
32 I X?1."?" W !!,"Answer with DRUG NUMBER, or GENERIC NAME, or VA PRODUCT NAME, or",!,"NATIONAL DRUG CLASS, or SYNONYM" G SELECT
33 I $G(PSORXED),X["^" S PSORXED("DFLG")=1 G SELECTX
34 I X="^"!(X["^^")!($D(DTOUT)) S PSONEW("DFLG")=1 G SELECTX
35 I '$G(POERR),X[U,$L(X)>1 S PSODIR("FLD")=PSONEW("FLD") D JUMP^PSODIR1 S:$G(PSODIR("FIELD")) PSONEW("FIELD")=PSODIR("FIELD") K PSODIR S PSODRG("QFLG")=1 G SELECTX
36 S DIC=50,DIC(0)="EMQZVT",DIC("T")="",D="B^C^VAPN^VAC"
37 S DIC("S")="I $S('$D(^PSDRUG(+Y,""I"")):1,'^(""I""):1,DT'>^(""I""):1,1:0),$S($P($G(^PSDRUG(+Y,2)),""^"",3)'[""O"":0,1:1),$D(^PSDRUG(""ASP"",+$G(^(2)),+Y))"
38 D MIX^DIC1 K DIC,D
39 I $D(DTOUT) S PSONEW("DFLG")=1 G SELECTX
40 I $D(DUOUT) K DUOUT G SELECT
41 I Y<0 G SELECT
42 S:$G(PSONEW("OLD VAL"))=+Y&('$G(PSOEDIT)) PSODRG("QFLG")=1
43 K PSOY S PSOY=Y,PSOY(0)=Y(0)
44 I $P(PSOY(0),"^")="OTHER DRUG"!($P(PSOY(0),"^")="OUTSIDE DRUG") D TRADE
45SELECTX K X,Y,DTOUT,DUOUT,PSONEW("OLD VAL")
46 Q
47 ;
48NDC(RX,RFL,DRG,NDC) ; Editing NDC for ECME Released Rx's
49 S NDC=$S($G(NDC)'="":$G(NDC),1:$$GETNDC^PSONDCUT(RX,.RFL))
50 I $$STATUS^PSOBPSUT(RX,RFL)="" Q
51 I '$$RXRLDT^PSOBPSUT(RX,RFL) Q
52 ;
53 S NDC=$S($G(NDC)'="":$G(NDC),1:$$GETNDC^PSONDCUT(RX,.RFL))
54 D NDCEDT^PSONDCUT(RX,.RFL,$G(DRG),$G(PSOSITE),.NDC)
55 Q
56 ;
57TRADE ;
58 K DIR,DIC,DA,X,Y
59 S DIR(0)="52,6.5" S:$G(PSOTRN)]"" DIR("B")=$G(PSOTRN) D ^DIR K DIR,DIC
60 I X="@" S Y=X K DIRUT
61 I $D(DIRUT) S:$D(DUOUT)!$D(DTOUT)&('$D(PSORX("EDIT"))) PSONEW("DFLG")=1 G TRADEX
62 S PSODRUG("TRADE NAME")=Y
63TRADEX I $G(PSORXED("DFLG")),$D(DIRUT) S PSORXED("DFLG")=1
64 K DIRUT,DTOUT,DUOUT,X,Y,DA,DR,DIE
65 Q
66SET ;
67 N STAT S PSODRUG("IEN")=+PSOY,PSODRUG("VA CLASS")=$P(PSOY(0),"^",2)
68 S PSODRUG("NAME")=$P(PSOY(0),"^")
69 S:+$G(^PSDRUG(+PSOY,2)) PSODRUG("OI")=+$G(^(2)),PSODRUG("OIN")=$P(^PS(50.7,+$G(^(2)),0),"^")
70 S PSODRUG("NDF")=$S($G(^PSDRUG(+PSOY,"ND"))]"":+^("ND")_"A"_$P(^("ND"),"^",3),1:0)
71 S PSODRUG("MAXDOSE")=$P(PSOY(0),"^",4),PSODRUG("DEA")=$P(PSOY(0),"^",3)
72 S PSODRUG("CLN")=$S($D(^PSDRUG(+PSOY,"ND")):+$P(^("ND"),"^",6),1:0)
73 S PSODRUG("SIG")=$P(PSOY(0),"^",5)
74 I $G(PSODRUG("NDC"))="" S PSODRUG("NDC")=$$GETNDC^PSSNDCUT(+PSOY,$G(PSOSITE))
75 S PSODRUG("DAW")=+$$GET1^DIQ(50,+PSOY,81)
76 S PSODRUG("STKLVL")=$G(^PSDRUG(+PSOY,660.1))
77 G:$G(^PSDRUG(+PSOY,660))']"" SETX
78 S PSOX1=$G(^PSDRUG(+PSOY,660))
79 S PSODRUG("COST")=$P($G(PSOX1),"^",6)
80 S PSODRUG("UNIT")=$P($G(PSOX1),"^",8)
81 S PSODRUG("EXPIRATION DATE")=$P($G(PSOX1),"^",9)
82SETX K PSOX1,PSOY
83 Q
84NFI ;display restriction/guidelines
85 D EN^PSSDIN(PSODRUG("OI"),PSODRUG("IEN")) S NFI=$$PROMPT^PSSDIN
86 I NFI]"","ODY"[NFI D TD^PSONFI
87 K NFI Q
88POST ;order checks
89 K PSORX("INTERVENE") N STAT,SIG,PTR,NDF,VAP S PSORX("DFLG")=0
90 D ^PSOBUILD
91 D @$S($G(COPY):"^PSOCPDUP",1:"^PSODRDUP") ; Set PSORX("DFLG")=1 if process to stop
92 Q:$G(PSORX("DFLG"))
93 W:$G(PSOFIN)']"" !,"Now doing drug interaction and allergy checks. Please wait...",!
94 D ^PSODGDGI
95 I $G(PSORX("INTERVENE"))]"" D FULL^VALM1,^PSORXI S VALMBCK="R"
96 G:PSORX("DFLG") POSTX
97 D:$P($G(^PSDRUG(PSODRUG("IEN"),"CLOZ1")),"^")]"" CLOZ G:PSORX("DFLG") POSTX
98 K PSORX("INTERVENE")
99 S PSONOAL="" D ALLERGY^PSOORUT2 D:PSONOAL'="" NOALRGY K PSONOAL
100 G:PSORX("DFLG") POSTX
101 I $D(PSODRUG("NDF")) S NDF=$P(PSODRUG("NDF"),"A"),VAP=$P(PSODRUG("NDF"),"A",2),PTR=NDF_"."_VAP
102 I $G(NDF) D CHK^PSODGAL(PSODFN,"DR",PTR) K NDF,VAP,PTR
103 I $P($G(PSODRUG("NDF")),"A")=0 D CHK1^PSODGAL(PSODFN)
104 I $D(PSODRUG("VA CLASS")) D CLASS^PSODGAL(PSODFN)
105POSTX ;
106 K ^TMP($J,"DI"_PSODFN),^TMP($J,"DI")
107 K PSORX("INTERVENE"),DA
108 Q
109 ;
110EOJ ;
111 K PSODRG
112 Q
113 ;
114CLOZ ;
115 S ANQRTN=$P(^PSDRUG(PSODRUG("IEN"),"CLOZ1"),"^"),ANQX=0
116 S P(5)=PSODRUG("IEN"),DFN=PSODFN,X=ANQRTN
117 X ^%ZOSF("TEST") I D @("^"_ANQRTN) S:$G(ANQX) PSORX("DFLG")=1
118 K P(5),ANQRTN,ANQX,X
119 Q
120 ;
121EN(DRG) ;returns lab test identified for clozapine order checking
122 K LAB I $P($G(^PSDRUG(DRG,"CLOZ1")),"^")'="PSOCLO1" S LAB("NOT")=0 Q
123 I $P($G(^PSDRUG(DRG,"CLOZ1")),"^")="PSOCLO1" D
124 .S (CNT,I)=0 F S I=$O(^PSDRUG(DRG,"CLOZ2",I)) Q:'I S CNT=$G(CNT)+1
125 .I CNT'=2 S LAB("BAD TEST")=0 K CNT Q
126 .K CNT F I=0:0 S I=$O(^PSDRUG(DRG,"CLOZ2",I)) Q:'I D
127 ..S LABT=$S($P(^PSDRUG(DRG,"CLOZ2",I,0),"^",4)=1:"WBC",1:"ANC"),LAB(LABT)=$P(^PSDRUG(DRG,"CLOZ2",I,0),"^")_"^"_$P(^(0),"^",3)_"^"_$P(^(0),"^",4)
128 K LABT,I
129 Q
130NOALRGY ;
131 W $C(7),!,"There is no allergy assessment on file for this patient."
132 W !,"You will be prompted to intervene if you continue with this prescription"
133 K DIR
134 S DIR(0)="SA^1:YES;0:NO",DIR("A")="Do you want to Continue?: ",DIR("B")="N" D ^DIR
135 I 'Y S PSORX("DFLG")=1 Q
136 D ^PSORXI
137 Q
Note: See TracBrowser for help on using the repository browser.