Files
St.Clair/MLMStripper/bin/Debug/SCH/SCH_FUNC_CREATININE_CLEARANCE.mlm

216 lines
6.5 KiB
Plaintext

maintenance:
title: SCH_Func_Creatinine_Clearance;;
mlmname: SCH_Func_Creatinine_Clearance;;
arden: version 2;;
version: 5.50;;
institution: St Clair Hospital;;
author: Teresa Spicuzza, Allscripts;;
specialist: ;;
date: 2012-07-11;;
validation: testing;;
library:
purpose: This MLM Calcualtes Creatinine Clearance based on SCH Guidelines. Adapted from Form_MLM_Creatinine_Clearance
;;
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
03.16.2018 TMS CSR 36322 Updated to use only actual body weight for Dabigatran (Pradaxa) and Rivaroxaban (Xarelto) renal
dosing alerts.
;;
knowledge:
type: data-driven;;
data:
// This MLM is passed three arguments, ...
(client_visit_guid, chart_guid, client_guid, CPSVal) := ARGUMENT;
standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
include standard_libs;
/*******************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:="";
/* 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 */
wtgm := read last
{ " Select Text from CV3PhysicalNoteDeclaration "
|| " where ClientGUID = " || SQL(client_guid)
|| " and ClientVisitGUID = " || SQL(client_visit_guid)
|| " and TypeCode = {{{SINGLE-QUOTE}}}weight{{{SINGLE-QUOTE}}} "
|| " order by Entered asc "
};
wt := (wtgm as number) / 1000;
htcm := read last
{ " Select Text from CV3PhysicalNoteDeclaration "
|| " where ClientGUID = " || SQL(client_guid)
|| " and ClientVisitGUID = " || SQL(client_visit_guid)
|| " and TypeCode = {{{SINGLE-QUOTE}}}height{{{SINGLE-QUOTE}}} "
|| " order by Entered asc "
};
ht := htcm as number;
If CPSVal is null then
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 o.chartguid = " || SQL(chart_guid)
|| " and o.performeddtm >= (DATEADD(hour, -24, getdate())) "
|| " and bo.itemname = {{{SINGLE-QUOTE}}}Creatinine Plasma/Serum{{{SINGLE-QUOTE}}} "
|| " order by o.performeddtm desc "
};
endif;
// use for testing on patient with no serum creat TESTING only remove for PROD
// dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "\n cpsval: " || cpsval ,"Alert","OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
// if not exist CPSVal then
// if tempcreat is not null then
// cpsval := tempcreat as number;
// endif; endif;
// dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "\n cpsvalTEST: " || cpsval ,"Alert","OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}};
// end of value for serum creatinine for TESTING only
CPSValNum := CPSVal As Number;
If exist CPSVal then
crclmgdl := (int ((CPSValNum + 0.05) * 10))/10;
crclumoll := (int (((crclmgdl * 88.4) + 0.05) * 10))/10;
endif;
domore := true;
// Get the patient age
(birthdate,dobM,dobD,birth_year, patientgender ) := read last { ClientInfo: BirthDate, BirthMonthNum, BirthDayNum, BirthYearNum, gendercode };
patientAge := (NOW - birthdate) / (1 year);
patientage:= (int (patientage));
;;
evoke: // No evoke statement
;;
logic:
If not exist wt or not exist ht or not exist crclmgdl then
domore := false; endif;
if patientage < 18 then
domore := false;
else
actualwt:= wt;
// now ideal
if patientgender = "Female"
then
WeightKg:= ((((ht /2.54)-60)* 2.3)+45.5);
else
WeightKg:= ((((ht /2.54)-60)* 2.3)+50);
endif; //if patientgender = "F"
idealwt := (int ((WeightKg+ 0.005) * 100))/100;
extraideal := "";
if ht < ideal_WT_height_limit
then
extraideal := "(Patient < 60 inches)";
if patientgender = "Female"
then
idealwt := 45.5;
else
idealwt := 50;
endif;
endif;
// now adjusted
adjustedwt := ((actualwt - idealwt)* 0.4) + idealwt;
// now round all
actualwt := (int ((actualwt + 0.005) * 100))/100;
idealwt := (int ((idealwt + 0.005) * 100))/100;
adjustedwt := (int ((adjustedwt + 0.005) * 100))/100;
commfield:="Calculated with age of " || patientage || ", Actual Weight:" || actualwt ||
", Ideal Weight:" || idealwt || ", Adjusted Weight " || adjustedwt || " Gender:" || patientgender;
// Added "ActualWeightOnly" TMS CSR 36322
If evokingobject.name matches pattern "Dabigatran%" or evokingobject.name matches pattern "Rivaroxaban%" then
ActualWeightOnly := true;
else
ActualWeightOnly := false;
endif;
if actualwt < idealwt or ActualWeightOnly = true then
weightused:= actualwt;
else
weightused:= adjustedwt;
endif;
commfield := commfield || ", WEIGHT USED:" || weightused;
EstCrClval := ((140 - patientage) * weightused )
/ (72 * crclmgdl);
commfield := commfield || ", FORMULA USED:((140 - Age) x Wt / (72 x SerumCreat))";
if patientgender = "Female"
then
EstCrClval := EstCrClval * 0.85;
commfield := commfield || " x 0.85";
endif; //gender = "F"
EstCrClval := (int ((EstCrClval + 0.05) * 10))/ 10;
crclestd:= EstCrClval;
endif;
conclude domore;
;;
action:
// This MLM returns two parameters, of types communication_type and form_type respectively.
return commfield, crclestd, cpsval, wt, patientage;
// return commfield, EstCrClval;
;;
end: