maintenance: title: FORM_MLM_Creatinine_Clearance_OS;; mlmname: FORM_MLM_Creatinine_Clearance_OS;; arden: version 2.5;; version: 15.10;; institution: St Clair Charger MLM;; author: Juliet M. Law, Allscripts;; specialist: Peggy Leschak, Allscripts ;; date: 2016-05-23;; validation: testing;; library: purpose: This MLM Calcualtes Creatinine Clearance based on SCH Guidelines ;; explanation: Uses SCH guidelines to choose the correct weight, round serum where necessary and calculate creatinine Uses SCH modified cockcrauft gault formula ;; keywords: Called MLMs, Form fields, Cockcrauft Gault, Creatinine ;; 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; /*******************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:=""; calc_abw_mlm := mlm {{{SINGLE-QUOTE}}}FORM_FUNC_CALC_ADJUSTED_BODY_WEIGHT{{{SINGLE-QUOTE}}}; // Assigns fields passed in the Form object to the Field object field_list:= this_form.fields; Visit_Guid := this_communication.ClientVisitGuid; CallingField :=this_communication.CallingFieldName; CallingEvent := this_communication.CallingEvent; /* What is the HEIGHT limit for using the Ideal weight calculation? */ /* The calculation will be done if the height is GREATER THAN OR EQUAL TO this number listed below */ ideal_WT_height_limit:= 150; /* cm */ comb_ht_wt_field := first of (field_list where field_list.DataItemName = "CombinedMeasurements" and field_List.Control_MultiFieldOccNum = 1); 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; wt_type := comb_ht_wt_val.weighttype; bsa := comb_ht_wt_val.bsa; bmi := comb_ht_wt_val.bmi; endif; // Get patient age (birthDate, patientgender) := read last {ClientInfo: BirthDate, GenderTypeIntlCode REFERENCING client_info_obj}; patientAge := (NOW - birthDate) / (1 year); patientAge:= (int (patientage)); //Retrieve fields crclmgdl := first of (field_list where field_list.DataItemName = "PRX_CrCl_mg_dl" and field_List.Control_MultiFieldOccNum = 1); crclumoll := first of (field_list where field_list.DataItemName = "PRX_CrCl_umol_L" and field_List.Control_MultiFieldOccNum = 1); crclestd := first of (field_list where field_list.DataItemName = "PRX_CrCl_Estimated" and field_List.Control_MultiFieldOccNum = 1); calcfield := first of (field_list where field_list.DataItemName = "PRX_Generic_CB" and field_list.Control_MultiFieldOccNum = 1 ); commfield := first of (field_list where field_list.DataItemName = "PRX_NOTECOMMENT0" and field_List.Control_MultiFieldOccNum = 1); client_guid := this_communication.ClientGUID; visit_guid := this_communication.ClientVisitGUID; chart_guid := this_communication.ChartGuid; if ( CallingEvent = "FormOpen" OR CallingEvent = "FieldChange" ) then if ( CallingEvent = "FormOpen" ) then // Get last creatinine level from this admission for antibiotics CPSVal := read last {"Select top 1 bo.value " || " From cv3order as o with (nolock) " || " join cv3basicobservation as bo with (nolock) " || " on o.clientguid = bo.clientguid " || " and o.chartguid = bo.chartguid " || " and o.guid = bo.orderguid " || " and bo.status = {{{SINGLE-QUOTE}}}F{{{SINGLE-QUOTE}}} " || " and bo.Active = 1 " || " And bo.IsHistory = 0 " || " join cv3ordercatalogmasteritem as ocmi with (nolock) " || " on ocmi.guid = o.ordercatalogmasteritemguid " || " and ocmi.active = 1 " || " where o.clientguid = " || SQL(client_guid) || " and bo.itemname = {{{SINGLE-QUOTE}}}Creatinine Plasma/Serum{{{SINGLE-QUOTE}}} " || " order by o.performeddtm desc " }; CPSValNum := CPSVal As Number; if ( exists CPSVal ) then crclmgdl.value := (int ((CPSValNum + 0.05) * 10))/10; crclumoll.value := (int (((crclmgdl.value * 88.4) + 0.05) * 10))/10; endif; endif; //FormOpen If (CallingField = "PRX_Generic_CB") or (CallingEvent = "FormOpen") or (CallingEvent = "FieldChange") then fatalerror := false; errormessage := ""; calcfield.value := false; If not exist wt OR wt = 0 then errormessage := errormessage || "Weight is required to calculate Creatinine Clearance \n\n"; fatalerror := true; endif; if not exist ht OR ht = 0 then errormessage := errormessage || "Height is required to calculate Creatinine Clearance\n\n"; fatalerror := true; endif; if not exist crclmgdl.value then errormessage := errormessage || "Creatinine is required to calculate Creatinine Clearance"; fatalerror := true; endif; if fatalerror = true then if patientage < 18 then this_communication.Message := "This Calculation Is Not Approved For Patients < 18 Years Old"; this_communication.MessageType := "Error"; elseif callingfield = "PRX_Generic_CB|1" then this_communication.Message := errormessage; this_communication.MessageType := "Error"; endif; else //Call ABW function this_communication, this_form, ABW, actualwt, idealwt := call calc_abw_mlm WITH this_communication, this_form, client_info_obj; commfield.value:="Calculated with age of " || patientage || ", Actual Weight:" || actualwt || ", Ideal Weight:" || idealwt || ", Adjusted Weight " || ABW || " Gender:" || patientgender; commfield.value := commfield.value || ", WEIGHT USED:" || ABW; EstCrClval := ((140 - patientage) * ABW ) / (72 * crclmgdl.value); commfield.value := commfield.value || ", FORMULA USED:((140 - Age) x Wt / (72 x SerumCreat))"; if patientgender = "F" then EstCrClval := EstCrClval * 0.85; commfield.value := commfield.value || " x 0.85"; endif; //gender = "F" EstCrClval := (int ((EstCrClval + 0.05) * 10))/ 10; crclestd.value := EstCrClval; endif; endif; endif; //End FormOpen or Fieldchange ;; 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: