source: WorldVistAEHR/trunk/r/INPATIENT_MEDICATIONS-PSJ-PSIV-PSG--PSGW/PSJDIN.m@ 1258

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

initial load of WorldVistAEHR

File size: 6.5 KB
RevLine 
[613]1PSJDIN ;BIR/MV - National Formulary Indicator Utility ;4 MAR 2000/ 4:27 PM
2 ;;5.0; INPATIENT MEDICATIONS ;**50,56,76**;16 DEC 97
3 ;
4 ; Reference to ^PSSDIN is supported by DBIA# 3166.
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(50.7 is supported by DBIA# 2180.
8 ; Reference tp ^PSDRUG is supported by DBIA# 2192.
9 ;
10DINIV(FIL,DRGTMP) ;
11 ;*Find the DD & OI IEN for the additive or solution
12 ;*FIL: 52.6 or 52.7
13 ;*DRGTMP: Additive or Solution's IEN
14 ;
15 NEW PSJDRG,PSJOI,PSJDD,PSJDIN,PSJINDEX
16 S PSJDRG=$P(^PS(FIL,+DRGTMP,0),U,2),PSJOI=$P(^PS(FIL,+DRGTMP,0),U,11)
17 D DIN(PSJOI,PSJDRG)
18 Q
19DIN(PSJOI,PSJDRG) ;
20 ;*This will issue the Restriction/guideline prompt for both OI & DD
21 ;*PSJOI: Orderable Item IEN
22 ;*PSJDRG: Dispense drug IEN
23 ;
24 NEW PSJDIN,PSJDD,PSJINDEX,Y,X,XIT
25 D EN^PSSDIN(PSJOI,PSJDRG)
26 Q:$O(^TMP("PSSDIN",$J,""))=""
27 S PSJDIN=$$PROMPT^PSSDIN
28 W:"DOY"[Y @IOF
29 I PSJDIN="D"!(PSJDIN="Y") D Q:XIT=U
30 . W !!,"Dispense Drug Text:" W ! D TXD("DD") W !!
31 I PSJDIN="O"!(PSJDIN="Y") D
32 . W !!,"Orderable Item Text:" W ! D TXD("OI") W !!
33 D PAUSE^VALM1,CLEAR^VALM1
34 Q
35TXD(N1) ;
36 ;N1 = "OI" or "DD"
37 ;DISPLAY OI/DD DRUG TEXT
38 N N2,N3,N4,NX S XIT="",NX="PSSDIN" ;
39 S N2="" F S N2=$O(^TMP(NX,$J,N1,N2)) Q:'N2!(XIT=U) D
40 .S N3="" F S N3=$O(^TMP(NX,$J,N1,N2,N3)) Q:'N3!(XIT=U) D
41 ..S N4="" F S N4=$O(^TMP(NX,$J,N1,N2,N3,N4)) Q:'N4!(XIT=U) D
42 ...W !?5,^TMP(NX,$J,N1,N2,N3,N4) I $Y>15 W ! D HLD S XIT=X
43 Q
44HLD ;
45 W !
46 ;K DIR S DIR(0)="E",DIR("A")="Press Return to Continue" D ^DIR K DIR
47 K DIR
48 S DIR(0)="E",DIR("A")="Press Return to Continue or ""^"" to Exit: "
49 D ^DIR K DIR
50 W @IOF
51 Q
52NFIV(FIL,PSJIVIEN,PSJNF) ;
53 ;*Return N/F and msg display for ad/sol.
54 ;*FIL: "AD" or "SOL"
55 ;*PSIVIEN: Additive or Solution's IEN
56 ;*PSJNF: 0 node from file 50
57 ;*PSJNF("NF"): Only exist if it is a Non-formulary
58 ;*PSJNF("MSG"): Return the message field to be displayed /w IV names
59 ;
60 S PSJNF=$G(^PSDRUG(+$P($G(^PS(FIL,+PSJIVIEN,0)),U,2),0))
61 S PSJNF("NF")=$S($P(PSJNF,U,9)=1:" *N/F*",1:"")
62 S PSJNF("MSG")=$P(PSJNF,U,10)
63 Q
64DINFLIV(DRG) ;
65 ;*This module will find all drug text that exist for the Orderable
66 ;*Items & dispense drugs associated with the Additive(s) & Solution(s)
67 ;*within the IV order. Once a drug text exist, return the <DIN>
68 ;*indicator to be displayed within the order view.
69 ;
70 ;*DRG: Drug array from the IV order
71 NEW PSJFIL,PSJND,PSJX,PSJFL
72 F PSJFIL="AD","SOL" F PSJND=0:0 S PSJND=$O(DRG(PSJFIL,PSJND)) Q:'PSJND!$G(PSJFL) D
73 . S PSJX=$G(^PS($S(PSJFIL="AD":52.6,1:52.7),+DRG(PSJFIL,PSJND),0)) D EN^PSSDIN($P(PSJX,U,11),$P(PSJX,U,2))
74 . I $O(^TMP("PSSDIN",$J,""))]"" S PSJFL=1 Q
75 I '$G(PSJFL),$G(PSJORD)["P" S PSJFL=$$DINFLUD(+P("PD")),PSJFL=$S(PSJFL]"":1,1:0)
76 K ^TMP("PSSDIN",$J)
77 Q $S($G(PSJFL):" <DIN>",1:"")
78 ;
79DINFLUD(PSJOI,PSJDDA) ;
80 ;*This module will find all drug text that exist for the Orderable
81 ;*items & dispense drugs associated with the unit dose order. Once
82 ;*a drug text exist, return the <DIN> indicator to be displayed with
83 ;*the order view.
84 ;*PSJOI: Orderable IEN (Require)
85 ;*PSJDDA: Dispense drug array within the order (Optional)
86 ;
87 NEW PSJFL,PSJDD
88 D EN^PSSDIN(PSJOI) I $O(^TMP("PSSDIN",$J,"OI",0)) K ^TMP("PSSDIN",$J) Q "<DIN>"
89 F PSJDD=0:0 S PSJDD=$O(PSJDDA(PSJDD)) Q:'PSJDD D
90 . D EN^PSSDIN(,PSJDD) I $O(^TMP("PSSDIN",$J,"DD",0)) S PSJFL=1 Q
91 K ^TMP("PSSDIN",$J)
92 Q $S($G(PSJFL):"<DIN>",1:"")
93 ;
94DINHIDE(PSJDFN,PSJORD) ;
95 ;*Display drug text from the hidden action.
96 ;*PSJDFN: Patient IEN (Require)
97 ;*PSJORD: Order #_"UVP" (Required)
98 ;*DRG: IV DRG array (Required for IV but Optional for UD orders)
99 ;
100 D:PSJORD["V" IV
101 D:PSJORD["U" UD
102 I PSJORD["P" D
103 . D @($S($O(DRG("AD",0)):"IV",$O(DRG("SOL",0)):"IV",1:"UD"))
104 I PSJORD="" D NEWUD
105 K ^TMP("PSSDIN",$J)
106 Q
107IV ;
108 ;NEW DRG,DRGI,DRGT,ND,ON55,Y
109 ;D:PSJORD["P" GT531^PSIVORFA(DFN,PSJORD)
110 ;I PSJORD["V" S ON55=PSJORD D GTDRG^PSIVORFB
111 ;*Loop thru IV DRG array to find OI & DD IEN from each AD & SOL.
112 ;
113 NEW FIL,NAME,PSJDD,PSJNF,PSJOI,PSJX,Y,X,PSJXY
114 D FULL^VALM1 W @IOF
115 W !,"Drug restriction/guideline info:"
116 F FIL="AD","SOL" F PSJX=0:0 S PSJX=$O(DRG(FIL,PSJX)) Q:'PSJX D
117 . NEW X
118 . S PSJXY=1
119 . SET NAME=$P(DRG(FIL,PSJX),U,2)
120 . W !!,"IV "_$S(FIL="AD":"Additive",1:"Solution")_": "_NAME
121 . D NFIV(FIL,+PSJX,.PSJNF) W $G(PSJNF("NF")),!
122 . S X=$S(FIL="AD":$G(^PS(52.6,+DRG(FIL,PSJX),0)),1:$G(^PS(52.7,+DRG(FIL,PSJX),0)))
123 . S PSJOI=$P(X,U,11),PSJDD=$P(X,U,2) D EN^PSSDIN(+PSJOI,+PSJDD)
124 . D DINOI(PSJOI,3)
125 . D DINDD(PSJDD,3)
126 D:'$G(PSJXY) HLD
127 K ^TMP("PSSDIN",$J)
128 Q
129UD ;
130 ;*Loop thru Unit dose order for Orderable Item & Dispense drug
131 ;
132 NEW F,PSJDD,PSJDDX,PSJOI,PSJXY
133 D FULL^VALM1 W @IOF
134 W !,"Drug restriction/guideline info:"
135 S F=$S(PSJORD["U":"^PS(55,PSJDFN,5,+PSJORD,",1:"^PS(53.1,+PSJORD,")
136 S PSJOI=+@(F_".2)") D EN^PSSDIN(PSJOI),DINOI(PSJOI,3)
137 ;*Loop thru dispense drug array
138 F PSJDDX=0:0 S PSJDDX=$O(@(F_"1,"_PSJDDX_")")) Q:'PSJDDX D
139 . S PSJXY=1
140 . S PSJDD=+@(F_"1,"_PSJDDX_",0)")
141 . D EN^PSSDIN(PSJOI,PSJDD)
142 . D DINDD(PSJDD,3)
143 D:'$G(PSJXY) HLD
144 K ^TMP("PSSDIN",$J)
145 Q
146NEWUD ;*New backdoor order doesn't have an order# yet.
147 ;*Loop thru Orderable Item & Dispense drug
148 ;
149 NEW F,PSJDD,PSJDDX,PSJOI,PSJXY
150 D FULL^VALM1 W @IOF
151 W !,"Drug restriction/guideline info:"
152 S PSJOI=+$G(PSGPD) D EN^PSSDIN(PSJOI),DINOI(PSJOI,3)
153 ;*Loop thru dispense drug array
154 F PSJDDX=0:0 S PSJDDX=$O(^PS(53.45,PSJSYSP,2,PSJDDX)) Q:'PSJDDX D
155 . S PSJXY=1
156 . S PSJDD=+$G(^PS(53.45,PSJSYSP,2,PSJDDX,0))
157 . D EN^PSSDIN(PSJOI,PSJDD)
158 . D DINDD(PSJDD,3)
159 D:'$G(PSJXY) HLD
160 K ^TMP("PSSDIN",$J)
161 Q
162DINOI(PSJOI,COL) ;
163 ;*Display drug text for Orderable Item
164 ;*OI: Orderable Item IEN
165 ;*COl: Column to display the text in
166 ;
167 NEW X,XX
168 W !!,?COL,"Orderable Item: "_$$OINAME^PSJLMUTL(PSJOI)_$$OINF(PSJOI),!
169 I '$O(^TMP("PSSDIN",$J,"OI",PSJOI,0)) W !,?10,"No information available",! Q
170 D TXD("OI") W !
171 Q
172DINDD(PSJDD,COL) ;
173 ;*Display drug text for Dispense drug
174 ;*PSJDD: Dispense drug IEN
175 ;*COL: Column to display the text in
176 ;
177 NEW X
178 W !,?COL,"Dispense drug: "_$$DDNAME^PSJLMUTL(+PSJDD)_$$DDNF(PSJDD),!
179 I '$O(^TMP("PSSDIN",$J,"DD",PSJDD,0)) W !?10,"No information available",! D HLD Q
180 D TXD("DD"),HLD W @IOF
181 Q
182OINF(PSJOI) ;
183 ;*Return *N/F* if the orderable item is Non-formulary
184 ;*PSJOI: Orderable item IEN
185 ;
186 Q $S($P($G(^PS(50.7,+PSJOI,0)),U,12)=1:" *N/F*",1:"")
187 ;
188DDNF(PSJDD) ;
189 ;**Return *N/F* if the dispense drug is Non-formulary
190 ;*PSJDD: Dispense drug IEN
191 ;
192 Q $S($P($G(^PSDRUG(+PSJDD,0)),U,9)=1:" *N/F*",1:"")
193
194
195
196
197
198
Note: See TracBrowser for help on using the repository browser.