Back to Main Page
MEDITECH PHA rule info
** No Warranty is Expressed or Implied with the accuracy of the below data **
Some of these rules were only in testing phase and never completed
Some were written years ago and no longer would write them the same way, but have not had time to change them to more efficient expressions
Note: End of documentation contains the code for The keywords.
Click here to see keywords
Some of the keywords require NPR reports. Below the keywords are a link to the NPR reports for keywords.
Click here to see NPR Reports for Keywords
RUN DATE: 01/11/07 NORTH COUNTRY NPR PHARMACY 4.6 **LIVE** PAGE 1
RUN TIME: 0849 pha.rule.zcus.hab.download
RUN USER: HAB
;
--------------------------------------------------------------------------------------------
15KG RX EVL DOSE FLAG TO WARN OF PATEINT'S<=15k
;This rule flags user to notify floor about heparin flush 10u/ml
"CHECK WT, IF<= 15kg, use heparin flush 10 u/ml. - ALERT FLOOR!"^A,
"PT is < 15kg, use heparin flush 10u/ml! - ALERT FLOOR!"^B,
IF{[f pt status]'="ADM IN" [f rx ok];
IF{[f pt oe wt kgs]^WT_.=.&([f pt adm/ser age]'>5) [f rx msg](A);
IF{[f pt oe wt kgs]'>15 [f rx msg](B);[f rx ok]}}};
--------------------------------------------------------------------------------------------
327OB RX EVL MED FLAG USER 327 OB
"Note: patient is in 327 - please change Rx inventory to OB"^FLAG,
IF{[f pt room]="327" [f rx msg](FLAG);1};
--------------------------------------------------------------------------------------------
ADBW CALC EVL MED Ideal BW/ABW- CRCL calc
[f pt sex]^SX_.=.,
[f pt oe ht cm]^HT_.=.,
[f pt oe wt kgs]^WT_.=.,
IF{SX="M" 50;45.5}^S,
IF{SX="M" 1;0.85}^F,
S+(2.3*((HT/2.54)-60)!0)^IBW_.=.,
IF{[f pt oe wt kgs]>1 IBW*1.2}^ADBW_.=.,
IF{[f pt oe wt kgs]<IBW [f pt oe wt kgs]^IBW_.=.},
IF{[f pt oe wt kgs]>ADBW ([f pt oe wt kgs]-IBW)^OW},
IF{OW'<0 (OW*0.4)^OWC_.=.},
IF{OW'<0 (OWC+IBW)^IBW_.=.},
IBW^ADBW;
--------------------------------------------------------------------------------------------
ADEN.BD CALC EVL MED ADENOSINE DOSE CHECKER
;used for calculating if correct dose is in dipyridamole infus.
[f rx iv add dose]^ADEN.BD;
--------------------------------------------------------------------------------------------
ADEN.CC CALC EVL MED ADENOSINE CALC RULE
;used for calculating if correct dose for dipyridamole
[f rx iv car vol]^ADEN.CC;
--------------------------------------------------------------------------------------------
ADEN.IMAG RX EVL MED ADENOSINE DOSE IMAGING
;this rule calculates amount of ADENOSINE IV which should be given
;based on 0.84 mg/kg and total volume 45 ml
IF{[f rx ord type]="SOI" [f rx ok];
"LINE FEED THE ADDITIVE MED, PRESS SPECIAL FUNCTION KEY & UPDATE WT"^A,
"Pt is > 161 kg, therefore, 135 mg ADENOSINE, 0 ml NaCl 0.9%"^M,
IF{[f pt oe wt kgs]^WT_.=. [f rx err msg](A);
IF{[f pt oe wt kgs]>160 [f rx msg](M);(([f pt oe wt kgs]*0.84):1D)^Z,
IF{[f rx ord type]="SOI" [f rx ok];
("CALCULATED ADENOSINE DOSE ",Z," MG")^D,
("NaCl needed = ",(45-(Z/3))," mls")^N,
[f rx msg](D) [f rx msg](N)}}}};
RUN DATE: 01/11/07 NORTH COUNTRY NPR PHARMACY 4.6 **LIVE** PAGE 2
RUN TIME: 0849 pha.rule.zcus.hab.download
RUN USER: HAB
--------------------------------------------------------------------------------------------
ADEN.IMG RX EVL DOSE ADENOSINE DOSE IMAGING
;this rule calculates amount of ADENOSINE IV which should be given
;based on 0.84 mg/kg and total volume 45 ml
"LINE FEED THE ADDITIVE MED, PRESS SPECIAL FUNCTION KEY & UPDATE WT"^A,
"Pt is > 161 kg, therefore, 135 mg adenosine, 0 ml NaCl 0.9%"^M,
IF{[f pt oe wt kgs]^WT_.=. [f rx err msg](A);
([f pt oe wt kgs]*0.84):1D^Z,
IF{135.01'<Z Z^Y;1350^Y},
(Y+0.1)^DH,
(Y-0.1)^DL,
IF{[f rx calc]("ADEN.BD")^BD_.=.;
("Calc. Adenosine =",Y," - NOT",BD,"mg")^M,
IF{(DH'<BD&(BD'<DL)) [f rx ok];
IF{BD_.=. [f rx ok];
[f rx err msg](M)}}}};
--------------------------------------------------------------------------------------------
ADEN.MC RX EVL MED ADENOSINE - BLOCK IF MEDICARE
[f rx calc]("MEDICARE")^INS,
;"NOCALC-IV"^NC,
;IF{INS=1 [f rx set charge type](NC);1};
IF{INS=1 [f rx err msg]("Line feed out 6 mg and use 30 mg vial");1};
--------------------------------------------------------------------------------------------
ADEN.MC.OK RX EVL MED ADENOSINE - BLOCK IF NOT MEDIC
[f rx calc]("MEDICARE")^INS,
IF{INS'=1 [f rx err msg]("Line feed out 30 mg and use 6 mg syringe");1};
--------------------------------------------------------------------------------------------
ADEN.NS RX EVL DOSE DIPYRIDAMOLE- NS VOLUME
;this rule calculates amount of adenosine IV which should be given
;based on 0.14 mg/kg and total volume 45 ml
IF{([f rx ord type]'="SOI"!([f rx med]'="NS-50ML")) [f rx ok];
"LINE FEED THE ADDITIVE MED, PRESS SPECIAL FUNCTION KEY & UPDATE WT"^A,
"Pt is > 160 kg, therefore, 135 mg adenosine 0.01 ml NaCl 0.9%"^M,
IF{[f pt oe wt kgs]^WT_.=. [f rx err msg](A);
([f pt oe wt kgs]*0.84):1D^Z,
IF{135.01'<Z Z^Y;135^Y},
(45-(Y/3))^N,
(N+0.1)^NH,
(N-0.1)^NL,
IF{[f rx calc]("ADEN.CC")^NS_.=.;
IF{(NH'<NS&(NS'<NL)) [f rx ok];
("CALCULATED ADENOSINE DOSE ",Y,"MG -- NS volume should be ",N,"MLS")^D,
[f rx err msg](D)}}}};
--------------------------------------------------------------------------------------------
ALBU.BLK RX EVL FILE ALBUTEROL NEBS BLOCK
;THIS RULE WILL STOP FILING THE 2.5 MG NEB FROM FILING
;
"Please use 1 mg mnemonic - ALBU-NEB for stock med charging."^WAR,
IF{[f rx chg type]="INHUD"&([f pt location]'="SBU") 1,
[f rx err msg](WAR);[f rx ok]};
--------------------------------------------------------------------------------------------
ALL.CLASS RX EVL MED Allergy - Class - any
RUN DATE: 01/11/07 NORTH COUNTRY NPR PHARMACY 4.6 **LIVE** PAGE 3
RUN TIME: 0849 pha.rule.zcus.hab.download
RUN USER: HAB
"No Class allergies"^MES,
[f z all class list]^MES,
IF{MES_.=. 1;
[f rx msg]("Class Allergies:"_MES),1};
--------------------------------------------------------------------------------------------
ALL.HAB RX EVL MED ALLERGY UPDATE MESSAGE TO RPH
;IF{[f z staff title]'="RPH" 1;
""^CAL^CAD^GAL^GAD,
[f z all class in]^CAL,
[f z adr class in]^CAD,
[f z all gen in]^GAL,
[f z adr gen in]^GAD,
CAL+CAD^CLS,
GAL+GAD^GEN,
IF{'GAL&'GAD&'CAL&'CAD 1;
[f rx win init],
IF{GAD!GAL ("Update allergies! Patient has "_GEN_" inactive Generic codes")^MG1,
"For Maximum patient safety, please switch to ingredient codes"^MG2,
[f rx win add](MG1),
[f rx win add](MG2)},
IF{CAL!CAD ("Update Allergies! Patient has "_CLS_" inactive Class codes")^MC1,
[f rx win add](MC1)},
[f rx win disp],1};
;[f rx msg]("Inactive Class: "_CLS_" Inactive Generics "_GEN);
;IF{[f z staff title]'="RPH" 1;
;[f z.any.allergies]^ALLERGIES,
;IF{'ALLERGIES 1;
;[f z mdx.allergy.y]^ALL,
;IF{[f z all.class.nka]="NKA" 1;
;IF{ALL="NOT" 1,
;("MDX allergy codes not verified, please update with ingredient codes")^MES1,
;[f z all.class.nka]^CLFS,
;[f z all class - last]^CLLS,
;[f z all generic first]^GNFS,
;[f z all generic last]^GNLS,
;IF{CLFS'=CLLS CLFS_" & "_CLLS^CLASS;CLFS^CLASS},
;("Some of Class allergies listed: "_CLASS)^CLASS,
;IF{GNFS'=GNLS GNFS_" & "_GNLS^GENERIC;GNFS^GENERIC},
;("Some of Generic Allergies Listed: "_GENERIC)^GENERIC,
;[f rx win init],
;[f rx win add](MES1),
;[f rx win add](CLASS),
;[f rx win add](GENERIC),
;[f rx win disp],1;1}}}};
--------------------------------------------------------------------------------------------
ALL.MES RX EVL MED ALLERGY UPDATE MESSAGE TO RPH
;IF{[f z staff title]'="RPH" 1;
IF{[f rx ord type]="T" 1;
""^CAL^CAD^GAL^GAD,
[f z all class in]^CAL,
[f z adr class in]^CAD,
[f z all gen in]^GAL,
[f z adr gen in]^GAD,
CAL+CAD^CLS,
GAL+GAD^GEN,
RUN DATE: 01/11/07 NORTH COUNTRY NPR PHARMACY 4.6 **LIVE** PAGE 4
RUN TIME: 0849 pha.rule.zcus.hab.download
RUN USER: HAB
IF{'GAL&'GAD&'CAL&'CAD 1;
[f rx win init],
IF{GAD!GAL ("Update allergies! Patient has "_GEN_" old GENERIC codes")^MG1,
"For Maximum patient safety, please switch to ingredient codes"^MG2,
[f rx win add](MG1),
[f rx win add](MG2)},
IF{CAL!CAD ("Update Allergies! Patient has "_CLS_" OLD CLASS codes")^MC1,
[f rx win add](MC1)},
[f rx win disp],1}};
;[f rx msg]("Inactive Class: "_CLS_" Inactive Generics "_GEN);
;IF{[f z staff title]'="RPH" 1;
;[f z.any.allergies]^ALLERGIES,
;IF{'ALLERGIES 1;
;[f z mdx.allergy.y]^ALL,
;IF{[f z all.class.nka]="NKA" 1;
;IF{ALL="NOT" 1,
;("MDX allergy codes not verified, please update with ingredient codes")^MES1,
;[f z all.class.nka]^CLFS,
;[f z all class - last]^CLLS,
;[f z all generic first]^GNFS,
;[f z all generic last]^GNLS,
;IF{CLFS'=CLLS CLFS_" & "_CLLS^CLASS;CLFS^CLASS},
;("Some of Class allergies listed: "_CLASS)^CLASS,
;IF{GNFS'=GNLS GNFS_" & "_GNLS^GENERIC;GNFS^GENERIC},
;("Some of Generic Allergies Listed: "_GENERIC)^GENERIC,
;[f rx win init],
;[f rx win add](MES1),
;[f rx win add](CLASS),
;[f rx win add](GENERIC),
;[f rx win disp],1;1}}}};
--------------------------------------------------------------------------------------------
ALL.TO.ING RX EVL MED Allergy chg to ingredient
IF{[f z pharmacist]="Y" 1,
[f z all gen and cls ls]^ALLG,
;"TEST"^ALLG,
IF{ALLG_.=. 1;
"Please Chg Allergies to Ingr:"^CHG,
IF{[f rx yes/no](CHG_ALLG_" OK?")=1 1;
"INGREDIENT allergies provide better checking than class or generic"^MES,
[f rx msg](MES),1}};1};
--------------------------------------------------------------------------------------------
ALL.UPDTE RX EVL MED ALLERGY UPDATE MESSAGE TO RPH
;IF{[f z staff title]'="RPH" 1;
[f z.any.allergies]^ALLERGIES,
IF{'ALLERGIES 1;
[f z mdx.allergy.y]^ALL,
IF{[f z all.class.nka]="NKA" 1;
IF{ALL="NOT" 1,
("MDX allergy codes not verified, please update with ingredient codes")^MES1,
[f z all.class.nka]^CLFS,
[f z all class - last]^CLLS,
[f z all generic first]^GNFS,
[f z all generic last]^GNLS,
IF{CLFS'=CLLS CLFS_" & "_CLLS^CLASS;CLFS^CLASS},
("Some of Class allergies listed: "_CLASS)^CLASS,
RUN DATE: 01/11/07 NORTH COUNTRY NPR PHARMACY 4.6 **LIVE** PAGE 5
RUN TIME: 0849 pha.rule.zcus.hab.download
RUN USER: HAB
IF{GNFS'=GNLS GNFS_" & "_GNLS^GENERIC;GNFS^GENERIC},
("Some of Generic Allergies Listed: "_GENERIC)^GENERIC,
[f rx win init],
[f rx win add](MES1),
[f rx win add](CLASS),
[f rx win add](GENERIC),
[f rx win disp],1;1}}};
--------------------------------------------------------------------------------------------
ALPROS.MSG RX EVL MED ALPROSTADIL MESSAGE
;MESSAGE TO USER BASED ON MESSAGE FROM JRG on 5/4/2004
;
;The Fargo transport team has been trained to use the alprostadil prepared
;according to weight using a modified "rule of 6" formula.
;The formula is as follows:
;Wt (in Kg) X 0.12 = volume of alprostadil 500mcg/ml to dilute to a total of
;10 ml with D10W.
;
;This solution is run at 1ml/hr to deliver 0.1mcg/kg/min
;or 0.5ml/hr to deliver 0.05mcg/kg/min which is the recommended dose range.
;
;Example: 3.5 kg infant x 0.12 = 0.42 ml is diluted with 9.58 ml
;(10-0.42ml=9.58ml) of D10W for a total volume of 10ml.
;This would be run at 1ml/hr for 0.1mcg/kg/min or 0.5ml/hr for 0.05 mcg/kg/min.
;
[f rx win init],
"Message from JRG - 5/4/2004"^M1,
[f rx win add](M1),
"The Fargo transport team has been trained to use the alprostadil prepared"^M1,
[f rx win add](M1),
"according to weight using a modified rule of 6 formula."^M1,
[f rx win add](M1),
[f rx win add](" "),
[f rx win add]("Wt in kg x 0.12 = volume of alprostadil 500 mcg/ml"),
[f rx win add]("to dilute to a total of 10 ml with D10W"),
[f rx win add]("This solution is run at 1 ml/hr to deliver 0.1 mcg/kg/min or"),
[f rx win add]("0.5 ml/hr to deliver 0.05 mcg/kg/min "),
[f rx win add]("Example: 3.5 kg infant x 0.12 = 0.42 ml is diluted with"),
[f rx win add]("9.58 ml (10 - 0.42ml = 9.58 ml) of D10W for a final vol. 10ml"),
[f rx win add]("Infuse at 0.5 ml/hr for dose of 0.05 mcg/kg/min or"),
[f rx win add]("Infuse at 1 ml/hr for a dose of 0.1 mcg/kg/min"),
[f rx win disp],1;
--------------------------------------------------------------------------------------------
AZIT.RTE RX EVL FILE Must be < 130
IF{[f rx calc]("CIPRRATE")^CIPRRATE_.=.;
"Rate for Zithromax should not exceed 130 ml/hr - infuse over 2 hrs"^B,
IF{CIPRRATE>130 [f rx err msg](B);1}};
--------------------------------------------------------------------------------------------
CATACHG RX EVL MED CATARACT CHARGE-MEDICARE
;Rule written Herb Bromenshenkel 3/24/99 CHARGES fee to medicare patients
;if non medicare,no fee. Fee is a surgical billing number
; will only work on M order types
"CAT-MEDC"^P,
IF{[f rx ord type]'="M" [f rx ok];
IF{[f rx calc]("MC2")^MC2_.=.;
RUN DATE: 01/11/07 NORTH COUNTRY NPR PHARMACY 4.6 **LIVE** PAGE 6
RUN TIME: 0849 pha.rule.zcus.hab.download
RUN USER: HAB
IF{(MC2=1) [f rx ok];[f rx set charge type]("NC")}}};
--------------------------------------------------------------------------------------------
CHG.COST4 RX EVL MED CHARGE- SET TYPE COST+4
;This rule sets the default charge type to "COST+4.00" if it is a DM order type
IF{[f rx ord type]'="DM" [f rx ok];[f rx set charge type]("COST+4.00")};
--------------------------------------------------------------------------------------------
CIPRRATE CALC EVL MED CIPRO RATE- LIMITS TO 2 HR-CLC
;This rule does not allowing filing of cipro 400 mg iv bags/200 ml
;unless rate is over 2 hours
[f rx iv rate]^CIPRRATE;
--------------------------------------------------------------------------------------------
CIPRRATE2 RX EVL FILE CIPRO RATE -MUST BE 100
IF{[f rx calc]("CIPRRATE")^CIPRRATE_.=.;
"Rate for cipro should not exceed 100 ml/hr"^B,
IF{CIPRRATE>120 [f rx err msg](B);1}};
--------------------------------------------------------------------------------------------
CLAR RX EVL MED CLARIFICATION - RESTRICT ENT
;TEST
IF{[f rx ord type]'="CLAR" [f rx ok];
IF{[f pt location]="2WEST" [f rx ok];
IF{[f pt location]="2EAST" [f rx ok];
IF{[f pt location]="FC" [f rx ok];
IF{[f pt location]="OB" [f rx ok];
"Order type CLAR is currently for 2nd & 3rd floor only"^A,
[f rx err msg](A)}}}}};
--------------------------------------------------------------------------------------------
CLAR2 RX EVL MED CLARIFICATION - RESTRICT ENT
;ORDER TYPE MUST BE CLAR
"order type must be CLAR"^A,
IF{[f rx ord type]="CLAR" [f rx ok];
[f rx err msg](A)};
--------------------------------------------------------------------------------------------
CORVERT RX EVL MED CORVERT- K & MG within 24hours
;Rule flags last K and Mg status of patient with time frame comments
;used for corvert
;assumes normal levels for K of: 3.3 - 4.8
;assumes normal lvels of Mg of 1.6 - 2.3
[f rx nth ver Res-RES]("K",1)^POT,
IF{POT_.=. ("No K+ done on this patient, please obtain lab results")^KM;
POT#"0,"^RES^KR,
POT#"1,"^DATE,
POT#"2,"^TIME,
;[f rx msg](RES_" "_DATE_" "_TIME)},
[f z elapsed.time]^KET,
IF{KET<24.9 "K level current:"^BK;"K Level >24 hrs! -CHECK:"^BK},
IF{KR<3.3 1,
(BK_" Last K is LOW: "_KR_" "_DATE_" @"_TIME_" ("_KET_" hrs)")^KM};
IF{KR>3.2&(KR<4.9) 1,
(BK_" Last K+ is normal: "_KR_" on "_DATE_" @"_TIME_" ("_KET_" hours)")^KM};
IF{KR>4.8 1,
(BK_" Last K is HIGH: "_KR_" "_DATE_"@ "_TIME_" ("_KET_" hours)")^KM}},
RUN DATE: 01/11/07 NORTH COUNTRY NPR PHARMACY 4.6 **LIVE** PAGE 7
RUN TIME: 0849 pha.rule.zcus.hab.download
RUN USER: HAB
[f rx nth ver Res-RES]("MG",1)^MAG,
IF{MAG_.=. ("No Mg+ done on this patient, please obtain lab results")^MM;
MAG#"0,"^RES^MR,
MAG#"1,"^DATE,
MAG#"2,"^TIME,
[f z elapsed.time]^MET,
IF{MET<24.9 "Mg level current:"^BM;"Mg Level >24 hrs! -CHECK:"^BM},
IF{MR<1.6 1,
(BM_" Last MG is LOW: "_MR_" "_DATE_" @"_TIME_" ("_MET_" hrs)")^MM};
IF{MR>1.55&(MR<2.35) 1,
(BM_" Last Mg+ is normal: "_MR_" on "_DATE_" @"_TIME_" ("_MET_" hours)")^MM};
IF{MR>2.3 1,
(BM_" Last Mg is HIGH: "_MR_" "_DATE_" @"_TIME_" ("_MET_" hours)")^MM}},
[f rx win init],
[f rx win add](KM),
[f rx win add](MM),
[f rx win disp],1;
--------------------------------------------------------------------------------------------
CRCL CALC EVL MED EST. CREATININE CLEARANCE
IF{IF{[f rx last ver result]("CR")^SRCR_.=.;
[f pt sex]^SX_.=.;
[f pt oe ht cm]^HT_.=.;
[f pt oe wt kgs]^WT_.=.;
[f pt cur age]^AGE_.=.} " Unable to calculate Creatinine Clearance. "^X,
[f rx msg](X)," ";
IF{SX="M" 50;45.5}^S,
IF{SX="M" 1;0.85}^F,
IF{SRCR<1.01 1.0^SRCR},
S+(2.3*((HT/2.54)-60)!0)^IBW,
IF{[f pt oe wt kgs]<IBW [f pt oe wt kgs]^IBW},
140-AGE*IBW/(72*SRCR)*F}^CRCL:0D^CRCL;
--------------------------------------------------------------------------------------------
CRCL.0WT CALC EVL MED EST. CRCL WITHOUT ANY WEIGHT
; THIS CALCULATES EST. CRCL WITHOUT USING WEIGHT.
; USED FOR GENT, TOB AND VANC AS OF 5/11/99 - SEE RPH MEETING MINUTES FOR FULL
;DETAILS/
IF{IF{[f rx last ver result]("CR")^SRCR_.=.;
[f pt sex]^SX_.=.;
[f pt oe ht cm]^HT_.=.;
[f pt oe wt kgs]^WT_.=.;
[f pt cur age]^AGE_.=.} " Unable to calculate Creatinine Clearance. "^X,
" "," ";
IF{SX="M" 1;0.85}^F,
IF{SRCR<1.01 1.0^SRCR},
((140-AGE)/SRCR)*F}^CRCL.ADJW;
--------------------------------------------------------------------------------------------
CRCL.ADJA CALC EVL MED EST. CRCL c ADJUSTED WT
;THIS CALUCATES AN ESTIMATED CRCL BASED ON AN ADJUSTED BODY WEIGHT. NOTE,
; THIS HAS BEEN MODIFED FROM CRCL.ADJW (THE MESSAGE "UNABLE TO CAC.. HAS BEEN
;REMOVED. I LEFT IT IN THE RULE, BUT DID NOT REFERENCE IT. IN THE LINE UNDER
; THE MESSAGE, I REPLACED THE MESSAGE PROMPT WITH ""
IF{IF{[f rx last ver result]("CR")^SRCR_.=.;
RUN DATE: 01/11/07 NORTH COUNTRY NPR PHARMACY 4.6 **LIVE** PAGE 8
RUN TIME: 0849 pha.rule.zcus.hab.download
RUN USER: HAB
[f pt sex]^SX_.=.;
[f pt oe ht cm]^HT_.=.;
[f pt oe wt kgs]^WT_.=.;
[f pt cur age]^AGE_.=.} " Unable to calculate Creatinine Clearance. "^X,
" "," ";
IF{SX="M" 50;45.5}^S,
IF{SX="M" 1;0.85}^F,
IF{SRCR<1.01 1.0^SRCR},
S+(2.3*((HT/2.54)-60)!0)^IBW_.=.,
IF{[f pt oe wt kgs]>1 IBW*1.2}^ADBW_.=.,
IF{[f pt oe wt kgs]<IBW [f pt oe wt kgs]^IBW_.=.},
IF{[f pt oe wt kgs]>ADBW ([f pt oe wt kgs]-IBW)^OW},
IF{OW'<0 (OW*0.4)^OWC_.=.},
IF{OW'<0 (OWC+IBW)^IBW_.=.},
(140-AGE*IBW:6D/(72*SRCR)*F):2D}^CRCL.ADJW;
--------------------------------------------------------------------------------------------
CRCL.ADJAR CALC EVL MED EST. CRCL c ADJUSTED WT - REV
;THIS CALUCATES AN ESTIMATED CRCL BASED ON AN ADJUSTED BODY WEIGHT. NOTE,
; THIS HAS BEEN MODIFED FROM CRCL.ADJW (THE MESSAGE "UNABLE TO CAC.. HAS BEEN
;REMOVED. I LEFT IT IN THE RULE, BUT DID NOT REFERENCE IT. IN THE LINE UNDER
; THE MESSAGE, I REPLACED THE MESSAGE PROMPT WITH ""
""^XZ,
IF{IF{[f rx last ver result]("CR")^SRCR_.=. XZ_"*Missing Cr "^XZ},
IF{[f pt sex]^SX_.=. XZ_"*Missing Sex "^XZ},
IF{[f pt oe ht cm]^HT_.=. XZ_"*Missing Ht "^XZ},
IF{[f pt oe wt kgs]^WT_.=. XZ_"*Missing Wt "^XZ},
IF{[f pt cur age]^AGE_.=. XZ_"*Missing Age"^XZ},XZ;
IF{SX="M" 50;45.5}^S,
IF{SX="M" 1;0.85}^F,
IF{SRCR<1.01 1.0^SRCR},
S+(2.3*((HT/2.54)-60)!0)^IBW_.=.,
IF{[f pt oe wt kgs]>1 IBW*1.2}^ADBW_.=.,
IF{[f pt oe wt kgs]<IBW [f pt oe wt kgs]^IBW_.=.},
IF{[f pt oe wt kgs]>ADBW ([f pt oe wt kgs]-IBW)^OW},
IF{OW'<0 (OW*0.4)^OWC_.=.},
IF{OW'<0 (OWC+IBW)^IBW_.=.},
(140-AGE*IBW:6D/(72*SRCR)*F):0D}^CRCL.ADJW;
--------------------------------------------------------------------------------------------
CRCL.ADJW CALC EVL MED EST. CRCL c ADJUSTED WT
;This formula calculates the estimated creatinine clearance. If it is missing
;data, it flags the user to that effect "unable to calculate.."
;am not using with the atbxs because I did not want a double flag, am using
;CRCL.ADJA (ADJUSTED WT CR CL- WITHOUT THE MESSAGE. IF DATA NOT THERE, IT JUST
;shows a blank figure for cr cl.
IF{IF{[f rx last ver result]("CR")^SRCR_.=.;
[f pt sex]^SX_.=.;
[f pt oe ht cm]^HT_.=.;
[f pt oe wt kgs]^WT_.=.;
[f pt cur age]^AGE_.=.} " Unable to calculate Creatinine Clearance. "^X,
[f rx msg](X)," ";
IF{SX="M" 50;45.5}^S,
IF{SX="M" 1;0.85}^F,
IF{SRCR<1.01 1.0^SRCR},
RUN DATE: 01/11/07 NORTH COUNTRY NPR PHARMACY 4.6 **LIVE** PAGE 9
RUN TIME: 0849 pha.rule.zcus.hab.download
RUN USER: HAB
S+(2.3*((HT/2.54)-60)!0)^IBW_.=.,
IF{[f pt oe wt kgs]>1 IBW*1.2}^ADBW_.=.,
IF{[f pt oe wt kgs]<IBW [f pt oe wt kgs]^IBW_.=.},
IF{[f pt oe wt kgs]>ADBW ([f pt oe wt kgs]-IBW)^OW},
IF{OW'<0 (OW*0.4)^OWC_.=.},
IF{OW'<0 (OWC+IBW)^IBW_.=.},
140-AGE*IBW:6D/(72*SRCR)*F}:2D^CRCL.ADJW;
--------------------------------------------------------------------------------------------
CRCL.ALL RX EVL DOSE Renal Fx Dosing -- ALL - DOSE
;Modified from Herb's presentation at MUSE & Bruce Mathiase CrCl
;This rule calculates the Estimated CrCL based on an Adjusted body weight
;and pulls the appropriate text from the Drug CDS to display suggested dose
;Set as global rule, only displays if all 5 crcl fields have data
;** note: Check to see if a from a string. If so, displays. If not
;from string - another rule - in med displays. This is done because if
;only have at med, will not display if use string.
IF{[f z order.string.mn]_.=. 1;
IF{[q PHACRCL50]_.=.!([q PHACRCL40]_.=.)!([q PHACRCL30]_.=.) 1;
IF{[q PHACRCL20]_.=.!([q PHACRCL10]_.=.) 1;
IF{([f z user mis office]="PHARMACY"!([f user]="HAB")) 1,
IF{[f pt cur age]<18 1;
;F{'[q PHACRCL50]&'[q PHACRCL40]&'[q PHACRCL30]&'[q PHACRCL20]&'[q PHACRCL50] 1;
("Pat. Data: Age: "_[f pt adm/ser age]_" Sex:"_[f pt sex])^BLANK,
;------ checking if weight exist - is so - displays ----------
IF{[f pt oe wt kgs]_.=. 1;
[f pt oe wt kgs]^KG,
(" Weight = ",(KG):0D,"kgs ("_((KG*2.2):0D),"lbs)")^KGLB,
BLANK_KGLB^BLANK},
;------------------------
;[f rx calc]("CRCL.ADJAR")^CRCL,
[f rx calc]("CRCL.C.IBW")^CRCL,
IF{CRCL#0="*" 1,
[f rx win init],
[f rx win add]("Est. CrCl can not be calculated for the following reason(s)"),
[f rx win add](CRCL),
IF{CRCL#9'="C" 1,
[f rx nth ver Res-RES]("CR",1)^RE1,
("FYI Last Cr info: "_(RE1#"0,")_" @"_(RE1#"1,")_" "_(RE1#"2,"))^L1},
[f rx win add](L1),
[f rx win add](BLANK),
[f rx win add](L2),
[f rx win disp],1;
;----- STARTING TO CALCULATE IF CRCL IS AVAILABLE ------------------
IF{[f rx nth ver Res-RES]("CR",1)^RE1,
("Based on Cr: "_(RE1#"0,")_" on "_(RE1#"1,")_" @ "_(RE1#"2,"))^M1,
IF{[f rx nth ver Res-RES]("CR",2)^RE2_.=. " "^M2;
(" ":27_"Previous Cr "_(RE2#"0,")_" on "_(RE2#"1,")_" @ "_(RE2#"2,"))^M2},
IF{[f rx nth ver Res-RES]("CR",3)^RE3_.=. " "^M3;
(" ":39_(RE3#"0,")_" on "_(RE3#"1,")_" @ "_(RE3#"2,"))^M3},
(("Est. CrCl = ",CRCL," ml/min "):26T_M1)^EST},
IF{49.999<CRCL 1,
"Since CrCl>50 ml/min, No need for dose adjustment"^DOSE;
(50>CRCL&(39.999<CRCL)) 1,
"Suggested Dose: "_[q PHACRCL50]^DOSE;
(40>CRCL&(29.999<CRCL)) 1,
"Suggested Dose: "_[q PHACRCL40]^DOSE;
RUN DATE: 01/11/07 NORTH COUNTRY NPR PHARMACY 4.6 **LIVE** PAGE 10
RUN TIME: 0849 pha.rule.zcus.hab.download
RUN USER: HAB
(30>CRCL&(19.999<CRCL)) 1,
"Suggested: "_[q PHACRCL30]^DOSE;
(20>CRCL&(9.999<CRCL)) 1,
"Suggested Dose: "_[q PHACRCL20]^DOSE;
(10>CRCL&(CRCL'<0)) 1,
"Suggested Dose: "_[q PHACRCL10]^DOSE;},
[f rx win init],
[f rx win add](DOSE),
[f rx win add](EST),
[f rx win add](M2),
[f rx win add](M3),
[f rx win add](BLANK),
[f rx win disp],1}};1}}}};
--------------------------------------------------------------------------------------------
CRCL.ALL.M RX EVL MED Renal Fx Dosing -- ALL - MED
;Modified from Herb's presentation at MUSE & Bruce Mathiase CrCl
;This rule calculates the Estimated CrCL based on an Adjusted body weight
;and pulls the appropriate text from the Drug CDS to display suggested dose
;Set as global rule, only displays if all 5 crcl fields have data
;
IF{[q PHACRCL50]_.=.!([q PHACRCL40]_.=.)!([q PHACRCL30]_.=.) 1;
IF{[q PHACRCL20]_.=.!([q PHACRCL10]_.=.) 1;
IF{([f z user mis office]="PHARMACY"!([f user]="HAB")) 1,
IF{[f pt cur age]<18 1;
;F{'[q PHACRCL50]&'[q PHACRCL40]&'[q PHACRCL30]&'[q PHACRCL20]&'[q PHACRCL50] 1;
("Pat. Data: Age: "_[f pt adm/ser age]_" Sex:"_[f pt sex])^BLANK,
;------ checking if weight exist - is so - displays ----------
IF{[f pt oe wt kgs]_.=. 1;
[f pt oe wt kgs]^KG,
(" Weight = ",(KG):0D,"kgs ("_((KG*2.2):0D),"lbs)")^KGLB,
BLANK_KGLB^BLANK},
;------------------------
;[f rx calc]("CRCL.ADJAR")^CRCL,
[f rx calc]("CRCL.C.IBW")^CRCL,
IF{CRCL#0="*" 1,
[f rx win init],
[f rx win add]("Est. CrCl can not be calculated for the following reason(s)"),
[f rx win add](CRCL),
IF{CRCL#9'="C" 1,
[f rx nth ver Res-RES]("CR",1)^RE1,
("FYI Last Cr info: "_(RE1#"0,")_" @"_(RE1#"1,")_" "_(RE1#"2,"))^L1},
[f rx win add](L1),
[f rx win add](BLANK),
[f rx win add](L2),
[f rx win disp],1;
;----- STARTING TO CALCULATE IF CRCL IS AVAILABLE ------------------
IF{[f rx nth ver Res-RES]("CR",1)^RE1,
("Based on Cr: "_(RE1#"0,")_" on "_(RE1#"1,")_" @ "_(RE1#"2,"))^M1,
IF{[f rx nth ver Res-RES]("CR",2)^RE2_.=. " "^M2;
(" ":27_"Previous Cr "_(RE2#"0,")_" on "_(RE2#"1,")_" @ "_(RE2#"2,"))^M2},
IF{[f rx nth ver Res-RES]("CR",3)^RE3_.=. " "^M3;
(" ":39_(RE3#"0,")_" on "_(RE3#"1,")_" @ "_(RE3#"2,"))^M3},
(("Est. CrCl = ",CRCL," ml/min "):26T_M1)^EST},
IF{49.999<CRCL 1,
"Since CrCl>50 ml/min, No need for dose adjustment"^DOSE;
(50>CRCL&(39.999<CRCL)) 1,
RUN DATE: 01/11/07 NORTH COUNTRY NPR PHARMACY 4.6 **LIVE** PAGE 11
RUN TIME: 0849 pha.rule.zcus.hab.download
RUN USER: HAB
"Suggested Dose: "_[q PHACRCL50]^DOSE;
(40>CRCL&(29.999<CRCL)) 1,
"Suggested Dose: "_[q PHACRCL40]^DOSE;
(30>CRCL&(19.999<CRCL)) 1,
"Suggested Dose: "_[q PHACRCL30]^DOSE;
(20>CRCL&(9.999<CRCL)) 1,
"Suggested Dose: "_[q PHACRCL20]^DOSE;
(10>CRCL&(CRCL'<0)) 1,
"Suggested: "_[q PHACRCL10]^DOSE;},
[f rx win init],
[f rx win add](DOSE),
[f rx win add](EST),
[f rx win add](M2),
[f rx win add](M3),
[f rx win add](BLANK),
[f rx win disp],1}};1}}};
--------------------------------------------------------------------------------------------
CRCL.BIPHO RX EVL MED Biphosphate warning <30
;This rule calculates the Estimated CrCL based on an ibw
IF{[f pt cur age]'>18 " ";
IF{[f rx calc]("CRCL")^CRCL_.=.;
("Note: EST.CRCL=",CRCL," ml/min")^W1,
"Since CrCl < 30 ml/min Avoid Use"^W2,
IF{CRCL<30.4 [f rx win init],
[f rx win add](W1),
[f rx win add](W2),
[f rx win disp],1;
[f rx ok]}}};
--------------------------------------------------------------------------------------------
CRCL.C.IBW CALC EVL MED Est. CrCL Calc Rule - Use IBW
""^XZ,
IF{IF{[f rx last ver result]("CR")^SRCR_.=. XZ_"*Missing Cr "^XZ},
IF{[f pt sex]^SX_.=. XZ_"*Missing Sex "^XZ},
IF{[f pt oe ht cm]^HT_.=. XZ_"*Missing Ht "^XZ},
IF{[f pt oe wt kgs]^WT_.=. XZ_"*Missing Wt "^XZ},
IF{[f pt cur age]^AGE_.=. XZ_"*Missing Age"^XZ},XZ;
IF{SX="M" 50;45.5}^S,
IF{SX="M" 1;0.85}^F,
IF{SRCR<1.01 1.0^SRCR},
S+(2.3*((HT/2.54)-60)!0)^IBW_.=.,
;IF{[f pt oe wt kgs]>1 IBW*1.2}^ADBW_.=.,
IF{[f pt oe wt kgs]<IBW [f pt oe wt kgs]^IBW_.=.},
;IF{[f pt oe wt kgs]>ADBW ([f pt oe wt kgs]-IBW)^OW},
;IF{OW'<0 (OW*0.4)^OWC_.=.},
;IF{OW'<0 (OWC+IBW)^IBW_.=.},
(140-AGE*IBW:6D/(72*SRCR)*F):0D}^CRCL.ADJW;
--------------------------------------------------------------------------------------------
CRCL.ENOX RX EVL MED ENOXAPARIN WARNING <30
;This rule calculates the Estimated CrCL based on an Adjusted body weight
;ENOXAPRIN SPECIFIC
;< 30 ML - ? may need dosage adjustment
""^A,
IF{[f pt cur age]'>18 " ";
;IF{[f rx calc]("CRCL.ADJA")^CRCL_.=.;
RUN DATE: 01/11/07 NORTH COUNTRY NPR PHARMACY 4.6 **LIVE** PAGE 12
RUN TIME: 0849 pha.rule.zcus.hab.download
RUN USER: HAB
IF{[f rx calc]("CRCL.C.IBW")^CRCL_.=.;
("Note: EST.CRCL=",CRCL," ml/min")^W1,
"Since CrCl < 30 - If dosing 1mg/kg - monitoring may be needed"^W,
IF{CRCL<30.4 [f rx win init],
[f rx win add](W1),
[f rx win add](W),
[f rx win disp],1;
[f rx ok]}}};
--------------------------------------------------------------------------------------------
CRCL.TEST RX EVL DOSE Renal Fx Dosing -- ALL - DOSE
;Modified from Herb's presentation at MUSE & Bruce Mathiase CrCl
;This rule calculates the Estimated CrCL based on an Adjusted body weight
;and pulls the appropriate text from the Drug CDS to display suggested dose
;Set as global rule, only displays if all 5 crcl fields have data
;** note: Check to see if a from a string. If so, displays. If not
;from string - another rule - in med displays. This is done because if
;only have at med, will not display if use string.
IF{[f z order.string.mn]_.=. 1;
IF{[q PHACRCL50]_.=.!([q PHACRCL40]_.=.)!([q PHACRCL30]_.=.) 1;
IF{[q PHACRCL20]_.=.!([q PHACRCL10]_.=.) 1;
IF{([f z user mis office]="PHARMACY"!([f user]="HAB")) 1,
IF{[f pt cur age]<18 1;
;F{'[q PHACRCL50]&'[q PHACRCL40]&'[q PHACRCL30]&'[q PHACRCL20]&'[q PHACRCL50] 1;
("Pat. Data: Age: "_[f pt adm/ser age]_" Sex:"_[f pt sex])^BLANK,
;------ checking if weight exist - is so - displays ----------
IF{[f pt oe wt kgs]_.=. 1;
[f pt oe wt kgs]^KG,
(" Weight = ",(KG):0D,"kgs ("_((KG*2.2):0D),"lbs)")^KGLB,
BLANK_KGLB^BLANK},
;------------------------
;[f rx calc]("CRCL.ADJAR")^CRCL,
[f rx calc]("CRCL.C.IBW")^CRCL,
IF{CRCL#0="*" 1,
[f rx win init],
[f rx win add]("Est. CrCl can not be calculated for the following reason(s)"),
[f rx win add](CRCL),
IF{CRCL#9'="C" 1,
[f rx nth ver Res-RES]("CR",1)^RE1,
("FYI Last Cr info: "_(RE1#"0,")_" @"_(RE1#"1,")_" "_(RE1#"2,"))^L1},
[f rx win add](L1),
[f rx win add](BLANK),
[f rx win add](L2),
[f rx win disp],1;
;----- STARTING TO CALCULATE IF CRCL IS AVAILABLE ------------------
IF{[f rx nth ver Res-RES]("CR",1)^RE1,
("Based on Cr: "_(RE1#"0,")_" on "_(RE1#"1,")_" @ "_(RE1#"2,"))^M1,
IF{[f rx nth ver Res-RES]("CR",2)^RE2_.=. " "^M2;
(" ":27_"Previous Cr "_(RE2#"0,")_" on "_(RE2#"1,")_" @ "_(RE2#"2,"))^M2},
IF{[f rx nth ver Res-RES]("CR",3)^RE3_.=. " "^M3;
(" ":39_(RE3#"0,")_" on "_(RE3#"1,")_" @ "_(RE3#"2,"))^M3},
(("Est. CrCl = ",CRCL," ml/min "):26T_M1)^EST},
IF{49.999<CRCL 1,
"Since CrCl>50 ml/min, No need for dose adjustment"^DOSE;
(50>CRCL&(39.999<CRCL)) 1,
"Suggested Dose: "_[q PHACRCL50]^DOSE;
(40>CRCL&(29.999<CRCL)) 1,
RUN DATE: 01/11/07 NORTH COUNTRY NPR PHARMACY 4.6 **LIVE** PAGE 13
RUN TIME: 0849 pha.rule.zcus.hab.download
RUN USER: HAB
"Suggested Dose: "_[q PHACRCL40]^DOSE;
(30>CRCL&(19.999<CRCL)) 1,
"Suggested: "_[q PHACRCL30]^DOSE;
(20>CRCL&(9.999<CRCL)) 1,
"Suggested Dose: "_[q PHACRCL20]^DOSE;
(10>CRCL&(CRCL'<0)) 1,
"Suggested Dose: "_[q PHACRCL10]^DOSE;},
[f rx win init],
[f rx win add](DOSE),
[f rx win add](EST),
[f rx win add](M2),
[f rx win add](M3),
[f rx win add](BLANK),
[f rx win disp],1}};1}}}};
--------------------------------------------------------------------------------------------
CRCL.VANC RX EVL DOSE VANCOMYCIN
;This rule caculates vanco dosing. Assumes a 15 mg/kg load for most patients
; dosing info bascially is comming off package insert
;ADBW -= adjusted body weight
;Vanco dose mg/kg/24h estimated at 0.227 * crcl +5.67
[f rx calc]("ADBW")^BW_.=.,
[f rx calc]("CRCL")^CL_.=.,
[f pt oe wt kgs]^WT,
((0.227*CL)+5.67)*BW^V,
("Rec Dose:",((((0.227*CL)+5.67)*BW)*0.33):0D," Q8H")^E,
"PATIENT IS UNDER 17, NOT A CANDIDATE FOR ONCE DAILY"^A,
"Estimated CrCl is < 10ml/min - Use with Caution"^X,
IF{[f pt cur age]'>18 [f rx ok];
IF{(9.5>CL) [f rx msg](X);
IF{(9.4<CL) ("Loading dose =",(BW*15:0D)," mg")^L,
[f rx msg](L)},
IF{(14.4'<CL&(CL'<9.5)) (".227 =",(BW*15:0D),"MG Q48H")^D,
[f rx msg](D);
(24.4'<CL&(CL'<14.5)) ("Rec Dose:",((((0.227*CL)+5.67)*BW)*0.5):0D," Q24H")^D,
[f rx msg](D),("Rec Dose:",((((0.227*CL)+5.67)*BW)):0D," Q48H")^G,
[f rx msg](G);
(34.4'<CL&(CL'<24.5)) ("Rec Dose:",((((0.227*CL)+5.67)*BW)):0D," Q24H")^D,
[f rx msg](D);
(45.4'<CL&(CL'<34.5)) ("Rec Dose:",((((0.227*CL)+5.67)*BW)*0.5):0D," Q12")^D,
[f rx msg](D),(" OR Rec Dose:",((((0.227*CL)+5.67)*BW)):0D," Q24H")^F,
[f rx msg](F);
(55.4'<CL&(CL'<45.5)) ("Rec Dose:",((((0.227*CL)+5.67)*BW)*0.5):0D," Q12H")^D,
[f rx msg](D),(" OR Rec Dose:",((((0.227*CL)+5.67)*BW)):0D," Q24H")^H,
[f rx msg](H);
(65.4'<CL&(CL'<54.5)) ("Rec Dose:",((((0.227*CL)+5.67)*BW)*0.5):0D," Q12H")^D,
[f rx msg](D);
(74.4'<CL&(CL'<65.5)) ("Rec Dose:",((((0.227*CL)+5.67)*BW)*0.5):0D," Q12H")^D,
[f rx msg](D);
(84.4'<CL&(CL'<75.5)) ("Rec Dose:",((((0.227*CL)+5.67)*BW)*0.5):0D," Q12H")^D,
[f rx msg](D);
((CL'<45.5)) ("Rec Dose:",((((0.227*CL)+5.67)*BW)*0.5):0D," Q12H")^D,
[f rx msg](D);[f rx ok]}}};
--------------------------------------------------------------------------------------------
CRCLT CALC EVL DOSE EST. CREATININE CLEARANCE
IF{IF{[f rx last ver result]("CR")^SRCR_.=.;
RUN DATE: 01/11/07 NORTH COUNTRY NPR PHARMACY 4.6 **LIVE** PAGE 14
RUN TIME: 0849 pha.rule.zcus.hab.download
RUN USER: HAB
[f pt sex]^SX_.=.;
[f pt oe ht cm]^HT_.=.;
[f pt oe wt kgs]^WT_.=.;
[f pt cur age]^AGE_.=.} " Unable to calculate Creatinine Clearance. "^X,
[f rx msg](X)," ";
IF{SX="M" 50;45.5}^S,
IF{SX="M" 1;0.85}^F,
IF{SRCR<1.01 1.0^SRCR},
S+(2.3*((HT/2.54)-60)!0)^IBW,
IF{[f pt oe wt kgs]<IBW [f pt oe wt kgs]^IBW},
140-AGE*IBW/(72*SRCR)*F}^CRCLT;
--------------------------------------------------------------------------------------------
CREA.VW.0 RX EVL MED WORKS RULE CRCL FOR VALUE(0 WT
IF{[f rx calc]("CRCL.0WT")^CRCL_.=.;
("Est Creatinine Clearance (0 weight used) = ",CRCL," ml/min ")^X,
[f rx msg](X)};
--------------------------------------------------------------------------------------------
CREAVIEW RX EVL MED WORKS WITH RULE CRCL FOR VALUE
IF{[f rx calc]("CRCL")^CRCL_.=.;
("Creatinine Clearance = ",CRCL," ml/min ")^X,[f rx msg](X)};
--------------------------------------------------------------------------------------------
D70.MGKG CALC EVL MED D70-MG/KG -CALC PORTION
;This rule calculates the mg/kg -of d70 ordered -used in rule to tell total
;volume
;THIS RULE WAS MODIFIED ON 8/26/98 (SEE REMMED PORTION) - SWITCHED ORDERING
;UNITS FROM ML TO GRAMS.
;[f rx iv add dose]^A,
;[f pt oe wt kgs]^W,
;((((A*0.7000)/W)*0.6944):1D)^MGKG;
[f rx iv add dose]^A,
[f pt oe wt kgs]^W,
(((A:4D/W)*0.6944):1D)^MGKG;
--------------------------------------------------------------------------------------------
D70W.MG.KG RX EVL DOSE ML/DAY OF D70 TPN PATIENTS
;This rule calculates MAX mg/kg d70/24 hours. Assumes tpn value -= 24 hour
; ASSUMES MAX TO BE 5 MG/KG/MIN
[f rx calc]("D70.MGKG")^MGKG_.=.,
("Current Dextrose from TPN = ",MGKG," mg/kg/min")^K,
[f rx msg](K),
[f pt oe wt kgs]^W,
((50:6D/([f pt oe wt kgs]*1.44)):1D)^D,
("Each liter of D5W/day will add ",D," mg/kg/min of Dextrose")^P,
[f rx msg](P),
(((7.2*W)):0D)^M,
("MAXIMUM D70W/DAY =",(M)," GRAMS IF NO OTHER DEXTROSE RUNNING")^B,
[f rx msg](B);
--------------------------------------------------------------------------------------------
DIPY.BD CALC EVL DOSE DIPYRIDAMOLE DOSE CHECKER
;used for calculating if correct dose is in dipyridamole infus.
[f rx iv add dose]^DIPY.BD;
--------------------------------------------------------------------------------------------
RUN DATE: 01/11/07 NORTH COUNTRY NPR PHARMACY 4.6 **LIVE** PAGE 15
RUN TIME: 0849 pha.rule.zcus.hab.download
RUN USER: HAB
DIPY.CC CALC EVL DOSE DIPYRIDAMOLE CALC RULE
;used for calculating if correct dose for dipyridamole
[f rx iv car vol]^DIPY.CC;
--------------------------------------------------------------------------------------------
DIPY.IMAG RX EVL MED DIPYRIDAMOLE DOSE IMAGING
;this rule calculates amount of dipyridamole IV which should be given
;based on 0.57 mg/kg and total volume 30 ML
IF{[f rx ord type]="SOI" [f rx ok];
"LINE FEED THE ADDITIVE MED, PRESS SPECIAL FUNCTION KEY & UPDATE WT"^A,
"Pt is > 104.5kg, therefore, 60 mg dipyridamole, 18 ml NaCl 0.9%"^M,
IF{[f pt oe wt kgs]^WT_.=. [f rx err msg](A);
IF{[f pt oe wt kgs]>104.5 [f rx msg](M);(([f pt oe wt kgs]*0.57):1D)^Z,
IF{[f rx ord type]="SOI" [f rx ok];
("CALCULATED DIPYRIDAMOLE DOSE ",Z," MG")^D,
("NaCl needed = ",(30-(Z/5))," mls")^N,
[f rx msg](D) [f rx msg](N)}}}};
--------------------------------------------------------------------------------------------
DIPY.IMG RX EVL DOSE DIPYRIDAMOLE DOSE IMAGING
;this rule calculates amount of dipyridamole IV which should be given
;based on 0.57 mg/kg and total volume 30 ML
"LINE FEED THE ADDITIVE MED, PRESS SPECIAL FUNCTION KEY & UPDATE WT"^A,
"Pt is > 104.5kg, therefore, 60 mg dipyridamole, 18 ml NaCl 0.9%"^M,
IF{[f pt oe wt kgs]^WT_.=. [f rx err msg](A);
([f pt oe wt kgs]*0.57):1D^Z,
IF{60.01'<Z Z^Y;60^Y},
(Y+0.1)^DH,
(Y-0.1)^DL,
IF{[f rx calc]("DIPY.BD")^BD_.=.;
("Calc. Dipyridamole =",Y," - NOT",BD,"mg")^M,
IF{(DH'<BD&(BD'<DL)) [f rx ok];
IF{BD_.=. [f rx ok];
[f rx err msg](M)}}}};
--------------------------------------------------------------------------------------------
DIPY.NS RX EVL DOSE DIPYRIDAMOLE- NS VOLUME
;this rule calculates amount of dipyridamole IV which should be given
;based on 0.57 mg/kg and total volume 35 ml
IF{([f rx ord type]'="SOI"!([f rx med]'="NS-25ML")) [f rx ok];
"LINE FEED THE ADDITIVE MED, PRESS SPECIAL FUNCTION KEY & UPDATE WT"^A,
"Pt is > 104.5kg, therefore, 60 mg dipyridamole, 18 ml NaCl 0.9%"^M,
IF{[f pt oe wt kgs]^WT_.=. [f rx err msg](A);
([f pt oe wt kgs]*0.57):1D^Z,
IF{60.01'<Z Z^Y;60^Y},
(30-(Y/5))^N,
(N+0.1)^NH,
(N-0.1)^NL,
IF{[f rx calc]("DIPY.CC")^NS_.=.;
IF{(NH'<NS&(NS'<NL)) [f rx ok];
("CALCULATED DIPYRIDAMOLE DOSE ",Y,"MG -- NS volume should be ",N,"MLS")^D,
[f rx err msg](D)}}}};
--------------------------------------------------------------------------------------------
DIS.EMP RX EVL MED STOPS ORDERS ON DISCHARGE EMP
; this rule stops user from filling a med on a DIS RCR with location of emp.
RUN DATE: 01/11/07 NORTH COUNTRY NPR PHARMACY 4.6 **LIVE** PAGE 16
RUN TIME: 0849 pha.rule.zcus.hab.download
RUN USER: HAB
"Patient is no longer an employee, line feed med and exit profile"^E,
IF{([f pt location]="EMP"&([f pt status]="DIS RCR")) [f rx err msg](E);1};
--------------------------------------------------------------------------------------------
DNS RX EVL MED Do NOT sell warning
; THIS RULE WILL display a warning for meds which should not be sold to DRUG
;stores
"Do NOT sell this med to other pharmacies. Check with Dorothy or Jim first!"^W,
IF{[f pt location]="DS" [f rx msg](W);[f rx ok]};
--------------------------------------------------------------------------------------------
DNS.STOP RX EVL MED Do NOT sell - STOP!!
; THIS RULE WILL STOP A USER FROM SELLING A MED TO A DRUG STORE
"Do NOT sell this med to other pharmacies. Check with Dorothy or Jim first!"^W,
IF{[f pt location]="DS" [f rx err msg](W);[f rx ok]};
--------------------------------------------------------------------------------------------
DO.NOT.PRT RX EVL MED DO NOT PRINT
[f z order.type.type]^TYPE,
"Do NOT - Repeat NOT print labels to PHIV - Update in Progress - OK?"^MES,
"Thanks for NOT printing - We will get it updated as soon as possible"^MES2,
"Please do not print - will ruin update process"^MES3,
IF{TYPE="I" 1,
IF{[f rx yes/no](MES)=1 MES2;MES3};1};
--------------------------------------------------------------------------------------------
DUP.DT.CUS RX EVL MED Duplicate Drug Type (specific)
;Use the keyword to check if any active medication, class, generic, or drug
;type component are on a patient's profile. Use the arguments "D"=Drug, "C"=
;Class, "G"=Generic, and "T"=Drug Type.
IF{[f user]'="HAB" 1;
[f z test.dup.dt]^PAT,
[f rx msg](PAT),1};
;[f z drug.type]^DT,
;[f rx msg](DT),
;"no dup"^DUP,
;[f z test.dup.dt]^DUP,
;[f rx msg](" got through getting dup"),
;[f rx msg](DUP),1};
--------------------------------------------------------------------------------------------
DUP.GEN RX EVL MED Duplicate Generic Flag
;Use the keyword to check if any active medication, class, generic, or drug
;type component are on a patient's profile. Use the arguments "D"=Drug, "C"=
;Class, "G"=Generic, and "T"=Drug Type.
[f rx med generic]^CGEN,
[f rx active meds]("G",CGEN)^MED,
IF{'MED 1;MED$8^MED2,
("Duplicate Generic: "_CGEN_" Rx# "_MED2_" OK?")^ASK,
IF{[f rx yes/no](ASK)=1 1;[f rx err msg]("Delete Mnemonic and DC other med")}};
;[f rx msg]("Duplicate Generic: "_CGEN_" Rx# "_MED2)};
--------------------------------------------------------------------------------------------
DUP.MNE.MR RX EVL MED Dup Mnemonic - MRI
RUN DATE: 01/11/07 NORTH COUNTRY NPR PHARMACY 4.6 **LIVE** PAGE 17
RUN TIME: 0849 pha.rule.zcus.hab.download
RUN USER: HAB
[f rx win init],
[f z dup.mne.mri],
[f rx win disp],1;
--------------------------------------------------------------------------------------------
ED.DR.0ED RX EVL MED FLAGS ED DR. IF ED is user
IF{'[f z user.prv] 0^MD;1^MD},
[f pt dr mne]^DR,
IF{(DR="ED"&(MD=1)) 1,
"Please change the patient's doctor in the computer, now listed as 'ED'"^MES2,
[f rx msg](MES2),1;1};
--------------------------------------------------------------------------------------------
ED.DR.0EDN RX EVL MED FLAGS RX IF DR = ED - RX SPEC
IF{[f rx doctor]'="ED" 1;
[f z user.prv] 1;
([f z user mis office]="PHARMACY"!([f user]="HAB")) 1,
[f pt admit dr mne]^AD,
[f pt er dr mne]^ED,
[f pt attend dr mne]^AT,
("Dr. ED Not Valid - Erase med - pick valid MD ")^M1,
("ED="_ED_" ADM="_AD_" ATT="_AT)^M2,
[f rx err msg](M1_M2)};
--------------------------------------------------------------------------------------------
ED.DUP.MED RX EVL MED ED - DUPLICATE MED
IF{[f pt location]="ER"&([f pt status]="REG ER") 1,
IF{[f z user mis office]="INFO SYS"!([f z user mis office]="PHARMACY") 1,
[f rx win init],
[f z chk.med.mnem.dup],
[f rx win disp],1;[f rx ok]};1};
--------------------------------------------------------------------------------------------
ED.INP.ORD RX EVL MED Requires INP order type on ED
IF{[f pt status]'="REG ER" 1;
IF{[f rx pt type]="INP" 1;
IF{[f rx ord type]="TAKEHOME" 1;
"RX for ER patient's should be INP order type. Erase med, back up one page"^MES,
"and use Right CTRL key to change Inp/Out/Dis Default to 'INP'"^MES2,
[f rx err msg](MES),[f rx err msg](MES2)}}};
--------------------------------------------------------------------------------------------
EMP.DIS RX EVL DOSE EMPLOYEE, DISCHARGE FLAG (DOSE
;THIS RULE FLAGS THE RPH AT MED ENTRY PATIENT IS NO LONGER EMPLOYEED AND SHOULD
; NOT GET MEDS
"This patient is no longer an employee, we can not fill rxs for this patient"^W,
IF{[f pt location]'="EMP" [f rx ok];
IF{[f pt status]'="DIS RCR" [f rx ok];[f rx err msg](W)}};
--------------------------------------------------------------------------------------------
EMP.DISM RX EVL MED DS -EMPLOYEE, DISCHARGE FLAG
;THIS RULE FLAGS THE RPH AT MED ENTRY PATIENT IS NO LONGER EMPLOYEED AND SHOULD
; NOT GET MEDS
"This account has been discharged is inactive, use active account"^W,
IF{[f pt location]'="DS" [f rx ok];
IF{[f pt status]'="DIS RCR" [f rx ok];[f rx err msg](W)}};
RUN DATE: 01/11/07 NORTH COUNTRY NPR PHARMACY 4.6 **LIVE** PAGE 18
RUN TIME: 0849 pha.rule.zcus.hab.download
RUN USER: HAB
--------------------------------------------------------------------------------------------
EMPDIS RX EVL MED KDU- DISCHARGE
;PREVENTS ENTERING ORDERS ON DISCHARGED KDU patients.
"New orders are not allowed on DISCHARGED Patients"^E,
"Contact Herb if an order actually needs to be entered"^E2,
IF{[f pt location]'="EMP" [f rx ok];
IF{[f pt status]="DIS RCR" [f rx err msg](E),[f rx err msg](E2);1}};
--------------------------------------------------------------------------------------------
ENOX RX EVL DOSE ENOXAPARIN - Q12 DOSE
;this rule flags user if enoxaprin dose (for 60, 80, 100s) is not within
; 5 mg of pt weight (assuming 1 mg/kg - q12h)
"Press F6 to return to MED field, Press the special funtion key (R-CTRL) and"^A,
"update the patient's weight by selecting #4 - Edit Patient Data"^B,
IF{[f pt oe wt kgs]^WT_.=. [f rx msg](A),[f rx msg](B);
[f pt oe wt kgs]:0D^K,
[f rx dose]^D,
;IF{(10.4'<CRCL&(CRCL'<0)) [f rx msg](C);
;(50.4'<CRCL&(CRCL'<10.5)) [f rx msg](B);
("Based on Patient's weight of",(K),"KG Q12H dose=",(K),"MG Q12 NOT",(D)," ")^W,
IF{((K+5)'<D&(D'<(K-5))) [f rx ok];
[f rx msg](W);1}};
--------------------------------------------------------------------------------------------
ENOX.FL RX EVL FILE ENOXAPARIN - Q12 DOSE
;SAME AS ENOX- BUT FLAGS AT FILE
;this rule flags user if enoxaprin dose (for 60, 80, 100s) is not within
; 5 mg of pt weight (assuming 1 mg/kg - q12h)
"Press F6 to return to MED field, Press the special funtion key (R-CTRL) and"^A,
"update the patient's weight by selecting #4 - Edit Patient Data"^B,
IF{[f z user mis office]'=PHA 1;
IF{[f pt oe wt kgs]^WT_.=. [f rx msg](A),[f rx msg](B);
[f pt oe wt kgs]:0D^K,
[f rx dose]^D,
;IF{(10.4'<CRCL&(CRCL'<0)) [f rx msg](C);
;(50.4'<CRCL&(CRCL'<10.5)) [f rx msg](B);
("Based on Patient's weight of",(K),"KG Q12H dose=",(K),"MG Q12 NOT",(D)," ")^W,
IF{((K+5)'<D&(D'<(K-5))) [f rx ok];
[f rx msg](W);1}}};
--------------------------------------------------------------------------------------------
EPID.GT.5 RX EVL FILE Epidural flag if > 0.5 ml/hr
[f rx charge type]^CHG,
[f z rate.volume]^RATE,
IF{CHG="EPID"&(RATE>0.9) 1,
("Rate is > 0.9 ml/hr ("_RATE_"). Is that correct?")^ASK,
IF{[f rx yes/no](ASK)=1 1;
[f rx err msg]("Please edit and adjust to desired rate")};1};
--------------------------------------------------------------------------------------------
EPO.DIAL RX EVL MED EPO-DIALYSIS PATIENTS
; THIS RULE WILL PREVENT PEOPLE FROM ORDERING OTHER MEDS THAN EPO 4,000 ON
;DIALYSIS PATIENTS
"USE DRUG MNEMONIC ERYT-20M/1 OR ERYT-10000"^X,
IF{[f pt location]="NP-KDU" [f rx err msg](X);[f rx ok]};
RUN DATE: 01/11/07 NORTH COUNTRY NPR PHARMACY 4.6 **LIVE** PAGE 19
RUN TIME: 0849 pha.rule.zcus.hab.download
RUN USER: HAB
--------------------------------------------------------------------------------------------
EPO.DOS2MC RX EVL FILE REST # SENT TO MATCH DOSE-MC
;THIS RULE
;WILL NOT ALLOW SOMEONE TO ENTER A INCORECT # TODISP/DOSE - SHOULD ALWAYS BE 1
; LOOKS AT NUMBER TO DISPENSE VERUS DOSE.
IF{[f pt location]'="NP-KDU" 1;
[f z.out.refill.num.dis]^N,
("For Dialysis patient's, quantity to dispense should always = 1, not,",(N))^E,
IF{N=1 [f rx ok];
[f rx err msg](E)}};
--------------------------------------------------------------------------------------------
EPO.DOSE RX EVL FILE RESTRICTS # SENT TO MATCH DOSE
;THIS RULE
;WILL NOT ALLOW SOMEONE TO ENTER A INCORECT # TODISP/DOSE
;- THIS IS FOR 10,000 U/ML VIAL
; CHARGE = 9.605/10000
IF{[f pt location]="NP-KDU",
"PLEASE CHECK EPO DOSE VERSUS VIALS (QUANTITY TO DISPENSE !!)"^E,
"OR CHECK TO MAKE SURE PRICE IN COMPUTER = 94.613/10,000 UNITS"^F,
[f rx dose]^D,
[f rx charge]}^DS,
(DS:6D/(D:2D/1000))^P,
IF{[f pt location]'="NP-KDU" [f rx ok];
IF{(9.59<P&(P<9.62)) [f rx ok];[f rx err msg](E),[f rx err msg](F)}};
--------------------------------------------------------------------------------------------
EPO.DOSE2 RX EVL FILE RESTRICTS # SENT TO MATCH DOSE
;
;THIS RULE
;WILL NOT ALLOW SOMEONE TO ENTER A INCORECT # TODISP/DOSE
;- THIS IS FOR 20,000 U/ML VIAL - CHARGE 10.134 (09/00)
IF{[f pt location]="NP-KDU",
"PLEASE CHECK EPO DOSE VERSUS VIALS (QUANTITY TO DISPENSE !!)"^E,
"OR CHECK TO MAKE SURE PRICE IN COMPUTER = 199.635/VIAL"^F,
[f rx dose]^D,
[f rx charge]}^DS,
(DS:4D/(D:2D/1000))^P,
IF{[f pt location]'="NP-KDU" [f rx ok];
IF{(10.11<P&(P<10.16)) [f rx ok];[f rx err msg](E),[f rx err msg](F)}};
--------------------------------------------------------------------------------------------
ER.MISC RX EVL FILE ER MISC- CHARGE
"Please remember to calculate correct charge via the Price Quote routine"^C1,
"Calculated Charge must be filled in."^C2,
IF{[f rx charge]="0.00" [f rx err msg](C1),[f rx err msg](C2);
[f rx ok]};
--------------------------------------------------------------------------------------------
ER.STOP RX EVL STOP user to put stop date in t+1
[f rx stop date]^STOP,
[f rx msg]("NEXT IS STOP"),
[f rx msg](STOP);
--------------------------------------------------------------------------------------------
ERYT.DOSE RX EVL DOSE EPO DOSE-SC OR IV
RUN DATE: 01/11/07 NORTH COUNTRY NPR PHARMACY 4.6 **LIVE** PAGE 20
RUN TIME: 0849 pha.rule.zcus.hab.download
RUN USER: HAB
;This rule will stop users from using epo 20Mu/ml on dose <=10000
IF{[f pt location]'="NP-KDU" [f rx ok];
"Use mnemonic ERYT-MC-20 for doses > 10000 units on dialysis patients"^B,
"Use mnemonic ERYT-MC-10 for doses <= 10000 units on dialysis patients"^A,
IF{([f rx dose]>10000&([f rx med]="ERYT-MC-10")) [f rx err msg](B);[f rx ok],
IF{([f rx dose]<10001&([f rx med]="ERYT-MC-20")) [f rx err msg](A);[f rx ok]}}};
--------------------------------------------------------------------------------------------
ESMOL.LD RX EVL DOSE ESMOLOL LOADING DOSE
;this rule calculates amount of esmolol load which should be given
;based on 500 mcg/kg
"Press F6 to return to MED field, Press the special funtion key (R-CTRL) and"^A,
"update the patient's weight by selecting #4 - Edit Patient Data"^B,
IF{[f pt oe wt kgs]^WT_.=. [f rx msg](A),[f rx msg](B);
[f pt oe wt kgs]:1D^K,
("Based on Patient's weight of",(K),"KG Loading dose = ",(K*.50:0D)," MG")^W,
[f rx msg](W);1};
--------------------------------------------------------------------------------------------
GENT.DOSE CALC EVL DOSE GENT IV ADDITIEV DSOSE
IF{[f rx iv add dose]<10 [f rx iv add dose]^GENT.DOSE};
--------------------------------------------------------------------------------------------
HEP.10.DI RX EVL MED HEPATITIS B VAC-10U/DIALYSIS
;THIS RULE
;WILL NOT ALLOW SOMEONE TO PICK HEPATITIS B VACCINE 10 U ON DIALYSIS PATS
"USE THE MNEMONIC> HEPA-B-VAC"^E,
IF{[f pt location]'="NP-KDU" [f rx ok];[f rx err msg](E)};
--------------------------------------------------------------------------------------------
HEP.B.DIAL RX EVL FILE HEPAT.B VAC-STOPSIF NOT DIAL-M
;RULE PREVENTS USING ON DIALYSIS PATIENTS
"Use the recombivax dialysis formulation 40 u for dialysis patients"^E,
IF{[f pt location]'="NP-KDU" [f rx ok];[f rx err msg](E)};
--------------------------------------------------------------------------------------------
HEPA.B.TEC RX EVL MED Hepatitis B - for Tech OT of T
;If user is a tech - user access dictionary as a N at pharmacist prompt
;requires order type for hepatitis B- Ped to be T
[f rx ord type]^OT,
[f z pharmacist]^ACC,
IF{ACC="N"&(OT'="T") 1,
"Pediatric Hepatitis B should be entered with an order type of T"^MES,
[f rx err msg](MES);1};
--------------------------------------------------------------------------------------------
HOS.STATUS RX EVL MED HOSPICE STATUS MUST BE REG RCR
;THIS IS TO CHECK - IF LOCATION IS NP-HOSPICE, PATIENT TYPE MUST BE
;REG RCR
IF{[f pt location]'="NP-HOSPICE" [f rx ok];
"Hospice Scripts must be entered on an account with a status of REG RCR"^W,
IF{[f pt status]="REG RCR" [f rx ok];[f rx err msg](W)}};
--------------------------------------------------------------------------------------------
INFL2 RX EVL TXN INFLUENZA MEDICARE
;SENDS- MEDICARE BILLING # THROUGH FOR MEDICARE PATIENTS
RUN DATE: 01/11/07 NORTH COUNTRY NPR PHARMACY 4.6 **LIVE** PAGE 21
RUN TIME: 0849 pha.rule.zcus.hab.download
RUN USER: HAB
;"MESSAGE A-MEDICARE"^A,
;"MESSAGE B-NON MEDICARE"^B,
IF{[f rx calc]("MEDICARE")^MEDICARE_.=.;
;IF{(MEDICARE=1) [f rx msg](A);
;[f rx msg](B)}};
IF{(MEDICARE=1) [f rx set billing code](16070625);
[f rx set billing code](16071318)}};
--------------------------------------------------------------------------------------------
INFLUENZA RX EVL MED INFLUENZA MEDICARE
;SENDS- MEDICARE BILLING # THROUGH FOR MEDICARE PATIENTS
IF{[f rx calc]("MEDICARE")^MEDICARE_.=.;
IF{(MEDICARE=1) [f rx set billing code](16070625);
[f rx set billing code](16071318)}};
--------------------------------------------------------------------------------------------
INR RX EVL MED DISPLAYS INR
IF{[f rx last ver result]("INR")^INR_.=.;
("LAST INR = ",INR,"")^I,
[f rx msg](I)};
;IF{[f rx nth ver Res-RES]("INR",1)^RE1_.=. 1;
;[f rx nth ver Res-RES]("INR",2)^RE2,
;[f rx nth ver Res-RES]("INR",3)^RE3,
;("Last INR info: "_(RE1#"0,")_" @"_(RE1#"1,")_" "_(RE1#"2,"))^M1,
;IF{[f rx nth ver Res-RES]("INR",2)^RE2_.=. ""^M2;
;("Other INR info: "_(RE2#"0,")_" @"_(RE2#"1,")_" "_(RE2#"2,"))^M2,
;IF{[f rx nth ver Res-RES]("INR",3)^RE3_.=. ""^M3;
;(" "_(RE3#"0,")_" @"_(RE3#"1,")_" "_(RE3#"2,"))^M3}},
;[f rx win init],
;[f rx win add](M1),
;[f rx win add](M2),
;[f rx win add](M3),
;[f rx win disp],1};
--------------------------------------------------------------------------------------------
INR.IV RX EVL MED DISPLAYS INR
IF{[f rx last ver result]("INR")^INR_.=.;
("LAST INR = ",INR,"")^I,
[f rx msg](I)};
;IF{[f rx nth ver Res-RES]("INR",1)^RE1_.=. 1;
;[f rx nth ver Res-RES]("INR",2)^RE2,
;[f rx nth ver Res-RES]("INR",3)^RE3,
;("Last INR info: "_(RE1#"0,")_" @"_(RE1#"1,")_" "_(RE1#"2,"))^M1,
;IF{[f rx nth ver Res-RES]("INR",2)^RE2_.=. ""^M2;
;("Other INR info: "_(RE2#"0,")_" @"_(RE2#"1,")_" "_(RE2#"2,"))^M2,
;IF{[f rx nth ver Res-RES]("INR",3)^RE3_.=. ""^M3;
;(" "_(RE3#"0,")_" @"_(RE3#"1,")_" "_(RE3#"2,"))^M3}},
;[f rx win init],
;[f rx win add](M1),
;[f rx win add](M2),
;[f rx win add](M3),
;[f rx win disp],1};
--------------------------------------------------------------------------------------------
INSGLARG RX EVL MED INSULIN GLARGINE - INJMDV -M
IF{[f rx ord type]="M" [f rx set charge type]("INJMDV")},1;
RUN DATE: 01/11/07 NORTH COUNTRY NPR PHARMACY 4.6 **LIVE** PAGE 22
RUN TIME: 0849 pha.rule.zcus.hab.download
RUN USER: HAB
--------------------------------------------------------------------------------------------
INSUFEE RX EVL FILE UD
"Insulin Fee needs to be charged - Dispense 1 fee"^A,
IF{[f z numb to dispense]="1" [f rx ok];[f rx err msg](A)};
--------------------------------------------------------------------------------------------
INVEN.STD RX EVL DOSE INVENTORY STD.-CUSTOM FIELD
;This rule looks at custom fields in the formuary and determines if the
;med is stocked routinely. If the order's inventory is u, all checking
;should be stopped. If the order defaults to current location, and the check
;for the standard is nill, a warning appears to the user.
IF{([f pt status]'="ADM IN"!([f rx ord type]'="M")) [f rx ok];
[f pt location]^PT,
[f rx inventory]^IN,
[f rx med]^M,
IF{PT'=IN [f rx ok];
("Please note, although this med is currently stocked in ",(IN)," it was")^M1,
"specifically loaded for another patient or order. Please check the Pyxis"^M2,
("Min and Max levels for med mnemonic^",(M)," in Pyxis location",(IN))^M3,
IF{PT="2WEST" IF{[f z rx.inv.std.2w]="Y" 1;
[f rx win init],
[f rx win add](M1),
[f rx win add](M2),
[f rx win add](M3),
[f rx win disp],1};
IF{PT="2EAST" IF{[f z rx.inv.std.2e]="Y" 1;
[f rx win init],
[f rx win add](M1),
[f rx win add](M2),
[f rx win add](M3),
[f rx win disp],1};
IF{PT="OB" IF{[f z rx.inv.std.ob]="Y" 1;
[f rx win init],
[f rx win add](M1),
[f rx win add](M2),
[f rx win add](M3),
[f rx win disp],1};
IF{PT="FC" IF{[f z rx.inv.std.fc]="Y" 1;
[f rx win init],
[f rx win add](M1),
[f rx win add](M2),
[f rx win add](M3),
[f rx win disp],1};
IF{PT="ARU" IF{[f z rx.inv.std.aru]="Y" 1;
[f rx win init],
[f rx win add](M1),
[f rx win add](M2),
[f rx win add](M3),
[f rx win disp],1};
IF{PT="SBU" IF{[f z rx.inv.std.sbu]="Y" 1;
[f rx win init],
[f rx win add](M1),
[f rx win add](M2),
[f rx win add](M3),
[f rx win disp],1};
IF{PT="ICU" IF{[f z rx.inv.std.icu]="Y" 1;
RUN DATE: 01/11/07 NORTH COUNTRY NPR PHARMACY 4.6 **LIVE** PAGE 23
RUN TIME: 0849 pha.rule.zcus.hab.download
RUN USER: HAB
[f rx win init],
[f rx win add](M1),
[f rx win add](M2),
[f rx win add](M3),
[f rx win disp],1}}}}}}}}};[f rx msg]("Pyxis Std Inv not Checked")};
;
;[f rx msg](NS2)}}}}};
;
;
;IF{(PT="2WEST"&([f z rx.inv.std.2w]="Y")) 1;
;IF{(PT="2WEST"&([f rx inventory]="2WEST")) [f rx msg](NS);[f rx ok]}}}};
;--------
;IF{(PT="2WEST"&([f z rx.inv.std.2w]'="Y"&([f rx inventory]="2WEST"))) 1,
;[f rx msg](NS);
;IF{((PT="2EAST"&([f z rx.inv.std.2e]=""&([f rx inventory]="2EAST")))) 1,
;[f rx msg](NS2);[f rx ok]}}}};
--------------------------------------------------------------------------------------------
IV RX EVL MED EMP-CONTRACT charge code chg
;5/26/99 - MEDITECH 4.7 NO CHARGE TYPE DEFAULT - CREATE RULE FOR ivS
IF{[f pt location]="NP-KDU" [f rx ok];
IF{[f rx ord type]="I" [f rx set charge type]("IV");[f rx ok]}};
--------------------------------------------------------------------------------------------
KCL.ADD RX EVL MED DISPLAYS KCL LEVEL
IF{[f rx calc]("NS50")^NS50_.=.;
[f rx msg](NS50),
IF{(NS>53) [f rx ok];
IF{(NS<48) [f rx ok];
IF{[f rx last ver result]("K")^K_.=.,
("Last K+ level = ",K," Protocol is KCL 10 mEq x 2 doses")^A,
("Last K+ level = ",K," Protocol is KCL 10 mEq x 3 doses")^B,
("Last K+ level = ",K," Protocol is KCL 10 mEq x 4 doses")^C,
("Last K+ level = ",K," Protocol is KCL 10 mEq x 5 doses")^D,
IF{(3.85'<K&(K'<3.5)) [f rx msg](A);
(3.45'<K&(K'<2.95)) [f rx msg](B);
(2.94'<K&(K'<2.45)) [f rx msg](C);
(K<2.44) [f rx msg](D);[f rx ok]}}}}};
--------------------------------------------------------------------------------------------
KCL.IV RX EVL MED DISPLAYS KCL LEVEL
IF{[f rx last ver result]("K")^K_.=.,
("Last K+ Level = ",K," Since >=3 use ORAL route is possible")^A,
"Oral dose= KDur or K-Lor 40 mEq x 1 dose-if need IV = KCL 10mEq X 2 doses"^A2,
"Oral dose= Kdur or K-Lor 40 mEq q2h X 2 doses.If need IV = 10mEq x 3doses"^A3,
"Oral dose= Kdur or K-Lor 40 mEq q2h X 3 doses.If need IV = 10mEq x 3doses"^A4,
("Last K+ level = ",K," Since <3 - give KCL (IV) 1 hr/dose 10 mEq x 4 doses")^C,
("Last K+ level = ",K," Since <3 - give KCL (IV) 1 hr/dose 10 mEq x 5 doses")^D,
;IF{(3.85'<K&(K'<3.49)) [f rx win init],[f rx win add](A),[f rx win add](A2),
IF{(3.65'<K&(K'<3.29)) [f rx win init],[f rx win add](A),[f rx win add](A2),
[f rx win disp],1;
;(3.48'<K&(K'<3.29)) [f rx win init],[f rx win add](A),[f rx win add](A3),
(3.28'<K&(K'<3.09)) [f rx win init],[f rx win add](A),[f rx win add](A3),
[f rx win disp],1;
;(3.27'<K&(K'<2.99)) [f rx win init],[f rx win add](A),[f rx win add](A4),
(3.07'<K&(K'<2.79)) [f rx win init],[f rx win add](A),[f rx win add](A4),
RUN DATE: 01/11/07 NORTH COUNTRY NPR PHARMACY 4.6 **LIVE** PAGE 24
RUN TIME: 0849 pha.rule.zcus.hab.download
RUN USER: HAB
[f rx win disp],1;
;(2.94'<K&(K'<2.45)) [f rx msg](C);
(2.74'<K&(K'<2.25)) [f rx msg](C);
;(K<2.44) [f rx msg](D);[f rx ok]}};
(K<2.24) [f rx msg](D);[f rx ok]}};
--------------------------------------------------------------------------------------------
KCL.IV3 RX EVL DOSE DISPLAYS KCL LEVEL
""^MG^K^MGD^MGO^MM^K1^K2,
; - ADDED DUE TO BUG - WHICH STARTS LAB LOOKUP IF ENTERED BY IV STRING
; - STARTED IF USE - f rx nth ver...
IF{[f rx med]_.=. 1,
[f rx last ver result]("MG")^MG,
[f rx last ver result]("K")^KC;
; - NED OF 3 LINES. To further complete - put } after KC two lines below,
[f rx nth ver Res-RES]("MG",1)^MG,
[f rx nth ver Res-RES]("K",1)^KC},
IF{MG_.=. "If for KCL Replacement Protocol:Mag Level not done, please order"^MM;
KC#"0,"^KCL,KC#"1,"^KCD,KC#"2,"^KCT,
MG#"0,"^MGL,MG#"1,"^MGD,MG#"2,"^MGT,
[f z mg.days.old]^MGO,
IF{MGO>1 "Last MG = "_MGL_" on "_MGD_". Since > 24 hours, redo level"^MM;
MGL>1.55 "Mg Level OK ("_MGL_" on "_MGD_")"^MM;
MGL>1.25&(MGL<1.55) 1,
"Last Mg ("_MGL_" on "_MGD_") Dose: 2 g in D5W 50ml over 2 hrs x 1"^MM;
MGL<1.25 1,
"Last Mg ("_MGL_" on "_MGD_") Dose: 4 g in D5W 50ml over 4 hrs x 1"^MM},
IF{KCL>3.6 "Last K is "_KCL_" since > 3.6, protocol not indicated"^K1,
" "^K2;
KCL>3.25&(KCL<3.65) 1,
"Oral Protocol for K+ of "_KCL_" is K-Lor or KDur 40 mEq x 1 dose"^K1,
"IV is KCl 10 mEq over 1 hour x 2 doses (20 mEq total)"^K2;
KCL>3.05&(KCL<3.25) 1,
"Oral Protocol for K+ of "_KCL_" is K-Lor or KDur 40 mEq Q2H X 2 doses"^K1,
"IV is KCl 10 mEq over 1 hour x 3 doses (30 mEq total)"^K2;
KCL>2.75&(KCL<3.05) 1,
"Oral Protocol for K+ of "_KCL_" is K-Lor or KDur 40 mEq Q2H X 3 doses"^K1,
"IV is KCl 10 mEq over 1 hour x 3 doses (30 mEq total)"^K2;
KCL>2.25&(KCL<2.85) "Since K is < 2.8 ("_KCL_"), Use IV therapy"^K1,
"KCl 10 mEq IV over 1 hour x 4 doses (40 mEq total)"^K2;
KCL<2.25 "Since K is < 2.3 ("_KCL_"),"^K1,
"KCL 10 mEq IV over 1 hour x 5 doses (50 mEq total)"^K2},
"Below info if using KCl per Replacement Protocol"^INIT,
[f rx win init],
[f rx win add](INIT),
[f rx win add](MM),
[f rx win add](K1),
[f rx win add](K2),
[f rx win disp],[f rx ok],1,
[f rx set rx comment](INIT_" "_MM_" "_K1_" "_K2),1};
--------------------------------------------------------------------------------------------
KCL.IV4 RX EVL DOSE DISPLAYS KCL LEVEL
""^MG^K^MGD^MGO^MM^K1^K2,
;IF{[f rx med]_.=. 1,
;[f rx last ver result]("MG")^MG,
;[f rx last ver result]("K")^KC;
RUN DATE: 01/11/07 NORTH COUNTRY NPR PHARMACY 4.6 **LIVE** PAGE 25
RUN TIME: 0849 pha.rule.zcus.hab.download
RUN USER: HAB
; - NED OF 3 LINES. To further complete - put } after KC two lines below,
[f rx nth ver Res-RES]("MG",1)^MG,
[f rx nth ver Res-RES]("K",1)^KC,
;IF{'KC&'MG [f rx msg]("K & MG Not Available - Manually Check");
IF{KC_.=. "K Not Available"^MM},
IF{MG_.=. MM_" If for KCL Repl: Mag not done, please order "^MM},
IF{MG_.=.&(KC_.=.) 1;KC#"0,"^KCL,KC#"1,"^KCD,KC#"2,"^KCT,
"Last K:"_" "_KCL_" on "_KCD_" "_KCT_"."_MM^MM;1},
IF{KC_.=.!(MG_.=.) 1;
KC#"0,"^KCL,KC#"1,"^KCD,KC#"2,"^KCT,
MG#"0,"^MGL,MG#"1,"^MGD,MG#"2,"^MGT,
[f z mg.days.old]^MGO,
IF{MGO>1 "Last MG = "_MGL_" on "_MGD_". Since > 24 hours, redo level"^MM;
MGL>1.55 "Mg Level OK ("_MGL_" on "_MGD_")"^MM;
MGL>1.25&(MGL<1.55) 1,
"Last Mg ("_MGL_" on "_MGD_") Dose: 2 g in D5W 50ml over 2 hrs x 1"^MM;
MGL<1.25 1,
"Last Mg ("_MGL_" on "_MGD_") Dose: 4 g in D5W 50ml over 4 hrs x 1"^MM},
IF{KCL>3.6 "Last K is "_KCL_" since > 3.6, protocol not indicated"^K1,
" "^K2;
KCL>3.25&(KCL<3.65) 1,
"Oral Protocol for K+ of "_KCL_" is K-Lor or KDur 40 mEq x 1 dose"^K1,
"IV is KCl 10 mEq over 1 hour x 2 doses (20 mEq total)"^K2;
KCL>3.05&(KCL<3.25) 1,
"Oral Protocol for K+ of "_KCL_" is K-Lor or KDur 40 mEq Q2H X 2 doses"^K1,
"IV is KCl 10 mEq over 1 hour x 3 doses (30 mEq total)"^K2;
KCL>2.75&(KCL<3.05) 1,
"Oral Protocol for K+ of "_KCL_" is K-Lor or KDur 40 mEq Q2H X 3 doses"^K1,
"IV is KCl 10 mEq over 1 hour x 3 doses (30 mEq total)"^K2;
KCL>2.25&(KCL<2.85) "Since K is < 2.8 ("_KCL_"), Use IV therapy"^K1,
"KCl 10 mEq IV over 1 hour x 4 doses (40 mEq total)"^K2;
KCL<2.25 "Since K is < 2.3 ("_KCL_"),"^K1,
"KCL 10 mEq IV over 1 hour x 5 doses (50 mEq total)"^K2}},
"Below info if using KCl per Replacement Protocol"^INIT,
;[f rx msg]("At Win Init"),
[f rx win init],
[f rx win add](INIT),
[f rx win add](MM),
[f rx win add](K1),
[f rx win add](K2),
[f rx win disp],[f rx ok],1,
[f rx set rx comment](INIT_" "_MM_" "_K1_" "_K2),1;
--------------------------------------------------------------------------------------------
KDUDISCH RX EVL MED KDU- DISCHARGE
;PREVENTS ENTERING ORDERS ON DISCHARGED KDU patients.
"New orders are not allowed on DISCHARGED KDU patients"^E,
"Contact Herb if an order actually needs to be entered"^E2,
IF{[f pt location]'="NP-KDU" [f rx ok];
IF{[f pt status]="DIS RCR" [f rx err msg](E),[f rx err msg](E2);1}};
--------------------------------------------------------------------------------------------
LAB.MULT RX EVL DOSE DISPLAYS MULTIPLE LAB
IF{[f rx nth ver Res-RES]("CR",1)^RE1_.=. 1;
[f rx nth ver Res-RES]("CR",2)^RE2,
[f rx nth ver Res-RES]("CR",3)^RE3,
RUN DATE: 01/11/07 NORTH COUNTRY NPR PHARMACY 4.6 **LIVE** PAGE 26
RUN TIME: 0849 pha.rule.zcus.hab.download
RUN USER: HAB
("Last Cr info: "_(RE1#"0,")_" @"_(RE1#"1,")_" "_(RE1#"2,"))^M1,
IF{[f rx nth ver Res-RES]("CR",2)^RE2_.=. ""^M2;
("Other Cr info: "_(RE2#"0,")_" @"_(RE2#"1,")_" "_(RE2#"2,"))^M2,
IF{[f rx nth ver Res-RES]("CR",3)^RE3_.=. ""^M3;
(" "_(RE3#"0,")_" @"_(RE3#"1,")_" "_(RE3#"2,"))^M3}},
[f rx win init],
[f rx win add](M1),
[f rx win add](M2),
[f rx win add](M3),
[f rx win add]("this is line #4"),
[f rx win add]("this is line #5"),
[f rx win disp],1};
--------------------------------------------------------------------------------------------
LAB.MULT2 RX EVL MED DISPLAYS MULTIPLE LAB TRY 2
[f rx nth ver Res-RES]("CR",1)^RE1,
("Last Cr info: "_(RE1#"0,")_" @"_(RE1#"1,")_" "_(RE1#"2,"))^MES,
[f rx msg](MES);
;
;IF{[f rx nth ver Res-RES]("CR",1)^RE1_.=. 1;
;[f rx nth ver Res-RES]("CR",2)^RE2,
;[f rx nth ver Res-RES]("CR",3)^RE3,
;("Last Cr info: "_(RE1#"0,")_" @"_(RE1#"1,")_" "_(RE1#"2,"))^M1,
;IF{[f rx nth ver Res-RES]("CR",2)^RE2_.=. ""^M2;
;("Other Cr info: "_(RE2#"0,")_" @"_(RE2#"1,")_" "_(RE2#"2,"))^M2,
;IF{[f rx nth ver Res-RES]("CR",3)^RE3_.=. ""^M3;
;(" "_(RE3#"0,")_" @"_(RE3#"1,")_" "_(RE3#"2,"))^M3}},
;[f rx win init],
;[f rx win add](M1),
;[f rx win add](M2),
;[f rx win add](M3),
;[f rx win add]("this is line #4"),
;[f rx win add]("this is line #5"),
;[f rx win disp],1};
--------------------------------------------------------------------------------------------
LEVA.RTE RX EVL FILE LEVAQUIN RATE -MUST BE 100
IF{[f rx calc]("CIPRRATE")^CIPRRATE_.=.;
"Rate for Levofloxacin should not exceed 100 ml/hr"^B,
IF{CIPRRATE>110 [f rx err msg](B);1}};
--------------------------------------------------------------------------------------------
LEVOF.LT18 RX EVL MED Levaquin flag if < 18
[f z patient age in yrs]^AGE,
IF{AGE>18 1;
"Pat. is <18 yo - Levofloxacin is NOT approved in this patient. Continue"^MES,
IF{[f rx yes/no](MES)=1 1;
[f rx med]^MED,
[f rx err msg]("Delete "_MED_", Order will not File if mnemonic exists")}};
--------------------------------------------------------------------------------------------
MAGNESIUM RX EVL MED DISPLAYS MAG LEVEL
IF{[f rx last ver result]("MG")^MG_.=.,
("MG = ",MG," mg/dL, protocol= 2 g (16.24 mEq in 50 ml D5W over 2 hour")^E,
("MG = ",MG," mg/dL, protocol= 4 g (32.48 mEq in 50 ml D5W over 4 hours")^F,
("MG = ",MG," mg/dL, Since >= 1.6, MG OK, does NOT need replacement")^G,
"Mg Level NOT done, please check MG if K+ is per protocol"^H,
RUN DATE: 01/11/07 NORTH COUNTRY NPR PHARMACY 4.6 **LIVE** PAGE 27
RUN TIME: 0849 pha.rule.zcus.hab.download
RUN USER: HAB
;IF{(1.85'<MG&(MG'<1.49)) [f rx msg](E);
IF{(1.55'<MG&(MG'<1.29)) [f rx msg](E);
;(MG<1.49) [f rx msg](F);[f rx msg](H);[f rx msg](G)}};
(MG<1.29) [f rx msg](F);[f rx msg](H);[f rx msg](G)}};
--------------------------------------------------------------------------------------------
MAXZ.25.IN RX EVL DOSE MAXZIDED 25 - ONLY USE FOR 1/2
;rule is to flag user from entering a dose of maxzide 25 if dose if full
;1/2 tabs ok, if one full tab - should use dyazide
IF{[f pt status]$3^ADM'="ADM" 1;
IF{[f rx dose]<0.6 1;
"Use Dyazide 1 cap for 1 Maxzide 25, Use Dyazide 2 caps for Maxzide 75/50"^M1,
"Save Maxzide 25 for use when dose is 0.5 tab"^M2,
[f rx win init],
[f rx win add](M1),
[f rx win add](M2),
[f rx win disp],1}};
--------------------------------------------------------------------------------------------
MC.DISP1 RX EVL FILE MERIT CARE- REQUIRES 1TO DISP
;this rule will only allow 1 dose to be dispensed
[f z.out.refill.num.dis]^P,
("When using Merit Care Products - (QTY to dispense) should be 1, NOT ",(P))^N,
IF{P=1 [f rx ok];[f rx err msg](N)};
--------------------------------------------------------------------------------------------
MC.KDU RX EVL MED MERIT CARE-DIALYSIS MEDS
;this rule will not allow any med which it is attached on to be used on any
;patient unless they are in "NP-KDU" as a location.
"This is a med is supplied by Merit Care for use during Dialysis only"^R,
IF{[f pt location]="NP-KDU" [f rx ok];[f rx err msg](R)};
--------------------------------------------------------------------------------------------
MC.KDU.RES RX EVL MED MC-MED- RESTRICT USINGON NP-KD
;this rule will not allow any med which it is attached on to be used on any
;PATINET IN NP-KDU
"This is a med is supplied by Merit Care use appropriate Meric Care mnemonic"^R,
IF{[f pt location]'="NP-KDU" [f rx ok];[f rx err msg](R)};
--------------------------------------------------------------------------------------------
MC.NOCALC RX EVL FILE MERIT CARE- REQUIRES NO CHARGE
;this rule will not allow any med which it is attached on to have any charges
;associated with the med
"This is a med is supplied by Merit Care for Dialysis Pat. only- NO CHARGE1"^R,
IF{[f rx charge]<0.01 [f rx ok];[f rx err msg](R)};
--------------------------------------------------------------------------------------------
MC2 CALC EVL FILE MEDICARE IDENT
;test ops
IF{[f pt ins1 name]="MEDICARE Z" 3^A;0^A},
IF{[f pt ins1 name]="MEDICARE/MA Z" 3^B;0^B},
IF{[f pt ins1 name]="MEDICARE/B" 3^C;0^C},
IF{[f pt ins1 name]="MEDICARE-HMO" 3^I;0^I},
IF{[f pt status]="REG SDC" 2^D;0^D},
IF{[f pt status]="REG ER" 2^E;0^E},
IF{[f pt status]="REG RCR" 2^F;0^F},
IF{[f pt status]="DEP ER" 2^G;0^G},
RUN DATE: 01/11/07 NORTH COUNTRY NPR PHARMACY 4.6 **LIVE** PAGE 28
RUN TIME: 0849 pha.rule.zcus.hab.download
RUN USER: HAB
IF{[f pt status]="DEP SDC" 2^H;0^H},
A+B+C+D+E+F+G+H+I^P,
IF{P>4 1^MC2;0^MC2};
--------------------------------------------------------------------------------------------
MC2TAKEH CALC EVL FILE MEDICARE IDENT - FOR TAKHOME
IF{[f pt ins1 name]="MEDICARE Z" 3^A;0^A},
IF{[f pt ins1 name]="MEDICARE/MA Z" 3^B;0^B},
IF{[f pt ins1 name]="MEDICARE/B" 3^C;0^C},
A+B+C^P,
IF{P>2 1^MC2TAKEH;0^MC2TAKEH};
--------------------------------------------------------------------------------------------
MEDICARE CALC EVL FILE MEDICARE IDENTIFIER-
;USED IN INFLUENZA IDENTIFIER - NOTE ALSO NEED TO MODIFY MC2 IF UPDATING
; ON 4/18/01 - ADDED MEDICARE-HMO
IF{[f pt ins1 name]="MEDICARE Z" 3^A;0^A},
IF{[f pt ins1 name]="MEDICARE/MA Z" 3^B;0^B},
IF{[f pt ins1 name]="MEDICARE/B" 3^C;0^C},
IF{[f pt ins2 name]="MEDICARE Z" 3^D;0^D},
IF{[f pt ins2 name]="MEDICARE/MA Z" 3^E;0^E},
IF{[f pt ins2 name]="MEDICARE/B" 3^F;0^F},
IF{[f pt ins2 name]="MEDICARE-HMO" 3^G;0^G},
IF{[f pt ins1 name]="MEDICARE-HMO" 3^H;0^H},
A+B+C+D+E+F+G+H^P,
IF{P>2 1^MEDICARE;0^MEDICARE};
--------------------------------------------------------------------------------------------
MEDICBLK RX EVL MED CHG CHG TYPE TO NC FOR MEDICAR
;Rule written Herb Bromenshenkel 12/98 - uses calc rule of MC2. MC2 determines
; if patient is an outpatient and medicare. If outpatient and medicare, blocks
; charges except for those charge rules listed below
; will only work on M order types
"M IS smaller THAN 2"^W,
"NC"^P,
[f z out dft chg type]^O,
IF{([f rx ord type]'="M"&([f rx ord type]'="T")) [f rx ok];
IF{[f z out dft chg type]="PO" 3^A;0^A},
IF{[f z out dft chg type]="NARCPO" 3^B;0^B},
IF{[f z out dft chg type]="EENT" 3^C;0^C},
IF{[f z out dft chg type]="INH" 3^D;0^D},
IF{[f z out dft chg type]="LIQ" 3^E;0^E},
IF{[f z out dft chg type]="LIQ-OTC" 3^F;0^F},
IF{[f z out dft chg type]="MP-ORAL" 3^G;0^G},
IF{[f z out dft chg type]="MP-NARCS" 3^H;0^H},
IF{[f z out dft chg type]="KAYEX" 3^J;0^J},
IF{[f z out dft chg type]="MORP-LIQ" 3^K;0^K},
IF{[f z out dft chg type]="INJCMS" 3^K;0^K},
A+B+C+D