Initial Checking with all 820 MLMs
This commit is contained in:
@@ -0,0 +1,990 @@
|
||||
maintenance:
|
||||
|
||||
title: FORM_SET_SKIN_ANTIBIOTICS_INPATIENT;;
|
||||
mlmname: FORM_SET_SKIN_ANTIBIOTICS_INPATIENT;;
|
||||
arden: version 2.5;;
|
||||
version: 15.10;;
|
||||
institution: St Clair Hospital;;
|
||||
author: Juliet M. Law, Allscripts ;;
|
||||
specialist: Peggy Leschak, Allscripts;;
|
||||
date: 2016-05-09;;
|
||||
validation: testing;;
|
||||
|
||||
library:
|
||||
purpose: Used for Pneumonia Antibiotics Outpatient order set
|
||||
;;
|
||||
|
||||
explanation: This MLM is called from Pneumonia Antibiotics Outpatient Order Set
|
||||
|
||||
Change history
|
||||
05.09.2016 JML CSR 34091: Created for Skin Antibiotic Inpatient Order Set
|
||||
02.13.2018 JML CSR 36163: Replaced Cefepime & Ceftriaxone with mini-syringe due to drug shortage
|
||||
03.09.2018 TMS CSR 34822: Update Zosyn selections to use extended infusion logic
|
||||
|
||||
;;
|
||||
keywords: Called MLMs, Antibiotic Skin, Inpatient, Weight Based Dosing
|
||||
;;
|
||||
knowledge:
|
||||
type: data-driven;;
|
||||
data:
|
||||
|
||||
standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
|
||||
include standard_libs;
|
||||
|
||||
using "ObjectsPlusXA.SCM.Forms";
|
||||
using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms";
|
||||
DiscontinueOrder := MLM {{{SINGLE-QUOTE}}}SCH_FUNC_DISCONTINUE_BY_ORDERGUID{{{SINGLE-QUOTE}}};
|
||||
|
||||
// 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;
|
||||
|
||||
ClientGuid := this_communication.ClientGUID;
|
||||
ChartGuid := this_communication.ChartGUID;
|
||||
ClientVisitGuid := this_communication.ClientVisitGUID;
|
||||
PrimaryObjdetail:=this_communication.PrimaryObj;
|
||||
OrderSetName := PrimaryObjdetail.OrderSetName;
|
||||
|
||||
/*******************Make Changes To Spelling And Flags In This Section*******************/
|
||||
|
||||
/* Set to True if a decision.log is needed.*/
|
||||
log_execution_info := False;
|
||||
|
||||
/***************************************************************************************/
|
||||
|
||||
// Initialize error message
|
||||
error_message:="";
|
||||
|
||||
enable_chkbx_mlm := mlm {{{SINGLE-QUOTE}}}FORM_Func_Disable_OS_Checkboxes{{{SINGLE-QUOTE}}};
|
||||
calc_abw_mlm := mlm {{{SINGLE-QUOTE}}}FORM_FUNC_CALC_ADJUSTED_BODY_WEIGHT{{{SINGLE-QUOTE}}};
|
||||
crcl_mlm := mlm {{{SINGLE-QUOTE}}}FORM_MLM_Creatinine_Clearance_OS{{{SINGLE-QUOTE}}};
|
||||
antibiotic_guideline_mlm := mlm {{{SINGLE-QUOTE}}}FORM_FUNC_DISPLAY_ANTIBIOTIC_GUIDELINES{{{SINGLE-QUOTE}}};
|
||||
|
||||
//Bring in Session variables
|
||||
local_session := cds_session.local;
|
||||
|
||||
exceptFld := ();
|
||||
vanco_logic_run := false;
|
||||
cefazolin_logic_run := false;
|
||||
clindamycin_logic_run := false;
|
||||
|
||||
// Assigns fields passed in the Form object to the Field object
|
||||
field_list:= this_form.fields;
|
||||
CallingEvent := this_communication.CallingEvent;
|
||||
CallingField := this_communication.CallingFieldName;
|
||||
|
||||
//Define fields
|
||||
Cefazolin_Chk := first of ( field_list WHERE field_list.DataItemName = "PRX_Checkbox1" AND field_list.Control_MultiFieldOccNum = 3 );
|
||||
Clindamycin_Chk := first of ( field_list WHERE field_list.DataItemName = "PRX_Checkbox1" AND field_list.Control_MultiFieldOccNum = 5 );
|
||||
Zosyn_Chk := first of ( field_list WHERE field_list.DataItemname = "PRX_Checkbox1" AND field_list.Control_MultiFieldOccNum = 15 );
|
||||
Cefepime_Flagyl_Chk := first of ( field_list WHERE field_list.DataItemName = "PRX_Checkbox1" AND field_list.Control_MultiFieldOccNum = 16 );
|
||||
Vanco_Chk := first of ( field_list WHERE field_list.DataItemName = "PRX_Checkbox1" AND field_list.Control_MultiFieldOccNum = 4 );
|
||||
Vanco2_Chk := first of ( field_list WHERE field_list.DataItemName = "PRX_Checkbox1" AND field_list.Control_MultiFieldOccNum = 20 );
|
||||
Vanco3_Chk := first of ( field_list WHERE field_list.DataItemName = "PRX_Checkbox1" AND field_list.Control_MultiFieldOccNum = 19 );
|
||||
|
||||
CrCl_MgDl := first of ( field_list WHERE field_list.DataItemName = "PRX_CrCl_mg_dl" AND field_list.Control_MultiFieldOccNum = 1 );
|
||||
CrCl_Estd := first of (field_list where field_list.DataItemName = "PRX_CrCl_Estimated" and field_List.Control_MultiFieldOccNum = 1);
|
||||
CrCl_Calc := first of ( field_list WHERE field_list.DataItemName = "PRX_Generic_CB" AND field_list.Control_MultiFieldOccNum = 1 );
|
||||
|
||||
ABW_Val := first of (field_list WHERE field_list.DataItemName = "PRX_ADJBodyWeight" AND field_list.Control_MultiFieldOccNum = 1 );
|
||||
Override_ABX_Sched := first of ( field_list WHERE field_list.DataItemName = "PRX_Override_Abx_Scheduling" AND field_list.Control_MultiFieldOccNum = 1 );
|
||||
Fire_Trough_MLM := first of ( field_list WHERE field_list.DataItemName = "MLM Generic Checkbox" AND field_list.Control_MultiFieldOccNum = 1 );
|
||||
|
||||
Antibiotic_Grid := first of ( field_list WHERE field_list.DataItemName = "MultiOrderGrid" AND field_list.Control_MultiFieldOccNum = 1 );
|
||||
Antibiotic_Grid_Value := Antibiotic_Grid.Value;
|
||||
Vancomycin_Grid := first of ( field_list WHERE field_list.DataItemName = "MultiOrderGrid" AND field_list.Control_MultiFieldOccNum = 2 );
|
||||
Vancomycin_Grid_Value := Vancomycin_Grid.Value;
|
||||
|
||||
Cefazolin_Dose := first of ( field_list WHERE field_list.DataItemName = "DosageLow" AND field_list.Control_MultiFieldOccNum = 1 );
|
||||
Cefazolin_Code := first of ( field_list WHERE field_list.DataItemName = "PRX_DrugIDCode" AND field_list.Control_MultiFieldOccnum = 1 );
|
||||
Cefazolin_SCIP := first of ( field_list WHERE field_list.DataItemname = "PRX_AntibioticNameforMLM" AND field_list.Control_MultiFieldOccNum = 1 );
|
||||
Clindamycin_Dose := first of ( field_list WHERE field_list.DataItemName = "DosageLow" AND field_list.Control_MultiFieldOccNum = 2 );
|
||||
Clindamycin_Freq := first of ( field_list WHERE field_list.DataItemName = "FrequencyCode" AND field_list.Control_MultiFieldOccNum = 2 );
|
||||
Clindamycin_Freq_Val := Clindamycin_Freq.Value;
|
||||
Vancomycin_Freq := first of ( field_list WHERE field_list.DataItemName = "FrequencyCode" AND field_list.Control_MultiFieldOccNum = 1 );
|
||||
Vancomycin_Freq_Val := Vancomycin_Freq.Value;
|
||||
|
||||
|
||||
Cefazolin := first of ( Antibiotic_Grid_Value WHERE Antibiotic_Grid_Value.Name = "Cefazolin:" );
|
||||
Clindamycin := first of ( Antibiotic_Grid_Value WHERE Antibiotic_Grid_Value.Name = "Clindamycin:" );
|
||||
Zosyn_Low := first of ( Antibiotic_Grid_Value WHERE Antibiotic_Grid_Value.Name = "Piperacillin/Tazobactam:" );
|
||||
Zosyn := last of ( Antibiotic_Grid_Value WHERE Antibiotic_Grid_Value.Name = "Piperacillin/Tazobactam:" );
|
||||
Cefepime := first of ( Antibiotic_Grid_Value WHERE Antibiotic_Grid_Value.Name = "Cefepime:" OR Antibiotic_Grid_Value.Name = "Cefepime Mini-Syringe" );
|
||||
Flagyl := first of ( Antibiotic_Grid_Value WHERE Antibiotic_Grid_Value.Name = "Metronidazole:" );
|
||||
Vancomycin_Load := first of ( Vancomycin_Grid_Value WHERE Vancomycin_Grid_Value.Name = "Vancomycin:" );
|
||||
Vancomycin := last of ( Vancomycin_Grid_Value WHERE Vancomycin_Grid_Value.Name = "Vancomycin:" );
|
||||
Vancomycin_Trough := first of ( Vancomycin_Grid_Value WHERE Vancomycin_Grid_Value.Name = "Vancomycin Trough Plasma/Serum" );
|
||||
Vancomycin_Nursing_Instr := first of ( Vancomycin_Grid_Value WHERE Vancomycin_Grid_Value.Name = "Nurse Instruction:" );
|
||||
|
||||
MRSA := first of ( field_list WHERE field_list.DataItemName = "PRX_MRSA" AND field_list.Control_MultiFieldOccNum = 1 );
|
||||
Load_ReqDate := last of ( field_list WHERE field_list.DataItemName = "RequestedDate"
|
||||
and field_list.Control_MultiFieldOccNum = 1);
|
||||
Load_ReqTime := last of ( field_list WHERE field_list.DataItemName = "RequestedTime"
|
||||
and field_list.Control_MultiFieldOccNum = 1);
|
||||
Load_ReqDate_Val := Load_ReqDate.Value;
|
||||
Load_ReqTime_Val := Load_ReqTime.Value;
|
||||
Zosyn_Freq := last of ( field_list WHERE field_list.DataItemName = "FrequencyCode"
|
||||
and field_list.Control_MultiFieldOccNum = 3);
|
||||
FreqValue := Zosyn_Freq.Value;
|
||||
|
||||
Zosyn_Freq_Dictionary := last of ( field_list WHERE field_list.DataItemName = "PRX_Zosyn_Ext_Inf_Freq"
|
||||
and field_list.Control_MultiFieldOccNum = 1);
|
||||
Maint_ReqDate := last of ( field_list WHERE field_list.DataItemName = "RequestedDate"
|
||||
and field_list.Control_MultiFieldOccNum = 2);
|
||||
Maint_ReqTime := last of ( field_list WHERE field_list.DataItemName = "RequestedTime"
|
||||
and field_list.Control_MultiFieldOccNum = 2);
|
||||
Maint_ReqDate_Val := Maint_ReqDate.Value;
|
||||
Maint_ReqTime_Val := Maint_ReqTime.Value;
|
||||
Override:= last of ( field_list WHERE field_list.DataItemName = "PRX_Generic_CB"
|
||||
and field_list.Control_MultiFieldOccNum = 2);
|
||||
NoLoad := false;
|
||||
ZosynMsg := last of ( field_list WHERE field_list.DataItemName = "NUR_GenAdditiionalLabel"
|
||||
and field_list.Control_MultiFieldOccNum = 9);
|
||||
ZOSYNGuid := read last { "select guid from cv3ordercatalogmasteritem where Name = {{{SINGLE-QUOTE}}}Piperacillin/Tazobactam:{{{SINGLE-QUOTE}}}" };
|
||||
StdZOSYNGuid := read last { "select guid from cv3ordercatalogmasteritem where Name = {{{SINGLE-QUOTE}}}Piperacillin/Tazobactam;{{{SINGLE-QUOTE}}}" };
|
||||
CRRTGuid := read last { "select guid from cv3ordercatalogmasteritem where Name = {{{SINGLE-QUOTE}}}Renal Replacement Treatment Type{{{SINGLE-QUOTE}}}"};
|
||||
|
||||
CRRT := read last
|
||||
{" select summaryline from cv3order where name = {{{SINGLE-QUOTE}}}Renal Replacement Treatment Type{{{SINGLE-QUOTE}}}
|
||||
and ClientGUID = " || SQL(clientguid) || " and ClientVisitGUID = " || SQL(clientvisitguid) || "
|
||||
and orderstatuscode = {{{SINGLE-QUOTE}}}AUA1{{{SINGLE-QUOTE}}} "};
|
||||
|
||||
If override.value = true then
|
||||
Zosyn_Freq_Dictionary.Control_Read_Only := false;
|
||||
else
|
||||
Zosyn_Freq_Dictionary.Control_Read_Only := true;
|
||||
endif;
|
||||
|
||||
// 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;
|
||||
ht := comb_ht_wt_val.height;
|
||||
weightvalue := (wt as number);
|
||||
endif;
|
||||
|
||||
// Get patient age
|
||||
(birthDate) := read last {ClientInfo: BirthDate REFERENCING client_info_obj};
|
||||
|
||||
patientAge := (NOW - birthDate) / (1 year);
|
||||
|
||||
If patientage < 11.99 and CallingEvent = "FormOpen" 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}}};
|
||||
endif;
|
||||
|
||||
if ( CallingEvent = "FormOpen" ) then
|
||||
//Retrieve CrCl values
|
||||
(this_communication, this_form) := call crcl_mlm WITH this_communication, this_form, client_info_obj;
|
||||
|
||||
( this_communication, this_form ) := call antibiotic_guideline_mlm WITH this_communication, this_form, client_info_obj;
|
||||
|
||||
for item IN Antibiotic_Grid_Value do
|
||||
//if ( item.Name NOT IN ("Piperacillin/Tazobactam:") ) then
|
||||
item.IsReadonly := true;
|
||||
// endif;
|
||||
enddo;
|
||||
|
||||
//Check for MRSA flag
|
||||
MRSA_result := READ LAST { "SELECT CASE WHEN ecd.EnterpriseClientCol8 = {{{SINGLE-QUOTE}}}MRSA{{{SINGLE-QUOTE}}} THEN {{{SINGLE-QUOTE}}}MRSA{{{SINGLE-QUOTE}}}"
|
||||
|| " WHEN ecd.EnterpriseClientCol8 = {{{SINGLE-QUOTE}}}VRE{{{SINGLE-QUOTE}}} THEN {{{SINGLE-QUOTE}}}VRE{{{SINGLE-QUOTE}}}"
|
||||
|| " WHEN ecd.EnterpriseClientCol8 = {{{SINGLE-QUOTE}}}BOTH{{{SINGLE-QUOTE}}} THEN {{{SINGLE-QUOTE}}}BOTH{{{SINGLE-QUOTE}}}"
|
||||
|| " ELSE {{{SINGLE-QUOTE}}}NO FLAG{{{SINGLE-QUOTE}}}"
|
||||
|| " END"
|
||||
|| " FROM CV3EnterpriseClientData ecd WITH (NOLOCK)"
|
||||
|| " WHERE ecd.ClientGUID = " || SQL(ClientGuid) };
|
||||
|
||||
if ( MRSA_result is null ) then
|
||||
MRSA.Value := "NO FLAG";
|
||||
else
|
||||
MRSA.Value := ( MRSA_Result as String );
|
||||
endif;
|
||||
|
||||
If OrderSetName = "Skin Antibiotic Inpatient ED" then
|
||||
Zosyn_Freq_Dictionary.control_visible := FALSE;
|
||||
Override.control_visible := FALSE;
|
||||
ZosynMsg.control_visible := FALSE;
|
||||
endif;
|
||||
endif;
|
||||
|
||||
if ( CallingEvent = "FieldChange" ) then
|
||||
|
||||
|
||||
//********* Height / Weight Measurements *******
|
||||
if ( CallingField = "CombinedMeasurements|1" ) then
|
||||
if ( Vanco_Chk.Value = true OR Vanco2_Chk.Value = true ) then
|
||||
vanco_logic_run := true;
|
||||
endif;
|
||||
|
||||
if ( Cefazolin_Chk.Value = true ) then
|
||||
cefazolin_logic_run := true;
|
||||
endif;
|
||||
|
||||
if ( Clindamycin_Chk.Value = true ) then
|
||||
clindamycin_logic_run := true;
|
||||
endif;
|
||||
endif;
|
||||
|
||||
//********* Creatinine Calculate ********
|
||||
if ( CallingField = "PRX_CrCl_mg_dl|1" OR CallingField = "PRX_Generic_CB|1" ) then
|
||||
( this_communication, this_form) := call crcl_mlm WITH this_communication, this_form, client_info_obj;
|
||||
CrCl_Calc.Value := false;
|
||||
|
||||
if ( Vanco_Chk.Value = true OR Vanco2_Chk.Value = true OR Vanco3_Chk.Value = true ) then
|
||||
vanco_logic_run := true;
|
||||
endif;
|
||||
endif;
|
||||
|
||||
//********* CEFAZOLIN *********************
|
||||
if ( CallingField = "PRX_Checkbox1|3" ) then
|
||||
|
||||
fieldValue := Cefazolin_Chk.Value;
|
||||
|
||||
if ( fieldValue = true ) then
|
||||
Cefazolin_SCIP.Value := "Cefazolin";
|
||||
|
||||
Cefazolin.IsSelected := true;
|
||||
cefazolin_logic_run := true;
|
||||
|
||||
rtnValue := call enable_chkbx_mlm WITH this_communication, this_form, client_info_obj, CallingField, true, "";
|
||||
elseif ( fieldValue = false ) then
|
||||
cefazolin_logic_run := false;
|
||||
Cefazolin.IsSelected := false;
|
||||
|
||||
rtnValue := call enable_chkbx_mlm WITH this_communication, this_form, client_info_obj, CallingField, false, "";
|
||||
endif;
|
||||
endif;
|
||||
|
||||
//********** CLINDAMYCIN ********************
|
||||
if ( CallingField = "PRX_Checkbox1|5" ) then
|
||||
|
||||
fieldValue := Clindamycin_Chk.Value;
|
||||
|
||||
if ( fieldValue = true ) then
|
||||
Clindamycin.IsSelected := true;
|
||||
|
||||
clindamycin_logic_run := true;
|
||||
|
||||
rtnValue := call enable_chkbx_mlm WITH this_communication, this_form, client_info_obj, CallingField, true, "";
|
||||
elseif ( fieldValue = false ) then
|
||||
clindamycin_logic_run := false;
|
||||
Clindamycin.IsSelected := false;
|
||||
|
||||
rtnValue := call enable_chkbx_mlm WITH this_communication, this_form, client_info_obj, CallingField, false, "";
|
||||
endif;
|
||||
endif;
|
||||
|
||||
//************* ZOSYN ********************
|
||||
if ( OrderSetName = "Skin Antibiotic Inpatient ED" and CallingField = "PRX_Checkbox1|15" ) then
|
||||
fieldValue := Zosyn_Chk.Value;
|
||||
|
||||
if ( fieldValue = true ) then
|
||||
Zosyn.IsSelected := true;
|
||||
|
||||
exceptFld := exceptFld, Vanco2_Chk.DataItemName || "|" || Vanco2_Chk.Control_MultiFieldOccNum;
|
||||
rtnValue := call enable_chkbx_mlm WITH this_communication, this_form, client_info_obj, CallingField, true, exceptFld;
|
||||
elseif ( fieldValue = false ) then
|
||||
Zosyn.IsSelected := false;
|
||||
Zosyn_Low.IsSelected := false;
|
||||
|
||||
rtnValue := call enable_chkbx_mlm WITH this_communication, this_form, client_info_obj, CallingField, false, "";
|
||||
endif;
|
||||
endif;
|
||||
|
||||
//*********** ZOSYN EXTENDED INFUSION***************************
|
||||
if ( CallingField = "PRX_Zosyn_Ext_Inf_Freq|1" ) then
|
||||
override.value := true;
|
||||
|
||||
if Zosyn_Freq_Dictionary.value = "Q12H" then
|
||||
FreqValue.FrequencySummary := "Q12H";
|
||||
elseif Zosyn_Freq_Dictionary.value = "Q8H" then
|
||||
FreqValue.FrequencySummary := "Q8H";
|
||||
endif;
|
||||
endif;
|
||||
|
||||
if (OrderSetName = "Skin Antibiotic Inpatient" and ( ( CallingField = "PRX_Checkbox1|15")
|
||||
or ( CallingField = "PRX_Zosyn_Ext_Inf_Freq|1" and Zosyn_Chk.Value = true)
|
||||
or (CallingField = "PRX_Generic_CB|1" and Zosyn_Chk.Value = true)
|
||||
or (CallingField = "PRX_Generic_CB|2" and Zosyn_Chk.Value = true)) ) then
|
||||
|
||||
fieldValue := Zosyn_Chk.Value;
|
||||
|
||||
if ( fieldValue = true ) then
|
||||
|
||||
exceptFld := exceptFld, Vanco2_Chk.DataItemName || "|" || Vanco2_Chk.Control_MultiFieldOccNum;
|
||||
rtnValue := call enable_chkbx_mlm WITH this_communication, this_form, client_info_obj, CallingField, true, exceptFld;
|
||||
|
||||
// **** Zosyn extended infusion ******
|
||||
//Retrieve possible load orders
|
||||
LoadOrderDose, LoadOrderGuid, LoadSigDtm, LoadStopDtm, LoadOrderStatus:= read
|
||||
{ " select me.dosagelow, o.guid, o.SignificantDtm, o.stopdtm, o.orderstatuscode from cv3order o
|
||||
join cv3clientvisit cv on cv.guid = o.ClientVisitGUID and cv.ClientGUID = o.ClientGUID
|
||||
join CV3MedicationExtension me on me.guid = o.guid
|
||||
where o.ClientVisitGUID = " || SQL(clientvisitguid) || " and o.ClientGuid = " || SQL(clientguid) || "
|
||||
and o.TypeCode = {{{SINGLE-QUOTE}}}Medication{{{SINGLE-QUOTE}}}
|
||||
and o.orderstatuscode in ({{{SINGLE-QUOTE}}}COMP{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}AUA1{{{SINGLE-QUOTE}}})
|
||||
and (me.dosagelow = {{{SINGLE-QUOTE}}}4.5{{{SINGLE-QUOTE}}} or me.dosagelow = {{{SINGLE-QUOTE}}}3.375{{{SINGLE-QUOTE}}})
|
||||
and ( (o.OrderCatalogMasterItemGUID = " || zosynguid || " and o.frequencycode in
|
||||
({{{SINGLE-QUOTE}}}Now{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}STAT{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Once{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}PRE OP{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}POST OP{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Pre-Procedure{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Post-Procedure{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Today{{{SINGLE-QUOTE}}}))
|
||||
or
|
||||
(o.OrderCatalogMasterItemGUID = " || stdzosynguid || " and o.frequencycode in
|
||||
({{{SINGLE-QUOTE}}}Now{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}STAT{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Once{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}PRE OP{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}POST OP{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Pre-Procedure{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Post-Procedure{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Today{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Q6H{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Q8H{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Q12H{{{SINGLE-QUOTE}}})) )
|
||||
order by o.orderstatuscode, o.SignificantDtm asc"};
|
||||
|
||||
//Retrieve possible maintenance orders
|
||||
MaintOrderDose, MaintOrderGuid := read
|
||||
{ " select me.dosagelow, o.guid from cv3order o
|
||||
join CV3MedicationExtension me on me.guid = o.guid
|
||||
where ClientVisitGUID = " || SQL(clientvisitguid) || " and o.ClientGuid = " || SQL(clientguid) || "
|
||||
and o.TypeCode = {{{SINGLE-QUOTE}}}Medication{{{SINGLE-QUOTE}}} and o.OrderCatalogMasterItemGUID = " || ZosynGuid || "
|
||||
and o.frequencycode not in ({{{SINGLE-QUOTE}}}Now{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}STAT{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Once{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}PRE OP{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}POST OP{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Pre-Procedure{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Post-Procedure{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Today{{{SINGLE-QUOTE}}})
|
||||
and o.orderstatuscode in ({{{SINGLE-QUOTE}}}AUA1{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}DISC{{{SINGLE-QUOTE}}})
|
||||
order by o.CreatedWhen asc"};
|
||||
|
||||
numorders := count LoadOrderDose;
|
||||
LoadOrderList := 1 seqto numorders;
|
||||
NumberMaintOrders := count MaintOrderDose;
|
||||
MaintOrderList := 1 seqto NumberMaintOrders;
|
||||
|
||||
if NumberMaintOrders = 1 then
|
||||
MaintOrderGuid := MaintOrderGuid [1];
|
||||
endif;
|
||||
|
||||
// Check task status of maintenance orders
|
||||
if NumberMaintOrders > 0 then
|
||||
|
||||
(MaintOrderLastGiven, MaintOrderHoursSinceGiven, MaintNextScheduled, MaintTaskStatus) := read
|
||||
{" select oto.performedfromdtm, DATEDIFF (HH, oto.performedfromdtm, getdate()),
|
||||
DATEDIFF (HH, oto.ScheduledDtm, getdate()), oto.TaskStatusCode
|
||||
from cv3ordercatalogmasteritem ocmi with (nolock)
|
||||
join cv3order o with (nolock)on o.ordercatalogmasteritemguid = ocmi.guid
|
||||
and o.ClientGUID = " || SQL(clientguid) || " and ClientVisitGuid = " || SQL(clientvisitguid) || "
|
||||
and o.TypeCode = {{{SINGLE-QUOTE}}}Medication{{{SINGLE-QUOTE}}} and ocmi.guid = " || ZosynGuid || "
|
||||
join cv3ordertask ot with (nolock) on ot.clientguid = o.clientguid and ot.orderguid = o.guid
|
||||
join cv3ordertaskoccurrence as oto with (nolock) on oto.clientguid = ot.clientguid and oto.orderguid = ot.orderguid
|
||||
and oto.ordertaskguid = ot.guid
|
||||
and o.guid in (" ||MaintOrderGuid || ")
|
||||
and oto.ScheduledDtm > DATEadd (HH, -14, getdate())
|
||||
and oto.TaskStatusCode <> {{{SINGLE-QUOTE}}}Canceled{{{SINGLE-QUOTE}}}
|
||||
order by oto.taskstatuscode, oto.performedfromdtm, oto.ScheduledDtm desc" };
|
||||
endif;
|
||||
|
||||
for i in 1 seqto (count MaintTaskStatus)do
|
||||
if MaintTaskStatus [i] = "Overdue" then
|
||||
Overduetime := MaintNextScheduled [i];
|
||||
elseif MaintTaskStatus [i] = "Pending" then
|
||||
Nextduetime := MaintNextScheduled [i];
|
||||
elseif MaintTaskStatus [i] = "Performed" then
|
||||
HoursSinceGiven := MaintOrderHoursSinceGiven [i];
|
||||
LastGivenTime := MaintOrderlastGiven [i];
|
||||
endif;
|
||||
enddo;
|
||||
|
||||
|
||||
if numorders = 1 then
|
||||
LoadOrderGuid := LoadOrderGuid [1];
|
||||
endif;
|
||||
|
||||
// Check task status of load orders
|
||||
if numorders > 0 then
|
||||
|
||||
(LoadOrderLastGiven, LoadOrderHoursSinceGiven,
|
||||
ExistingSchedule, LoadTaskStatus, LoadFrequency) := read last
|
||||
{
|
||||
" select top 1 oto.performedfromdtm, DATEDIFF (HH, oto.performedfromdtm, getdate()),
|
||||
oto.ScheduledDtm, oto.TaskStatusCode,o.FrequencyCode
|
||||
from cv3ordercatalogmasteritem ocmi
|
||||
join cv3order o with (nolock)on o.ordercatalogmasteritemguid = ocmi.guid
|
||||
and o.ClientGUID = " || SQL(clientguid) || " and o.clientvisitguid = " || SQL(clientvisitguid) || "
|
||||
join cv3ordertask ot with (nolock) on ot.clientguid = o.clientguid and ot.orderguid = o.guid
|
||||
join cv3ordertaskoccurrence as oto with (nolock) on oto.clientguid = ot.clientguid and oto.orderguid = ot.orderguid
|
||||
where o.TypeCode = {{{SINGLE-QUOTE}}}Medication{{{SINGLE-QUOTE}}} and (ocmi.guid = " ||ZosynGuid || " or ocmi.guid = " || StdZosynGuid || ")
|
||||
and oto.ordertaskguid = ot.guid
|
||||
and o.guid in (" || LoadOrderGuid || ")
|
||||
and oto.SignificantDtm > DATEadd (HH, -8, getdate())
|
||||
and oto.TaskStatusCode = {{{SINGLE-QUOTE}}}Performed{{{SINGLE-QUOTE}}}
|
||||
order by oto.performedfromdtm desc"
|
||||
};
|
||||
|
||||
(LoadOrderHoursSinceScheduled, ExistingSchedule, LoadTaskStatus, LoadGuid) := read last
|
||||
{
|
||||
" select top 1 DATEDIFF (HH, oto.ScheduledDtm, getdate()) Timespan, oto.ScheduledDtm, oto.TaskStatusCode, o.guid
|
||||
from cv3ordercatalogmasteritem ocmi with (nolock)
|
||||
join cv3order o with (nolock)on o.ordercatalogmasteritemguid = ocmi.guid
|
||||
and o.ClientGUID = " || SQL(clientguid) || " and o.ClientVisitGUID = " || SQL(clientvisitguid) || "
|
||||
join cv3ordertask ot with (nolock) on ot.clientguid = o.clientguid and ot.orderguid = o.guid
|
||||
join cv3ordertaskoccurrence as oto with (nolock) on oto.clientguid = ot.clientguid and oto.orderguid = ot.orderguid
|
||||
where o.TypeCode = {{{SINGLE-QUOTE}}}Medication{{{SINGLE-QUOTE}}} and ocmi.guid = " || ZosynGuid || "
|
||||
and oto.ordertaskguid = ot.guid
|
||||
and o.guid in (" ||LoadOrderGuid || ")
|
||||
and oto.SignificantDtm > DATEadd (HH, -12, getdate()) and oto.SignificantDtm < DATEadd (HH, 1, getdate())
|
||||
and oto.TaskStatusCode in ({{{SINGLE-QUOTE}}}Pending{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Overdue{{{SINGLE-QUOTE}}})
|
||||
order by oto.ScheduledDtm desc"
|
||||
};
|
||||
|
||||
endif;
|
||||
|
||||
if LoadOrderLastGiven is not null then
|
||||
Zosyn.IsSelected := False;
|
||||
Zosyn_Low.IsSelected := True;
|
||||
|
||||
// Determine if patient needs loaded or reloaded
|
||||
if (LoadOrderHoursSinceGiven >= 6 and (CrCl_Estd.value is null or CrCl_Estd.value >=20) and override.value = false)
|
||||
or (LoadOrderHoursSinceGiven >= 8 and CrCl_Estd.value < 20 and override.value = false)
|
||||
or (LoadOrderHoursSinceGiven >= 6 and Override.value = true and Zosyn_Freq_Dictionary.value = "Q8H" )
|
||||
or (LoadOrderHoursSinceGiven >= 8 and Override.value = true and Zosyn_Freq_Dictionary.value = "Q12H" ) then
|
||||
StartDTM := now ;
|
||||
StartMin := extract minute now;
|
||||
Zosyn.IsSelected := True;
|
||||
|
||||
If (StartMin as number) >= 45 then
|
||||
LoadDoseDTM := StartDTM + 2 hour;
|
||||
else LoadDoseDTM := StartDTM + 1 hour;
|
||||
endif;
|
||||
|
||||
else
|
||||
|
||||
startdtm := LoadOrderLastGiven ;
|
||||
startmin := extract minute LoadOrderLastGiven;
|
||||
If (StartMin as number) >= 45 then
|
||||
LoadDoseDTM := StartDTM + 1 hour;
|
||||
Else LoadDoseDTM := StartDTM ;
|
||||
Endif;
|
||||
|
||||
endif;
|
||||
|
||||
|
||||
elseif ExistingSchedule is not null then
|
||||
// If load not given but ordered within past 2 hours then don{{{SINGLE-QUOTE}}}t reorder
|
||||
// If greater than 2 hours and not given discontinue and reorder
|
||||
If LoadOrderHoursSinceScheduled < 2 then
|
||||
Zosyn.IsSelected := False;
|
||||
Zosyn_Low.IsSelected := True;
|
||||
StartDTM := ExistingSchedule;
|
||||
StartMin := extract minute ExistingSchedule;
|
||||
|
||||
If (StartMin as number) >= 45 then
|
||||
LoadDoseDTM := StartDTM + 1 hour;
|
||||
else LoadDoseDTM := StartDTM;
|
||||
endif;
|
||||
|
||||
else
|
||||
MLMMessage := "This is where we discontinue old order";
|
||||
Reason := "Change Administration Times";
|
||||
Source := "CPOE Clarification";
|
||||
|
||||
dc_call := call DiscontinueOrder with
|
||||
LoadOrderGuid,
|
||||
this_communication.CareProviderGUID,
|
||||
ClientVisitGUID,
|
||||
Reason,
|
||||
Source;
|
||||
|
||||
StartDTM := now ;
|
||||
StartMin := extract minute now;
|
||||
Zosyn.IsSelected := True;
|
||||
Zosyn_Low.IsSelected := True;
|
||||
|
||||
If (StartMin as number) >= 45 then
|
||||
LoadDoseDTM := StartDTM + 2 hour;
|
||||
else LoadDoseDTM := StartDTM + 1 hour;
|
||||
endif;
|
||||
endif;
|
||||
|
||||
elseif
|
||||
// If patient has loading dose or is transitioning from standard therapy scheduled maint dose
|
||||
((HoursSinceGiven as number) > 9 and override.value = false and (CrCl_Estd.value >= 20 or CrCl_Estd.value is null)) or
|
||||
((HoursSinceGiven as number) > 13 and override.value = false and CrCl_Estd.value < 20) or
|
||||
// ((Overduetime as number) >= 2 and HoursSinceGiven is null) or
|
||||
((HoursSinceGiven as number) > 9 and Override.value = true and Zosyn_Freq_Dictionary.value = "Q8H" ) or
|
||||
((HoursSinceGiven as number) > 13 and Override.value = true and Zosyn_Freq_Dictionary.value = "Q12H" ) then
|
||||
|
||||
Zosyn.IsSelected := True;
|
||||
Zosyn_Low.IsSelected := True;
|
||||
NoLoad := False;
|
||||
FmtLoadDate := null;
|
||||
FmtLoadTime := null;
|
||||
StartDTM := now ;
|
||||
StartMin := extract minute now;
|
||||
|
||||
If (StartMin as number) >= 45 then
|
||||
LoadDoseDTM := StartDTM + 2 hour;
|
||||
else LoadDoseDTM := StartDTM + 1 hour;
|
||||
endif;
|
||||
|
||||
elseif
|
||||
// If patient needs reloaded order load and schedule maint dose
|
||||
((HoursSinceGiven as number) <= 9 and override.value = false and (CrCl_Estd.value >= 20 or CrCl_Estd.value is null)) or
|
||||
((HoursSinceGiven as number) <= 13 and override.value = false and CrCl_Estd.value < 20) or
|
||||
// ((Overduetime as number) < 2 ) or
|
||||
((HoursSinceGiven as number) <= 9 and override.value = true and Zosyn_Freq_Dictionary.value = "Q8H") or
|
||||
((HoursSinceGiven as number) <= 13 and override.value = true and Zosyn_Freq_Dictionary.value = "Q12H") then
|
||||
|
||||
Zosyn.IsSelected := False;
|
||||
NoLoad := True;
|
||||
Zosyn_Low.IsSelected := True;
|
||||
Override_ABX_Sched.value := False;
|
||||
StartDTM := LastGivenTime ;
|
||||
StartMin := extract minute LastGivenTime;
|
||||
|
||||
If (StartMin as number) >= 45 then
|
||||
MaintDoseDTM := StartDTM + 1 hour;
|
||||
else MaintDoseDTM := StartDTM ;
|
||||
endif;
|
||||
|
||||
else
|
||||
// No prior zosyn orders schedule load and maint dose
|
||||
Zosyn.IsSelected := True;
|
||||
Zosyn_Low.IsSelected := True;
|
||||
StartDTM := now ;
|
||||
StartMin := extract minute now;
|
||||
|
||||
If (StartMin as number) >= 45 then
|
||||
LoadDoseDTM := StartDTM + 2 hour;
|
||||
else LoadDoseDTM := StartDTM + 1 hour;
|
||||
endif;
|
||||
endif;
|
||||
|
||||
// format all date and times
|
||||
MaintDose6HR := LoadDoseDTM + 6 hour;
|
||||
MaintDose8HR := LoadDoseDTM + 8 hour;
|
||||
MaintDoseQ8HR := MaintDoseDTM + 8 hour;
|
||||
MaintDoseQ12HR := MaintDoseDTM + 12 hour;
|
||||
|
||||
loadhour := extract hour LoadDoseDTM;
|
||||
loadmon := extract month LoadDoseDTM;
|
||||
loadday := extract day LoadDoseDTM;
|
||||
loadyear := extract year LoadDoseDTM;
|
||||
|
||||
due6hour := extract hour MaintDose6HR;
|
||||
due6mon := extract month MaintDose6HR;
|
||||
due6day := extract day MaintDose6HR;
|
||||
due6year := extract year MaintDose6HR;
|
||||
|
||||
due8hour := extract hour MaintDose8HR;
|
||||
due8mon := extract month MaintDose8HR;
|
||||
due8day := extract day MaintDose8HR;
|
||||
due8year := extract year MaintDose8HR;
|
||||
|
||||
maint8hour := extract hour MaintDoseQ8HR;
|
||||
maint8mon := extract month MaintDoseQ8HR;
|
||||
maint8day := extract day MaintDoseQ8HR;
|
||||
maint8year := extract year MaintDoseQ8HR;
|
||||
|
||||
maint12hour := extract hour MaintDoseQ12HR;
|
||||
maint12mon := extract month MaintDoseQ12HR;
|
||||
maint12day := extract day MaintDoseQ12HR;
|
||||
maint12year := extract year MaintDoseQ12HR;
|
||||
|
||||
FmtLoadTime := loadhour formatted with "%2.2d" || ":00";
|
||||
FmtLoadDate := loadmon formatted with "%2.2d"||"-" ||loadday formatted with "%2.2d" ||"-" ||loadyear ;
|
||||
Fmt6HRTime := due6hour formatted with "%2.2d" || ":00";
|
||||
Fmt6HRDate := due6mon formatted with "%2.2d"||"-" ||due6day formatted with "%2.2d" ||"-" ||due6year ;
|
||||
Fmt8HRTime := due8hour formatted with "%2.2d" || ":00";
|
||||
Fmt8HRDate := due8mon formatted with "%2.2d"||"-" ||due8day formatted with "%2.2d" ||"-" ||due8year ;
|
||||
FmtQ8HRTime := maint8hour formatted with "%2.2d" || ":00";
|
||||
FmtQ8HRDate := maint8mon formatted with "%2.2d"||"-" ||maint8day formatted with "%2.2d" ||"-" ||maint8year ;
|
||||
FmtQ12HRTime := maint12hour formatted with "%2.2d" || ":00";
|
||||
FmtQ12HRDate := maint12mon formatted with "%2.2d"||"-" ||maint12day formatted with "%2.2d" ||"-" ||maint12year ;
|
||||
|
||||
if NoLoad = false or noload is null then
|
||||
Load_ReqTime_Val.ReqTimeCode := "Scheduled/Start Time";
|
||||
Load_ReqTime_Val.ReqTimeValue := FMTLoadTime;
|
||||
Load_ReqDate.value := FmtLoadDate;
|
||||
endif;
|
||||
|
||||
// Select correct formatted time and frequency based upon CrCl, Load or No Load and if override the selected frequency
|
||||
If ((CrCl_Estd.value >= 20 or CrCl_Estd.value is null or CRRT is not null ) and override.value = false and NoLoad = False) or (override.value = true and Zosyn_Freq_Dictionary.value = "Q8H" and NoLoad = False ) then
|
||||
|
||||
Maint_ReqDate.value := Fmt6HRDate;
|
||||
Maint_ReqTime_Val.ReqTimeCode := "Scheduled/Start Time";
|
||||
Maint_ReqTime_Val.ReqTimeValue := Fmt6HRTime;
|
||||
FreqValue.FrequencySummary := "Q8H";
|
||||
Zosyn_Freq_Dictionary.value := "Q8H";
|
||||
|
||||
elseif (CrCl_Estd.Value < 20 and CRRT is null and override.value = false and NoLoad = false) or (override.value = true and Zosyn_Freq_Dictionary.value = "Q12H" and noLoad = false) then
|
||||
|
||||
Maint_ReqDate.value := Fmt8HRDate;
|
||||
Maint_ReqTime_Val.ReqTimeCode := "Scheduled/Start Time";
|
||||
Maint_ReqTime_Val.ReqTimeValue := Fmt8HRTime;
|
||||
FreqValue.FrequencySummary := "Q12H";
|
||||
Zosyn_Freq_Dictionary.value := "Q12H";
|
||||
|
||||
elseIf ((CrCl_Estd.value >= 20 or CrCl_Estd.value is null or CRRT is not null) and override.value = false and NoLoad = true) or (override.value = true and Zosyn_Freq_Dictionary.value = "Q8H" and NoLoad = true) then
|
||||
|
||||
Maint_ReqDate.value := FmtQ8HRDate;
|
||||
Maint_ReqTime_Val.ReqTimeCode := "Scheduled/Start Time";
|
||||
Maint_ReqTime_Val.ReqTimeValue := FmtQ8HRTime;
|
||||
FreqValue.FrequencySummary := "Q8H";
|
||||
Zosyn_Freq_Dictionary.value := "Q8H";
|
||||
|
||||
elseif (CrCl_Estd.value < 20 and CRRT is null and override.value = false and NoLoad = true) or (override.value = true and Zosyn_Freq_Dictionary.value = "Q12H" and noLoad = true ) then
|
||||
|
||||
Load_ReqDate.value := null;
|
||||
Load_ReqTime_Val.ReqTimeCode := null;
|
||||
Load_ReqTime_Val.ReqTimeValue := null;
|
||||
|
||||
Maint_ReqDate.value := FmtQ12HRDate;
|
||||
Maint_ReqTime_Val.ReqTimeCode := "Scheduled/Start Time";
|
||||
Maint_ReqTime_Val.ReqTimeValue := FmtQ12HRTime;
|
||||
FreqValue.FrequencySummary := "Q12H";
|
||||
Zosyn_Freq_Dictionary.value := "Q12H";
|
||||
endif;
|
||||
|
||||
// **** end extended Zosyn infusion *********
|
||||
elseif ( fieldValue = false ) then
|
||||
Zosyn.IsSelected := false;
|
||||
Zosyn_Low.IsSelected := false;
|
||||
|
||||
rtnValue := call enable_chkbx_mlm WITH this_communication, this_form, client_info_obj, CallingField, false, "";
|
||||
endif;
|
||||
endif;
|
||||
|
||||
|
||||
//************ CEFEPIME + FLAGYL **************
|
||||
if ( CallingField = "PRX_Checkbox1|16" ) then
|
||||
|
||||
fieldValue := Cefepime_Flagyl_Chk.Value;
|
||||
|
||||
if ( fieldValue = true ) then
|
||||
Cefepime.IsSelected := true;
|
||||
Flagyl.IsSelected := true;
|
||||
|
||||
exceptFld := exceptFld, Vanco2_Chk.DataItemName || "|" || Vanco2_Chk.Control_MultiFieldOccNum;
|
||||
rtnValue := call enable_chkbx_mlm WITH this_communication, this_form, client_info_obj, CallingField, true, exceptFld;
|
||||
elseif ( fieldValue = false ) then
|
||||
Cefepime.IsSelected := false;
|
||||
Flagyl.IsSelected := false;
|
||||
|
||||
rtnValue := call enable_chkbx_mlm WITH this_communication, this_form, client_info_obj, CallingField, false, "";
|
||||
endif;
|
||||
endif;
|
||||
|
||||
//********* VANCOMYCIN *********************
|
||||
if ( CallingField = "PRX_Checkbox1|4" OR CallingField = "PRX_Checkbox1|20" OR CallingField = "PRX_Checkbox1|19" ) then
|
||||
|
||||
if ( CallingField = "PRX_Checkbox1|4" ) then
|
||||
fieldValue := Vanco_Chk.Value;
|
||||
disableChk := true;
|
||||
elseif ( CallingField = "PRX_Checkbox1|20" ) then
|
||||
fieldValue := Vanco2_Chk.Value;
|
||||
disableChk := false;
|
||||
elseif ( CallingField = "PRX_Checkbox1|19" ) then
|
||||
fieldValue := Vanco3_Chk.Value;
|
||||
|
||||
disableChk := false;
|
||||
endif;
|
||||
|
||||
if ( fieldValue = true ) then
|
||||
|
||||
vanco_logic_run := true;
|
||||
|
||||
if ( disableChk ) then
|
||||
rtnValue := call enable_chkbx_mlm WITH this_communication, this_form, client_info_obj, CallingField, disableChk, exceptFld;
|
||||
endif;
|
||||
elseif ( fieldValue = false ) then
|
||||
|
||||
vanco_logic_run := false;
|
||||
|
||||
Vancomycin_Load.IsSelected := false;
|
||||
Vancomycin.IsSelected := false;
|
||||
|
||||
if ( disableChk ) then
|
||||
rtnValue := call enable_chkbx_mlm WITH this_communication, this_form, client_info_obj, CallingField, false, "";
|
||||
endif;
|
||||
|
||||
Vancomycin_Trough.IsSelected := false;
|
||||
Vancomycin_Nursing_Instr.IsSelected := false;
|
||||
endif;
|
||||
endif;
|
||||
|
||||
//************ ANTIBIOTICS GRID *******************
|
||||
if ( CallingField = "MultiOrderGrid|1" ) then
|
||||
if ( Zosyn.IsSelected = true OR Zosyn_Low.IsSelected = true ) then
|
||||
if ( Zosyn_Chk.Value = false ) then
|
||||
Zosyn_Chk.Value := true;
|
||||
endif;
|
||||
elseif ( Zosyn.IsSelected = false AND Zosyn_Low.IsSelected = false ) then
|
||||
Zosyn_Chk.Value := false;
|
||||
endif;
|
||||
endif;
|
||||
|
||||
if ( CallingField = "MultiOrderGrid|2" ) then
|
||||
if ( Vancomycin_Load.IsSelected = false AND Vancomycin.IsSelected = false ) then
|
||||
Vanco_Chk.Value := false;
|
||||
Vanco2_Chk.Value := false;
|
||||
Vanco3_Chk.Value := false;
|
||||
|
||||
Vancomycin_Trough.IsSelected := false;
|
||||
Vancomycin_Nursing_Instr.IsSelected := false;
|
||||
endif;
|
||||
|
||||
if ( Vancomycin_Load.IsSelected = true AND Vancomycin.IsSelected = false ) then
|
||||
Vancomycin_Trough.IsSelected := false;
|
||||
Vancomycin_Nursing_Instr.IsSelected := false;
|
||||
endif;
|
||||
|
||||
if ( Vancomycin_Load.IsSelected = false AND Vancomycin.IsSelected = true ) then
|
||||
Override_ABX_Sched.Value := false;
|
||||
endif;
|
||||
|
||||
if ( Vancomycin_Load.IsSelected = true AND Vancomycin.IsSelected = true ) then
|
||||
vanco_logic_run := true;
|
||||
endif;
|
||||
endif;
|
||||
endif; //End FieldChange
|
||||
|
||||
if ( vanco_logic_run = true ) then
|
||||
|
||||
if ( OrderSetName = "Skin Antibiotic Inpatient ED" ) then
|
||||
if ( weightvalue = 0 OR weightvalue IS NULL or ht = 0 OR ht IS NULL ) then
|
||||
DialogRes := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "Weight Based Dosing Requires Height & Weight To Be Entered.", "Alert", "OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
|
||||
|
||||
if ( Vanco_Chk.Value = true ) then
|
||||
Vanco_Chk.Value := false;
|
||||
rtnValue := call enable_chkbx_mlm WITH this_communication, this_form, client_info_obj, CallingField, false, "";
|
||||
endif;
|
||||
Vanco2_Chk.Value := false;
|
||||
Vanco3_Chk.Value := false;
|
||||
else
|
||||
Vancomycin_Load.IsSelected := true;
|
||||
|
||||
this_communication, this_form, ABW := call calc_abw_mlm WITH this_communication, this_form, client_info_obj;
|
||||
ABW_Val.Value := ( ABW as number);
|
||||
endif;
|
||||
|
||||
else
|
||||
if ( weightvalue = 0 OR weightvalue IS NULL OR ht = 0 OR ht IS NULL ) then
|
||||
dialogRes := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "Weight Based Dosing Requires Height & Weight To Be Entered.", "Alert", "OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
|
||||
|
||||
if ( Vanco_Chk.Value = true ) then
|
||||
Vanco_Chk.Value := false;
|
||||
rtnValue := call enable_chkbx_mlm WITH this_communication, this_form, client_info_obj, CallingField, false, "";
|
||||
endif;
|
||||
|
||||
Vanco2_Chk.Value := false;
|
||||
Vanco3_Chk.Value := false;
|
||||
|
||||
elseif ( CrCl_Estd.Value IS NULL OR CrCl_Estd.Value = 0 ) then
|
||||
errormsg := "Creatinine is required to calculate Creatinine Clearance; Creatinine Clearance is required to calculate Vancomycin Dose.";
|
||||
this_communication.Message := errormsg;
|
||||
this_communication.MessageType := "Error";
|
||||
|
||||
Vanco_Chk.Value := false;
|
||||
Vanco2_Chk.Value := false;
|
||||
Vanco3_Chk.Value := false;
|
||||
else
|
||||
|
||||
//Determine if a Loading dose should be given
|
||||
//Check for existing Vanco on-time dose
|
||||
(vanco_load_exists,
|
||||
vanco_load_given,
|
||||
vanco_load_ordered,
|
||||
vanco_load_dtm,
|
||||
vanco_load_dosing) := READ LAST {"SELECT 1, CASE WHEN ot.TaskStatusCode = {{{SINGLE-QUOTE}}}Performed{{{SINGLE-QUOTE}}} THEN ot.TaskStatusCode"
|
||||
|| " ELSE {{{SINGLE-QUOTE}}}Pending{{{SINGLE-QUOTE}}} END,"
|
||||
|| " CASE WHEN ot.TaskStatusCode = {{{SINGLE-QUOTE}}}Performed{{{SINGLE-QUOTE}}} THEN DateDiff(hour, ot.PerformedFromDtm, GETDATE())"
|
||||
|| " ELSE DATEDIFF(HOUR, o.RequestedDtm, GETDATE()) END,"
|
||||
|| " CASE WHEN ot.TaskStatusCode = {{{SINGLE-QUOTE}}}Performed{{{SINGLE-QUOTE}}} THEN ot.PerformedFromDtm"
|
||||
|| " ELSE o.RequestedDtm END,"
|
||||
|| " o.SummaryLine"
|
||||
|| " FROM CV3ClientVisit cv WITH (NOLOCK) JOIN CV3Order o WITH (NOLOCK)"
|
||||
|| " ON cv.ClientGUID = o.ClientGUID"
|
||||
|| " AND cv.GUID = o.ClientVisitGUID"
|
||||
|| " AND cv.ChartGUID = o.ChartGUID"
|
||||
|| " JOIN CV3OrderTaskOccurrence ot WITH (NOLOCK)"
|
||||
|| " ON ot.ClientGUID = o.ClientGUID"
|
||||
|| " AND ot.OrderGUID = o.GUID"
|
||||
|| " WHERE o.NAME LIKE {{{SINGLE-QUOTE}}}VANCOMYCIN%{{{SINGLE-QUOTE}}}"
|
||||
|| " AND o.FrequencyCode IN ({{{SINGLE-QUOTE}}}Once{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}STAT{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Now{{{SINGLE-QUOTE}}})"
|
||||
|| " AND cv.ClientGUID = " || Sql(ClientGUID)
|
||||
|| " AND cv.GUID = " || Sql(ClientVisitGUID)
|
||||
|| " AND cv.ChartGUID = " || Sql(ChartGUID)
|
||||
|| " AND DateDiff(hh, o.Entered, GETDATE()) <= 48"
|
||||
|| " AND (o.OrderStatusLevelNum > 15"
|
||||
|| " AND o.OrderStatusLevelNum NOT IN ({{{SINGLE-QUOTE}}}69{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}70{{{SINGLE-QUOTE}}}))"
|
||||
|| " order by o.Entered ASC"};
|
||||
|
||||
if ( ( CrCl_Estd.Value as number ) >= 60 ) then
|
||||
frequencyValue := "Q12H";
|
||||
elseif ( ( CrCl_Estd.Value as number ) >= 30 AND ( CrCl_Estd.Value as number ) < 60 ) then
|
||||
frequencyValue := "Q24H";
|
||||
elseif ( ( CrCl_Estd.Value as number ) < 30 ) then
|
||||
frequencyValue := "Now";
|
||||
endif;
|
||||
|
||||
this_communication, this_form, ABW := call calc_abw_mlm WITH this_communication, this_form, client_info_obj;
|
||||
ABW_Val.Value := ( ABW as number);
|
||||
|
||||
if ( frequencyValue = "Now" ) then
|
||||
|
||||
if ( exists vanco_load_exists ) then
|
||||
|
||||
if ( ( vanco_load_ordered as number ) < 24 ) then
|
||||
|
||||
strMsg := "Patient was ";
|
||||
if ( vanco_load_given = "Performed" ) then
|
||||
strMsg := strMsg || "given ";
|
||||
else
|
||||
strMsg := strMsg || "ordered ";
|
||||
endif;
|
||||
|
||||
strMsg := strMsg || "Vancomycin " || vanco_load_dosing || " dose less than 24 hours ago at " || vanco_load_dtm;
|
||||
strMsg := strMsg || "\n\nDo you want to proceed with the additional Vancomycin NOW dose?";
|
||||
|
||||
dialogRes := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with strMsg, "Vancomycin Dose", "YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}}, "Question" as {{{SINGLE-QUOTE}}}MessageBoxIcon{{{SINGLE-QUOTE}}};
|
||||
|
||||
if ( ( dialogRes as String ) = "Yes" ) then
|
||||
//Don{{{SINGLE-QUOTE}}}t order Loading Dose
|
||||
//Order {{{SINGLE-QUOTE}}}Once{{{SINGLE-QUOTE}}} Vanco maintenance dose
|
||||
//Order Nursing Instruction
|
||||
//Don{{{SINGLE-QUOTE}}}t order Trough
|
||||
Vancomycin_Load.IsSelected := false;
|
||||
|
||||
Vancomycin.IsSelected := true;
|
||||
Vancomycin_Freq_Val.FrequencySummary := frequencyValue;
|
||||
|
||||
Vancomycin_Nursing_Instr.IsSelected := true;
|
||||
|
||||
Vancomycin_Trough.IsSelected := false;
|
||||
else
|
||||
Vanco_Chk.Value := false;
|
||||
Vanco2_Chk.Value := false;
|
||||
endif;
|
||||
else
|
||||
//Don{{{SINGLE-QUOTE}}}t order Loading Dose
|
||||
//Order {{{SINGLE-QUOTE}}}Once{{{SINGLE-QUOTE}}} Vanco maintenance dose
|
||||
//Order Nursing Instruction
|
||||
//Don{{{SINGLE-QUOTE}}}t order Trough
|
||||
Vancomycin_Load.IsSelected := false;
|
||||
|
||||
Vancomycin.IsSelected := true;
|
||||
Vancomycin_Freq_Val.FrequencySummary := frequencyValue;
|
||||
|
||||
Vancomycin_Nursing_Instr.IsSelected := true;
|
||||
|
||||
Vancomycin_Trough.IsSelected := false;
|
||||
endif;
|
||||
else
|
||||
//Don{{{SINGLE-QUOTE}}}t order Loading Dose
|
||||
//Order {{{SINGLE-QUOTE}}}Once{{{SINGLE-QUOTE}}} Vanco maintenance dose
|
||||
//Order Nursing Instruction
|
||||
//Don{{{SINGLE-QUOTE}}}t order Trough
|
||||
Vancomycin_Load.IsSelected := false;
|
||||
|
||||
Vancomycin.IsSelected := true;
|
||||
Vancomycin_Freq_Val.FrequencySummary := frequencyValue;
|
||||
|
||||
Vancomycin_Nursing_Instr.IsSelected := true;
|
||||
|
||||
Vancomycin_Trough.IsSelected := false;
|
||||
endif;
|
||||
endif;
|
||||
|
||||
//Loading dose previously ordered; don{{{SINGLE-QUOTE}}}t re-order
|
||||
if ( exists vanco_load_exists AND frequencyValue <> "Now" ) then
|
||||
|
||||
Vancomycin_Load.IsSelected := false;
|
||||
|
||||
//Vanco loading dose already exists, let Antibiotic scheduling work as normal
|
||||
// to determine maintenance dosing schedule
|
||||
Vancomycin.IsSelected := true;
|
||||
Vancomycin_Freq_Val.FrequencySummary := frequencyValue;
|
||||
|
||||
//Determine if Vanco Load has been given; if not, then adjust Antibiotic Scheduling
|
||||
if ( exists vanco_load_exists ) then
|
||||
if ( vanco_load_given <> "Performed" AND ( vanco_load_ordered as number ) <= 8 ) then
|
||||
Override_ABX_Sched.Value := true;
|
||||
elseif ( vanco_load_given = "Performed" AND ( vanco_load_ordered as number ) <= 12 ) then
|
||||
Override_ABX_Sched.Value := true;
|
||||
else
|
||||
Override_ABX_Sched.Value := false;
|
||||
endif;
|
||||
endif;
|
||||
|
||||
//Vanco_FreqVal.FrequencySummary := frequencyValue;
|
||||
local_session.SessionVancoTroughFrequency := frequencyValue;
|
||||
|
||||
Vancomycin_Nursing_Instr.IsSelected := false;
|
||||
|
||||
//Need to order a loading dose
|
||||
elseif ( NOT exists vanco_load_exists AND frequencyValue <> "Now" ) then
|
||||
|
||||
Vancomycin_Load.IsSelected := true;
|
||||
//New vanco load scheduled, need to calculate vanco maint schedule
|
||||
//based on Now & Then logic
|
||||
Override_ABX_Sched.Value := true;
|
||||
|
||||
Vancomycin.IsSelected := true;
|
||||
|
||||
local_session.SessionVancoTroughFrequency := frequencyValue;
|
||||
|
||||
Vancomycin_Nursing_Instr.IsSelected := false;
|
||||
|
||||
endif;
|
||||
|
||||
if ( frequencyValue <> "Now" ) then
|
||||
Vancomycin_Trough.IsSelected := true;
|
||||
Fire_Trough_MLM.Value := true;
|
||||
endif;
|
||||
endif;
|
||||
endif;
|
||||
endif;
|
||||
|
||||
if ( cefazolin_logic_run = true ) then
|
||||
if ( weightvalue = 0 OR weightvalue IS NULL ) then
|
||||
//Display message that weight is missing
|
||||
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}}};
|
||||
else
|
||||
|
||||
if ( weightvalue < 80 ) then
|
||||
Cefazolin_Dose.Value := ( 1 as number );
|
||||
// Cefazolin_Code.Value := "08498P";
|
||||
elseif ( weightvalue >= 80 ) then
|
||||
Cefazolin_Dose.Value := ( 2 as number );
|
||||
Cefazolin_SCIP.Value := "Cefazolin";
|
||||
// Cefazolin_Code.Value := "08499P";
|
||||
endif;
|
||||
endif;
|
||||
endif;
|
||||
|
||||
if ( clindamycin_logic_run = true ) then
|
||||
if ( weightvalue = 0 OR weightvalue IS NULL ) then
|
||||
//Display message that weight is missing
|
||||
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}}};
|
||||
else
|
||||
|
||||
if ( weightvalue < 80 ) then
|
||||
Clindamycin_Dose.Value := ( 600 as number );
|
||||
if ( OrderSetName = "Skin Antibiotic Inpatient ED" ) then
|
||||
Clindamycin_Freq_Val.FrequencySummary := "STAT";
|
||||
else
|
||||
Clindamycin_Freq_Val.FrequencySummary := "Q6H";
|
||||
endif;
|
||||
elseif ( weightvalue >= 80 ) then
|
||||
Clindamycin_Dose.Value := ( 900 as number );
|
||||
if ( OrderSetName = "Skin Antibiotic Inpatient ED" ) then
|
||||
Clindamycin_Freq_Val.FrequencySummary := "STAT";
|
||||
else
|
||||
Clindamycin_Freq_Val.FrequencySummary := "Q8H";
|
||||
endif;
|
||||
endif;
|
||||
endif;
|
||||
endif;
|
||||
|
||||
;;
|
||||
evoke: // No evoke statement
|
||||
;;
|
||||
logic:
|
||||
|
||||
conclude True;
|
||||
;;
|
||||
action:
|
||||
// This MLM returns two parameters, of types communication_type and form_type respectively.
|
||||
return this_communication, this_form;
|
||||
;;
|
||||
end:
|
||||
Reference in New Issue
Block a user