source: WorldVistAEHR/trunk/r/OUTPATIENT_PHARMACY-PSO-APSP-HUIP/PSODRG.m@ 1704

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

revised back to 6/30/08 version

File size: 6.7 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,208**;DEC 1997;Build 39
3 ; Modified from FOIA VISTA,
4 ; Copyright (C) 2007 WorldVistA
5 ;
6 ; This program is free software; you can redistribute it and/or modify
7 ; it under the terms of the GNU General Public License as published by
8 ; the Free Software Foundation; either version 2 of the License, or
9 ; (at your option) any later version.
10 ;
11 ; This program is distributed in the hope that it will be useful,
12 ; but WITHOUT ANY WARRANTY; without even the implied warranty of
13 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 ; GNU General Public License for more details.
15 ;
16 ; You should have received a copy of the GNU General Public License
17 ; along with this program; if not, write to the Free Software
18 ; Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 ;Reference ^PSDRUG supported by DBIA 221
20 ;Reference ^PS(50.7 supported by DBIA 2223
21 ;Reference to PSSDIN supported by DBIA 3166
22 ;Reference to $$NDCFMT^PSSNDCUT supported by IA 4707
23 ;----------------------------------------------------------
24START ;
25 S (PSONEW("DFLG"),PSONEW("FIELD"),PSODRG("QFLG"))=0
26 D @($S(+$G(PSOEDIT)=1&('$D(DA)):"SELECT^PSODRGN",1:"SELECT"))
27 G:$G(PSORXED("DFLG")) END ; Select Drug
28 I $G(PSORX("EDIT")),$G(PSOY),$G(PSODRUG("IEN"))=+PSOY D G:$G(PSORXED("DFLG")) END
29 . N NDC D NDC(+$G(PSORXED("IRXN")),0,+PSOY,.NDC) I $G(NDC)="^" S PSORXED("DFLG")=1 Q
30 . I $G(NDC)'="" S (PSODRUG("NDC"),PSORXED("FLD",27))=NDC
31 ;
32 I $G(PSORX("EDIT"))]"",'PSONEW("FIELD") D TRADE
33 G:PSONEW("DFLG")!(PSODRG("QFLG"))!($G(PSORXED("DFLG"))) END
34 D SET ; Set various drug information
35 D NFI ; Display dispense drug/orderable item text
36 D:'$G(PSOEDIT) POST I $G(PSORX("DFLG")) S PSONEW("DFLG")=1 K:'$G(PSORX("EDIT")) PSORX("DFLG") ; Do any post selection action
37END ;D EOJ
38 Q
39 ;------------------------------------------------------------
40 ;
41SELECT ;
42 K:'$G(PSORXED) CLOZPAT
43 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),"^")
44 I $G(PSODRUG("IEN"))]"" S Y=PSODRUG("NAME"),PSONEW("OLD VAL")=PSODRUG("IEN")
45 W !,"DRUG: "_$S($G(Y)]"":Y_"// ",1:"") R X:$S($D(DTIME):DTIME,1:300) I '$T S DTOUT=1
46 I X="",$G(Y)]"" S:Y X=Y S:'X X=$G(PSODRUG("IEN")) S:X X="`"_X
47 G:X="" SELECT
48 I X?1."?" W !!,"Answer with DRUG NUMBER, or GENERIC NAME, or VA PRODUCT NAME, or",!,"NATIONAL DRUG CLASS, or SYNONYM" G SELECT
49 I $G(PSORXED),X["^" S PSORXED("DFLG")=1 G SELECTX
50 I X="^"!(X["^^")!($D(DTOUT)) S PSONEW("DFLG")=1 G SELECTX
51 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
52 S DIC=50,DIC(0)="EMQZVT",DIC("T")="",D="B^C^VAPN^VAC"
53 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))"
54 D MIX^DIC1 K DIC,D
55 I $D(DTOUT) S PSONEW("DFLG")=1 G SELECTX
56 I $D(DUOUT) K DUOUT G SELECT
57 I Y<0 G SELECT
58 S:$G(PSONEW("OLD VAL"))=+Y&('$G(PSOEDIT)) PSODRG("QFLG")=1
59 K PSOY S PSOY=Y,PSOY(0)=Y(0)
60 I $P(PSOY(0),"^")="OTHER DRUG"!($P(PSOY(0),"^")="OUTSIDE DRUG") D TRADE
61SELECTX K X,Y,DTOUT,DUOUT,PSONEW("OLD VAL")
62 Q
63 ;
64NDC(RX,RFL,DRG,NDC) ; Editing NDC for ECME Released Rx's
65 S NDC=$S($G(NDC)'="":$G(NDC),1:$$GETNDC^PSONDCUT(RX,.RFL))
66 I $$STATUS^PSOBPSUT(RX,RFL)="" Q
67 I '$$RXRLDT^PSOBPSUT(RX,RFL) Q
68 ;
69 S NDC=$S($G(NDC)'="":$G(NDC),1:$$GETNDC^PSONDCUT(RX,.RFL))
70 D NDCEDT^PSONDCUT(RX,.RFL,$G(DRG),$G(PSOSITE),.NDC)
71 Q
72 ;
73TRADE ;
74 K DIR,DIC,DA,X,Y
75 S DIR(0)="52,6.5" S:$G(PSOTRN)]"" DIR("B")=$G(PSOTRN) D ^DIR K DIR,DIC
76 I X="@" S Y=X K DIRUT
77 I $D(DIRUT) S:$D(DUOUT)!$D(DTOUT)&('$D(PSORX("EDIT"))) PSONEW("DFLG")=1 G TRADEX
78 S PSODRUG("TRADE NAME")=Y
79TRADEX I $G(PSORXED("DFLG")),$D(DIRUT) S PSORXED("DFLG")=1
80 K DIRUT,DTOUT,DUOUT,X,Y,DA,DR,DIE
81 Q
82SET ;
83 N STAT S PSODRUG("IEN")=+PSOY,PSODRUG("VA CLASS")=$P(PSOY(0),"^",2)
84 S PSODRUG("NAME")=$P(PSOY(0),"^")
85 S:+$G(^PSDRUG(+PSOY,2)) PSODRUG("OI")=+$G(^(2)),PSODRUG("OIN")=$P(^PS(50.7,+$G(^(2)),0),"^")
86 S PSODRUG("NDF")=$S($G(^PSDRUG(+PSOY,"ND"))]"":+^("ND")_"A"_$P(^("ND"),"^",3),1:0)
87 S PSODRUG("MAXDOSE")=$P(PSOY(0),"^",4),PSODRUG("DEA")=$P(PSOY(0),"^",3)
88 S PSODRUG("CLN")=$S($D(^PSDRUG(+PSOY,"ND")):+$P(^("ND"),"^",6),1:0)
89 S PSODRUG("SIG")=$P(PSOY(0),"^",5)
90 I $G(PSODRUG("NDC"))="" S PSODRUG("NDC")=$$GETNDC^PSSNDCUT(+PSOY,$G(PSOSITE))
91 S PSODRUG("DAW")=+$$GET1^DIQ(50,+PSOY,81)
92 S PSODRUG("STKLVL")=$G(^PSDRUG(+PSOY,660.1))
93 G:$G(^PSDRUG(+PSOY,660))']"" SETX
94 S PSOX1=$G(^PSDRUG(+PSOY,660))
95 S PSODRUG("COST")=$P($G(PSOX1),"^",6)
96 S PSODRUG("UNIT")=$P($G(PSOX1),"^",8)
97 S PSODRUG("EXPIRATION DATE")=$P($G(PSOX1),"^",9)
98SETX K PSOX1,PSOY
99 Q
100NFI ;display restriction/guidelines
101 D EN^PSSDIN(PSODRUG("OI"),PSODRUG("IEN")) S NFI=$$PROMPT^PSSDIN
102 I NFI]"","ODY"[NFI D TD^PSONFI
103 K NFI Q
104POST ;order checks
105 I $G(PSOAFYN)="Y" G POSTX ;vfam - VOE
106 K PSORX("INTERVENE") N STAT,SIG,PTR,NDF,VAP S PSORX("DFLG")=0
107 D ^PSOBUILD
108 D @$S($G(COPY):"^PSOCPDUP",1:"^PSODRDUP") ; Set PSORX("DFLG")=1 if process to stop
109 Q:$G(PSORX("DFLG"))
110 W:$G(PSOFIN)']"" !,"Now doing drug interaction and allergy checks. Please wait...",!
111 D ^PSODGDGI
112 I $G(PSORX("INTERVENE"))]"" D FULL^VALM1,^PSORXI S VALMBCK="R"
113 G:PSORX("DFLG") POSTX
114 D:$P($G(^PSDRUG(PSODRUG("IEN"),"CLOZ1")),"^")]"" CLOZ G:PSORX("DFLG") POSTX
115 K PSORX("INTERVENE")
116 S PSONOAL="" D ALLERGY^PSOORUT2 D:PSONOAL'="" NOALRGY K PSONOAL
117 G:PSORX("DFLG") POSTX
118 I $D(PSODRUG("NDF")) S NDF=$P(PSODRUG("NDF"),"A"),VAP=$P(PSODRUG("NDF"),"A",2),PTR=NDF_"."_VAP
119 I $G(NDF) D CHK^PSODGAL(PSODFN,"DR",PTR) K NDF,VAP,PTR
120 I $P($G(PSODRUG("NDF")),"A")=0 D CHK1^PSODGAL(PSODFN)
121 I $D(PSODRUG("VA CLASS")) D CLASS^PSODGAL(PSODFN)
122POSTX ;
123 K ^TMP($J,"DI"_PSODFN),^TMP($J,"DI")
124 K PSORX("INTERVENE"),DA
125 Q
126 ;
127EOJ ;
128 K PSODRG
129 Q
130 ;
131CLOZ ;
132 S ANQRTN=$P(^PSDRUG(PSODRUG("IEN"),"CLOZ1"),"^"),ANQX=0
133 S P(5)=PSODRUG("IEN"),DFN=PSODFN,X=ANQRTN
134 X ^%ZOSF("TEST") I D @("^"_ANQRTN) S:$G(ANQX) PSORX("DFLG")=1
135 K P(5),ANQRTN,ANQX,X
136 Q
137 ;
138EN(DRG) ;returns lab test identified for clozapine order checking
139 K LAB I $P($G(^PSDRUG(DRG,"CLOZ1")),"^")'="PSOCLO1" S LAB("NOT")=0 Q
140 I $P($G(^PSDRUG(DRG,"CLOZ1")),"^")="PSOCLO1" D
141 .S (CNT,I)=0 F S I=$O(^PSDRUG(DRG,"CLOZ2",I)) Q:'I S CNT=$G(CNT)+1
142 .I CNT'=2 S LAB("BAD TEST")=0 K CNT Q
143 .K CNT F I=0:0 S I=$O(^PSDRUG(DRG,"CLOZ2",I)) Q:'I D
144 ..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)
145 K LABT,I
146 Q
147NOALRGY ;
148 W $C(7),!,"There is no allergy assessment on file for this patient."
149 W !,"You will be prompted to intervene if you continue with this prescription"
150 K DIR
151 S DIR(0)="SA^1:YES;0:NO",DIR("A")="Do you want to Continue?: ",DIR("B")="N" D ^DIR
152 I 'Y S PSORX("DFLG")=1 Q
153 D ^PSORXI
154 Q
Note: See TracBrowser for help on using the repository browser.