Files
St.Clair/MLMStripper/bin/Debug/FORM/FORM_VANCOMYCIN_WTBASED.mlm

665 lines
28 KiB
Plaintext

maintenance:
title: Form_Vancomycin_WtBased;;
mlmname: Form_Vancomycin_WtBased;;
arden: version 2;;
version: 5.50;;
institution: St. Clair Hospital;;
author: Teresa M. Spicuzza (Teresa.Spicuzza@stclair.org), 412.942.1721 ;;
specialist: Eclipsys Corporation;;
date: 2011-06-24;;
validation: testing;;
library:
purpose: Calculate Vancomycin dose based on weight - this MLM only calculates the dose
and supplies the correct item code - it does not check for creatinine clearance
and recommend dosing based upon CrCl value.
;;
explanation:
Change history
06.24.2011 TMS Initial build
09.20.2011 TMS Added informational alert for calculations on patients under 12 years of age and
patients under 25kg to contact physician for dosing.
04.26.2012 TMS Add statement to check hidden prebuilt order box on form for all product codes
except 02106 and 02107 (type in doses) Help Desk Ticket 149199
01.30.2013 TMS Added call to Form_HoldOrder_RequestedTime mlm on form open. Call moved from form close
to allow for "Now and Then" MLM - CSR 26926
04.30.2014 TMS Added logic to precheck type in dosing if nothing is checked on form open.- CSR 31759
03.24.2015 TMS Add logic to append "T" to the ancillary code if ordered from the Vanco trough order set
for Veriscan processing. CSR 32241
03.30.2016 BB Added new Vanco items to the Base Solution - Manual Dose section for 1.75 GM orders - CSR 34057.
03.30.2016 BB Modifying logic to set Normal Saline as standard diluent vs. D5W - CSR 33780
06.01.2016 TMS Adding logic for Vancomycin Loading Dose (25mg/kg using adjusted body weight, rounded to
nearest 250mg with a Max dose of 2gm). Added logic for Vancomycin maintenance dosing
20mg/kg using adjusted body weight with frequency determined by CrCl value. - CSR 34154, 34156
03.30.2017 TMS Added field exclusion to process type C when no weight is entered to eliminate "no weight{{{SINGLE-QUOTE}}} alert
presenting upon field change of combined weights. HD 2632970
05.10.2017 JML CSR 35272: Modified to work with new Sepsis Unknown Source Antibiotic ED order set AND
Sepsis Work Up Orders (ED) order set
;;
keywords:
Vancomycin, dose, weight;
;;
knowledge:
type: data-driven;;
data:
// This MLM is passed three arguments, of types
// communication_type, form_type and client info object respectively.
(this_communication, // Communication object
this_form, // Form object
client_info_obj // Arden ClientInfo object
) := argument;
standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
include standard_libs;
//Local session object
local_session := cds_session.local;
comm_obj := this_communication.primaryobj;
called_by := this_communication.CallingEvent;
call_field := this_communication.CallingFieldName;
session_type := comm_obj.internalprocessingtype;
OrderSet_Name := comm_obj.OrderSetName;
if called_by_editor then
client_guid := "9000001369400200";
visit_guid := visit_obj.GUID;
chart_guid := "9000001918900170";
orderId := "1000002689073001";
called_by := "FormOpen";
else
client_guid := this_communication.ClientGUID;
visit_guid := this_communication.ClientVisitGUID;
chart_guid := this_communication.ChartGuid;
orderid := this_comm.ItemID;
endif;
//Initialize MLM pointers:
str_parse := mlm {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}};
// Assigns fields passed in the Form object to the Field object
field_list:= this_form.fields;
// Get patient weight
comb_ht_wt_field := first of (field_list where field_list.DataItemName = "CombinedMeasurements");
if exists comb_ht_wt_field then comb_ht_wt_val := comb_ht_wt_field.value;
wt := comb_ht_wt_val.weight;
weightvalue := (wt as number);
ht := comb_ht_wt_val.height;
heightvalue := (ht as number);
endif;
If weightvalue = 0 then needweight := True;
else needweight := False;
endif;
If heightvalue = 0 then needheight := True;
else needheight := False;
endif;
// Get patient age
(patientage) := read last
{
" select "
||" case when "
||" right({{{SINGLE-QUOTE}}}00{{{SINGLE-QUOTE}}} + cast (datepart (MM,getdate()) as varchar),2) + right({{{SINGLE-QUOTE}}}00{{{SINGLE-QUOTE}}} + cast (datepart (DD,getdate()) as varchar),2) < "
||" right({{{SINGLE-QUOTE}}}00{{{SINGLE-QUOTE}}} + cast (birthmonthnum as varchar),2) + right({{{SINGLE-QUOTE}}}00{{{SINGLE-QUOTE}}} + cast (birthdaynum as varchar),2) "
||" then datediff (yy, cast (birthyearnum as varchar) ,getdate()) -1 "
||" else datediff (yy, cast (birthyearnum as varchar) ,getdate()) "
||" end "
||" from cv3client with (nolock) where guid = " || Client_Guid || " "
};
// Define other fields
Prebuilt := last of (field_list where field_list.DataItemName = "PRX_PrebuiltOrder" );
StartNow := last of (field_list where field_list.DataItemName = "PRX_Dosing Start Now" );
Dose := first of (field_list where field_list.DataItemName = "DosageLow");
BaseSolution_obj := OBJECT [Name, ItemID, Dose, UOM, OrderCatalogMasterItemGUID];
BaseSolution_field := first of (field_list where field_list.DataItemName = "BASESOLUTION");
If exists BaseSolution_field then
BaseSolution_value := BaseSolution_field.value;
BaseSolution_name := BaseSolution_field.name;
BaseSolution_dose := BaseSolution_field.dose;
BaseSolution_uom := BaseSolution_field.uom;
endif;
DoseUOM := first of (field_list where field_list.DataItemName = "UOM");
WorxCode := first of (field_list where field_list.DataItemName = "PRX_DRUGIDCODE");
// CalcDose := first of (field_list where field_list.DataItemName = "PRX_Generic_CB");
Adj_Wt_Value := first of (field_list where field_list.DataItemName = "PRX_AdjBodyWeight");
CalcDose := first of (field_list where field_list.DataItemName = "PRX_DosageWeightBased");
AdjCalcDose := first of (field_list where field_list.DataItemName = "PRX_DosageAdjWtBased");
LoadDose := first of (field_list where field_list.DataItemName = "PRX_LoadingDose");
DiluentBox := first of (field_list where field_list.DataItemName = "PRX_ResetDiluent");
Override := first of (field_list where field_list.DataItemName = "PRX_DosageOverride");
OrderInfo := first of (field_list where field_list.DataItemName = "PRX_NoteComment0");
TroughMed := first of (field_list where field_list.DataItemName = "PRX_Med for Trough Level");
PRNReason := first of (field_list where field_list.DataItemName = "PRX_PRNCONDITION");
CrClmgdl := first of (field_list where field_list.DataItemName = "PRX_CrCl_mg_dl");
CrClEstd := first of (field_list where field_list.DataItemName = "PRX_CrCl_Estimated");
CalcField := first of (field_list where field_list.DataItemName = "PRX_Generic_CB");
FrequencyCode := last of (field_list where field_list.DataItemName = "FrequencyCode");
MLMfromOrderSet := last of (field_list where field_list.DataItemName = "MLM_From Order Set");
FrequencyValue := FrequencyCode.value;
Frequency := FrequencyValue.FrequencySummary;
//Jules Test
StopAfter := first of ( field_list WHERE field_list.DataItemName = "StopAfter" );
StopDate := first of ( field_list WHERE field_list.DataItemName = "StopDate" );
StopTime := first of ( field_list WHERE field_list.DataItemName = "StopTime" );
//End Jules Test
CalcDose_value := calcdose.value;
AdjCalcDose_value := AdjCalcDose.value;
Override_value := override.value;
LoadDose_value := LoadDose.value;
TroughMed_value := TroughMed.value;
// MLM{{{SINGLE-QUOTE}}}s for Adjusted Body Weight and Creatinine Clearance
Adj_Body_Wt := mlm {{{SINGLE-QUOTE}}}FORM_FUNC_CALC_ADJUSTED_BODY_WEIGHT{{{SINGLE-QUOTE}}};
CrClCalc := MLM {{{SINGLE-QUOTE}}}Form_MLM_Creatinine_Clearance{{{SINGLE-QUOTE}}};
If exists WorxCode then
WorxCode_value := WorxCode.value;
endif;
If OrderSet_Name in ("Pneumonia Antibiotic ED", "Pneumonia Antibiotic", "Skin Antibiotic Inpatient", "Skin Antibiotic Inpatient ED", "Sepsis Unknown Source Antibiotic ED"
,"Sepsis Unknown Source Antibiotic","Antibiotic Guidelines", "Antibiotic Guidelines ED") OR OrderSet_Name matches pattern "Transition Orders%" OR OrderSet_Name = "Septic Work Up Orders" then
(this_communication, this_form, Adj_Weight) := call Adj_Body_Wt with (this_communication, this_form, client_info_obj);
Adj_Wt_Value.value := Adj_Weight as number;
ShowLoading := True;
LoadDose.Control_Visible := True;
AdjCalcDose.Control_Visible := True;
CalcDose.Control_Visible := False;
CrClmgdl.Control_Visible := True;
CrClEstd.Control_Visible := True;
CalcField.Control_Visible := True;
else
ShowLoading := False;
LoadDose.Control_Visible := False;
AdjCalcDose.Control_Visible := False;
CrClmgdl.Control_Visible := False;
CrClEstd.Control_Visible := False;
CalcField.Control_Visible := False;
endif;
// Patients under 12 years of age require manual dosing
If patientage < 12 and Called_by = "FormOpen" and (CalcDose.value = true or AdjCalcDose.value = true) then;
dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "Patient under 12 years of age." ||"\n Please call physician for dosing. " ,"Alert","OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
Override.value := True;
CalcDose.value := False;
AdjCalcDose.value := False;
LoadDose.value := False;
Processtype := "M";
endif;
If patientage < 12 and Called_by = "FieldChange" and AdjCalcDose.value = true and call_field = "PRX_DosageAdjWtBased" then;
dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "Patient under 12 years of age." ||"\n Please call physician for dosing. " ,"Alert","OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
Override.value := True;
CalcDose.value := False;
AdjCalcDose.value := False;
LoadDose.value := False;
Processtype := "M";
endif;
If patientage < 12 and Called_by = "FieldChange" and calcdose.value = true and call_field = "PRX_DosageWeightBased" then;
dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "Patient under 12 years of age." ||"\n Please call physician for dosing. " ,"Alert","OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
Override.value := True;
CalcDose.value := False;
AdjCalcDose.value := False;
LoadDose.value := False;
Processtype := "M";
endif;
//Underweight adult patients require manual dosing
If (patientage > 12 and weightvalue < 25 and weightvalue <> 0) then;
If ((Call_field = "CombinedMeasurements" and CalcDose.value = true) or (Call_field = "PRX_DosageWeightBased" and CalcDose.value = true)
or (Call_field = "CombinedMeasurements" and AdjCalcDose.value = true) or (Call_field = "PRX_DosageAdjWtBased" and AdjCalcDose.value = true) ) then;
dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "Patient weight under 25 kg." ||"\n Please call physician for dosing. " ,"Alert","OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
Override.value := True;
LoadDose.value := False;
AdjCalcDose.value := False;
CalcDose.value := False;
CalcDose.control_read_only := true;
Processtype := "M";
endif;
If ((Called_by = "FormOpen" and CalcDose.value = true) or (Called_by = "FormOpen" and AdjCalcDose.value = true)) then;
dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "Patient weight under 25 kg." ||"\n Please call physician for dosing. " ,"Alert","OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
Override.value := True;
LoadDose.value := False;
AdjCalcDose.value := False;
CalcDose.value := False;
CalcDose.control_read_only := true;
Dose.Value := "";
Processtype := "M";
endif;
If (Called_by = "FormOpen" and Override.value = true) then;
dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "Patient weight under 25 kg." ||"\n Please verify dose. " ,"Alert","OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
Override.value := True;
LoadDose.value := False;
AdjCalcDose.value := False;
CalcDose.value := False;
CalcDose.control_read_only := true;
Dose.Value := "";
Processtype := "M";
endif;
endif; //If (patientage > 12 and weightvalue < 25 and weightvalue <> 0)
// if AdjCalcDose.value = True then
// (this_communication, this_form, CrClEstdValue ) := call CrClCalc with this_communication, this_form, client_info_obj;
// CrClEstd.Value := CrClEstdValue;
// endif;
// if hold session set requested time to scheduled/start time with no time specified
If called_by ="FormOpen" then
if (override_value = False and CalcDose_value = False and LoadDose_value = False and AdjCalcDose.value = False) then
override.value := True;
endif;
if AdjCalcDose_value = True and CrClEstd.Value is null then
(this_communication, this_form, CrClEstdValue ) := call CrClCalc with this_communication, this_form, client_info_obj;
CrClEstd.Value := CrClEstdValue;
endif;
HoldOrder := MLM {{{SINGLE-QUOTE}}}Form_HoldOrder_RequestedTime{{{SINGLE-QUOTE}}};
(this_communication, this_form) := call HoldOrder with this_communication, this_form, client_info_obj;
endif;
if (call_field = "CombinedMeasurements" or call_field = "PRX_Generic_CB" or call_field = "MLM_From Order Set" )and called_by = "FieldChange" and AdjCalcDose_value = True then
(this_communication, this_form, CrClEstdValue ) := call CrClCalc with this_communication, this_form, client_info_obj;
CrClEstd.Value := CrClEstdValue;
(this_communication, this_form, Adj_Weight) := call Adj_Body_Wt with (this_communication, this_form, client_info_obj);
Adj_Wt_Value.value := Adj_Weight;
endif;
if AdjCalcDose.value = True then
Processtype := "A";
elseif CalcDose.value = True then
Processtype := "C";
elseif LoadDose.value = True then
Processtype := "L";
else Processtype := "M";
endif;
// Toggle between wt based and manual dosing (and Loading Dose from Abx Stewardship Order Sets)
if call_field = "PRX_DosageOverride" and Override.value = True then
CalcDose.value := False; AdjCalcDose.value := false; LoadDose.value := False; Processtype := "M";
endif;
if call_field = "PRX_DosageOverride" and Override.value = False and ShowLoading = False then
CalcDose.value := True; AdjCalcDose.value := False; LoadDose.value := False; Processtype := "C";
endif;
if call_field = "PRX_DosageWeightBased" and CalcDose.value = True then
override.value := False; AdjCalcDose.value := false; LoadDose.value := False; Processtype := "C";
endif;
if call_field = "PRX_DosageWeightBased" and CalcDose.value = False and ShowLoading = False then
override.value := True; LoadDose.value := False; AdjCalcDose.value := false; Processtype := "M";
endif;
if call_field = "PRX_DosageAdjWtBased" and AdjCalcDose.value = True and ShowLoading = True then
override.value := False; LoadDose.value := False; CalcDose.value := False; Processtype := "A";
(this_communication, this_form, CrClEstdValue ) := call CrClCalc with this_communication, this_form, client_info_obj;
CrClEstd.Value := CrClEstdValue;
endif;
if call_field = "PRX_DosageAdjWtBased" and AdjCalcDose.value = False and ShowLoading = True then
override.value := True; LoadDose.value := False; CalcDose.value := False; Processtype := "M";
endif;
If call_field = "PRX_LoadingDose" and LoadDose.value = True then
override.value := False; CalcDose.value := False; AdjCalcDose.value := False; Processtype := "L";
endif;
If call_field = "PRX_LoadingDose" and LoadDose.value = False then
override.value := False; CalcDose.value := False; AdjCalcDose.value := True; Processtype := "A";
endif;
// alert user if weight based dosing is selected and patient has no weight
If (Processtype = "C" and weightvalue = 0) and (call_field <>"CombinedMeasurements") then
dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "Weight Based Dosing Requires Weight To Be Entered." , "Alert","OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
endif;
If ((Processtype = "L" or Processtype = "A") and (weightvalue = 0 or heightvalue = 0) and (call_field <>"CombinedMeasurements") ) then
dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "Dosing Based on Adjusted Body Weight Requires and Height and Weight To Be Entered." , "Alert","OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
endif;
If (Processtype = "C" or Processtype = "A") then
Dose.control_read_only := true; DoseUOM.control_read_only := true;
DiluentBox.control_read_only := false; Orderinfo.value := " ";
endif;
If LoadDose.value = True then Processtype := "L";
Dose.control_read_only := true; DoseUOM.control_read_only := true;
DiluentBox.control_read_only := false; Orderinfo.value := " ";
endif;
If Override.value = True then Processtype := "M";
Dose.control_read_only := false; DoseUOM.control_read_only := false;
DiluentBox.control_read_only := false; Orderinfo.value := " ";
endif;
If weightvalue < 25 and weightvalue > 0 then Processtype := "W"; doseUOM.value := "mg";
If (call_field = "CombinedMeasurements" and called_by = "FieldChange") or (Called_by = "FormOpen" and Override_Value = true) then
Dose.value := "";
CalcDose.Value := false; calcdose.control_read_only := true; Override.Value := true;
LoadDose.Value := false; LoadDose.control_read_only := true;
endif;
endif;
If weightvalue <> 0 or processtype is null then
Override.control_read_only := false;
CalcDose.control_read_only := false;
Dose.control_read_only := false;
DoseUOM.control_read_only := false;
endif;
//weight under 25kg process
If Processtype = "W" and called_by in ("FormOpen", "FormClose", "FieldChange") then
WorxCode.value := "02106";
BaseSolution_value.dose := 100;
BaseSolution_value.uom := "mL";
If DiluentBox.Value = false then
Basesolution_field.name := "0.9% NaCl 100ml ."; //:= "D5W 100ml ."; Original setup [BB]
else
Basesolution_field.name := "D5W 100ml ."; //:= "0.9% NaCl 100ml ."; Original setup [BB]
endif;
endif;
// Set default worxcode for manual dosing if not found in table.
If Processtype = "M" and called_by in ("FormOpen", "FormClose", "FieldChange") and weightvalue > 30 then
WorxCode.value := "02106";
Basesolution_field.name := Null;
Override.control_read_only := false;
CalcDose.control_read_only := false;
Prebuilt.value := False;
endif;
// Obtain correct diluent and WORx Code for Weight Based dosing option
if weightvalue >= 25 and ProcessType = "C" and called_by in ("FormOpen", "FormClose", "FieldChange") then
If DiluentBox.value = true then
DilType := "D"; //:= "N"; Original Setup [BB]
else DilType := "N"; //:= "D"; Original setup [BB]
endif;
calc_map_list :=(
// Wgt Lower Limit | Wgt Upper Limit | dose | UOM | Worx Code | Diluent | Volume | UOM | (D)5W or (N)ss
"30|39.9|500|mg|08370|D5W 100ml .|100|mL|D",
"40|49.9|750|mg|00212|D5W 250ml .|250|mL|D",
"50|79.9|1|gm|08271P|D5W 250ml .|250|mL|D",
"80|94.9|1.25|gm|00214|D5W 250ml .|250|mL|D",
"95|453.6|1.5|gm|00216|D5W 500ml .|500|mL|D",
"30|39.9|500|mg|08524|0.9% NaCl 100ml .|100|mL|N",
"40|49.9|750|mg|00213|0.9% NaCl 250ml .|250|mL|N",
"50|79.9|1|gm|08523|0.9% NaCl 250ml .|250|mL|N",
"80|94.9|1.25|gm|00215|0.9% NaCl 250ml .|250|mL|N",
"95|453.6|1.5|gm|00217|0.9% NaCl 500ml|500|mL|N",
"28.4|29.9|450|mg|02106|D5W 100ml .|100|mL|D",
"28.4|29.9|450|mg|02106|0.9% NaCl 100ml .|100|mL|N",
"25|28.3|400|mg|02106|D5W 100ml .|100|mL|D",
"25|28.3|400|mg|02106|0.9% NaCl 100ml .|100|mL|N"
// "21.7|24.9|350|mg|02106|D5W 100ml .|100|mL|D",
// "21.7|24.9|350|mg|02106|0.9% NaCl 100ml .|100|mL|N",
// "18.4|21.6|300|mg|02106|D5W 100ml .|100|mL|D",
// "18.4|21.6|300|mg|02106|0.9% NaCl 100ml .|100|mL|N",
// "15|18.3|250|mg|02106|D5W 100ml .|100|mL|D",
// "15|18.3|250|mg|02106|0.9% NaCl 100ml .|100|mL|N",
// "11.7|14.9|200|mg|02106|D5W 100ml .|100|mL|D",
// "11.7|14.9|200|mg|02106|0.9% NaCl 100ml .|100|mL|N",
// "8.4|11.6|150|mg|02106|D5W 100ml .|100|mL|D",
// "8.4|11.6|150|mg|02106|0.9% NaCl 100ml .|100|mL|N",
// "5.0|8.3|100|mg|02106|D5W 100ml .|100|mL|D",
// "5.0|8.3|100|mg|02106|0.9% NaCl 100ml .|100|mL|N",
// "2.0|2.9|50|mg|02106|D5W 100ml .|100|mL|D",
// "2.0|4.9|50|mg|02106|0.9% NaCl 100ml .|100|mL|N"
);
for i in 1 seqto count calc_map_list do
calc_element_list := call str_parse with calc_map_list[i], "|";
field1 := calc_element_list[1];
field2 := calc_element_list[2];
field3 := calc_element_list[3];
field4 := calc_element_list[4];
field5 := calc_element_list[5];
field6 := calc_element_list[6];
field7 := calc_element_list[7];
field8 := calc_element_list[8];
field9 := calc_element_list[9];
//
field1conv := (field1 as number);
field2conv := (field2 as number);
field3conv := (field3 as number);
field5conv := (field5 as number);
field7conv := (field7 as number);
if (weightvalue >= field1conv) and (weightvalue <= field2conv) and (field9 = diltype) and (override.value = false) then
Dose.value := field3;
DoseUOM.value := field4;
WorxCode.value := field5;
BaseSolution_value.name := field6;
BaseSolution_value.dose := field7conv;
BaseSolution_value.uom := field8;
Dose.control_read_only := true;
DoseUOM.control_read_only := true;
endif; //if (weightvalue >= field1conv
enddo; /* for i in 1 seqto count calc_map_list do */
endif; //processtype = c
if weightvalue > 0 and (ProcessType = "L" or ProcessType = "A") and called_by in ("FormOpen", "FormClose", "FieldChange") then
If (Adj_Wt_Value is not null) and (Adj_Weight as number) > 0 then
if Processtype = "L" then
raw_dose := (Adj_Weight as number)* 25;
rounded_dose := int((raw_dose + 125)/250) * 250;
If rounded_dose < 1000 then
dose.value := rounded_dose;
doseuom.value := "mg";
MaxDoseMsg := " ";
elseif rounded_dose >= 1000 and rounded_dose <= 2000 then
dose.value := rounded_dose / 1000;
doseuom.value := "gm";
MaxDoseMsg := " ";
elseif rounded_dose > 2000 then
dose.value := 2;
doseuom.value := "gm";
MaxDoseMsg := " (Maximum Loading Dose 2gm) ";
endif;
infomsg := "Loading Dose = 25mg/kg of Adjusted Body Weight (" || Adj_Weight || "kg) "|| MaxDoseMsg;
// If FrequencyValue.FrequencySummary is null then
FrequencyValue.FrequencySummary := "Now";
// endif;
Orderinfo.value := infomsg;
endif; //Processtype = "L"
if Processtype = "A" then
raw_dose := (Adj_Weight as number)* 20;
rounded_dose := int((raw_dose + 125)/250) * 250;
If rounded_dose < 1000 then
dose.value := rounded_dose;
doseuom.value := "mg";
MaxDoseMsg := " ";
elseif rounded_dose >= 1000 and rounded_dose <= 2000 then
dose.value := rounded_dose / 1000;
doseuom.value := "gm";
MaxDoseMsg := " ";
elseif rounded_dose > 2000 then
dose.value := 2;
doseuom.value := "gm";
MaxDoseMsg := " (Maximum Dose 2gm) ";
endif;
infomsg := "Maintenance Dose = 20mg/kg of Adjusted Body Weight (" || Adj_Weight || "kg) "|| MaxDoseMsg;
// Determine frequency based upon Estimated CrCl value
If CrClEstd.Value >= 60 then FrequencyValue.FrequencySummary := "Q12H";
Elseif CrClEstd.Value >= 30 and CrClEstd.Value < 60 then FrequencyValue.FrequencySummary := "Q24H";
ElseIf CrClEstd.Value < 30 then FrequencyValue.FrequencySummary := "Now";
Elseif CrClEstd.Value is null then
FrequencyValue.FrequencySummary := null;
endif;
Orderinfo.value := infomsg;
local_session.SessionVancoTroughDose := dose.value;
local_session.SessionVancoTroughUOM := doseuom.value;
endif; // if processtype = "A"
endif; // Adj_Weight is not null and Adj_Weight > 0
If DiluentBox.value = true then
DilType := "D"; //:= "N"; Original Setup [BB]
else
DilType := "N"; //:= "D"; Original setup [BB]
endif;
endif; //weightvalue >= 0 and (ProcessType = "L" or ProcessType = "A") and called_by in ("FormOpen", "FormClose", "FieldChange")
// Obtain correct diluent and WORx Code for Loading Dose and Type in dosing option
if (ProcessType = "M" or ProcessType = "L" or ProcessType = "A" or ProcessType is Null) and called_by in ("FormOpen", "FormClose", "FieldChange") then
If DiluentBox.value = true then
DilType := "D"; //:= "N"; Original Setup [BB]
else DilType := "N"; //:= "D"; Original setup [BB]
endif;
dosevalue := dose.value; doseuomvalue := doseUOM.value;
WorxCode.value :="02106";
//BaseSolution_field.value := Null;
manual_dose := dose.value; manual_uom := doseUOM.value;
man_map_list :=(
// Wgt Lower Limit | Wgt Upper Limit | dose | UOM | Worx Code | Diluent | Volume | UOM | (D)5W or (N)ss
"30|39.9|500|mg|08370|D5W 100ml .|100|mL|D",
"40|49.9|750|mg|00212|D5W 250ml .|250|mL|D",
"50|79.9|1|gm|08271P|D5W 250ml .|250|mL|D",
"80|94.9|1.25|gm|00214|D5W 250ml .|250|mL|D",
"95|99.9|1.5|gm|00216|D5W 500ml .|500|mL|D",
"100|104.9|1.75|gm|00478|D5W 500ml .|500|mL|D", //Added [BB]
"105|453.6|2|gm|00490|D5W 500ml .|500|mL|D", //Added [TMS]
"30|39.9|500|mg|08524|0.9% NaCl 100ml .|100|mL|N",
"40|49.9|750|mg|00213|0.9% NaCl 250ml .|250|mL|N",
"50|79.9|1|gm|08523|0.9% NaCl 250ml .|250|mL|N",
"80|94.9|1.25|gm|00215|0.9% NaCl 250ml .|250|mL|N",
"95|99.9|1.5|gm|00217|0.9% NaCl 500ml|500|mL|N",
"100|104.9|1.75|gm|00479|0.9% NaCl 500ml|500|mL|N", //Added [BB]
"105|453.6|2|gm|00491|0.9% NaCl 500ml|500|mL|N", //Added [TMS]
"50|79.9|1000|mg|08271P|D5W 250ml .|250|mL|D",
"80|94.9|1250|mg|00214|D5W 250ml .|250|mL|D",
"95|453.6|1500|mg|00216|D5W 500ml .|500|mL|D",
"50|79.9|1000|mg|08523|0.9% NaCl 250ml .|250|mL|N",
"80|94.9|1250|mg|00215|0.9% NaCl 250ml .|250|mL|N",
"95|453.6|1500|mg|00217|0.9% NaCl 500ml|500|mL|N",
"30|39.9|0.5|gm|08370|D5W 100ml .|100|mL|D",
"40|49.9|0.75|gm|00212|D5W 250ml .|250|mL|D",
"30|39.9|0.5|gm|08524|0.9% NaCl 100ml .|100|mL|N",
"40|49.9|0.75|gm|00213|0.9% NaCl 250ml .|250|mL|N",
"100|104.9|1750|mg|00479|0.9% NaCl 500ml|500|mL|N", //Added [TMS]
"105|453.6|2000|mg|00491|0.9% NaCl 500ml|500|mL|N", //Added [TMS]
"100|104.9|1750|mg|00478|D5W 500ml .|500|mL|D", //Added [TMS]
"105|453.6|2000|mg|00490|D5W 500ml .|500|mL|D" //Added [TMS]
);
for m in 1 seqto count man_map_list do
man_element_list := call str_parse with man_map_list[m], "|";
field1 := man_element_list[1];
field2 := man_element_list[2];
field3 := man_element_list[3];
field4 := man_element_list[4];
field5 := man_element_list[5];
field6 := man_element_list[6];
field7 := man_element_list[7];
field8 := man_element_list[8];
field9 := man_element_list[9];
field3conv := (field3 as number);
field5conv := (field5 as number);
field7conv := (field7 as number);
//
If manual_dose = (field3 as number) and manual_uom = field4 and diltype = field9 then
WorxCode.value := field5;
BaseSolution_value.name := field6;
BaseSolution_value.dose := field7conv;
BaseSolution_value.uom := field8;
endif;
enddo; /* for i in 1 seqto count man_map_list do */
If weightvalue <> 0 or ProcessType is null then
Override.control_read_only := false;
CalcDose.control_read_only := false;
endif;
endif; //if (ProcessType = "M" or ProcessType = "L" or ProcessType = "A" or ProcessType is Null)
If exists Prebuilt and called_by = "FormClose" and (WorxCode_value = "02106" or WorxCode_value = "02107") then
Prebuilt.value := false;
else
Prebuilt.value := true;
endif; //If exists Prebuilt
If called_by = "FormClose" and Troughmed_value = True then
AncCode := substring 5 characters starting at 1 from (worxcode.value As string);
WorxCode.value := AncCode ||"T";
If PRNReason.value is Null then
PRNReason.value := "Vancomycin Conditional Orders";
endif;
endif;
if ( called_by = "FieldChange" AND ProcessType = "M" ) then
local_session.SessionVancoTroughFrequency := Frequency;
endif;
;;
evoke:
;;
logic:
Conclude true;
;;
action:
// This MLM returns two parameters, of types
//communication_type and form_type respectively.
return this_communication, this_form;
;;
Urgency: 50;;
end: