source: FOIAVistA/trunk/r/INPATIENT_MEDICATIONS-PSJ-PSIV-PSG--PSGW/PSJDCHK.m@ 1742

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

initial load of FOIAVistA 6/30/08 version

File size: 4.7 KB
Line 
1PSJDCHK ;BIR/MLM-ORDER CHECKS FOR DRUG SELECTION ;24 NOV 97 / 1:27 PM
2 ;;5.0; INPATIENT MEDICATIONS ;**81,91**;16 DEC 97
3 ;
4 ; Reference to ^PS(51.2 is supported by DBIA 2178.
5 ; Reference to ^PS(52.6 is supported by DBIA 1231.
6 ; Reference to ^PS(52.7 is supported by DBIA 2173.
7 ; Reference to ^PS(55 is supported by DBIA 2191.
8 ; Reference to ^PSDRUG( is supported by DBIA 2192.
9 ; Reference to ^PSOORDRG is supported by DBIA #2190.
10 ; Reference to ^PSOORRL is supported by DBIA #2400.
11 ; Reference to ^PSD(58.8 is supported by DBIA 2283.
12 ; Reference to ^PSI(58.1 is supported by DBIA 2284.
13 ;
14START ;
15 ;
16END ; used by DRUG (55.06,101 & 53.1,101) x-refs to warn user if patient is receiving or about to receive the drug just ordered
17 Q:$D(PSJHLSKP)
18 N Z,ZZ I $G(PSJPWD)&($P($G(PSJSYSU),";")=3)&($G(PSGDRG)) I ($D(^PSI(58.1,"D",PSGDRG,PSJPWD)))!($D(^PSD(58.8,"D",PSGDRG,PSJPWD))) W !?25,"*** A WARD STOCK ITEM ***"
19 ;I $G(^DPT(+PSGP,"PI"))="Y",$D(^("PG",PSGX)) W $C(7),$C(7),!!?7,"*** WARNING! THIS PATIENT IS LISTED AS REACTING TO THIS DRUG! ***",!
20 Q
21ENDDC(PSGP,PSJDD) ; Perform Duplicate Drug, Duplicate Class,
22 ; Drug-Drug interaction check, Drug-Allergy interaction check.
23 D END,EN^PSOORDRG(PSGP,PSJDD) K PSJPDRG S Y=1,X="" S DFN=PSGP
24 I $O(^TMP($J,"DD",0)) D
25 .W !,"This patient is already receiving this medication in the following orders:",!,"this drug.",!
26 .F INDEX=0:0 S INDEX=$O(^TMP($J,"DD",INDEX)) Q:'INDEX S ND=$G(^TMP($J,"DD",INDEX)),ON=$P(ND,U,3),TYPE=$P(ON,";",2) D OEL^PSOORRL(PSGP,ON) D @TYPE
27 Q
28O ; Display OP order.
29 W !,"Outpatient display goes here",!
30 Q
31I ; Display UD order.
32 W !,"Inpatient Order Display goes here",!
33 Q
34 S ND=$P($G(^TMP($J,"PS",0)),"^")
35 I $D(^TMP($J,"PS","A"))!($D(^TMP($J,"PS","B"))) D
36 .F X=0:0 S X=$O(^TMP($J,"PS","A",X)) Q:'X D
37 ..S Y=$G(^TMP($J,"PS","A",X,0)) I Y W !,?10,$P(Y,U)," ",$P(Y,U,2) W:$P(Y,U,3) "(",$P(Y,U,3),")"
38 ..W !,?10,$P(ND,U),!,?13,"Give: "
39 .F X=0:0 S X=$O(^TMP($J,"DI",X)) Q:'X D
40 ..S ND=$G(^TMP($J,"DI",X,0)) W $P(ND,U,2)," (",$P(ND,U,4),")",!
41 ;
42CONT ; Ask user if they wish to continue in spite of an order check.
43 Q:'$D(PSJPDRG) S DIR(0)="Y",DIR("A")="Do you wish to continue entering this order",DIR("?",1)="Enter ""N"" if you wish to exit without creating a new order,"
44 S DIR("?")="or ""Y"" to continue with the order entry process." D ^DIR S:'Y Y=-1,X="^"
45 Q
46 ;
47SF ;
48 S Y=+Y,ND=$G(^PSDRUG(Y,0)),PSGID=+$G(^("I")) I PSGID W !!,"THIS DRUG IS INACTIVE AS OF ",$E($$ENDTC^PSGMI(PSGID),1,8)
49 W !!,$S($P(ND,"^",9):"NON-",1:""),"FORMULARY ITEM" W:$P(ND,"^",10)]"" !,$P(ND,"^",10)
50 S ND=$P($G(^PSDRUG(Y,2)),"^",3)["U" W !,$P("NOT^","^",ND+1)," A UNIT DOSE DRUG" W ! S ND=$G(^(8)),N5=$G(^(8.5)) W !?2,$$CODES2^PSIVUTL(50,62.01),": " I ND W $P(ND,"^")
51 W !?10,$$CODES2^PSIVUTL(50,62.02),": " I $P(ND,"^",2) W $S($D(^PS(51.2,$P(ND,"^",2),0)):$P(^(0),"^"),1:$P(ND,"^",2))
52 W !?6,$$CODES2^PSIVUTL(50,62.03),": " I $P(ND,"^",3)]"" W $$CODES^PSIVUTL($P(ND,"^",3),50,62.03)
53 W !?11,$$CODES2^PSIVUTL(50,62.04),": " I $P(ND,"^",4)]"" W $P(ND,"^",4)
54 W !,$$CODES2^PSIVUTL(50,62.05),": " I $P(ND,"^",5) W $S('$D(^PSDRUG(+$P(ND,"^",5),0)):$P(ND,"^",5),$P(^(0),"^")]"":$P(^(0),"^"),1:$P(ND,"^",5))
55 W !?17,$$CODES2^PSIVUTL(50,212.2),": " I $P(N5,"^",2)]"" W $P(N5,"^",2)
56 Q:'$$CODES2^PSIVUTL(50,212) W !?17,$$CODES2^PSIVUTL(50,212),": " D
57 . F Q=0:0 S Q=$O(^PSDRUG(Y,212,Q)) Q:'Q S ND=$G(^(Q,0)) I ND,$P(ND,"^",2) W ?31,$S('$D(^PS(57.5,+ND,0)):+ND_";PS(57.5,",$P(^(0),"^")]"":$P(^(0),"^"),1:+ND_";PS(57.5,"),?56,$P(ND,"^",2),!
58 Q
59 ;
60PDWCHK(DFN,ON) ; Print Dup Drug order.
61 N ND,ND0,ND2,X
62 ;W:'$D(PSJDCHK) $C(7),$C(7),!!,"WARNING! THIS PATIENT HAS THE FOLLOWING ORDER(S) FOR THIS MEDICATION:",!!
63 ;I ON["V" D DISPIV Q
64 F DRG=0:0 S DRG=$O(^PS(55,DFN,"IV",+ON,"AD",DRG)) Q:'DRG D
65 . S ND=$$DRUGNAME^PSJLMUTL(DFN,ON)
66 S F=$S(ON["P":"^PS(53.1,",1:"^PS(55,"_DFN_",5,"),ND0=$G(@(F_+ON_",0)")),ND2=$G(^(2)),X=$P(ND,U,2),X=$S(X=.2:$P($G(^(.2)),U,2),1:$G(^(.3)))
67 W ?10,$P(ND,U),!,?13,"Give: ",X," ",$$ENMRN^PSGMI(+$P(ND0,U,3))," ",$P(ND2,U),!!
68 Q
69 ;
70DISPUD(DFN,ON) ;
71 I ON["P",(TYPE="F") ;D DISPPF(DFN,ON) Q
72 S F=$S(ON["P":"^PS(53.1,",1:"^PS(55,"_DFN_",5,"),DN=$$DRUGNAME^PSJLMUTL(DFN,ON)
73 S ND0=$G(@(F_+ON_",0)")),TYPE=$P(ND0,U,4),ND2=$G(^(2))
74 S X=$P(DN,U,2),LINE=$S(X=".2":$P($G(@(F_+ON_",.2)")),U,2),X=.3:$P($G(@(F_+ON_".3)")),U),1:"")
75 W !,?10,$P(DN,U),!,13,"Give: ",LINE," ",$$ENMRA^PSGMI(+$P(ND0,U,3))," ",$P(ND2,U),!!
76 Q
77 ;
78DISPIV(DFN,ON) ; Display condensed IV order display.
79 N AD,SOL
80 F AD=0:0 S AD=$O(^PS(55,DFN,"IV",+ON,"AD",AD)) Q:'AD D
81 .S ND=$G(^PS(55,DFN,"IV",+ON,"AD",AD,0)),DRG=$P($G(^PS(52.6,+ND,0)),U),AMT=$P(ND,U,2),BOT=$P(ND,U,3)
82 .W !,PAD," ",AMT W:BOT "(",BOT,")"
83 F SOL=0:0 S SOL=$O(^PS(55,"IV",+ON,"SOL",SOL)) Q:'SOL D
84 .S ND=$G(^PS(55,DFN,"IV",+ON,"SOL",SOL,0)),DRG=$P($G(^PS(52.7,+ND,0)),U),AMT=$P(ND,U,2)
85 .W !,$S(FIRST:"in",1:" "),$P(DRG,U)," ",$P(DRG,U,2)
86 Q
Note: See TracBrowser for help on using the repository browser.